Commit 03b06257 authored by Tim Allen's avatar Tim Allen

Update to v106r65 release.

byuu says:

This synchronizes bsnes/higan with many recent internal nall changes.

This will be the last WIP until I am situated in Japan. Apologies for the
bugfixes that didn't get applied yet, I ran out of time.
parent 336d2012
Pipeline #31987970 failed with stage
in 20 minutes and 35 seconds
......@@ -55,3 +55,5 @@ else ifneq ($(filter $(platform),linux bsd),)
rm -f $(prefix)/share/applications/$(name).desktop
rm -f $(prefix)/share/icons/$(name).png
endif
-include obj/*.d
......@@ -148,7 +148,7 @@ auto ListWindow::loadDatabase(string location) -> void {
}
auto ListWindow::saveDatabase(string location) -> void {
file fp{location, file::mode::write};
auto fp = file::open(location, file::mode::write);
if(!fp) return MessageDialog().setParent(*this).setText({
"Error: failed to write file.\n\n",
"Name: ", location
......@@ -618,24 +618,12 @@ auto hiro::initialize() -> void {
}
#include <nall/main.hpp>
auto nall::main(vector<string> arguments) -> void {
auto nall::main(Arguments) -> void {
new ListWindow;
new GameWindow;
new MemoryWindow;
new OscillatorWindow;
//internal command used to synchronize all genius databases from an old format to a new format
//if enabled, use with extreme caution and make backups first
/*if(arguments.size() == 3 && arguments[1] == "--sync") {
for(auto& filename : directory::contents(arguments[2], "*.bml")) {
if(filename.beginsWith("Boards")) continue;
print(filename, "\n");
listWindow->loadDatabase({arguments[2], filename});
listWindow->saveDatabase({arguments[2], filename});
}
return print("[Done]\n");
}*/
listWindow->setVisible();
Application::run();
}
......@@ -28,7 +28,7 @@ using namespace nall;
namespace Emulator {
static const string Name = "higan";
static const string Version = "106.64";
static const string Version = "106.65";
static const string Author = "byuu";
static const string License = "GPLv3";
static const string Website = "https://byuu.org/";
......
......@@ -67,7 +67,7 @@ auto APU::power() -> void {
phase = 0;
cycle = 0;
PRNG prng;
PRNG::PCG prng;
for(auto& n : wave.pattern) n = prng.random();
}
......
......@@ -54,7 +54,7 @@ auto BSMemory::load() -> bool {
for(auto& byte : page.buffer[1]) byte = random();
for(auto& block : blocks) {
block.erased = 0;
block.erased = 1;
block.locked = 1;
}
......
......@@ -23,10 +23,9 @@ auto hiro::initialize() -> void {
}
#include <nall/main.hpp>
auto nall::main(vector<string> arguments) -> void {
auto nall::main(Arguments arguments) -> void {
settings.location = locate("settings.bml");
arguments.takeLeft(); //ignore program location in argument parsing
for(auto argument : arguments) {
if(argument == "--fullscreen") {
presentation.startFullScreen = true;
......
......@@ -123,7 +123,7 @@ auto Program::openRomSuperFamicom(string name, vfs::file::mode mode) -> vfs::sha
return vfs::fs::file::open({Location::notsuffix(superFamicom.location), ".msu"}, mode);
}
if(name.match("msu1/track-*.pcm")) {
if(name.match("msu1/track*.pcm")) {
name.trimLeft("msu1/track", 1L);
return vfs::fs::file::open({Location::notsuffix(superFamicom.location), name}, mode);
}
......
......@@ -100,7 +100,7 @@ auto Program::saveState(string filename) -> bool {
if(gamePath().endsWith("/")) {
string location = {statePath(), filename, ".bst"};
directory::create(Location::path(location));
if(!file::write(location, saveState.data(), saveState.size())) {
if(!file::write(location, saveState)) {
return showMessage({"Unable to write [", prefix, "] to disk"}), false;
}
} else {
......
......@@ -18,7 +18,7 @@ auto hiro::initialize() -> void {
}
#include <nall/main.hpp>
auto nall::main(vector<string> arguments) -> void {
auto nall::main(Arguments arguments) -> void {
new Program(arguments);
Application::run();
}
#include <nall/nall.hpp>
using namespace nall;
#include <ruby/ruby.hpp>
using namespace ruby;
extern unique_pointer<Video> video;
......
......@@ -13,7 +13,7 @@
#include "utility.cpp"
unique_pointer<Program> program;
Program::Program(vector<string> arguments) {
Program::Program(Arguments arguments) {
program = this;
Emulator::platform = this;
......@@ -89,8 +89,7 @@ Program::Program(vector<string> arguments) {
updateAudioDriver();
updateAudioEffects();
arguments.takeFirst(); //ignore program location in argument parsing
for(auto& argument : arguments) {
for(auto argument : arguments) {
if(argument == "--fullscreen") {
presentation->toggleFullScreen();
} else if(directory::exists(argument.split("|", 1L).right())) {
......
struct Program : Emulator::Platform {
//program.cpp
Program(vector<string> arguments);
Program(Arguments arguments);
auto main() -> void;
auto quit() -> void;
......
......@@ -11,9 +11,9 @@ auto Program::loadState(uint slot, bool managed) -> bool {
string type = managed ? "managed" : "quick";
auto location = stateName(slot, managed);
auto memory = file::read(location);
if(memory.size() == 0) return showMessage({"Slot ", slot, " ", type, " state does not exist"}), false;
if(!memory) return showMessage({"Slot ", slot, " ", type, " state does not exist"}), false;
serializer s(memory.data(), memory.size());
if(emulator->unserialize(s) == false) return showMessage({"Slot ", slot, " ", type, " state incompatible"}), false;
if(!emulator->unserialize(s)) return showMessage({"Slot ", slot, " ", type, " state incompatible"}), false;
return showMessage({"Loaded ", type, " state from slot ", slot}), true;
}
......@@ -22,10 +22,8 @@ auto Program::saveState(uint slot, bool managed) -> bool {
string type = managed ? "managed" : "quick";
auto location = stateName(slot, managed);
serializer s = emulator->serialize();
if(s.size() == 0) return showMessage({"Failed to save ", type, " state to slot ", slot}), false;
if(!s) return showMessage({"Failed to save ", type, " state to slot ", slot}), false;
directory::create(Location::path(location));
if(file::write(location, s.data(), s.size()) == false) {
return showMessage({"Unable to write ", type, " state to slot ", slot}), false;
}
if(!file::write(location, {s.data(), s.size()})) return showMessage({"Unable to write ", type, " state to slot ", slot}), false;
return showMessage({"Saved ", type, " state to slot ", slot}), true;
}
database
revision: 2018-05-17
revision: 2018-09-20
//BS Memory (JPN)
......
database
revision: 2018-05-17
revision: 2018-09-20
//Sufami Turbo (JPN)
......
database
revision: 2018-05-17
revision: 2018-09-20
//Prototypes (JPN)
......@@ -125,7 +125,7 @@ game
//Super Famicom (JPN)
database
revision: 2018-05-17
revision: 2018-09-20
game
sha256: 5c4e283efc338958b8dd45ebd6daf133a9eb280420a98e2e1df358ae0242c366
......@@ -1002,6 +1002,18 @@ game
content: Program
note: Custom wiring on PCB
game
sha256: 76f80cdf704a0e1daf1af5bbf564e427b425a5ee42329417de6f29219fe63e5f
label: ロックマンエックス
name: Rockman X
region: SHVC-RX
revision: SHVC-RX-1
board: SHVC-2A0N-11
memory
type: ROM
size: 0x180000
content: Program
game
sha256: 6dfc016c571a16e5d42045060b1a88b6f3da5831e05b33c22035e1d990deccf3
label: ロマンシング サ・ガ3 体験版サンプルROM
......@@ -1321,6 +1333,22 @@ game
size: 0x2000
content: Save
game
sha256: b3204162def67b0dc40097344074e9b660ed296e5b5e22e778f373f0b985645b
label: スーパー麻雀大会
name: Super Mahjong Taikai
region: SHVC-IQ
revision: SHVC-IQ-2
board: SHVC-1A3B-13
memory
type: ROM
size: 0x80000
content: Program
memory
type: RAM
size: 0x2000
content: Save
game
sha256: 15d1187d17fa10c77152f691197d33674e64c33a1f8ceb37e8570588be507b89
label: スーパー麻雀大会
......@@ -5733,7 +5761,7 @@ game
//Super Nintendo (USA)
database
revision: 2018-05-06
revision: 2018-09-20
game
sha256: 2ffe8828480f943056fb1ab5c3c84d48a0bf8cbe3ed7c9960b349b59adb07f3b
......@@ -7538,6 +7566,22 @@ game
oscillator
frequency: 21440000
game
sha256: fa8cacf5bbfc39ee6bbaa557adf89133d60d42f6cf9e1db30d5a36a469f74d15
label: Donkey Kong Country
name: Donkey Kong Country
region: SNS-8X-USA
revision: SNS-8X-0
board: SHVC-1J1M-11
memory
type: ROM
size: 0x400000
content: Program
memory
type: RAM
size: 0x800
content: Save
game
sha256: df2644d435330192a13768cc1f79c5aa3084a64217a5250c6dd4ffdbe2175be4
label: Donkey Kong Country
......@@ -10270,6 +10314,18 @@ game
size: 0x180000
content: Program
game
sha256: b8f70a6e7fb93819f79693578887e2c11e196bdf1ac6ddc7cb924b1ad0be2d32
label: Mega Man X
name: Mega Man X
region: SNS-RX-USA
revision: SNS-RX-1
board: MAXI-1A0N-30
memory
type: ROM
size: 0x180000
content: Program
game
sha256: da484f2a636b8d692840f40e5468e992c5f2af26d365c69fbc12ef2923588d23
label: Mega Man X2
......@@ -12980,6 +13036,23 @@ game
content: Save
volatile
game
sha256: 82e39dfbb3e4fe5c28044e80878392070c618b298dd5a267e5ea53c8f72cc548
label: Star Fox
name: Star Fox
region: SNS-FO-USA
revision: SNS-FO-2
board: SHVC-1C0N
memory
type: ROM
size: 0x100000
content: Program
memory
type: RAM
size: 0x8000
content: Save
volatile
game
sha256: 2c0bac12a7866fad1cb306da768a201c12f2520332df1ef51cba1576db21ff06
label: Star Fox: Super Weekend
......@@ -13690,6 +13763,46 @@ game
oscillator
frequency: 7600000
game
sha256: 76d293e5a772eb2f326e173eac62ca323873b1f329f9b935a97ba86974e1fcd5
label: Super Mario Kart
name: Super Mario Kart
region: SNS-MK-USA
revision: SNS-MK-0
board: SHVC-1K1X-10
memory
type: ROM
size: 0x80000
content: Program
memory
type: RAM
size: 0x800
content: Save
memory
type: ROM
size: 0x1800
content: Program
manufacturer: NEC
architecture: uPD7725
identifier: DSP1B
memory
type: ROM
size: 0x800
content: Data
manufacturer: NEC
architecture: uPD7725
identifier: DSP1B
memory
type: RAM
size: 0x200
content: Data
manufacturer: NEC
architecture: uPD7725
identifier: DSP1B
volatile
oscillator
frequency: 7600000
game
sha256: 740646f3535bfb365ca44e70d46ab433467b142bd84010393070bd0b141af853
label: Super Mario RPG: Legend of the Seven Stars
......@@ -13727,6 +13840,24 @@ game
size: 0x800
content: Save
game
sha256: 9b4957466798bbdb5b43a450bbb60b2591ae81d95b891430f62d53ca62e8bc7b
label: Super Mario World 2: Yoshi's Island
name: Super Mario World 2 - Yoshi's Island
region: SNS-YI-USA
revision: SNS-YI-0
board: SHVC-1CB5B-01
memory
type: ROM
size: 0x200000
content: Program
memory
type: RAM
size: 0x8000
content: Save
oscillator
frequency: 21440000
game
sha256: bd763c1a56365c244be92e6cffefd318780a2a19eda7d5baf1c6d5bd6c1b3e06
label: Super Mario World 2: Yoshi's Island
......
......@@ -42,13 +42,13 @@ else ifneq ($(filter $(platform),linux bsd),)
mkdir -p $(prefix)/share/applications/
mkdir -p $(prefix)/share/icons/
mkdir -p $(prefix)/share/$(name)/
mkdir -p $(prefix)/share/$(name)/database/
mkdir -p $(prefix)/share/$(name)/firmware/
mkdir -p $(prefix)/share/$(name)/Database/
mkdir -p $(prefix)/share/$(name)/Firmware/
cp out/$(name) $(prefix)/bin/$(name)
cp data/$(name).desktop $(prefix)/share/applications/$(name).desktop
cp data/$(name).png $(prefix)/share/icons/$(name).png
cp -R database/* $(prefix)/share/$(name)/database/
cp -R firmware/* $(prefix)/share/$(name)/firmware/
cp -R Database/* $(prefix)/share/$(name)/Database/
cp -R Firmware/* $(prefix)/share/$(name)/Firmware/
endif
uninstall:
......
Icarus::Icarus() {
Database::Famicom = BML::unserialize(string::read(locate("database/Famicom.bml")));
Database::SuperFamicom = BML::unserialize(string::read(locate("database/Super Famicom.bml")));
Database::MasterSystem = BML::unserialize(string::read(locate("database/Master System.bml")));
Database::MegaDrive = BML::unserialize(string::read(locate("database/Mega Drive.bml")));
Database::PCEngine = BML::unserialize(string::read(locate("database/PC Engine.bml")));
Database::SuperGrafx = BML::unserialize(string::read(locate("database/SuperGrafx.bml")));
Database::GameBoy = BML::unserialize(string::read(locate("database/Game Boy.bml")));
Database::GameBoyColor = BML::unserialize(string::read(locate("database/Game Boy Color.bml")));
Database::GameBoyAdvance = BML::unserialize(string::read(locate("database/Game Boy Advance.bml")));
Database::GameGear = BML::unserialize(string::read(locate("database/Game Gear.bml")));
Database::WonderSwan = BML::unserialize(string::read(locate("database/WonderSwan.bml")));
Database::WonderSwanColor = BML::unserialize(string::read(locate("database/WonderSwan Color.bml")));
Database::PocketChallengeV2 = BML::unserialize(string::read(locate("database/Pocket Challenge V2.bml")));
Database::BSMemory = BML::unserialize(string::read(locate("database/BS Memory.bml")));
Database::SufamiTurbo = BML::unserialize(string::read(locate("database/Sufami Turbo.bml")));
Database::Famicom = BML::unserialize(string::read(locate("Database/Famicom.bml")));
Database::SuperFamicom = BML::unserialize(string::read(locate("Database/Super Famicom.bml")));
Database::MasterSystem = BML::unserialize(string::read(locate("Database/Master System.bml")));
Database::MegaDrive = BML::unserialize(string::read(locate("Database/Mega Drive.bml")));
Database::PCEngine = BML::unserialize(string::read(locate("Database/PC Engine.bml")));
Database::SuperGrafx = BML::unserialize(string::read(locate("Database/SuperGrafx.bml")));
Database::GameBoy = BML::unserialize(string::read(locate("Database/Game Boy.bml")));
Database::GameBoyColor = BML::unserialize(string::read(locate("Database/Game Boy Color.bml")));
Database::GameBoyAdvance = BML::unserialize(string::read(locate("Database/Game Boy Advance.bml")));
Database::GameGear = BML::unserialize(string::read(locate("Database/Game Gear.bml")));
Database::WonderSwan = BML::unserialize(string::read(locate("Database/WonderSwan.bml")));
Database::WonderSwanColor = BML::unserialize(string::read(locate("Database/WonderSwan Color.bml")));
Database::PocketChallengeV2 = BML::unserialize(string::read(locate("Database/Pocket Challenge V2.bml")));
Database::BSMemory = BML::unserialize(string::read(locate("Database/BS Memory.bml")));
Database::SufamiTurbo = BML::unserialize(string::read(locate("Database/Sufami Turbo.bml")));
}
auto Icarus::error() const -> string {
......
......@@ -12,7 +12,7 @@ struct Icarus {
}
virtual auto write(const string& filename, const uint8_t* data, uint size) -> bool {
return file::write(filename, data, size);
return file::write(filename, {data, size});
}
auto write(const string& filename, const vector<uint8_t>& buffer) -> bool {
......
......@@ -46,7 +46,7 @@ auto Icarus::superFamicomImport(vector<uint8_t>& buffer, string location) -> str
auto size = rom["size"].natural();
if(size > buffer.size() - offset) {
auto firmware = string{rom["identifier"].text(), ".", rom["content"].text(), ".rom"}.trimLeft(".", 1L).downcase();
auto location = locate({"firmware/", firmware});
auto location = locate({"Firmware/", firmware});
if(location && file::size(location) == size) {
write({target, name}, file::read(location));
} else {
......
......@@ -62,23 +62,23 @@ auto hiro::initialize() -> void {
}
#include <nall/main.hpp>
auto nall::main(vector<string> arguments) -> void {
if(arguments.size() == 2 && arguments[1] == "--name") {
auto nall::main(Arguments arguments) -> void {
if(arguments.size() == 1 && arguments[0] == "--name") {
return print("icarus");
}
if(arguments.size() == 3 && arguments[1] == "--manifest" && directory::exists(arguments[2])) {
return print(icarus.manifest(arguments[2]));
if(arguments.size() == 2 && arguments[0] == "--manifest" && directory::exists(arguments[1])) {
return print(icarus.manifest(arguments[1]));
}
if(arguments.size() == 3 && arguments[1] == "--import" && file::exists(arguments[2])) {
if(string target = icarus.import(arguments[2])) {
if(arguments.size() == 2 && arguments[0] == "--import" && file::exists(arguments[1])) {
if(string target = icarus.import(arguments[1])) {
return print(target, "\n");
}
return;
}
if(arguments.size() == 2 && arguments[1] == "--import") {
if(arguments.size() == 1 && arguments[0] == "--import") {
if(string source = BrowserDialog()
.setTitle("Load ROM File")
.setPath(settings["icarus/Path"].text())
......
......@@ -39,10 +39,13 @@ ifeq ($(platform),)
endif
endif
compiler.c = $(compiler) -x c -std=c11
compiler.cpp = $(compiler) -x c++ -std=c++14
compiler.objc = $(compiler) -x objective-c -std=c11
compiler.objcpp = $(compiler) -x objective-c++ -std=c++14
flags.c = -x c -std=c11
flags.h = -x c-header -std=c11
flags.cpp = -x c++ -std=c++14
flags.hpp = -x c++-header -std=c++14
flags.objc = -x objective-c -std=c11
flags.objcpp = -x objective-c++ -std=c++14
flags.deps = -MMD -MP -MF $(@:.o=.d)
......@@ -51,8 +54,8 @@ flags.deps = -MMD -MP -MF $(@:.o=.d)
ifeq ($(compiler),)
ifeq ($(platform),windows)
compiler := g++
flags.cpp := -x c++ -std=gnu++14
flags.hpp := -x c++-header -std=gnu++14
compiler.cpp = $(compiler) -x c++ -std=gnu++14
flags.cpp = -x c++ -std=gnu++14
else ifeq ($(platform),macos)
compiler := clang++
else ifeq ($(platform),linux)
......@@ -158,14 +161,10 @@ nall.verbose:
compile = \
$(strip \
$(if $(filter %.c,$<), \
$(compiler) $(flags.c) $(flags.deps) $(flags) $1 -c $< -o [email protected] \
$(compiler.c) $(flags.deps) $(flags) $1 -c $< -o [email protected] \
,$(if $(filter %.cpp,$<), \
$(compiler) $(flags.cpp) $(flags.deps) $(flags) $1 -c $< -o [email protected] \
,$(if $(filter %.h,$<), \
$(compiler) $(flags.h) $(flags) $1 -c $< -o [email protected] \
,$(if $(filter %.hpp,$<), \
$(compiler) $(flags.hpp) $(flags) $1 -c $< -o [email protected] \
)))) \
$(compiler.cpp) $(flags.deps) $(flags) $1 -c $< -o [email protected] \
)) \
)
# function rwildcard(directory, pattern)
......
#pragma once
#include <nall/location.hpp>
#include <nall/path.hpp>
#include <nall/string.hpp>
#include <nall/vector.hpp>
namespace nall {
struct Arguments {
Arguments(int argc, char** argv);
Arguments(vector<string> arguments);
explicit operator bool() const { return (bool)arguments; }
auto size() const -> uint { return arguments.size(); }
auto operator[](uint index) -> string& { return arguments[index]; }
auto operator[](uint index) const -> const string& { return arguments[index]; }
auto programPath() const -> string;
auto programName() const -> string;
auto programLocation() const -> string;
auto find(string_view name) const -> bool;
auto find(string_view name, bool& argument) const -> bool;
auto find(string_view name, string& argument) const -> bool;
auto begin() const { return arguments.begin(); }
auto end() const { return arguments.end(); }
auto rbegin() const { return arguments.rbegin(); }
auto rend() const { return arguments.rend(); }
auto take() -> string