some warning for apple rosetta

This commit is contained in:
minjaesong
2023-06-24 01:03:58 +09:00
parent 2e956f89f5
commit 61e6255b52
2 changed files with 23 additions and 5 deletions

View File

@@ -142,6 +142,12 @@ public class App implements ApplicationListener {
public static final int GLOBAL_FRAMERATE_LIMIT = 300;
private static String undesirableConditions;
public static String getUndesirableConditions() {
return undesirableConditions;
}
/**
* These languages won't distinguish regional differences (e.g. enUS and enUK, frFR and frCA)
*/
@@ -346,10 +352,13 @@ public class App implements ApplicationListener {
processorVendor = "Unknown CPU";
}
if (processor.startsWith("Apple M") && Objects.equals(systemArch, "aarch64")) {
if (processor.startsWith("Apple M") && systemArch.equals("aarch64")) {
isAppleM = true;
System.out.println("Apple Proprietary "+processor+" detected; don't expect smooth sailing...");
}
if (processor.startsWith("Apple M") && !systemArch.equals("aarch64")) {
undesirableConditions = "apple_execution_through_rosetta";
}
if (!IS_DEVELOPMENT_BUILD) {
var p = UnsafeHelper.INSTANCE.allocate(64);

View File

@@ -332,11 +332,11 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
batch.color = Color.WHITE
// warn: 32-bit
val linegap = 4
val imgTxtGap = 10
val yoff = App.scr.height - App.scr.tvSafeGraphicsHeight - 64 - (3*(20+linegap)) - imgTxtGap - 9
if (App.is32BitJVM && uiRemoCon.currentRemoConContents.parent == null) {
// if (uiRemoCon.currentRemoConContents.parent == null) {
val linegap = 4
val imgTxtGap = 10
val yoff = App.scr.height - App.scr.tvSafeGraphicsHeight - 64 - (3*(20+linegap)) - imgTxtGap - 9
Toolkit.drawCentered(batch, warning32bitJavaIcon, yoff)
for (i in 0..2) {
val text = Lang.get("GAME_32BIT_WARNING${i+1}", (i != 2))
@@ -344,6 +344,15 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
App.fontGame.draw(batch, text, ((drawWidth - App.fontGame.getWidth(text)) / 2).toFloat(), yoff + imgTxtGap + 64f + linegap + i*(20+linegap))
}
}
// warn: rosetta on Apple M-chips
else if (App.getUndesirableConditions() == "apple_execution_through_rosetta") {
listOf(
"It seems you are using a Mac with Apple Silicon but running the game through Rosetta.",
"A native build for the game is available which runs much faster than current version."
).forEachIndexed { i, text ->
App.fontGame.draw(batch, text, ((drawWidth - App.fontGame.getWidth(text)) / 2).toFloat(), yoff + imgTxtGap + 64f + linegap + i*(20+linegap))
}
}
}
override fun pause() {