Skip to content

Commit

Permalink
closes #924 Allow VBA to run GB/GBC games
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Mattello <mail@joemattiello.com>
  • Loading branch information
JoeMatt committed Dec 10, 2022
1 parent be01ce5 commit 254b181
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Cores/VisualBoyAdvance-M/GBA/PVGBAEmulatorCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#import <PVSupport/PVEmulatorCore.h>
#import <PVSupport/PVSupport-Swift.h>

@interface PVGBAEmulatorCore : PVEmulatorCore <PVGBASystemResponderClient>
@interface PVGBAEmulatorCore : PVEmulatorCore <PVGBASystemResponderClient, PVGBSystemResponderClient>

- (void)didPushGBAButton:(PVGBAButton)button forPlayer:(NSInteger)player;
- (void)didReleaseGBAButton:(PVGBAButton)button forPlayer:(NSInteger)player;
Expand Down
13 changes: 13 additions & 0 deletions Cores/VisualBoyAdvance-M/GBA/PVGBAEmulatorCore.mm
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ - (BOOL)loadStateFromFileAtPath:(NSString *)fileName error:(NSError**)error
};
const int GBAMap[] = {KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_BUTTON_A, KEY_BUTTON_B, KEY_BUTTON_L, KEY_BUTTON_R, KEY_BUTTON_START, KEY_BUTTON_SELECT};


- (void)didPushGBAButton:(PVGBAButton)button forPlayer:(NSInteger)player
{
pad[player] |= GBAMap[button];
Expand All @@ -362,6 +363,18 @@ - (void)didReleaseGBAButton:(PVGBAButton)button forPlayer:(NSInteger)player
pad[player] &= ~GBAMap[button];
}

const int GBMap[] = {KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_BUTTON_A, KEY_BUTTON_B, KEY_BUTTON_START, KEY_BUTTON_SELECT};

- (void)didPushGBButton:(PVGBButton)button forPlayer:(NSInteger)player
{
pad[player] |= GBMap[button];
}

- (void)didReleaseGBButton:(PVGBButton)button forPlayer:(NSInteger)player
{
pad[player] &= ~GBMap[button];
}

bool systemReadJoypads()
{
__strong PVGBAEmulatorCore *strongCurrent = _current;
Expand Down
64 changes: 32 additions & 32 deletions Cores/VisualBoyAdvance-M/PVGBA.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -210,35 +210,35 @@
1A9FBC3A1ABD0FEF004E778B /* GBACore */ = {
isa = PBXGroup;
children = (
1A9FBC3B1ABD0FEF004E778B /* apu */,
1A9FBD211ABD0FEF004E778B /* Util.cpp */,
1A9FBC4A1ABD0FEF004E778B /* AutoBuild.h */,
1A9FBC4B1ABD0FEF004E778B /* common */,
1A9FBC871ABD0FEF004E778B /* gba */,
1A9FBD0A1ABD0FEF004E778B /* NLS.h */,
1A9FBD201ABD0FEF004E778B /* System.h */,
1A9FBD211ABD0FEF004E778B /* Util.cpp */,
1A9FBD221ABD0FEF004E778B /* Util.h */,
1A9FBD241ABD0FEF004E778B /* version.h */,
1A9FBC3B1ABD0FEF004E778B /* apu */,
1A9FBC4B1ABD0FEF004E778B /* common */,
1A9FBC871ABD0FEF004E778B /* gba */,
);
path = GBACore;
sourceTree = "<group>";
};
1A9FBC3B1ABD0FEF004E778B /* apu */ = {
isa = PBXGroup;
children = (
1A9FBC3F1ABD0FEF004E778B /* Blip_Buffer.cpp */,
1A9FBC411ABD0FEF004E778B /* Effects_Buffer.cpp */,
1A9FBC451ABD0FEF004E778B /* Gb_Apu_State.cpp */,
1A9FBC431ABD0FEF004E778B /* Gb_Apu.cpp */,
1A9FBC461ABD0FEF004E778B /* Gb_Oscs.cpp */,
1A9FBC481ABD0FEF004E778B /* Multi_Buffer.cpp */,
1A9FBC3C1ABD0FEF004E778B /* blargg_common.h */,
1A9FBC3D1ABD0FEF004E778B /* blargg_config.h */,
1A9FBC3E1ABD0FEF004E778B /* blargg_source.h */,
1A9FBC3F1ABD0FEF004E778B /* Blip_Buffer.cpp */,
1A9FBC401ABD0FEF004E778B /* Blip_Buffer.h */,
1A9FBC411ABD0FEF004E778B /* Effects_Buffer.cpp */,
1A9FBC421ABD0FEF004E778B /* Effects_Buffer.h */,
1A9FBC431ABD0FEF004E778B /* Gb_Apu.cpp */,
1A9FBC441ABD0FEF004E778B /* Gb_Apu.h */,
1A9FBC451ABD0FEF004E778B /* Gb_Apu_State.cpp */,
1A9FBC461ABD0FEF004E778B /* Gb_Oscs.cpp */,
1A9FBC471ABD0FEF004E778B /* Gb_Oscs.h */,
1A9FBC481ABD0FEF004E778B /* Multi_Buffer.cpp */,
1A9FBC491ABD0FEF004E778B /* Multi_Buffer.h */,
);
path = apu;
Expand All @@ -247,17 +247,17 @@
1A9FBC4B1ABD0FEF004E778B /* common */ = {
isa = PBXGroup;
children = (
1A9FBC4C1ABD0FEF004E778B /* Array.h */,
1A9FBC4F1ABD0FEF004E778B /* memgzio.c */,
1A9FBC4D1ABD0FEF004E778B /* ffmpeg.cpp */,
1A9FBC511ABD0FEF004E778B /* Patch.cpp */,
1A9FBC561ABD0FEF004E778B /* SoundSDL.cpp */,
1A9FBC4C1ABD0FEF004E778B /* Array.h */,
1A9FBC4E1ABD0FEF004E778B /* ffmpeg.h */,
1A9FBC4F1ABD0FEF004E778B /* memgzio.c */,
1A9FBC501ABD0FEF004E778B /* memgzio.h */,
1A9FBC511ABD0FEF004E778B /* Patch.cpp */,
1A9FBC521ABD0FEF004E778B /* Patch.h */,
1A9FBC531ABD0FEF004E778B /* Port.h */,
1A9FBC541ABD0FEF004E778B /* RingBuffer.h */,
1A9FBC551ABD0FEF004E778B /* SoundDriver.h */,
1A9FBC561ABD0FEF004E778B /* SoundSDL.cpp */,
1A9FBC571ABD0FEF004E778B /* SoundSDL.h */,
1A9FBC581ABD0FEF004E778B /* Types.h */,
);
Expand All @@ -268,37 +268,21 @@
isa = PBXGroup;
children = (
1A9FBC881ABD0FEF004E778B /* agbprint.cpp */,
1A9FBC891ABD0FEF004E778B /* agbprint.h */,
1A9FBC8A1ABD0FEF004E778B /* armdis.cpp */,
1A9FBC8B1ABD0FEF004E778B /* armdis.h */,
1A9FBC8C1ABD0FEF004E778B /* bios.cpp */,
1A9FBC8D1ABD0FEF004E778B /* bios.h */,
1A9FBC8E1ABD0FEF004E778B /* Cheats.cpp */,
1A9FBC8F1ABD0FEF004E778B /* Cheats.h */,
1A9FBC901ABD0FEF004E778B /* CheatSearch.cpp */,
1A9FBC911ABD0FEF004E778B /* CheatSearch.h */,
1A9FBC921ABD0FEF004E778B /* EEprom.cpp */,
1A9FBC931ABD0FEF004E778B /* EEprom.h */,
1A9FBC941ABD0FEF004E778B /* elf.cpp */,
1A9FBC951ABD0FEF004E778B /* elf.h */,
1A9FBC961ABD0FEF004E778B /* Flash.cpp */,
1A9FBC971ABD0FEF004E778B /* Flash.h */,
1A9FBC981ABD0FEF004E778B /* GBA-arm.cpp */,
1A9FBC991ABD0FEF004E778B /* GBA-thumb.cpp */,
1A9FBC9A1ABD0FEF004E778B /* GBA.cpp */,
1A9FBC9B1ABD0FEF004E778B /* GBA.h */,
1A9FBC9C1ABD0FEF004E778B /* GBAcpu.h */,
1A9FBC9D1ABD0FEF004E778B /* gbafilter.cpp */,
1A9FBC9E1ABD0FEF004E778B /* gbafilter.h */,
1A9FBC9F1ABD0FEF004E778B /* GBAGfx.cpp */,
1A9FBCA01ABD0FEF004E778B /* GBAGfx.h */,
1A9FBCA11ABD0FEF004E778B /* GBAinline.h */,
1A9FBCA21ABD0FEF004E778B /* GBALink.cpp */,
1A9FBCA31ABD0FEF004E778B /* GBALink.h */,
1A9FBCA41ABD0FEF004E778B /* GBASockClient.cpp */,
1A9FBCA51ABD0FEF004E778B /* GBASockClient.h */,
1A9FBCA61ABD0FEF004E778B /* Globals.cpp */,
1A9FBCA71ABD0FEF004E778B /* Globals.h */,
1A9FBCA81ABD0FEF004E778B /* Mode0.cpp */,
1A9FBCA91ABD0FEF004E778B /* Mode1.cpp */,
1A9FBCAA1ABD0FEF004E778B /* Mode2.cpp */,
Expand All @@ -307,10 +291,26 @@
1A9FBCAD1ABD0FEF004E778B /* Mode5.cpp */,
1A9FBCAE1ABD0FEF004E778B /* remote.cpp */,
1A9FBCAF1ABD0FEF004E778B /* RTC.cpp */,
1A9FBCB01ABD0FEF004E778B /* RTC.h */,
1A9FBCB11ABD0FEF004E778B /* Sound.cpp */,
1A9FBCB21ABD0FEF004E778B /* Sound.h */,
1A9FBCB31ABD0FEF004E778B /* Sram.cpp */,
1A9FBC891ABD0FEF004E778B /* agbprint.h */,
1A9FBC8B1ABD0FEF004E778B /* armdis.h */,
1A9FBC8D1ABD0FEF004E778B /* bios.h */,
1A9FBC8F1ABD0FEF004E778B /* Cheats.h */,
1A9FBC911ABD0FEF004E778B /* CheatSearch.h */,
1A9FBC931ABD0FEF004E778B /* EEprom.h */,
1A9FBC951ABD0FEF004E778B /* elf.h */,
1A9FBC971ABD0FEF004E778B /* Flash.h */,
1A9FBC9B1ABD0FEF004E778B /* GBA.h */,
1A9FBC9C1ABD0FEF004E778B /* GBAcpu.h */,
1A9FBC9E1ABD0FEF004E778B /* gbafilter.h */,
1A9FBCA01ABD0FEF004E778B /* GBAGfx.h */,
1A9FBCA11ABD0FEF004E778B /* GBAinline.h */,
1A9FBCA31ABD0FEF004E778B /* GBALink.h */,
1A9FBCA51ABD0FEF004E778B /* GBASockClient.h */,
1A9FBCA71ABD0FEF004E778B /* Globals.h */,
1A9FBCB01ABD0FEF004E778B /* RTC.h */,
1A9FBCB21ABD0FEF004E778B /* Sound.h */,
1A9FBCB41ABD0FEF004E778B /* Sram.h */,
);
path = gba;
Expand Down
2 changes: 2 additions & 0 deletions Cores/VisualBoyAdvance-M/PVGBA/Core.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<key>PVSupportedSystems</key>
<array>
<string>com.provenance.gba</string>
<string>com.provenance.gb</string>
<string>com.provenance.gbc</string>
</array>
<key>PVProjectName</key>
<string>VisualBoyAdvance</string>
Expand Down

0 comments on commit 254b181

Please sign in to comment.