Skip to content

Commit

Permalink
Merge branch 'feature/retroarchBetterIntergration' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeMatt committed Nov 30, 2024
2 parents db8d43f + 2c3e2fd commit f1e1531
Show file tree
Hide file tree
Showing 39 changed files with 278 additions and 185 deletions.
2 changes: 1 addition & 1 deletion Cores/Gearcoleco/PVGearcolecoCore/PVGearcolecoCore.mm
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ - (void *)getVariable:(const char *)variable {
// "GameMaster2|"
// "FMPAC"
// },
char *value = strdup("FMPAC");
char *value = strdup("Guess");
return value;
} else {
ELOG(@"Unprocessed var: %s", variable);
Expand Down
4 changes: 4 additions & 0 deletions CoresRetro/RetroArch/PVRetroArch/Core.plist
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
<string>PVRetroArch.PVRetroArchCoreCore</string>
<key>PVProjectName</key>
<string>Flycast (RetroArch)</string>
<key>PVAppStoreDisabled</key>
<true/>
<key>PVSupportedSystems</key>
<array>
<string>com.provenance.dreamcast</string>
Expand All @@ -97,6 +99,8 @@
<string>https://github.com/libretro/mupen64plus-libretro-nx</string>
<key>PVProjectVersion</key>
<string>2022.12.12</string>
<key>PVAppStoreDisabled</key>
<true/>
</dict>
<dict>
<key>PVCoreIdentifier</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ - (void)didMove3DOJoystickDirection:(PV3DOButton)button withValue:(CGFloat)value
[self handle3DOButton:button forPlayer:player pressed:(value != 0) value:value];
}
- (void)handle3DOButton:(PV3DOButton)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
static float ltXAxis=0;
static float ltYAxis=0;
static float rtXAxis=0;
static float rtYAxis=0;
static float axisMult = 1.0;
switch (button) {
case(PV3DOButtonUp):
yAxis=pressed?(!xAxis?1.0:0.5):0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ - (void)didMoveDSJoystickDirection:(PVDSButton)button withValue:(CGFloat)value f
[self handleDSButton:button forPlayer:player pressed:(value != 0) value:value];
}
- (void)handleDSButton:(PVDSButton)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
static float ltXAxis=0;
static float ltYAxis=0;
static float rtXAxis=0;
static float rtYAxis=0;
static float axisMult = 1.0;

switch (button) {
case(PVDSButtonUp):
yAxis=pressed?(!xAxis?1.0:0.5):0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ - (void)didMoveDreamcastJoystickDirection:(PVDreamcastButton)button withXValue:(
}

- (void)handleDreamcastButton:(PVDreamcastButton)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
static float ltXAxis=0;
static float ltYAxis=0;
static float rtXAxis=0;
static float rtYAxis=0;
static float axisMult = 1.0;
switch (button) {
case(PVDreamcastButtonUp):
yAxis=pressed?(!xAxis?1.0:0.5):0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ - (void)didReleaseGBButton:(PVGBButton)button forPlayer:(NSInteger)player {
}

- (void)handleGBButton:(PVGBButton)button forPlayer:(NSInteger)player pressed:(BOOL)pressed {
static float xAxis=0;
static float yAxis=0;

switch (button) {
case(PVGBButtonUp):
yAxis=pressed?(!xAxis?1.0:0.5):0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ - (void)didMoveGenesisJoystickDirection:(PVGenesisButton)button withValue:(CGFlo
[self handleGenesisButton:button forPlayer:player pressed:(value != 0) value:value];
}
- (void)handleGenesisButton:(PVGenesisButton)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
static float ltXAxis=0;
static float ltYAxis=0;
static float rtXAxis=0;
static float rtYAxis=0;
static float axisMult = 1.0;

switch (button) {
case(PVGenesisButtonUp):
yAxis=pressed?(!xAxis?1.0:0.5):0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ - (void)didMoveMAMEJoystickDirection:(PVMAMEButton)button withXValue:(CGFloat)xV
}

- (void)handleMAMEButton:(PVMAMEButton)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
switch (button) {
case(PVMAMEButtonUp):
yAxis=pressed?1.0:0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ - (void)didMoveN64JoystickDirection:(PVN64Button)button withXValue:(CGFloat)xVal
}

- (void)handleN64Button:(PVN64Button)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
static float ltXAxis=0;
static float ltYAxis=0;
static float rtXAxis=0;
static float rtYAxis=0;
static float axisMult = 1.0;

switch (button) {
case(PVN64ButtonDPadUp):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ - (void)didMoveNeoGeoJoystickDirection:(PVNeoGeoButton)button withXValue:(CGFloa
}

- (void)handleNeoGeoButton:(PVNeoGeoButton)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
switch (button) {
case(PVNeoGeoButtonUp):
yAxis=pressed?1.0:0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,60 +47,58 @@ - (void)didMovePCEJoystickDirection:(PVPCEButton)button withValue:(CGFloat)value
[self handlePCEButton:button forPlayer:player pressed:(value != 0) value:value];
}
- (void)handlePCEButton:(PVPCEButton)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
static float ltXAxis=0;
static float ltYAxis=0;
static float rtXAxis=0;
static float rtYAxis=0;
static float axisMult = 1.0;

switch (button) {
case(PVPCEButtonUp):
yAxis=pressed?(!xAxis?1.0:0.5):0;
yAxis = pressed ? 1.0 :0;
DLOG(@"Pressed %@ : %@", @"up", pressed ? @"Yes" : @"No");
[touch_controller.extendedGamepad.dpad setValueForXAxis:xAxis yAxis:yAxis];
break;
case(PVPCEButtonDown):
yAxis=pressed?(!xAxis?-1.0:-0.5):0;
yAxis = pressed ? -1.0 :0;
DLOG(@"Pressed %@ : %@", @"down", pressed ? @"Yes" : @"No");
[touch_controller.extendedGamepad.dpad setValueForXAxis:xAxis yAxis:yAxis];
break;
case(PVPCEButtonLeft):
xAxis=pressed?(!yAxis?-1.0:-0.5):0;
xAxis = pressed ? -1.0 :0;
DLOG(@"Pressed %@ : %@", @"left", pressed ? @"Yes" : @"No");
[touch_controller.extendedGamepad.dpad setValueForXAxis:xAxis yAxis:yAxis];
break;
case(PVPCEButtonRight):
xAxis=pressed?(!yAxis?1.0:0.5):0;
xAxis = pressed ? 1.0 :0;
DLOG(@"Pressed %@ : %@", @"right", pressed ? @"Yes" : @"No");
[touch_controller.extendedGamepad.dpad setValueForXAxis:xAxis yAxis:yAxis];
break;
case(PVPCEButtonButton1):
[touch_controller.extendedGamepad.buttonB setValue:pressed?1:0];
[touch_controller.extendedGamepad.buttonB setValue:pressed ? 1 : 0];
break;
case(PVPCEButtonButton2):
[touch_controller.extendedGamepad.buttonA setValue:pressed?1:0];
[touch_controller.extendedGamepad.buttonA setValue:pressed ? 1 : 0];
break;
case(PVPCEButtonButton3):
[touch_controller.extendedGamepad.buttonX setValue:pressed?1:0];
[touch_controller.extendedGamepad.buttonX setValue:pressed ? 1 : 0];
break;
case(PVPCEButtonButton4):
[touch_controller.extendedGamepad.buttonY setValue:pressed?1:0];
[touch_controller.extendedGamepad.buttonY setValue:pressed ? 1 : 0];
break;
case(PVPCEButtonButton5):
[touch_controller.extendedGamepad.leftShoulder setValue:pressed?1:0];
[touch_controller.extendedGamepad.leftShoulder setValue:pressed ? 1 : 0];
break;
case(PVPCEButtonButton6):
[touch_controller.extendedGamepad.rightShoulder setValue:pressed?1:0];
[touch_controller.extendedGamepad.rightShoulder setValue:pressed ? 1 : 0];
break;
case(PVPCEButtonMode):
[touch_controller.extendedGamepad.leftTrigger setValue:pressed?1:0];
[touch_controller.extendedGamepad.leftTrigger setValue:pressed ? 1 : 0];
break;
case(PVPCEButtonCount):
[touch_controller.extendedGamepad.leftThumbstickButton setValue:pressed?1:0];
break;
case(PVPCEButtonSelect):
[touch_controller.extendedGamepad.buttonOptions setValue:pressed?1:0];
[touch_controller.extendedGamepad.buttonHome setValue:pressed?1:0];
[touch_controller.extendedGamepad.buttonOptions setValue:pressed ? 1 : 0];
[touch_controller.extendedGamepad.buttonHome setValue:pressed ? 1 : 0];
break;
case(PVPCEButtonRun):
[touch_controller.extendedGamepad.buttonMenu setValue:pressed?1:0];
[touch_controller.extendedGamepad.buttonMenu setValue:pressed ? 1 : 0];
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,7 @@ - (void)didMovePSXJoystickDirection:(PVPS2Button)button withXValue:(CGFloat)xVal
}
}
- (void)handlePSXButton:(PVPS2Button)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
static float ltXAxis=0;
static float ltYAxis=0;
static float rtXAxis=0;
static float rtYAxis=0;
static float axisMult = 1.0;

static float axisRounding = 0.22;

switch (button) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,7 @@ - (void)didMovePSXJoystickDirection:(PVPSXButton)button withXValue:(CGFloat)xVal
}
}
- (void)handlePSXButton:(PVPSXButton)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
static float ltXAxis=0;
static float ltYAxis=0;
static float rtXAxis=0;
static float rtYAxis=0;
static float axisMult = 1.0;

static float axisRounding = 0.22;

switch (button) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ - (void)didMoveSaturnJoystickDirection:(PVSaturnButton)button withXValue:(CGFloa
}

- (void)handleSaturnButton:(PVSaturnButton)button forPlayer:(NSInteger)player pressed:(BOOL)pressed value:(CGFloat)value {
static float xAxis=0;
static float yAxis=0;
static float ltXAxis=0;
static float ltYAxis=0;
static float rtXAxis=0;
static float rtYAxis=0;
static float axisMult = 1.0;
switch (button) {
case(PVSaturnButtonUp):
yAxis=pressed?(!xAxis?1.0:0.5):0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ -(void) writeConfigFile {
NSFileManager *fm = [[NSFileManager alloc] init];
NSString *fileName = [NSString stringWithFormat:@"%@/../../RetroArch/config/retroarch.cfg",
self.batterySavesPath];
NSString *verFile = [NSString stringWithFormat:@"%@/../../RetroArch/config/1.2.22.cfg",
// TODO: Get the version # from core.plist
NSString *verFile = [NSString stringWithFormat:@"%@/../../RetroArch/config/1.27.1.cfg",
self.batterySavesPath];
if (![fm fileExistsAtPath: fileName] || ![fm fileExistsAtPath: verFile] || [self shouldUpdateAssets]) {
NSString *src = [[NSBundle bundleForClass:[PVRetroArchCore class]] pathForResource:@"retroarch.cfg" ofType:nil];
Expand Down Expand Up @@ -258,6 +259,9 @@ -(void) writeConfigFile {
error:nil];
}
- (bool)shouldUpdateAssets {
#if DEBUG
return true;
#else
// If assets were updated, refresh config
NSFileManager *fm = [[NSFileManager alloc] init];
NSString *file=[NSString stringWithFormat:@"%@/../../RetroArch/assets/xmb/flatui/png/arrow.png", self.batterySavesPath];
Expand All @@ -268,6 +272,7 @@ - (bool)shouldUpdateAssets {
}
}
return true;
#endif
}
#pragma mark - Running

Expand Down Expand Up @@ -437,15 +442,15 @@ - (void)startVM:(UIView *)view {
[self extractArchive:[[NSBundle bundleForClass:[PVRetroArchCore class]] pathForResource:@"assets.zip" ofType:nil] toDestination:[self.batterySavesPath stringByAppendingPathComponent:@"../../RetroArch"] overwrite:true];
processing_init=false;
}
NSError *error;
[[AVAudioSession sharedInstance]
setCategory:AVAudioSessionCategoryAmbient
mode:AVAudioSessionModeDefault
options:AVAudioSessionCategoryOptionAllowBluetooth |
AVAudioSessionCategoryOptionAllowAirPlay |
AVAudioSessionCategoryOptionAllowBluetoothA2DP |
AVAudioSessionCategoryOptionMixWithOthers
error:&error];
// NSError *error;
// [[AVAudioSession sharedInstance]
// setCategory:AVAudioSessionCategoryAmbient
// mode:AVAudioSessionModeDefault
// options:AVAudioSessionCategoryOptionAllowBluetooth |
// AVAudioSessionCategoryOptionAllowAirPlay |
// AVAudioSessionCategoryOptionAllowBluetoothA2DP |
// AVAudioSessionCategoryOptionMixWithOthers
// error:&error];
[self refreshSystemConfig];
[self showGameView];
rarch_main(argc, argv, NULL);
Expand Down
2 changes: 2 additions & 0 deletions CoresRetro/RetroArch/PVRetroArchCore/Core/PVRetroArchCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
bool coreOptionOverwrite;
NSString* coreOptionConfigPath;
NSString* coreOptionConfig;
// Controls
float xAxis, yAxis, ltXAxis, ltYAxis, rtXAxis, rtYAxis, axisMult;
@public
dispatch_queue_t _callbackQueue;
}
Expand Down
3 changes: 3 additions & 0 deletions CoresRetro/RetroArch/PVRetroArchCore/Core/PVRetroArchCore.mm
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ - (instancetype)init {
[CocoaView get];

[self setupEmulation];

xAxis = yAxis = ltXAxis = ltYAxis = rtXAxis = rtYAxis = 0.0;
axisMult = 1.0;
}
_current=self;
return self;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Foundation
import PVSupport
import PVEmulatorCore
import PVCoreBridge
import PVLogging

extension PVRetroArchCoreCore: CoreOptional {
public static var options: [PVCoreBridge.CoreOption] {
Expand Down Expand Up @@ -233,7 +234,7 @@ extension PVRetroArchCore: CoreOptional {
if (UIScreen.screens.count > 1 && UIDevice.current.userInterfaceIdiom == .pad) {
self.hasSecondScreen = secondScreen;
}
if let systemIdentifier = self.systemIdentifier {
if let systemIdentifier = self.systemIdentifier?.lowercased() {
if (systemIdentifier.contains("psp")) {
self.gsPreference = 2; // Use Vulkan PSP
}
Expand All @@ -242,14 +243,16 @@ extension PVRetroArchCore: CoreOptional {
systemIdentifier.contains("dreamcast") ||
systemIdentifier.contains("genesis") ||
systemIdentifier.contains("saturn") ||
systemIdentifier.contains("3DO") ||
systemIdentifier.contains("3do") ||
systemIdentifier.contains("gb") ||
systemIdentifier.contains("segacd") ||
systemIdentifier.contains("gba") ||
systemIdentifier.contains("psx") ||
systemIdentifier.contains("neogeo") ||
systemIdentifier.contains("mame") ||
systemIdentifier.contains("pce") ||
// systemIdentifier.contains("pce") ||
// systemIdentifier.contains("pcecd") ||
// systemIdentifier.contains("sgfx") ||
systemIdentifier.contains("ds") ||
systemIdentifier.contains("psp") ||
systemIdentifier.contains("n64")) {
Expand Down Expand Up @@ -369,11 +372,11 @@ extension PVRetroArchCore: CoreOptional {
extension PVRetroArchCoreCore: GameWithCheat {
@objc public func setCheat(code: String, type: String, codeType: String, cheatIndex: UInt8, enabled: Bool) -> Bool {
do {
NSLog("Calling setCheat \(code) \(type) \(codeType)")
ILOG("Calling setCheat \(code) \(type) \(codeType)")
try self._bridge.setCheat(code, setType: type, setCodeType: codeType, setIndex: cheatIndex, setEnabled: enabled)
return true
} catch let error {
NSLog("Error setCheat \(error)")
ILOG("Error setCheat \(error)")
return false
}
}
Expand Down
Loading

0 comments on commit f1e1531

Please sign in to comment.