diff --git a/src/platform/osx/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..130b2e0 --- /dev/null +++ b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,63 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "icon16x16@2x.png", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "icon32x32@2x.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "icon128x128.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "icon256x256.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "icon512x512.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon128x128.png b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon128x128.png new file mode 100644 index 0000000..9303085 Binary files /dev/null and b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon128x128.png differ diff --git a/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon16x16@2x.png b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon16x16@2x.png new file mode 100644 index 0000000..cfa3e59 Binary files /dev/null and b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon16x16@2x.png differ diff --git a/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon256x256.png b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon256x256.png new file mode 100644 index 0000000..2921288 Binary files /dev/null and b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon256x256.png differ diff --git a/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon32x32@2x.png b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon32x32@2x.png new file mode 100644 index 0000000..9e39b60 Binary files /dev/null and b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon32x32@2x.png differ diff --git a/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon512x512.png b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon512x512.png new file mode 100644 index 0000000..884e54b Binary files /dev/null and b/src/platform/osx/Assets.xcassets/AppIcon.appiconset/icon512x512.png differ diff --git a/src/platform/osx/OpenLara-Info.plist b/src/platform/osx/OpenLara-Info.plist index 622c632..788e681 100644 --- a/src/platform/osx/OpenLara-Info.plist +++ b/src/platform/osx/OpenLara-Info.plist @@ -6,10 +6,10 @@ en CFBundleExecutable ${EXECUTABLE_NAME} - CFBundleIconFile - icon CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) + Bundle display name + OpenLara CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/src/platform/osx/OpenLara.xcodeproj/project.pbxproj b/src/platform/osx/OpenLara.xcodeproj/project.pbxproj index ab8d3ca..2ec096c 100644 --- a/src/platform/osx/OpenLara.xcodeproj/project.pbxproj +++ b/src/platform/osx/OpenLara.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 523F97E41DDF7AA5006FE2FC /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 523F97E31DDF7AA5006FE2FC /* Cocoa.framework */; }; 9938F1A421E830250056E172 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9938F1A021E81EFE0056E172 /* IOKit.framework */; }; 99713CC9204CAD9900006FAC /* tinflate.c in Sources */ = {isa = PBXBuildFile; fileRef = 99713CC8204CAD9900006FAC /* tinflate.c */; }; + 9975BF0B21E9F5D300F13342 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9975BF0A21E9F5D300F13342 /* Assets.xcassets */; }; 99BF38CD21E7176900D90A38 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 99BF38CC21E7176900D90A38 /* main.mm */; }; 99BF38D221E7202500D90A38 /* audio in Resources */ = {isa = PBXBuildFile; fileRef = 99BF38CE21E7202500D90A38 /* audio */; }; 99BF38D321E7202500D90A38 /* DELDATA in Resources */ = {isa = PBXBuildFile; fileRef = 99BF38CF21E7202500D90A38 /* DELDATA */; }; @@ -51,6 +52,7 @@ 99713CC5204CA3DA00006FAC /* ui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ui.h; path = ../../ui.h; sourceTree = ""; }; 99713CC6204CA3DA00006FAC /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../utils.h; sourceTree = ""; }; 99713CC8204CAD9900006FAC /* tinflate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tinflate.c; path = ../../libs/tinf/tinflate.c; sourceTree = ""; }; + 9975BF0A21E9F5D300F13342 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = SOURCE_ROOT; }; 99BF38CC21E7176900D90A38 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; 99BF38CE21E7202500D90A38 /* audio */ = {isa = PBXFileReference; lastKnownFileType = folder; name = audio; path = ../../../../Desktop/OpenLara_TR1/audio; sourceTree = ""; }; 99BF38CF21E7202500D90A38 /* DELDATA */ = {isa = PBXFileReference; lastKnownFileType = folder; name = DELDATA; path = ../../../../Desktop/OpenLara_TR1/DELDATA; sourceTree = ""; }; @@ -146,6 +148,7 @@ 99C4C0A31796AACF0032DE85 /* Supporting Files */ = { isa = PBXGroup; children = ( + 9975BF0A21E9F5D300F13342 /* Assets.xcassets */, 99C4C0A41796AACF0032DE85 /* OpenLara-Info.plist */, ); name = "Supporting Files"; @@ -207,6 +210,7 @@ 99BF38D321E7202500D90A38 /* DELDATA in Resources */, 99BF38D421E7202500D90A38 /* PSXDATA in Resources */, 99BF38D521E7202500D90A38 /* FMV in Resources */, + 9975BF0B21E9F5D300F13342 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -305,6 +309,7 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -322,6 +327,7 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; GCC_OPTIMIZATION_LEVEL = 3; diff --git a/src/platform/osx/main.mm b/src/platform/osx/main.mm index 022d66c..787d361 100644 --- a/src/platform/osx/main.mm +++ b/src/platform/osx/main.mm @@ -105,18 +105,20 @@ float joyAxisValue(IOHIDValueRef value) { static const struct { uint32 vendorId, productId; } JOY_VENDORS[] = { { 0x045E, 0x0000 }, // Microsoft { 0x2DC8, 0x0000 }, // 8Bitdo - { 0x054C, 0x05C4 }, // 8Bitdo - { 0x054C, 0x0000 }, // Sony + { 0x054C, 0x05C4 }, // Sony DS4 CUH-ZCT1x + { 0x054C, 0x09CC }, // Sony DS4 CUH-ZCT2x + { 0x054C, 0x0000 }, // Sony DS3 { 0x2717, 0x0000 }, // Xiaomi } ; #define JOY_MAX_VENDORS COUNT(JOY_VENDORS) #define JOY_MAX_BUTTONS 17 -static const uint32 joyAxisTable[JOY_MAX_VENDORS][6] = { +static const uint32 joyAxisTable[][6] = { { kHIDUsage_GD_X, kHIDUsage_GD_Y, kHIDUsage_GD_Rx, kHIDUsage_GD_Ry, kHIDUsage_GD_Z, kHIDUsage_GD_Rz }, { kHIDUsage_GD_X, kHIDUsage_GD_Y, kHIDUsage_GD_Z, kHIDUsage_GD_Rz, 0, 0 }, { kHIDUsage_GD_X, kHIDUsage_GD_Y, kHIDUsage_GD_Z, kHIDUsage_GD_Rz, 0, 0 }, + { kHIDUsage_GD_X, kHIDUsage_GD_Y, kHIDUsage_GD_Z, kHIDUsage_GD_Rz, kHIDUsage_GD_Rx, kHIDUsage_GD_Ry }, { kHIDUsage_GD_X, kHIDUsage_GD_Y, kHIDUsage_GD_Z, kHIDUsage_GD_Rz, 0, 0 }, { kHIDUsage_GD_X, kHIDUsage_GD_Y, kHIDUsage_GD_Z, kHIDUsage_GD_Rz, 0, 0 }, }; @@ -125,6 +127,7 @@ static const uint32 joyButtonsTable[][JOY_MAX_BUTTONS] = { { jkA, jkB, jkX, jkY, jkLB, jkRB, jkLT, jkRT, jkStart, jkSelect, jkNone, jkUp, jkDown, jkLeft, jkRight, jkNone, jkNone }, { jkB, jkA, jkNone, jkY, jkX, jkNone, jkLB, jkRB, jkLT, jkRT, jkSelect, jkStart, jkNone, jkL, jkR, jkNone, jkNone }, { jkX, jkA, jkB, jkY, jkLB, jkRB, jkLT, jkRT, jkSelect, jkStart, jkL, jkR, jkNone, jkNone, jkNone, jkNone, jkNone }, + { jkX, jkA, jkB, jkY, jkLB, jkRB, jkLT, jkRT, jkSelect, jkStart, jkL, jkR, jkNone, jkNone, jkNone, jkNone, jkNone }, { jkSelect, jkL, jkR, jkStart, jkUp, jkRight, jkDown, jkLeft, jkLT, jkRT, jkLB, jkRB, jkY, jkB, jkA, jkX, jkNone }, { jkA, jkB, jkNone, jkX, jkY, jkNone, jkLB, jkRB, jkLT, jkRT, jkSelect, jkStart, jkNone, jkL, jkR, jkNone, jkNone }, }; @@ -262,14 +265,15 @@ void joyInit() { IOHIDManagerRegisterInputValueCallback(hidManager, hidValueCallback, NULL); CFSetRef devices = IOHIDManagerCopyDevices(hidManager); - CFIndex count = CFSetGetCount(devices); - CFTypeRef devicesArray[count]; // array of IOHIDDeviceRef - CFSetGetValues(devices, devicesArray); - for (int i = 0; i < count; i++) { - joyAdd(NULL, 0, NULL, (IOHIDDeviceRef)devicesArray[i]); + if (devices) { + CFIndex count = CFSetGetCount(devices); + CFTypeRef devicesArray[count]; // array of IOHIDDeviceRef + CFSetGetValues(devices, devicesArray); + for (int i = 0; i < count; i++) { + joyAdd(NULL, 0, NULL, (IOHIDDeviceRef)devicesArray[i]); + } + CFRelease(devices); } - CFRelease(devices); - } void joyFree() {