diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cdf9a71129..8fb44ff3ad 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -469,6 +469,7 @@ build-retroarch-osx-arm64-metal: artifacts: paths: - ${XCPROJECT_NAME}.zip + - retroarch-repo/ expire_in: 10 min dependencies: [] script: @@ -477,6 +478,9 @@ build-retroarch-osx-arm64-metal: - ditto -c -k --sequesterRsrc --keepParent RetroArch.app RetroArch.zip - popd - mv ${XCARCHIVE_PATH}.xcarchive/Products/Users/gitlab/Applications/RetroArch.zip ${XCPROJECT_NAME}.zip + - mkdir .retroarch-repo + - "cp -r ./* .retroarch-repo" + - "mv .retroarch-repo/ retroarch-repo/" # Mac OS Universal, Metal build-retroarch-osx-universal-metal: diff --git a/config.def.h b/config.def.h index 6d2225da30..753e9bb51c 100644 --- a/config.def.h +++ b/config.def.h @@ -72,7 +72,7 @@ * we need to extract to a user-writable directory on first boot. * * Examples include: Android, iOS/OSX) */ -#if defined(ANDROID) || defined(IOS) +#if defined(ANDROID) || defined(IOS) || defined(OSX) #define DEFAULT_BUNDLE_ASSETS_EXTRACT_ENABLE true #else #define DEFAULT_BUNDLE_ASSETS_EXTRACT_ENABLE false diff --git a/configuration.c b/configuration.c index dd00802a98..fee833f00d 100644 --- a/configuration.c +++ b/configuration.c @@ -2007,7 +2007,9 @@ static struct config_uint_setting *populate_settings_uint( SETTING_UINT("user_language", msg_hash_get_uint(MSG_HASH_USER_LANGUAGE), true, DEFAULT_USER_LANGUAGE, false); #endif #endif +#ifndef __APPLE__ SETTING_UINT("bundle_assets_extract_version_current", &settings->uints.bundle_assets_extract_version_current, true, 0, false); +#endif SETTING_UINT("bundle_assets_extract_last_version", &settings->uints.bundle_assets_extract_last_version, true, 0, false); SETTING_UINT("input_overlay_show_physical_inputs_port", &settings->uints.input_overlay_show_physical_inputs_port, true, 0, false); SETTING_UINT("video_msg_bgcolor_red", &settings->uints.video_msg_bgcolor_red, true, message_bgcolor_red, false); @@ -2443,7 +2445,7 @@ void config_set_defaults(void *data) *settings->paths.path_content_music_history = '\0'; *settings->paths.path_content_video_history = '\0'; *settings->paths.path_cheat_settings = '\0'; -#ifndef IOS +#if !defined(IOS) && !defined(OSX) *settings->arrays.bundle_assets_src = '\0'; *settings->arrays.bundle_assets_dst = '\0'; *settings->arrays.bundle_assets_dst_subdir = '\0'; diff --git a/frontend/drivers/platform_darwin.m b/frontend/drivers/platform_darwin.m index 0ec1577e7d..eaead9781e 100644 --- a/frontend/drivers/platform_darwin.m +++ b/frontend/drivers/platform_darwin.m @@ -338,6 +338,8 @@ static void frontend_darwin_get_env(int *argc, char *argv[], { CFURLRef bundle_url; CFStringRef bundle_path; + CFURLRef resource_url; + CFStringRef resource_path; #if TARGET_OS_IPHONE char resolved_home_dir_buf[ PATH_MAX_LENGTH] = {0}; @@ -346,6 +348,8 @@ static void frontend_darwin_get_env(int *argc, char *argv[], #endif char temp_dir[PATH_MAX_LENGTH] = {0}; char bundle_path_buf[PATH_MAX_LENGTH] = {0}; + char resource_path_buf[PATH_MAX_LENGTH] = {0}; + char full_resource_path_buf[PATH_MAX_LENGTH] = {0}; char home_dir_buf[PATH_MAX_LENGTH] = {0}; CFBundleRef bundle = CFBundleGetMainBundle(); @@ -354,10 +358,15 @@ static void frontend_darwin_get_env(int *argc, char *argv[], bundle_url = CFBundleCopyBundleURL(bundle); bundle_path = CFURLCopyPath(bundle_url); + + resource_url = CFBundleCopyResourcesDirectoryURL(bundle); + resource_path = CFURLCopyPath(resource_url); CFStringGetCString(bundle_path, bundle_path_buf, sizeof(bundle_path_buf), kCFStringEncodingUTF8); - + CFStringGetCString(resource_path, + resource_path_buf, sizeof(resource_path_buf), kCFStringEncodingUTF8); + fill_pathname_join(full_resource_path_buf, bundle_path_buf, resource_path_buf, sizeof(full_resource_path_buf)); CFSearchPathForDirectoriesInDomains(CFDocumentDirectory, CFUserDomainMask, 1, home_dir_buf, sizeof(home_dir_buf)); @@ -439,20 +448,20 @@ static void frontend_darwin_get_env(int *argc, char *argv[], fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], application_data, "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], application_data, "screenshots", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT])); #if defined(RELEASE_BUILD) - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], bundle_path_buf, "Contents/Resources/shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], bundle_path_buf, "Contents/Resources/cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], bundle_path_buf, "Contents/Resources/info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], bundle_path_buf, "Contents/Resources/overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], application_data, "shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], application_data, "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], application_data, "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], application_data, "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); #ifdef HAVE_VIDEO_LAYOUT - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], bundle_path_buf, "Contents/Resources/layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], application_data, "layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT])); #endif - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], bundle_path_buf, "Contents/Resources/autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], bundle_path_buf, "Contents/Resources/assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], bundle_path_buf, "Contents/Resources/database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], bundle_path_buf, "Contents/Resources/database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], bundle_path_buf, "Contents/Resources/cht", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], bundle_path_buf, "Contents/Resources/audio_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], bundle_path_buf, "Contents/Resources/video_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], application_data, "autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], application_data, "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], application_data, "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CURSOR], application_data, "database/cursors", sizeof(g_defaults.dirs[DEFAULT_DIR_CURSOR])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], application_data, "cht", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], application_data, "audio_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], application_data, "video_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER])); #else fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], home_dir_buf, "audio_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], home_dir_buf, "video_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER])); @@ -460,14 +469,17 @@ static void frontend_darwin_get_env(int *argc, char *argv[], #endif -#if TARGET_OS_IPHONE char assets_zip_path[PATH_MAX_LENGTH]; #if TARGET_OS_IOS if (major > 8) strcpy_literal(g_defaults.path_buildbot_server_url, "http://buildbot.libretro.com/nightly/apple/ios9/latest/"); #endif +#if TARGET_OS_IOS fill_pathname_join(assets_zip_path, bundle_path_buf, "assets.zip", sizeof(assets_zip_path)); +#else + fill_pathname_join(assets_zip_path, full_resource_path_buf, "assets.zip", sizeof(assets_zip_path)); +#endif if (path_is_valid(assets_zip_path)) { @@ -480,11 +492,15 @@ static void frontend_darwin_get_env(int *argc, char *argv[], assets_zip_path); configuration_set_string(settings, settings->arrays.bundle_assets_dst, - home_dir_buf); - /* TODO/FIXME: Just hardcode this for now */ - configuration_set_uint(settings, settings->uints.bundle_assets_extract_version_current, 130); - } +#if TARGET_OS_IOS + home_dir_buf +#else + application_data #endif + ); + /* TODO/FIXME: Just hardcode this for now */ + configuration_set_uint(settings, settings->uints.bundle_assets_extract_version_current, 1); + } CFTemporaryDirectory(temp_dir, sizeof(temp_dir)); strlcpy(g_defaults.dirs[DEFAULT_DIR_CACHE], diff --git a/pkg/apple/OSX/assets.zip b/pkg/apple/OSX/assets.zip new file mode 100644 index 0000000000..dda8d2b591 Binary files /dev/null and b/pkg/apple/OSX/assets.zip differ diff --git a/pkg/apple/RetroArch.xcodeproj/project.pbxproj b/pkg/apple/RetroArch.xcodeproj/project.pbxproj index 85ec4770bc..2108c2d4f6 100644 --- a/pkg/apple/RetroArch.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch.xcodeproj/project.pbxproj @@ -30,6 +30,8 @@ 84DD5EB51A89E737007336C1 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84DD5EB41A89E737007336C1 /* IOKit.framework */; }; 84DD5EB81A89F1C7007336C1 /* retroarch.icns in Resources */ = {isa = PBXBuildFile; fileRef = 84DD5EB71A89F1C7007336C1 /* retroarch.icns */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 9254B33425FA72ED00A1E0DA /* assets.zip in Resources */ = {isa = PBXBuildFile; fileRef = 9254B33325FA72ED00A1E0DA /* assets.zip */; }; + 9254B33525FA72ED00A1E0DA /* assets.zip in Resources */ = {isa = PBXBuildFile; fileRef = 9254B33325FA72ED00A1E0DA /* assets.zip */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -91,6 +93,7 @@ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = OSX/Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* RetroArch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RetroArch.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9254B2F825F5A94300A1E0DA /* OpenGL_GitLabCI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = OpenGL_GitLabCI.xcconfig; sourceTree = ""; }; + 9254B33325FA72ED00A1E0DA /* assets.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = assets.zip; path = OSX/assets.zip; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -221,6 +224,7 @@ 841CBB821A8A33810066E9F1 /* Assets */ = { isa = PBXGroup; children = ( + 9254B33325FA72ED00A1E0DA /* assets.zip */, ); name = Assets; sourceTree = ""; @@ -301,6 +305,7 @@ files = ( 500845251B89300700CE6073 /* InfoPlist.strings in Resources */, 500845261B89300700CE6073 /* MainMenu.xib in Resources */, + 9254B33425FA72ED00A1E0DA /* assets.zip in Resources */, 500845271B89300700CE6073 /* retroarch.icns in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -311,6 +316,7 @@ files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, + 9254B33525FA72ED00A1E0DA /* assets.zip in Resources */, 84DD5EB81A89F1C7007336C1 /* retroarch.icns in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -445,7 +451,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = x86_64; - CODE_SIGN_IDENTITY = "Developer ID Application"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; @@ -484,7 +490,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = x86_64; - CODE_SIGN_IDENTITY = "Developer ID Application"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; diff --git a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj index 16b11979b9..ad6cd6bfa6 100644 --- a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj @@ -48,6 +48,8 @@ 84DD5EB51A89E737007336C1 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84DD5EB41A89E737007336C1 /* IOKit.framework */; }; 84DD5EB81A89F1C7007336C1 /* retroarch.icns in Resources */ = {isa = PBXBuildFile; fileRef = 84DD5EB71A89F1C7007336C1 /* retroarch.icns */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 9254B33125FA0BA300A1E0DA /* assets.zip in Resources */ = {isa = PBXBuildFile; fileRef = 9254B33025FA0BA300A1E0DA /* assets.zip */; }; + 9254B33825FA72F100A1E0DA /* assets.zip in Resources */ = {isa = PBXBuildFile; fileRef = 9254B33025FA0BA300A1E0DA /* assets.zip */; }; A90209ED44A1161587F10CA4 /* MainMenu_Metal.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9020F323D5F3C8E120D04AC /* MainMenu_Metal.xib */; }; D27C50882228360000113BC0 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D27C50872228360000113BC0 /* AVFoundation.framework */; }; D27C508A2228360D00113BC0 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D27C50892228360D00113BC0 /* AudioToolbox.framework */; }; @@ -526,6 +528,7 @@ 84DD5EB71A89F1C7007336C1 /* retroarch.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = retroarch.icns; path = ../../media/retroarch.icns; sourceTree = ""; }; 8D1107320486CEB800E47090 /* RetroArch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RetroArch.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9254B2E625F5516A00A1E0DA /* GitLabCI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GitLabCI.xcconfig; sourceTree = ""; }; + 9254B33025FA0BA300A1E0DA /* assets.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = assets.zip; path = OSX/assets.zip; sourceTree = ""; }; A902040DE66D42F9EE47BFE3 /* MenuDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuDisplay.h; sourceTree = ""; }; A90205FD4D5979BD8B7E4DD6 /* Info_Metal.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.info; name = Info_Metal.plist; path = OSX/Info_Metal.plist; sourceTree = ""; }; A902065A41AEBECE594908C7 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = OSX/en.lproj/MainMenu_Metal.xib; sourceTree = ""; }; @@ -1463,6 +1466,7 @@ 841CBB821A8A33810066E9F1 /* Assets */ = { isa = PBXGroup; children = ( + 9254B33025FA0BA300A1E0DA /* assets.zip */, ); name = Assets; sourceTree = ""; @@ -1544,6 +1548,7 @@ files = ( 05422E3E2140C8DB00F09961 /* InfoPlist.strings in Resources */, 05422E402140C8DB00F09961 /* retroarch.icns in Resources */, + 9254B33825FA72F100A1E0DA /* assets.zip in Resources */, 0502387C2179713000789627 /* MainMenu_Metal.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1554,6 +1559,7 @@ files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 84DD5EB81A89F1C7007336C1 /* retroarch.icns in Resources */, + 9254B33125FA0BA300A1E0DA /* assets.zip in Resources */, A90209ED44A1161587F10CA4 /* MainMenu_Metal.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/retroarch.c b/retroarch.c index 0807c0b102..5e2dfed371 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3851,12 +3851,8 @@ static bool menu_init( if ( settings->bools.bundle_assets_extract_enable && !string_is_empty(settings->arrays.bundle_assets_src) && !string_is_empty(settings->arrays.bundle_assets_dst) -#ifndef IOS - /* TODO/FIXME - we should make this more generic so that - * this platform-specific ifdef is no longer needed */ && (settings->uints.bundle_assets_extract_version_current != settings->uints.bundle_assets_extract_last_version) -#endif ) { if (menu_dialog_push_pending(true, MENU_DIALOG_HELP_EXTRACT)) @@ -3872,6 +3868,8 @@ static bool menu_init( NULL, NULL, false); + /* Support only 1 version - setting this would prevent the assets from being extracted every time */ + configuration_set_int(settings, settings->uints.bundle_assets_extract_last_version, 1); #endif } }