Skip to content

Commit

Permalink
Update to MAME 264
Browse files Browse the repository at this point in the history
  • Loading branch information
ToddLa committed May 17, 2024
1 parent fd8910d commit 6036ac1
Show file tree
Hide file tree
Showing 27 changed files with 523 additions and 2,228 deletions.
Binary file modified iOS-res/hash.zip
Binary file not shown.
Binary file modified iOS-res/plugins.zip
Binary file not shown.
54 changes: 8 additions & 46 deletions iOS/EmulatorController.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@
#import "WebServer.h"
#import "Alert.h"
#import "ZipFile.h"
#import "SteamController.h"
#import "SkinManager.h"
#if 0
#import "CloudSync.h"
#endif
#import "SoftwareList.h"

#import "Timer.h"
Expand Down Expand Up @@ -304,8 +301,6 @@ -(void)toggleFullScreen:(id)sender;
static NSInteger g_settings_file_count;
static Options* g_settings_options;

static BOOL g_bluetooth_enabled;

static EmulatorController *sharedInstance = nil;

static const int buttonPressReleaseCycles = 2;
Expand Down Expand Up @@ -748,10 +743,11 @@ void m4i_game_list(myosd_game_info* game_info, int game_count)
year = @"";
NSString *driver = [@(game_info[i].source_file ?: "").lastPathComponent stringByDeletingPathExtension];

#if TARGET_APPSTORE
// App Store release: don't include pong/breakout to avoid copyright issues
if ( [driver isEqualToString:@"pong"] || [driver isEqualToString:@"breakout"]) {
continue;
}
if ( [driver isEqualToString:@"pong"] || [driver isEqualToString:@"breakout"])
continue;
#endif

GameInfo* game = [[GameInfo alloc] initWithDictionary:@{
kGameInfoType: type,
Expand Down Expand Up @@ -784,8 +780,8 @@ void m4i_game_list(myosd_game_info* game_info, int game_count)
[games addObject:game];
[games addObjectsFromArray:software];
}
#if 0

#if !TARGET_APPSTORE
NSString* mame_version = [@((const char *)myosd_get(MYOSD_VERSION_STRING) ?: "") componentsSeparatedByString:@" ("].firstObject;

// add a *special* system game that will run the DOS MAME menu.
Expand Down Expand Up @@ -1477,16 +1473,12 @@ - (void)runAddROMS:(id)from {
[self runImport];
}]];
#endif

#if 0
if (CloudSync.status == CloudSyncStatusAvailable)
{
[alert addAction:[UIAlertAction actionWithTitle:@"Import from iCloud" symbol:@"icloud.and.arrow.down" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action) {
[CloudSync import];
}]];
}
#endif

#if TARGET_OS_IOS
[alert addAction:[UIAlertAction actionWithTitle:@"Show Files" symbol:@"folder" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action) {
[self runShowFiles];
Expand Down Expand Up @@ -1891,17 +1883,6 @@ -(void)viewDidLoad{
// always enable Keyboard for hardware keyboard support
keyboardView.active = YES;

// see if bluetooth is enabled...

if (@available(iOS 13.1, tvOS 13.0, *))
g_bluetooth_enabled = CBCentralManager.authorization == CBManagerAuthorizationAllowedAlways;
else if (@available(iOS 13.0, *))
g_bluetooth_enabled = FALSE; // authorization is not in iOS 13.0, so no bluetooth for you.
else
g_bluetooth_enabled = TRUE; // pre-iOS 13.0, bluetooth allways.

NSLog(@"BLUETOOTH ENABLED: %@", g_bluetooth_enabled ? @"YES" : @"NO");

[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(gameControllerConnected:) name:GCControllerDidConnectNotification object:nil];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(gameControllerDisconnected:) name:GCControllerDidDisconnectNotification object:nil];

Expand Down Expand Up @@ -5192,13 +5173,6 @@ -(void)setupGameControllers {
[controllers addObject:controler];
}

// now add any Steam Controllers, these should always have a extendedGamepad profile
if (g_bluetooth_enabled) {
for (GCController* controler in SteamControllerManager.sharedManager.controllers) {
if (controler.extendedGamepad != nil)
[controllers addObject:controler];
}
}
// only handle upto NUM_JOY (non Siri Remote) controllers
if (controllers.count > MYOSD_NUM_JOY) {
[controllers removeObjectsInRange:NSMakeRange(MYOSD_NUM_JOY,controllers.count - MYOSD_NUM_JOY)];
Expand Down Expand Up @@ -5695,8 +5669,6 @@ -(void)dumpDevice:(NSObject*)_device {

-(void)scanForDevices{
[GCController startWirelessControllerDiscoveryWithCompletionHandler:nil];
if (g_bluetooth_enabled)
[[SteamControllerManager sharedManager] scanForControllers];
}

-(void)gameControllerConnected:(NSNotification*)notif{
Expand Down Expand Up @@ -6057,8 +6029,8 @@ -(void)chooseGame:(NSArray*)games {
NSLog(@"ROMS: %@", [NSFileManager.defaultManager enumeratorAtPath:getDocumentPath(@"roms")].allObjects);
NSLog(@"SOFTWARE: %@", [NSFileManager.defaultManager enumeratorAtPath:getDocumentPath(@"software")].allObjects);

// 4/14/24 TODO: commenting this out for App Store release since games are bundled - create a build config for App Store
#if 0
// 4/14/24 TODO: commenting this out for App Store release since games are bundled
#if !TARGET_APPSTORE
// NOTE: MAME 2xx has a bunch of "no-rom" arcade games, we need to check if `roms` is empty too
NSInteger roms_count = [NSFileManager.defaultManager enumeratorAtPath:getDocumentPath(@"roms")].allObjects.count +
[NSFileManager.defaultManager enumeratorAtPath:getDocumentPath(@"software")].allObjects.count;
Expand All @@ -6067,14 +6039,12 @@ -(void)chooseGame:(NSArray*)games {
if (g_no_roms_found && !g_no_roms_found_canceled) {
NSLog(@"NO GAMES, ASK USER WHAT TO DO....");

#if 0
// if iCloud is still initializing give it a litte time.
if ([CloudSync status] == CloudSyncStatusUnknown) {
NSLog(@"....WAITING FOR iCloud");
[self performSelector:_cmd withObject:games afterDelay:1.0];
return;
}
#endif

change_pause(PAUSE_INPUT);
[self runAddROMS:nil];
Expand Down Expand Up @@ -6109,14 +6079,6 @@ -(void)chooseGame:(NSArray*)games {
return;
}

// now that we have passed the startup phase, check on and maybe re-enable bluetooth.
if (@available(iOS 13.1, tvOS 13.0, *)) {
if (!g_bluetooth_enabled && CBCentralManager.authorization == CBManagerAuthorizationNotDetermined) {
g_bluetooth_enabled = TRUE;
[self performSelectorOnMainThread:@selector(scanForDevices) withObject:nil waitUntilDone:NO];
}
}

[self updateUserActivity:nil];

NSLog(@"GAMES: %@", games);
Expand Down
4 changes: 2 additions & 2 deletions iOS/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
#define PRODUCT_NAME "MAME4sim"
#define PRODUCT_NAME_LONG "MAME for Simulator"
#else
#define PRODUCT_NAME "MAME"
#define PRODUCT_NAME_LONG "MAME"
#define PRODUCT_NAME "MAME4iOS"
#define PRODUCT_NAME_LONG "MAME for iOS"
#endif

static inline BOOL IsRunningOnMac(void) {
Expand Down
2 changes: 0 additions & 2 deletions iOS/OptionsController.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ enum OptionSections
kSupportSection = 0,
kOtherSection,
kImportSection,
#if 0
kCloudImportSection,
#endif
kVideoSection,
kVectorSection,
kFullscreenSection,
Expand Down
11 changes: 0 additions & 11 deletions iOS/OptionsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@
#import "HelpController.h"
#import "EmulatorController.h"
#import "ImageCache.h"

#if 0
#import "CloudSync.h"
#endif

#import "Alert.h"

Expand Down Expand Up @@ -346,7 +343,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}
break;
}
#if 0
case kCloudImportSection:
{
switch (indexPath.row)
Expand Down Expand Up @@ -382,7 +378,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}
break;
}
#endif
case kResetSection:
{
switch (indexPath.row)
Expand Down Expand Up @@ -444,9 +439,7 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte
case kFilterSection: return @"Game Filter";
case kOtherSection: return @""; // @"Other";
case kImportSection: return @"Import and Export";
#if 0
case kCloudImportSection: return @"iCloud";
#endif
case kResetSection: return @"";
case kBenchmarkSection: return @"";
}
Expand All @@ -466,15 +459,13 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
case kMiscSection: return 8;
case kFilterSection: return 3;
case kImportSection: return 4;
#if 0
case kCloudImportSection:
if (CloudSync.status == CloudSyncStatusAvailable)
return 4;
else if (CloudSync.status == CloudSyncStatusEmpty)
return 1;
else
return 0;
#endif
case kResetSection: return 1;
case kBenchmarkSection:
return self.presentingViewController == self.emuController ? 1 : 0;
Expand Down Expand Up @@ -559,7 +550,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}
break;
}
#if 0
case kCloudImportSection:
{
if (row==0) {
Expand All @@ -579,7 +569,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}
break;
}
#endif
case kResetSection:
{
if (row==0) {
Expand Down
23 changes: 4 additions & 19 deletions xcode/MAME4iOS/CloudSync.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@
#import "EmulatorController.h"
#import "Alert.h"

#if TARGET_OS_MACCATALYST
#import <Security/SecTask.h>
#else
// declare *just* the Security APIs we need to check for entitlments on iOS
typedef CFTypeRef SecTaskRef;
extern SecTaskRef SecTaskCreateFromSelf(CFAllocatorRef allocator);
extern CFTypeRef SecTaskCopyValueForEntitlement(SecTaskRef task, CFStringRef entitlement, CFErrorRef *error);
#endif

#define DebugLog 1
#if DebugLog == 0 || !defined(DEBUG)
#define NSLog(...) (void)0
Expand Down Expand Up @@ -71,23 +62,17 @@ +(NSString*)cloudIdentifier {
return [NSString stringWithFormat:@"iCloud.%@", NSBundle.mainBundle.bundleIdentifier];
}

// use the Security framework to see if we have the iCloud entitlement
+(BOOL)isEntitled {
SecTaskRef task = SecTaskCreateFromSelf(NULL);
if (task == NULL)
return FALSE;
CFTypeRef val = SecTaskCopyValueForEntitlement(task, CFSTR("com.apple.developer.icloud-services"), NULL);
CFRelease(task);
if (val == NULL)
return FALSE;
CFRelease(val);
#if ENTITLEMENTS_TYPE == -Full
return TRUE;
#else
return FALSE;
#endif
}

+(void)updateCloudStatus {

if (_container == nil) {

if ([self isEntitled]) {
@try {
// **NOTE** CKContainer.defaultContainer will throw a uncatchable exception, dont use it.
Expand Down
14 changes: 11 additions & 3 deletions xcode/MAME4iOS/MAME4iOS.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
// you can also set the Development Team via the drop down in the Xcode project editor, for each Target.
// you can find your TeamID [here](https://developer.apple.com/account/#/membership)

ORG_IDENTIFIER = com.yoshisuga // CHANGE this to your Organization Identifier.
ORG_IDENTIFIER = com.example // CHANGE this to your Organization Identifier.
DEVELOPMENT_TEAM = ABC8675309 // CHANGE this to your Team ID. (or select in Xcode project editor)
CURRENT_PROJECT_VERSION = 2022.5
MARKETING_VERSION = 2022.5
CURRENT_PROJECT_VERSION = 2024.1
MARKETING_VERSION = 2024.1

// 2. enable or disable entitlements
// tvOS TopShelf and iCloud import/export require special app entitlements
Expand All @@ -36,6 +36,9 @@ MAMELIB = libmame-139u1
// USE THIS LINE for a build of current latest MAME (via get-libmame.sh)
// MAMELIB = libmame

// AppStore build
TARGET_APPSTORE = 0 // 1=AppStore build, 0=not

// let developer override with optional file.
#include? "Developer.xcconfig"

Expand All @@ -54,3 +57,8 @@ MAMELIB_TVOS[sdk=appletvsimulator*] = $(MAMELIB)-tvos-simulator.a

PRODUCT_BUNDLE_NAME = $(TARGET_NAME)
PRODUCT_BUNDLE_NAME[sdk=macosx*] = MAME4mac

// set special #defines
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) TARGET_APPSTORE=$(TARGET_APPSTORE)
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) ENTITLEMENTS_TYPE=$(ENTITLEMENTS_TYPE)

Loading

0 comments on commit 6036ac1

Please sign in to comment.