Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gba: add option to enable Game Boy Player #1856

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ares/gba/system/controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ auto System::Controls::load(Node::Object parent) -> void {
start = node->append<Node::Input::Button>("Start");

if(GameBoyAdvance::Model::GameBoyPlayer()) {
rumbler = parent->append<Node::Input::Rumble>("Rumble");
rumbler = node->append<Node::Input::Rumble>("Rumble");
}
}

Expand Down
2 changes: 0 additions & 2 deletions ares/gba/system/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ auto System::load(Node::System& root, string name) -> bool {

information = {};
if(name.find("Game Boy Advance")) {
information.name = "Game Boy Advance";
information.model = Model::GameBoyAdvance;
}
if(name.find("Game Boy Player")) {
information.name = "Game Boy Player";
information.model = Model::GameBoyPlayer;
}

Expand Down
4 changes: 3 additions & 1 deletion desktop-ui/emulator/game-boy-advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ struct GameBoyAdvance : Emulator {
auto load() -> LoadResult override;
auto save() -> bool override;
auto pak(ares::Node::Object) -> shared_pointer<vfs::directory> override;
string deviceName;
};

GameBoyAdvance::GameBoyAdvance() {
Expand Down Expand Up @@ -66,9 +67,10 @@ auto GameBoyAdvance::load() -> LoadResult {
return result;
}

deviceName = settings.gameBoyAdvance.player ? "Game Boy Player" : "Game Boy Advance";
ares::GameBoyAdvance::option("Pixel Accuracy", settings.video.pixelAccuracy);

if(!ares::GameBoyAdvance::load(root, "[Nintendo] Game Boy Advance")) return otherError;
if(!ares::GameBoyAdvance::load(root, {"[Nintendo] ", deviceName})) return otherError;

if(auto port = root->find<ares::Node::Port>("Cartridge Slot")) {
port->allocate();
Expand Down
8 changes: 8 additions & 0 deletions desktop-ui/settings/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ auto OptionSettings::construct() -> void {
nintendo64ExpansionPakLayout.setAlignment(1).setPadding(12_sx, 0);
nintendo64ExpansionPakHint.setText("Enable/Disable the 4MB Expansion Pak").setFont(Font().setSize(7.0)).setForegroundColor(SystemColor::Sublabel);

gameBoyAdvanceSettingsLabel.setText("Game Boy Advance Settings").setFont(Font().setBold());

gameBoyPlayerOption.setText("Game Boy Player").setChecked(settings.gameBoyAdvance.player).onToggle([&] {
settings.gameBoyAdvance.player = gameBoyPlayerOption.checked();
});
gameBoyPlayerLayout.setAlignment(1).setPadding(12_sx, 0);
gameBoyPlayerHint.setText("Enable/Disable Game Boy Player rumble").setFont(Font().setSize(7.0)).setForegroundColor(SystemColor::Sublabel);

megaDriveSettingsLabel.setText("Mega Drive Settings").setFont(Font().setBold());

megaDriveTmssOption.setText("TMSS Boot Rom").setChecked(settings.megadrive.tmss).onToggle([&] {
Expand Down
2 changes: 2 additions & 0 deletions desktop-ui/settings/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ auto Settings::process(bool load) -> void {

bind(boolean, "Nintendo64/ExpansionPak", nintendo64.expansionPak);

bind(boolean, "GameBoyAdvance/Player", gameBoyAdvance.player);

bind(boolean, "MegaDrive/TMSS", megadrive.tmss);

for(u32 index : range(9)) {
Expand Down
8 changes: 8 additions & 0 deletions desktop-ui/settings/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ struct Settings : Markup::Node {
bool expansionPak = true;
} nintendo64;

struct GameBoyAdvance {
bool player = false;
} gameBoyAdvance;

struct MegaDrive {
bool tmss = false;
} megadrive;
Expand Down Expand Up @@ -262,6 +266,10 @@ struct OptionSettings : VerticalLayout {
HorizontalLayout nintendo64ExpansionPakLayout{this, Size{~0, 0}, 5};
CheckLabel nintendo64ExpansionPakOption{&nintendo64ExpansionPakLayout, Size{0, 0}, 5};
Label nintendo64ExpansionPakHint{&nintendo64ExpansionPakLayout, Size{0, 0}};
Label gameBoyAdvanceSettingsLabel{this, Size{~0, 0}, 5};
HorizontalLayout gameBoyPlayerLayout{this, Size{~0, 0}, 5};
CheckLabel gameBoyPlayerOption{&gameBoyPlayerLayout, Size{0, 0}, 5};
Label gameBoyPlayerHint{&gameBoyPlayerLayout, Size{0, 0}};
Label megaDriveSettingsLabel{this, Size{~0, 0}, 5};
HorizontalLayout megaDriveTmssLayout{this, Size{~0, 0}, 5};
CheckLabel megaDriveTmssOption{&megaDriveTmssLayout, Size{0, 0}, 5};
Expand Down
1 change: 1 addition & 0 deletions mia/medium/game-boy-advance.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
struct GameBoyAdvance : Cartridge {
auto name() -> string override { return "Game Boy Advance"; }
auto saveName() -> string override { return "Game Boy Advance"; }
auto extensions() -> vector<string> override { return {"gba"}; }
auto load(string location) -> LoadResult override;
auto save(string location) -> bool override;
Expand Down
Loading