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 <[email protected]>

vba: refactor to 2 targets

Signed-off-by: Joseph Mattello <[email protected]>

Add VBA-Next source files

Signed-off-by: Joseph Mattello <[email protected]>
  • Loading branch information
JoeMatt committed Dec 12, 2022
1 parent b3a9588 commit b8cb573
Show file tree
Hide file tree
Showing 6 changed files with 595 additions and 128 deletions.
35 changes: 35 additions & 0 deletions Cores/VisualBoyAdvance-M/BuildFlags.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// BuildFlags.xcconfig
// VisualBoyAdvbance
//
// Created by Joseph Mattiello on 02/19/22.
//
//

// All
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) C_CORE=1 FINAL_VERSION=1 NO_LINK=1 TILED_RENDERING=1 NO_PNG=1 INLINE=inline
OTHER_CFLAGS = $(inherited)
GCC_C_LANGUAGE_STANDARD = c99
//GCC_C_LANGUAGE_STANDARD = gnu99
CLANG_CXX_LANGUAGE_STANDARD = gnu++0x
CLANG_CXX_LIBRARY = libc++
WARNING_CFLAGS = $(inherited) -Wno-write-strings
//:configuration = Archive
//HEADER_SEARCH_PATHS = $(inherited)
//
// // Device
//GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*] = $(inherited)
//OTHER_CFLAGS[sdk=iphoneos*] = $(inherited)
//
//// Simulator
//GCC_PREPROCESSOR_DEFINITIONS[sdk=iphonesimulator*] = $(inherited)
//
//// tvOS Device
//GCC_PREPROCESSOR_DEFINITIONS[sdk=appletvos*] = $(inherited)
//OTHER_CFLAGS[sdk=appletvos*] = $(inherited)
//
//// tvOS Simulator
//GCC_PREPROCESSOR_DEFINITIONS[sdk=appletvsimulator*] = $(inherited)
//
//// DEBUG
//GCC_PREPROCESSOR_DEFINITIONS[configuration=Debug] = DEBUG=1 $(inherited)
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
Loading

0 comments on commit b8cb573

Please sign in to comment.