Merged changes from original repo and modified some web port releated files

This commit is contained in:
2025-09-27 22:13:02 +03:00
parent ac0d4784d9
commit 6673ecaa31
57 changed files with 1294 additions and 300 deletions
@@ -125,6 +125,15 @@ public class IOSLauncher extends IOSApplication.Delegate {
config.addIosDevice("IPHONE_15_PLUS", "iPhone15,5", 460);
config.addIosDevice("IPHONE_15_PRO", "iPhone16,1", 460);
config.addIosDevice("IPHONE_15_PRO_MAX", "iPhone16,2", 460);
config.addIosDevice("IPHONE_16_PRO", "iPhone17,1", 460);
config.addIosDevice("IPHONE_16_PRO_MAX", "iPhone17,2", 460);
config.addIosDevice("IPHONE_16", "iPhone17,3", 460);
config.addIosDevice("IPHONE_16_PLUS", "iPhone17,4", 460);
config.addIosDevice("IPHONE_16E", "iPhone17,5", 460);
config.addIosDevice("IPHONE_17_PRO", "iPhone18,1", 460);
config.addIosDevice("IPHONE_17_PRO_MAX", "iPhone18,2", 460);
config.addIosDevice("IPHONE_17", "iPhone18,3", 460);
config.addIosDevice("IPHONE_AIR", "iPhone18,4", 460);
config.addIosDevice("IPAD_7G_WIFI", "iPad7,11", 264);
config.addIosDevice("IPAD_7G_WIFI_CELLULAR", "iPad7,12", 264);
@@ -144,16 +153,37 @@ public class IOSLauncher extends IOSApplication.Delegate {
config.addIosDevice("IPAD_PRO_11_3G", "iPad13,7", 264);
config.addIosDevice("IPAD_PRO_12.9_5G", "iPad13,8", 264);
config.addIosDevice("IPAD_PRO_12.9_5G", "iPad13,9", 264);
config.addIosDevice("IPAD_PRO_12.9_5G", "iPad13,10", 264);
config.addIosDevice("IPAD_PRO_12.9_5G", "iPad13,11", 264);
config.addIosDevice("IPAD_AIR_5G_WIF", "iPad13,16", 264);
config.addIosDevice("IPAD_AIR_5G_WIFI_CELLULAR", "iPad13,17", 264);
config.addIosDevice("IPAD_10G", "iPad13,18", 264);
config.addIosDevice("IPAD_10G", "iPad13,19", 264);
config.addIosDevice("IPAD_PRO_12.9_5G", "iPad13,10",264);
config.addIosDevice("IPAD_PRO_12.9_5G", "iPad13,11",264);
config.addIosDevice("IPAD_AIR_5G_WIFI", "iPad13,16",264);
config.addIosDevice("IPAD_AIR_5G_WIFI_CELLULAR", "iPad13,17",264);
config.addIosDevice("IPAD_10G", "iPad13,18",264);
config.addIosDevice("IPAD_10G", "iPad13,19",264);
config.addIosDevice("IPAD_PRO_11_4G", "iPad14,3", 264);
config.addIosDevice("IPAD_PRO_11_4G", "iPad14,4", 264);
config.addIosDevice("IPAD_PRO_12.9_6G", "iPad14,5", 264);
config.addIosDevice("IPAD_PRO_12.9_6G", "iPad14,6", 264);
config.addIosDevice("IPAD_AIR_11_6G_WIFI", "iPad14,8", 264);
config.addIosDevice("IPAD_AIR_11_6G_WIFI_CELLULAR", "iPad14,9", 264);
config.addIosDevice("IPAD_AIR_13_6G_WIFI", "iPad14,10",264);
config.addIosDevice("IPAD_AIR_13_6G_WIFI_CELLULAR", "iPad14,11",264);
config.addIosDevice("IPAD_AIR_11_7G_WIFI", "iPad15,3", 264);
config.addIosDevice("IPAD_AIR_11_7G_WIFI_CELLULAR", "iPad15,4", 264);
config.addIosDevice("IPAD_AIR_13_7G_WIFI", "iPad15,5", 264);
config.addIosDevice("IPAD_AIR_13_7G_WIFI_CELLULAR", "iPad15,6", 264);
config.addIosDevice("IPAD_11G_WIFI", "iPad15,7", 264);
config.addIosDevice("IPAD_11G_WIFI_CELLULAR", "iPad15,8", 264);
config.addIosDevice("IPAD_MINI_7G_WIFI", "iPad16,1", 326);
config.addIosDevice("IPAD_MINI_7G_WIFI_CELLULAR", "iPad16,2", 326);
config.addIosDevice("IPAD_PRO_11_5G", "iPad16,3", 264);
config.addIosDevice("IPAD_PRO_11_5G", "iPad16,4", 264);
config.addIosDevice("IPAD_PRO_12.9_7G", "iPad16,5", 264);
config.addIosDevice("IPAD_PRO_12.9_7G", "iPad16,6", 264);
//also override simulator devices for better testing when simulating modern iPhones
config.addIosDevice("SIMULATOR_32", "i386", 460);
config.addIosDevice("SIMULATOR_64", "x86_64", 460);
config.addIosDevice("SIMULATOR_ARM64", "arm64", 460);
return new IOSApplication(new ShatteredPixelDungeon(new IOSPlatformSupport()), config);
}
@@ -62,26 +62,22 @@ public class IOSPlatformSupport extends PlatformSupport {
public RectF getSafeInsets(int level) {
RectF insets = super.getSafeInsets(INSET_ALL);
//magic number BS for larger status bar caused by dynamic island
boolean hasDynamicIsland = insets.top / Gdx.graphics.getBackBufferScale() >= 51;
//iOS gives us ALL insets by default, and so we need to filter from there:
//ignore the home indicator if we're in fullscreen
if (!supportsFullScreen() || SPDSettings.fullscreen()){
insets.bottom = 0;
} else {
//otherwise bottom inset is pretty big, halve it
insets.bottom /= 2;
}
//only cutouts can be on top/left/right, which are never blocking
if (level == INSET_BLK){
insets.left = insets.top = insets.right = 0;
} else if (level == INSET_LRG){
//Dynamic Island counts as a 'small cutout', we have to use status bar height to get it =I
CGRect statusBarFrame = UIApplication.getSharedApplication().getStatusBarFrame();
double statusBarHeight = Math.min(statusBarFrame.getWidth(), statusBarFrame.getHeight());
if (statusBarHeight >= 51){ //magic number BS for larger status bar caused by island
insets.left = insets.top = insets.right = 0;
}
} else if (level == INSET_LRG && hasDynamicIsland){
//Dynamic Island counts as a 'small cutout'
insets.left = insets.top = insets.right = 0;
}
//if we are in landscape, the display cutout is only actually on one side, so cancel the other
@@ -93,6 +89,12 @@ public class IOSPlatformSupport extends PlatformSupport {
}
}
//finally iOS is very conservative with these insets, we can shrink them a bit.
insets.top /= hasDynamicIsland ? 1.2f : 1.4f;
insets.left /= hasDynamicIsland ? 1.2f : 1.4f;
insets.right /= hasDynamicIsland ? 1.2f : 1.4f;
insets.bottom /= 2; //home bar inset is especially big for no reason
return insets;
}