1
0

macOS: update

This commit is contained in:
Maksym H 2022-11-13 17:35:33 +01:00
parent a254814f11
commit 3ce839dc11
18 changed files with 395 additions and 117 deletions

View File

@ -1,4 +1,4 @@
locale
assets
Pods
Podfile.lock
deps/*

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 55;
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
@ -112,6 +112,8 @@
841AD8B928D0E2EA0042E335 /* libvorbisfile.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 841AD8B828D0E2E40042E335 /* libvorbisfile.a */; };
841AD8BA28D12E7C0042E335 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84585C0424B134850040BA4F /* OpenGL.framework */; };
841AD8BB28D12E980042E335 /* libintl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84EEE5E62782728E00F61929 /* libintl.a */; };
84287CA6291ED0F000E30F96 /* locale in Resources */ = {isa = PBXBuildFile; fileRef = 84287CA4291ED0F000E30F96 /* locale */; };
84287CA7291ED0F000E30F96 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = 84287CA5291ED0F000E30F96 /* fonts */; };
844436EF28DA80C700662A9D /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 844436EE28DA80C100662A9D /* libfreetype.a */; };
84463B8C24B258AA0099DFBD /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8458617724B1BF2D0040BA4F /* AppKit.framework */; };
84463B9124B258AF0099DFBD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84585C0024B1347B0040BA4F /* Foundation.framework */; };
@ -123,8 +125,6 @@
8458610724B13BDF0040BA4F /* mini-gmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8458610524B13BDF0040BA4F /* mini-gmp.c */; };
8458610A24B13BF90040BA4F /* jsoncpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8458610924B13BF90040BA4F /* jsoncpp.cpp */; };
8458616A24B1B7E20040BA4F /* libIrrlicht.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8458616724B1B7990040BA4F /* libIrrlicht.a */; };
8458617D24B1C3BC0040BA4F /* games in Resources */ = {isa = PBXBuildFile; fileRef = 8458617924B1C3BA0040BA4F /* games */; };
8458617E24B1C3BC0040BA4F /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = 8458617A24B1C3BA0040BA4F /* fonts */; };
8458617F24B1C3BC0040BA4F /* builtin in Resources */ = {isa = PBXBuildFile; fileRef = 8458617B24B1C3BB0040BA4F /* builtin */; };
8458618024B1C3BC0040BA4F /* textures in Resources */ = {isa = PBXBuildFile; fileRef = 8458617C24B1C3BB0040BA4F /* textures */; };
846F883B27A59704007B6210 /* libluajit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 846F883A27A596F9007B6210 /* libluajit.a */; };
@ -143,7 +143,6 @@
84A1F9BB252E617D00000717 /* scripting_mainmenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A1F9B5252E617D00000717 /* scripting_mainmenu.cpp */; };
84A1F9BC252E617D00000717 /* scripting_client.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A1F9B8252E617D00000717 /* scripting_client.cpp */; };
84A1F9BD252E617D00000717 /* scripting_server.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A1F9B9252E617D00000717 /* scripting_server.cpp */; };
84A1FA4D252E635900000717 /* locale in Resources */ = {isa = PBXBuildFile; fileRef = 84A1FA4C252E635900000717 /* locale */; };
84BE974328CA1291004E8CEC /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84BE974228CA1291004E8CEC /* GameController.framework */; };
84BE974528CA129C004E8CEC /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84BE974428CA129C004E8CEC /* CoreHaptics.framework */; };
84C2AB5328DA7776001968EE /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C2AB5228DA7770001968EE /* libpng.a */; };
@ -521,6 +520,8 @@
841AD8B828D0E2E40042E335 /* libvorbisfile.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisfile.a; path = ../deps/libvorbis/libvorbisfile.a; sourceTree = "<group>"; };
8425D3702837D89300753F0E /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Localizable.strings; sourceTree = "<group>"; };
8425D3712837D89600753F0E /* id */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = id; path = id.lproj/Localizable.strings; sourceTree = "<group>"; };
84287CA4291ED0F000E30F96 /* locale */ = {isa = PBXFileReference; lastKnownFileType = folder; name = locale; path = ../../assets/locale; sourceTree = "<group>"; };
84287CA5291ED0F000E30F96 /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = ../../assets/fonts; sourceTree = "<group>"; };
844436EE28DA80C100662A9D /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = ../deps/freetype/libfreetype.a; sourceTree = "<group>"; };
8453A49D24DB22F00087ECF9 /* client */ = {isa = PBXFileReference; lastKnownFileType = folder; name = client; path = ../../../../client; sourceTree = "<group>"; };
8457C2C52848DB7300D69304 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = "<group>"; };
@ -539,14 +540,12 @@
8458616724B1B7990040BA4F /* libIrrlicht.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libIrrlicht.a; path = ../deps/irrlicht/libIrrlicht.a; sourceTree = "<group>"; };
8458617524B1BF280040BA4F /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
8458617724B1BF2D0040BA4F /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
8458617924B1C3BA0040BA4F /* games */ = {isa = PBXFileReference; lastKnownFileType = folder; name = games; path = ../../../../games; sourceTree = "<group>"; };
8458617A24B1C3BA0040BA4F /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = ../../../../fonts; sourceTree = "<group>"; };
8458617B24B1C3BB0040BA4F /* builtin */ = {isa = PBXFileReference; lastKnownFileType = folder; name = builtin; path = ../../../../builtin; sourceTree = "<group>"; };
8458617C24B1C3BB0040BA4F /* textures */ = {isa = PBXFileReference; lastKnownFileType = folder; name = textures; path = ../../../../textures; sourceTree = "<group>"; };
846F883A27A596F9007B6210 /* libluajit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libluajit.a; path = ../deps/luajit/lib/libluajit.a; sourceTree = "<group>"; };
846F883A27A596F9007B6210 /* libluajit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libluajit.a; path = ../deps/luajit/libluajit.a; sourceTree = "<group>"; };
847C6D4925D6F483008F5FC8 /* unidata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = unidata.h; path = ../../../../lib/luautf8/unidata.h; sourceTree = "<group>"; };
847C6D4A25D6F483008F5FC8 /* lutf8lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lutf8lib.c; path = ../../../../lib/luautf8/lutf8lib.c; sourceTree = "<group>"; };
8488539E28DA4851004AD90F /* libjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjpeg.a; path = ../deps/libjpeg/lib/libjpeg.a; sourceTree = "<group>"; };
8488539E28DA4851004AD90F /* libjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjpeg.a; path = ../deps/libjpeg/libjpeg.a; sourceTree = "<group>"; };
848ADEF527BD68AE001C60F3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
848ADEF827BD6904001C60F3 /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Localizable.strings; sourceTree = "<group>"; };
848ADEF927BD695E001C60F3 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = "<group>"; };
@ -591,14 +590,13 @@
84A1F9B8252E617D00000717 /* scripting_client.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = scripting_client.cpp; path = ../../../../src/script/scripting_client.cpp; sourceTree = "<group>"; };
84A1F9B9252E617D00000717 /* scripting_server.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = scripting_server.cpp; path = ../../../../src/script/scripting_server.cpp; sourceTree = "<group>"; };
84A1F9BA252E617D00000717 /* scripting_server.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scripting_server.h; path = ../../../../src/script/scripting_server.h; sourceTree = "<group>"; };
84A1FA4C252E635900000717 /* locale */ = {isa = PBXFileReference; lastKnownFileType = folder; name = locale; path = ../../locale; sourceTree = "<group>"; };
84A636C327C67F01005B4503 /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Localizable.strings; sourceTree = "<group>"; };
84AABAF72822C3F000A89340 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
84AABAF82822C3FC00A89340 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = vi; path = vi.lproj/Localizable.strings; sourceTree = "<group>"; };
84BE974228CA1291004E8CEC /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
84BE974428CA129C004E8CEC /* CoreHaptics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreHaptics.framework; path = System/Library/Frameworks/CoreHaptics.framework; sourceTree = SDKROOT; };
84C2AB5228DA7770001968EE /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = ../deps/libpng/libpng.a; sourceTree = "<group>"; };
84EEE5E62782728E00F61929 /* libintl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libintl.a; path = ../deps/gettext/lib/libintl.a; sourceTree = "<group>"; };
84EEE5E62782728E00F61929 /* libintl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libintl.a; path = ../deps/gettext/libintl.a; sourceTree = "<group>"; };
84F20D5425D52790009562A9 /* irrUString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrUString.h; path = ../../../../src/irrlicht_changes/irrUString.h; sourceTree = "<group>"; };
84F20D5525D52790009562A9 /* static_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = static_text.cpp; path = ../../../../src/irrlicht_changes/static_text.cpp; sourceTree = "<group>"; };
84F20D5625D52790009562A9 /* static_text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = static_text.h; path = ../../../../src/irrlicht_changes/static_text.h; sourceTree = "<group>"; };
@ -1105,9 +1103,8 @@
children = (
8458617B24B1C3BB0040BA4F /* builtin */,
8453A49D24DB22F00087ECF9 /* client */,
8458617A24B1C3BA0040BA4F /* fonts */,
84A1FA4C252E635900000717 /* locale */,
8458617924B1C3BA0040BA4F /* games */,
84287CA5291ED0F000E30F96 /* fonts */,
84287CA4291ED0F000E30F96 /* locale */,
8458617C24B1C3BB0040BA4F /* textures */,
845856B224B1322D0040BA4F /* Assets.xcassets */,
845856B724B1322D0040BA4F /* Info.plist */,
@ -1752,7 +1749,7 @@
};
};
buildConfigurationList = 845856A424B1322C0040BA4F /* Build configuration list for PBXProject "MultiCraft" */;
compatibilityVersion = "Xcode 13.0";
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
@ -1799,14 +1796,13 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8458617D24B1C3BC0040BA4F /* games in Resources */,
8458617F24B1C3BC0040BA4F /* builtin in Resources */,
8453A49E24DB22F00087ECF9 /* client in Resources */,
8458618024B1C3BC0040BA4F /* textures in Resources */,
845856B324B1322D0040BA4F /* Assets.xcassets in Resources */,
8453A49E24DB22F00087ECF9 /* client in Resources */,
84287CA7291ED0F000E30F96 /* fonts in Resources */,
84287CA6291ED0F000E30F96 /* locale in Resources */,
848ADEF427BD68AE001C60F3 /* Localizable.strings in Resources */,
84A1FA4D252E635900000717 /* locale in Resources */,
8458617E24B1C3BC0040BA4F /* fonts in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2191,7 +2187,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 20;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = R3RLJ9TW52;
ENABLE_HARDENED_RUNTIME = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
@ -2204,6 +2200,7 @@
"USE_LEVELDB=1",
"USE_LUAJIT=1",
"USE_SYSTEM_GMP=0",
"_IRR_COMPILE_WITH_SDL_DEVICE_=1",
"ENABLE_UPDATE_CHECKER=1",
"VERSION_MAJOR=2",
"VERSION_MINOR=0",
@ -2215,9 +2212,8 @@
"$(inherited)",
"${SRCROOT}/../../../src",
"${SRCROOT}/../../../src/script",
"${SRCROOT}/../../../lib/jsoncpp",
"${SRCROOT}/../../../lib/gmp",
"${SRCROOT}/../../../lib/intl",
"${SRCROOT}/../../../lib/jsoncpp",
"${SRCROOT}/../deps/freetype/include",
"${SRCROOT}/../deps/gettext/include",
"${SRCROOT}/../deps/irrlicht/include",
@ -2239,18 +2235,15 @@
);
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 2.0.2;
OTHER_CFLAGS = (
"$(inherited)",
"-D_IRR_COMPILE_WITH_SDL_DEVICE_",
);
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
"-L${SRCROOT}/../deps/freetype",
"-L${SRCROOT}/../deps/gettext/lib",
"-L${SRCROOT}/../deps/gettext",
"-L${SRCROOT}/../deps/irrlicht",
"-L${SRCROOT}/../deps/libjpeg/lib",
"-L${SRCROOT}/../deps/libjpeg",
"-L${SRCROOT}/../deps/leveldb",
"-L${SRCROOT}/../deps/luajit/lib",
"-L${SRCROOT}/../deps/luajit",
"-L${SRCROOT}/../deps/libogg",
"-L${SRCROOT}/../deps/openal",
"-L${SRCROOT}/../deps/libpng",
@ -2271,7 +2264,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 20;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = R3RLJ9TW52;
ENABLE_HARDENED_RUNTIME = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
@ -2286,6 +2279,7 @@
"USE_LEVELDB=1",
"USE_LUAJIT=1",
"USE_SYSTEM_GMP=0",
"_IRR_COMPILE_WITH_SDL_DEVICE_=1",
"ENABLE_UPDATE_CHECKER=1",
"VERSION_MAJOR=2",
"VERSION_MINOR=0",
@ -2297,9 +2291,8 @@
"$(inherited)",
"${SRCROOT}/../../../src",
"${SRCROOT}/../../../src/script",
"${SRCROOT}/../../../lib/jsoncpp",
"${SRCROOT}/../../../lib/gmp",
"${SRCROOT}/../../../lib/intl",
"${SRCROOT}/../../../lib/jsoncpp",
"${SRCROOT}/../deps/freetype/include",
"${SRCROOT}/../deps/gettext/include",
"${SRCROOT}/../deps/irrlicht/include",
@ -2321,18 +2314,15 @@
);
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 2.0.2;
OTHER_CFLAGS = (
"$(inherited)",
"-D_IRR_COMPILE_WITH_SDL_DEVICE_",
);
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
"-L${SRCROOT}/../deps/freetype",
"-L${SRCROOT}/../deps/gettext/lib",
"-L${SRCROOT}/../deps/gettext",
"-L${SRCROOT}/../deps/irrlicht",
"-L${SRCROOT}/../deps/libjpeg/lib",
"-L${SRCROOT}/../deps/libjpeg",
"-L${SRCROOT}/../deps/leveldb",
"-L${SRCROOT}/../deps/luajit/lib",
"-L${SRCROOT}/../deps/luajit",
"-L${SRCROOT}/../deps/libogg",
"-L${SRCROOT}/../deps/openal",
"-L${SRCROOT}/../deps/libpng",

View File

@ -10,6 +10,11 @@ cd deps
sh libraries.sh
cd ..
echo
echo "Preparing Assets:"
sh assets.sh
echo
echo "Preparing Locales:"

11
build/macOS/assets.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash -e
if [ ! -d MultiCraft/MultiCraft.xcodeproj ]; then
echo "Run this in build/macOS"
exit 1
fi
DEST=$(pwd)/assets
mkdir -p $DEST/fonts
cp ../../fonts/*.ttf $DEST/fonts/

View File

@ -0,0 +1,263 @@
diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m
index 02c99e8e72a5..6b68a2b807b3 100644
--- a/SDL2-src/src/video/cocoa/SDL_cocoakeyboard.m
+++ b/SDL2-src/src/video/cocoa/SDL_cocoakeyboard.m
@@ -177,209 +177,49 @@ - (NSArray *)validAttributesForMarkedText
@end
-
-/* This is a helper function for HandleModifierSide. This
- * function reverts back to behavior before the distinction between
- * sides was made.
- */
-static void
-HandleNonDeviceModifier(unsigned int device_independent_mask,
- unsigned int oldMods,
- unsigned int newMods,
- SDL_Scancode scancode)
-{
- unsigned int oldMask, newMask;
-
- /* Isolate just the bits we care about in the depedent bits so we can
- * figure out what changed
- */
- oldMask = oldMods & device_independent_mask;
- newMask = newMods & device_independent_mask;
-
- if (oldMask && oldMask != newMask) {
- SDL_SendKeyboardKey(SDL_RELEASED, scancode);
- } else if (newMask && oldMask != newMask) {
- SDL_SendKeyboardKey(SDL_PRESSED, scancode);
- }
-}
-
-/* This is a helper function for HandleModifierSide.
- * This function sets the actual SDL_PrivateKeyboard event.
- */
-static void
-HandleModifierOneSide(unsigned int oldMods, unsigned int newMods,
- SDL_Scancode scancode,
- unsigned int sided_device_dependent_mask)
-{
- unsigned int old_dep_mask, new_dep_mask;
-
- /* Isolate just the bits we care about in the depedent bits so we can
- * figure out what changed
- */
- old_dep_mask = oldMods & sided_device_dependent_mask;
- new_dep_mask = newMods & sided_device_dependent_mask;
-
- /* We now know that this side bit flipped. But we don't know if
- * it went pressed to released or released to pressed, so we must
- * find out which it is.
- */
- if (new_dep_mask && old_dep_mask != new_dep_mask) {
- SDL_SendKeyboardKey(SDL_PRESSED, scancode);
- } else {
- SDL_SendKeyboardKey(SDL_RELEASED, scancode);
- }
-}
-
-/* This is a helper function for DoSidedModifiers.
- * This function will figure out if the modifier key is the left or right side,
- * e.g. left-shift vs right-shift.
- */
-static void
-HandleModifierSide(int device_independent_mask,
- unsigned int oldMods, unsigned int newMods,
- SDL_Scancode left_scancode,
- SDL_Scancode right_scancode,
- unsigned int left_device_dependent_mask,
- unsigned int right_device_dependent_mask)
-{
- unsigned int device_dependent_mask = (left_device_dependent_mask |
- right_device_dependent_mask);
- unsigned int diff_mod;
-
- /* On the basis that the device independent mask is set, but there are
- * no device dependent flags set, we'll assume that we can't detect this
- * keyboard and revert to the unsided behavior.
- */
- if ((device_dependent_mask & newMods) == 0) {
- /* Revert to the old behavior */
- HandleNonDeviceModifier(device_independent_mask, oldMods, newMods, left_scancode);
- return;
- }
-
- /* XOR the previous state against the new state to see if there's a change */
- diff_mod = (device_dependent_mask & oldMods) ^
- (device_dependent_mask & newMods);
- if (diff_mod) {
- /* A change in state was found. Isolate the left and right bits
- * to handle them separately just in case the values can simulataneously
- * change or if the bits don't both exist.
- */
- if (left_device_dependent_mask & diff_mod) {
- HandleModifierOneSide(oldMods, newMods, left_scancode, left_device_dependent_mask);
- }
- if (right_device_dependent_mask & diff_mod) {
- HandleModifierOneSide(oldMods, newMods, right_scancode, right_device_dependent_mask);
- }
- }
-}
-
-/* This is a helper function for DoSidedModifiers.
- * This function will release a key press in the case that
- * it is clear that the modifier has been released (i.e. one side
- * can't still be down).
- */
-static void
-ReleaseModifierSide(unsigned int device_independent_mask,
- unsigned int oldMods, unsigned int newMods,
- SDL_Scancode left_scancode,
- SDL_Scancode right_scancode,
- unsigned int left_device_dependent_mask,
- unsigned int right_device_dependent_mask)
-{
- unsigned int device_dependent_mask = (left_device_dependent_mask |
- right_device_dependent_mask);
-
- /* On the basis that the device independent mask is set, but there are
- * no device dependent flags set, we'll assume that we can't detect this
- * keyboard and revert to the unsided behavior.
- */
- if ((device_dependent_mask & oldMods) == 0) {
- /* In this case, we can't detect the keyboard, so use the left side
- * to represent both, and release it.
- */
- SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
- return;
- }
-
- /*
- * This could have been done in an if-else case because at this point,
- * we know that all keys have been released when calling this function.
- * But I'm being paranoid so I want to handle each separately,
- * so I hope this doesn't cause other problems.
- */
- if ( left_device_dependent_mask & oldMods ) {
- SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
- }
- if ( right_device_dependent_mask & oldMods ) {
- SDL_SendKeyboardKey(SDL_RELEASED, right_scancode);
- }
-}
-
-/* This function will handle the modifier keys and also determine the
- * correct side of the key.
- */
-static void
-DoSidedModifiers(unsigned short scancode,
- unsigned int oldMods, unsigned int newMods)
-{
- /* Set up arrays for the key syms for the left and right side. */
- const SDL_Scancode left_mapping[] = {
- SDL_SCANCODE_LSHIFT,
- SDL_SCANCODE_LCTRL,
- SDL_SCANCODE_LALT,
- SDL_SCANCODE_LGUI
- };
- const SDL_Scancode right_mapping[] = {
- SDL_SCANCODE_RSHIFT,
- SDL_SCANCODE_RCTRL,
- SDL_SCANCODE_RALT,
- SDL_SCANCODE_RGUI
- };
- /* Set up arrays for the device dependent masks with indices that
- * correspond to the _mapping arrays
- */
- const unsigned int left_device_mapping[] = { NX_DEVICELSHIFTKEYMASK, NX_DEVICELCTLKEYMASK, NX_DEVICELALTKEYMASK, NX_DEVICELCMDKEYMASK };
- const unsigned int right_device_mapping[] = { NX_DEVICERSHIFTKEYMASK, NX_DEVICERCTLKEYMASK, NX_DEVICERALTKEYMASK, NX_DEVICERCMDKEYMASK };
-
- unsigned int i, bit;
-
- /* Iterate through the bits, testing each against the old modifiers */
- for (i = 0, bit = NSEventModifierFlagShift; bit <= NSEventModifierFlagCommand; bit <<= 1, ++i) {
- unsigned int oldMask, newMask;
-
- oldMask = oldMods & bit;
- newMask = newMods & bit;
-
- /* If the bit is set, we must always examine it because the left
- * and right side keys may alternate or both may be pressed.
- */
- if (newMask) {
- HandleModifierSide(bit, oldMods, newMods,
- left_mapping[i], right_mapping[i],
- left_device_mapping[i], right_device_mapping[i]);
- }
- /* If the state changed from pressed to unpressed, we must examine
- * the device dependent bits to release the correct keys.
- */
- else if (oldMask && oldMask != newMask) {
- ReleaseModifierSide(bit, oldMods, newMods,
- left_mapping[i], right_mapping[i],
- left_device_mapping[i], right_device_mapping[i]);
- }
- }
-}
-
static void
HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags)
{
- SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata;
-
- if (modifierFlags == data.modifierFlags) {
- return;
+ SDL_Scancode code = darwin_scancode_table[scancode];
+
+ const SDL_Scancode codes[] = {
+ SDL_SCANCODE_LSHIFT,
+ SDL_SCANCODE_LCTRL,
+ SDL_SCANCODE_LALT,
+ SDL_SCANCODE_LGUI,
+ SDL_SCANCODE_RSHIFT,
+ SDL_SCANCODE_RCTRL,
+ SDL_SCANCODE_RALT,
+ SDL_SCANCODE_RGUI,
+ SDL_SCANCODE_LSHIFT,
+ SDL_SCANCODE_LCTRL,
+ SDL_SCANCODE_LALT,
+ SDL_SCANCODE_LGUI, };
+
+ const unsigned int modifiers[] = {
+ NX_DEVICELSHIFTKEYMASK,
+ NX_DEVICELCTLKEYMASK,
+ NX_DEVICELALTKEYMASK,
+ NX_DEVICELCMDKEYMASK,
+ NX_DEVICERSHIFTKEYMASK,
+ NX_DEVICERCTLKEYMASK,
+ NX_DEVICERALTKEYMASK,
+ NX_DEVICERCMDKEYMASK,
+ NX_SHIFTMASK,
+ NX_CONTROLMASK,
+ NX_ALTERNATEMASK,
+ NX_COMMANDMASK };
+
+ for (int i = 0; i < 12; i++)
+ {
+ if (code == codes[i])
+ {
+ if (modifierFlags & modifiers[i])
+ SDL_SendKeyboardKey(SDL_PRESSED, code);
+ else
+ SDL_SendKeyboardKey(SDL_RELEASED, code);
+ }
}
-
- DoSidedModifiers(scancode, data.modifierFlags, modifierFlags);
- data.modifierFlags = modifierFlags;
}
static void
@@ -579,8 +419,7 @@ - (NSArray *)validAttributesForMarkedText
SDL_SendKeyboardKey(SDL_RELEASED, code);
break;
case NSEventTypeFlagsChanged:
- /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */
- HandleModifiers(_this, scancode, (unsigned int)[event modifierFlags]);
+ HandleModifiers(_this, scancode, (unsigned int)[event modifierFlags]);
break;
default: /* just to avoid compiler warnings */
break;

View File

@ -1,7 +1,7 @@
#!/bin/bash -e
. sdk.sh
SDL2_VERSION=2.24.0
SDL2_VERSION=2.24.2
if [ ! -d SDL2-src ]; then
wget https://github.com/libsdl-org/SDL/archive/release-$SDL2_VERSION.tar.gz
@ -10,6 +10,7 @@ if [ ! -d SDL2-src ]; then
rm release-$SDL2_VERSION.tar.gz
# patch SDL2
patch -p1 < SDL2.diff
patch -p1 < SDL2-command-modifier.diff
# Disable some features that are not needed
sed -i '' 's/#define SDL_AUDIO_DRIVER_COREAUDIO 1/#define SDL_AUDIO_DRIVER_COREAUDIO 0/g' SDL2-src/include/SDL_config_macosx.h
sed -i '' 's/#define SDL_AUDIO_DRIVER_DISK 1/#define SDL_AUDIO_DRIVER_DISK 0/g' SDL2-src/include/SDL_config_macosx.h
@ -35,7 +36,7 @@ BUILD_FOLDER=$(xcodebuild \
grep TARGET_BUILD_DIR | sed -n -e 's/^.*TARGET_BUILD_DIR = //p')
mkdir -p ../SDL2
cp -a "${BUILD_FOLDER}/libSDL2.a" ../SDL2
cp -a include ../SDL2
cp -v "${BUILD_FOLDER}/libSDL2.a" ../SDL2
cp -rv include ../SDL2
echo "SDL2 build successful"

View File

@ -23,15 +23,14 @@ cmake .. \
-DFT_DISABLE_HARFBUZZ=TRUE \
-DFT_DISABLE_BROTLI=TRUE \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$OSX_OSVER \
-DCMAKE_OSX_ARCHITECTURES=$OSX_ARCHITECTURES
cmake --build . -j
mkdir -p ../../freetype
cp -r ../include ../../freetype/include
cp -v libfreetype.a ../../freetype
cp -rv ../include ../../freetype/include
rm -rf ../../freetype/include/dlg
cp -r libfreetype.a ../../freetype/libfreetype.a
echo "FreeType build successful"

View File

@ -1,7 +1,7 @@
#!/bin/bash -e
. sdk.sh
GETTEXT_VERSION=0.21
GETTEXT_VERSION=0.21.1
if [ ! -d gettext-src ]; then
wget https://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz
@ -18,9 +18,12 @@ CFLAGS="$OSX_FLAGS $OSX_ARCH -Dlocale_charset=intl_locale_charset" \
PKG_CONFIG=/bin/false \
./configure --prefix=/ \
--disable-shared --enable-static
make -j
mkdir -p ../../gettext
make DESTDIR=$PWD/../../gettext install
make -j
make DESTDIR=$PWD/build install
mkdir -p ../../gettext/include
cp -v build/include/libintl.h ../../gettext/include
cp -v build/lib/libintl.a ../../gettext
echo "gettext build successful"

View File

@ -24,7 +24,7 @@ cd ../..
[ -d ../irrlicht ] && rm -r ../irrlicht
mkdir -p ../irrlicht
cp "${BUILD_FOLDER}/libIrrlicht.a" ../irrlicht
cp -r include ../irrlicht/include
cp -v "${BUILD_FOLDER}/libIrrlicht.a" ../irrlicht
cp -rv include ../irrlicht/include
echo "Irrlicht build successful"

View File

@ -1,9 +1,10 @@
#!/bin/bash -e
. sdk.sh
LEVELDB_VERSION=1.23
if [ ! -d leveldb-src ]; then
git clone --depth 1 https://github.com/google/leveldb leveldb-src
git clone -b $LEVELDB_VERSION --depth 1 https://github.com/google/leveldb leveldb-src
mkdir leveldb-src/build
fi
@ -18,10 +19,11 @@ cmake .. \
-DLEVELDB_BUILD_TESTS=FALSE \
-DLEVELDB_BUILD_BENCHMARKS=FALSE \
-DLEVELDB_INSTALL=FALSE
cmake --build . -j
mkdir -p ../../leveldb
cp -r libleveldb.a ../../leveldb/libleveldb.a
cp -r ../include ../../leveldb/include
cp -v libleveldb.a ../../leveldb
cp -rv ../include ../../leveldb/include
echo "LevelDB build successful"

View File

@ -12,6 +12,8 @@ fi
rm -rf libjpeg
mkdir -p libjpeg/include
cd libjpeg-src
for ARCH in x86_64 arm64
@ -20,26 +22,27 @@ do
mkdir -p build; cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_SHARED=OFF \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS -arch $ARCH" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$OSX_OSVER \
-DCMAKE_OSX_ARCHITECTURES=$ARCH
-DCMAKE_INSTALL_PREFIX="." \
-DCMAKE_OSX_ARCHITECTURES=$ARCH \
-DENABLE_SHARED=OFF
cmake --build . -j
make install -s
if [ $ARCH = "x86_64" ]; then
make DESTDIR=$PWD/../../libjpeg install
mv ../../libjpeg/opt/libjpeg-turbo/* ../../libjpeg
rm -rf ../../libjpeg/opt
mv ../../libjpeg/lib/libjpeg.a ../../libjpeg/lib/templib_$ARCH.a
cp -rv include ../../libjpeg
cp -v lib/libjpeg.a ../../libjpeg/templib_$ARCH.a
else
mv libjpeg.a ../../libjpeg/lib/templib_$ARCH.a
cp -v lib/libjpeg.a ../../libjpeg/templib_$ARCH.a
fi
cd ..; rm -rf build
done
# repack into one .a
cd ../libjpeg/lib
cd ../libjpeg
lipo -create templib_*.a -output libjpeg.a
rm templib_*.a
rm libturbojpeg.a
echo "libjpeg build successful"

View File

@ -3,25 +3,25 @@
. sdk.sh
OGG_VERSION=1.3.5
if [ ! -d ogg-src ]; then
wget https://github.com/xiph/ogg/releases/download/v$OGG_VERSION/libogg-$OGG_VERSION.tar.gz
tar -xzvf libogg-$OGG_VERSION.tar.gz
mv libogg-$OGG_VERSION libogg-src
rm libogg-$OGG_VERSION.tar.gz
if [ ! -d libogg-src ]; then
git clone -b v$OGG_VERSION --depth 1 https://github.com/xiph/ogg libogg-src
mkdir libogg-src/build
fi
rm -rf libogg
cd libogg-src/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" -DCMAKE_CXX_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$OSX_OSVER \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" \
-DCMAKE_CXX_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" \
-DCMAKE_OSX_ARCHITECTURES=$OSX_ARCHITECTURES
cmake --build . -j
mkdir -p ../../libogg
cp -r libogg.a ../../libogg/libogg.a
cp -r ../include ../../libogg/include
cp -v libogg.a ../../libogg
cp -rv ../include ../../libogg/include
echo "Ogg build successful"

View File

@ -12,6 +12,8 @@ fi
rm -rf libpng
mkdir -p libpng/include
cd libpng-src
for ARCH in x86_64 arm64
@ -20,21 +22,24 @@ do
mkdir -p build; cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS -arch $ARCH" \
-DCMAKE_ASM_FLAGS_RELEASE="$OSX_FLAGS -arch $ARCH" \
-DCMAKE_INSTALL_PREFIX="." \
-DCMAKE_OSX_ARCHITECTURES=$ARCH \
-DPNG_SHARED=OFF \
-DPNG_TESTS=OFF \
-DPNG_EXECUTABLES=OFF \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS -arch $ARCH" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$OSX_OSVER \
-DCMAKE_OSX_ARCHITECTURES=$ARCH
-DPNG_EXECUTABLES=OFF
cmake --build . -j
make install -s
if [ $ARCH = "x86_64" ]; then
make DESTDIR=$PWD/../../libpng install
mv ../../libpng/usr/local/include ../../libpng/include
mv ../../libpng/usr/local/lib/libpng16.a ../../libpng/templib_$ARCH.a
rm -rf ../../libpng/usr
cp -rv include ../../libpng
cp -v lib/libpng16.a ../../libpng/templib_$ARCH.a
else
mv libpng16.a ../../libpng/templib_$ARCH.a
cp -v lib/libpng16.a ../../libpng/templib_$ARCH.a
fi
cd ..; rm -rf build
done

View File

@ -3,11 +3,8 @@
. sdk.sh
VORBIS_VERSION=1.3.7
if [ ! -d vorbis-src ]; then
wget https://github.com/xiph/vorbis/releases/download/v$VORBIS_VERSION/libvorbis-$VORBIS_VERSION.tar.gz
tar -xzvf libvorbis-$VORBIS_VERSION.tar.gz
mv libvorbis-$VORBIS_VERSION libvorbis-src
rm libvorbis-$VORBIS_VERSION.tar.gz
if [ ! -d libvorbis-src ]; then
git clone -b v$VORBIS_VERSION --depth 1 https://github.com/xiph/vorbis libvorbis-src
mkdir libvorbis-src/build
fi
@ -17,15 +14,17 @@ cd libvorbis-src/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DOGG_LIBRARY="../../libogg/libogg.a" -DOGG_INCLUDE_DIR="../../libogg/include" \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" -DCMAKE_CXX_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$OSX_OSVER \
-DOGG_LIBRARY="../../libogg/libogg.a" \
-DOGG_INCLUDE_DIR="../../libogg/include" \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" \
-DCMAKE_CXX_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" \
-DCMAKE_OSX_ARCHITECTURES=$OSX_ARCHITECTURES
cmake --build . -j
mkdir -p ../../libvorbis
cp -r lib/libvorbis.a ../../libvorbis/libvorbis.a
cp -r lib/libvorbisfile.a ../../libvorbis/libvorbisfile.a
cp -r ../include ../../libvorbis/include
cp -v lib/libvorbis.a ../../libvorbis
cp -v lib/libvorbisfile.a ../../libvorbis
cp -rv ../include ../../libvorbis/include
echo "Vorbis build successful"

View File

@ -3,25 +3,22 @@
. sdk.sh
export MACOSX_DEPLOYMENT_TARGET=10.15
LUAJIT_VERSION=2.1
LUAJIT_VERSION="v2.1"
if [ ! -d LuaJIT-src ]; then
wget https://github.com/LuaJIT/LuaJIT/archive/v$LUAJIT_VERSION.zip
unzip v$LUAJIT_VERSION.zip
mv LuaJIT-$LUAJIT_VERSION LuaJIT-src
rm v$LUAJIT_VERSION.zip
if [ ! -d luajit-src ]; then
git clone -b $LUAJIT_VERSION --depth 1 -c core.autocrlf=false https://github.com/LuaJIT/LuaJIT luajit-src
fi
rm -rf LuaJIT
rm -rf luajit
cd LuaJIT-src
cd luajit-src
for ARCH in x86_64 arm64
do
echo "Building LuaJIT for $ARCH"
make amalg -j \
TARGET_FLAGS="$OSX_FLAGS -fno-fast-math -funwind-tables -fasynchronous-unwind-tables -arch $ARCH"
mv src/libluajit.a templib_$ARCH.a
cp src/libluajit.a templib_$ARCH.a
make clean
done
@ -29,8 +26,8 @@ done
lipo -create templib_*.a -output libluajit.a
rm templib_*.a
mkdir -p ../luajit/{lib,include}
mkdir -p ../luajit/include
cp -v src/*.h ../luajit/include
cp -v libluajit.a ../luajit/lib
cp -v libluajit.a ../luajit
echo "LuaJIT build successful"

View File

@ -4,10 +4,7 @@
OPENAL_VERSION=1.22.2
if [ ! -d openal-src ]; then
wget https://github.com/kcat/openal-soft/archive/$OPENAL_VERSION.tar.gz
tar -xzvf $OPENAL_VERSION.tar.gz
mv openal-soft-$OPENAL_VERSION openal-src
rm $OPENAL_VERSION.tar.gz
git clone -b $OPENAL_VERSION --depth 1 https://github.com/kcat/openal-soft openal-src
fi
rm -rf openal
@ -18,15 +15,18 @@ cmake -S . \
-DCMAKE_BUILD_TYPE=Release \
-DLIBTYPE=STATIC \
-DALSOFT_REQUIRE_COREAUDIO=ON \
-DALSOFT_EMBED_HRTF_DATA=ON -DALSOFT_UTILS=OFF \
-DALSOFT_EXAMPLES=OFF -DALSOFT_INSTALL=OFF -DALSOFT_BACKEND_WAVE=OFF \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" -DCMAKE_CXX_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$OSX_OSVER \
-DALSOFT_EMBED_HRTF_DATA=ON \
-DALSOFT_UTILS=OFF \
-DALSOFT_EXAMPLES=OFF \
-DALSOFT_BACKEND_WAVE=OFF \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" \
-DCMAKE_CXX_FLAGS_RELEASE="$OSX_FLAGS $OSX_ARCH" \
-DCMAKE_OSX_ARCHITECTURES=$OSX_ARCHITECTURES
cmake --build . -j
mkdir -p ../openal
cp -r libopenal.a ../openal/libopenal.a
cp -r include ../openal/include
cp -v libopenal.a ../openal
cp -rv include ../openal/include
echo "OpenAL-Soft build successful"

View File

@ -1,6 +1,6 @@
#!/bin/bash -e
# This file sets the appropriate compiler and flags for compiling for macOS without XCode
# This file sets the appropriate compiler and flags for compiling for macOS without Xcode
sdk=macosx
export OSX_OSVER=10.11
@ -11,4 +11,4 @@ export OSX_ARCH="-arch x86_64 -arch arm64"
export OSX_COMPILER=$(xcrun --sdk $sdk --find clang)
export OSX_CC=$OSX_COMPILER
export OSX_CXX=$OSX_COMPILER
export OSX_FLAGS="-isysroot $(xcrun --sdk $sdk --show-sdk-path) -mmacosx-version-min=$OSX_OSVER -fvisibility=hidden -fdata-sections -ffunction-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -Ofast"
export OSX_FLAGS="-isysroot $(xcrun --sdk $sdk --show-sdk-path) -mmacosx-version-min=$OSX_OSVER -fdata-sections -ffunction-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -Ofast"

View File

@ -5,7 +5,7 @@ if [ ! -d MultiCraft/MultiCraft.xcodeproj ]; then
exit 1
fi
DEST=$(pwd)/locale
DEST=$(pwd)/assets/locale
pushd ../../po
for lang in *; do