forked from HailToDodongo/ares-wasm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I've started on a new multi-system emulator, byuu. It will share all cores with higan, and as such will be focused on accuracy and self-documenting code foremost. But unlike higan, I will do everything possible to make the program featureful and easy to use. The way I'm doing this is through a translation layer to abstract higan's tree-view into a list-view. The list-view is similar to higan v106 and earlier. I'm also going to add more ease-of-use improvements from bsnes. The list-view will sacrifice support for extreme edge cases, but should more than make up for it in ease of use. bsnes' success greatly exceeded my expectations, and resulted in many improvements to higan's SNES core as well. But unfortunately, bsnes is for the SNES only, and I just don't have the bandwidth to maintain 24 emulator projects. As such, the goal of this project is to try and create an easy-to-use alternative for *all* of my emulator cores. Right now, I'm maintaining this as an alternate user interface target inside the higan source tree. Long-term, the intention is that higan and byuu will be equal emulators, rather than one being a superset of the other. I don't know how that final form will look just yet, but for now, this will at least allow me to keep the history in Git. I do ask that binaries not be distributed of byuu until the software is ready for release. I wouldn't even recommend using it. It's not really functional at all yet. But it'll get there over time.
- Loading branch information
byuu
committed
Jan 30, 2020
1 parent
88758a0
commit 1ed1e05
Showing
41 changed files
with
1,210 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
target := higan | ||
#target := byuu | ||
build := performance | ||
openmp := false | ||
local := true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name := byuu | ||
|
||
hiro.path := ../hiro | ||
hiro.resource := $(ui)/resource/byuu.rc | ||
include $(hiro.path)/GNUmakefile | ||
|
||
ruby.path := ../ruby | ||
include $(ruby.path)/GNUmakefile | ||
|
||
objects += ui-byuu ui-resource ui-emulator ui-program ui-presentation | ||
objects := $(objects:%=obj/%.o) | ||
|
||
obj/ui-byuu.o: $(ui)/byuu.cpp | ||
obj/ui-resource.o: $(ui)/resource/resource.cpp | ||
obj/ui-emulator.o: $(ui)/emulator/emulator.cpp | ||
obj/ui-program.o: $(ui)/program/program.cpp | ||
obj/ui-presentation.o: $(ui)/presentation/presentation.cpp | ||
|
||
all: $(hiro.objects) $(ruby.objects) $(objects) | ||
$(info Linking out/$(name) ...) | ||
+@$(compiler) -o out/$(name) $(hiro.objects) $(ruby.objects) $(objects) $(hiro.options) $(ruby.options) $(options) | ||
ifeq ($(platform),macos) | ||
rm -rf out/$(name).app | ||
mkdir -p out/$(name).app/Contents/MacOS/ | ||
mkdir -p out/$(name).app/Contents/Resources/ | ||
mv out/$(name) out/$(name).app/Contents/MacOS/$(name) | ||
cp $(ui)/resource/$(name).plist out/$(name).app/Contents/Info.plist | ||
sips -s format icns $(ui)/resource/$(name).png --out out/$(name).app/Contents/Resources/$(name).icns | ||
endif | ||
|
||
verbose: hiro.verbose ruby.verbose nall.verbose all; | ||
|
||
install: all | ||
ifeq ($(platform),windows) | ||
mkdir -p $(prefix)/$(name)/ | ||
else ifeq ($(shell id -un),root) | ||
$(error "make install should not be run as root") | ||
else ifeq ($(platform),macos) | ||
mkdir -p ~/Library/Application\ Support/$(name)/ | ||
cp -R out/$(name).app /Applications/$(name).app | ||
else ifneq ($(filter $(platform),linux bsd),) | ||
mkdir -p $(prefix)/bin/ | ||
mkdir -p $(prefix)/share/applications/ | ||
mkdir -p $(prefix)/share/icons/ | ||
mkdir -p $(prefix)/share/$(name)/ | ||
cp out/$(name) $(prefix)/bin/$(name) | ||
cp $(ui)/resource/$(name).desktop $(prefix)/share/applications/$(name).desktop | ||
cp $(ui)/resource/$(name).png $(prefix)/share/icons/$(name).png | ||
endif | ||
|
||
uninstall: | ||
ifeq ($(platform),windows) | ||
else ifeq ($(shell id -un),root) | ||
$(error "make uninstall should not be run as root") | ||
else ifeq ($(platform),macos) | ||
rm -rf /Applications/$(name).app | ||
else ifneq ($(filter $(platform),linux bsd),) | ||
rm -f $(prefix)/bin/$(name) | ||
rm -f $(prefix)/share/applications/$(name).desktop | ||
rm -f $(prefix)/share/icons/$(name).png | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "byuu.hpp" | ||
|
||
namespace ruby { | ||
Video video; | ||
Audio audio; | ||
Input input; | ||
} | ||
|
||
#include <nall/main.hpp> | ||
auto nall::main(Arguments arguments) -> void { | ||
Application::setName("byuu"); | ||
Application::setScreenSaver(false); | ||
|
||
Emulator::construct(); | ||
Instances::presentation.construct(); | ||
|
||
if(!Path::user().find("byuu")) { | ||
MessageDialog() | ||
.setTitle("byuu") | ||
.setText({ | ||
"Note: this is pre-alpha software!\n" | ||
"Development literally just started.\n\n" | ||
"Please do not distribute binaries of byuu.\n" | ||
"Please do not report any bugs.\n" | ||
"Please don't even run this at all!\n" | ||
"If you do so anyway, the consequences are on you." | ||
}) | ||
.information(); | ||
} | ||
|
||
program.create(); | ||
Application::onMain({&Program::main, &program}); | ||
Application::run(); | ||
|
||
Instances::presentation.destruct(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <ruby/ruby.hpp> | ||
//using namespace ruby; | ||
|
||
#include <hiro/hiro.hpp> | ||
using namespace hiro; | ||
|
||
#include <emulator/emulator.hpp> | ||
|
||
#include <nall/instance.hpp> | ||
|
||
namespace ruby { | ||
extern Video video; | ||
extern Audio audio; | ||
extern Input input; | ||
} | ||
|
||
#include "resource/resource.hpp" | ||
#include "emulator/emulator.hpp" | ||
#include "program/program.hpp" | ||
#include "presentation/presentation.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "../byuu.hpp" | ||
#include "famicom.cpp" | ||
|
||
vector<shared_pointer<Emulator::Instance>> emulators; | ||
shared_pointer<Emulator::Instance> emulator; | ||
|
||
namespace Emulator { | ||
|
||
auto construct() -> void { | ||
#ifdef CORE_FC | ||
emulators.append(new Emulator::Famicom); | ||
#endif | ||
} | ||
|
||
auto Instance::load(const string& name, const vector<uint8_t>& data) -> void { | ||
game.name = name; | ||
game.data = data; | ||
|
||
auto system = higan::Node::System::create(); | ||
system->setName(interface->name()); | ||
auto configuration = higan::Node::serialize(system); | ||
interface->load(root, configuration); | ||
|
||
load(); | ||
interface->power(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace Emulator { | ||
|
||
struct Instance { | ||
auto load(const string& name, const vector<uint8_t>& data) -> void; | ||
virtual auto load() -> void = 0; | ||
virtual auto load(higan::Node::Object, string name, vfs::file::mode mode, bool required) -> shared_pointer<vfs::file> = 0; | ||
|
||
struct Port { | ||
string name; | ||
}; | ||
|
||
struct Game { | ||
string name; | ||
string manifest; | ||
vector<uint8_t> data; | ||
}; | ||
|
||
shared_pointer<higan::Interface> interface; | ||
string name; | ||
string abbreviation; | ||
vector<string> extensions; | ||
vector<Port> ports; | ||
|
||
higan::Node::Object root; | ||
Game game; | ||
}; | ||
|
||
auto construct() -> void; | ||
|
||
struct Famicom : Instance { | ||
Famicom(); | ||
auto load() -> void; | ||
auto load(higan::Node::Object, string name, vfs::file::mode mode, bool required) -> shared_pointer<vfs::file>; | ||
}; | ||
|
||
} | ||
|
||
extern vector<shared_pointer<Emulator::Instance>> emulators; | ||
extern shared_pointer<Emulator::Instance> emulator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <fc/interface/interface.hpp> | ||
|
||
namespace Emulator { | ||
|
||
Famicom::Famicom() { | ||
interface = new higan::Famicom::FamicomInterface; | ||
name = "Nintendo"; | ||
abbreviation = "NES"; | ||
extensions = {"nes"}; | ||
|
||
{ Port port; | ||
port.name = "Controller Port 1"; | ||
ports.append(port); | ||
} | ||
|
||
{ Port port; | ||
port.name = "Controller Port 2"; | ||
ports.append(port); | ||
} | ||
} | ||
|
||
auto Famicom::load() -> void { | ||
if(auto port = root->find<higan::Node::Port>("Cartridge Slot")) { | ||
auto peripheral = port->allocate(); | ||
peripheral->setAttribute("id", "rom"); | ||
peripheral->setAttribute("location", game.name); | ||
port->connect(peripheral); | ||
} | ||
} | ||
|
||
auto Famicom::load(higan::Node::Object node, string name, vfs::file::mode mode, bool required) -> shared_pointer<vfs::file> { | ||
auto document = BML::unserialize(game.manifest); | ||
auto headerSize = document["game/board/memory(content=iNES,type=ROM)/size"].natural(); | ||
auto programSize = document["game/board/memory(content=Program,type=ROM)/size"].natural(); | ||
auto characterSize = document["game/board/memory(content=Character,type=ROM)/size"].natural(); | ||
|
||
if(name == "program.rom") { | ||
uint address = headerSize; | ||
return vfs::memory::file::open(game.data.data() + address, programSize); | ||
} | ||
|
||
if(name == "character.rom") { | ||
uint address = headerSize + programSize; | ||
return vfs::memory::file::open(game.data.data() + address, characterSize); | ||
} | ||
|
||
return {}; | ||
} | ||
|
||
} |
Oops, something went wrong.