Add message catalogs to android assets

This commit is contained in:
SSimco
2025-08-27 14:45:56 +03:00
parent 8d717160e9
commit 6a3b7f0290
5 changed files with 312 additions and 280 deletions
File diff suppressed because it is too large Load Diff
+25 -10
View File
@@ -19,6 +19,7 @@ jobs:
deploy:
name: Deploy experimental release
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
@@ -26,11 +27,21 @@ jobs:
submodules: "recursive"
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Install system dependencies
run: |
sudo apt update -qq
sudo apt install -y gettext
- name: Uncompile message catalogs
run: |
for mo_file in bin/resources/*/cemu.mo
do
echo $mo_file
language_code=$(basename $(dirname $mo_file))
po_file=src/android/app/src/main/assets/translations/$language_code/cemu.po
mkdir -p $(dirname $po_file)
msgunfmt $mo_file -o $po_file || echo "Failed to uncompile message catalog from $mo_file"
done
- name: Build Cemu
env:
@@ -39,13 +50,17 @@ jobs:
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
EMULATOR_VERSION_MAJOR: ${{ inputs.version_major }}
EMULATOR_VERSION_MINOR: ${{ inputs.version_minor }}
BUILD_TYPE: ${{ inputs.build_type }}
run: |
cd ./src/android
base64 --decode <<< "${ANDROID_STORE_FILE_BASE64}" > store.jks
export ANDROID_KEYSTORE_FILE=$(pwd)/store.jks
./gradlew assemble$BUILD_TYPE
export JAVA_HOME=$JAVA_HOME_17_X64
cd ./src/android
if [[ -n "$ANDROID_STORE_FILE_BASE64" ]]; then
base64 --decode <<< "${ANDROID_STORE_FILE_BASE64}" > store.jks
export ANDROID_STORE_FILE=$(pwd)/store.jks
fi
./gradlew assembleRelease
- name: Set version dependent vars
env:
+16 -24
View File
@@ -4,7 +4,6 @@ import java.security.MessageDigest
import java.util.regex.Pattern
import javax.xml.bind.DatatypeConverter
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
@@ -75,7 +74,7 @@ android {
signingConfigs {
if (keystoreFilePath != null) {
create("releaseSigningConfig") {
create("release") {
storeFile = file(keystoreFilePath)
storePassword = System.getenv("ANDROID_KEY_STORE_PASSWORD")
keyAlias = System.getenv("ANDROID_KEY_ALIAS")
@@ -83,46 +82,37 @@ android {
}
}
}
androidComponents {
beforeVariants { variantBuilder ->
if (variantBuilder.name == "release") {
variantBuilder.enable = false
}
}
}
buildTypes {
debug {
applicationIdSuffix = ".debug"
}
create("github") {
if (keystoreFilePath != null) {
initWith(getByName("release"))
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("releaseSigningConfig")
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = if (keystoreFilePath != null) {
signingConfigs.getByName("release")
} else {
initWith(getByName("debug"))
externalNativeBuild {
cmake {
arguments.add("-DCMAKE_BUILD_TYPE=DEBUG")
}
}
signingConfigs.getByName("debug")
}
}
}
compileOptions {
sourceCompatibility(JavaVersion.VERSION_17)
targetCompatibility(JavaVersion.VERSION_17)
}
externalNativeBuild {
cmake {
version = "3.25.0+"
path = file("../../../CMakeLists.txt")
}
}
defaultConfig {
externalNativeBuild {
cmake {
@@ -152,12 +142,14 @@ android {
}
}
}
buildFeatures {
buildConfig = true
dataBinding = true
viewBinding = true
compose = true
}
kotlinOptions {
jvmTarget = "17"
}
@@ -98,11 +98,16 @@ class DPadInput(
}
private fun getStateByPosition(x: Float, y: Float): Int {
val norm2 = (x - centerX) * (x - centerX) + (y - centerY) * (y - centerY)
val dx = x - centerX
val dy = y - centerY
val norm2 = dx * dx + dy * dy
if (norm2 <= radius2 * 0.1f) {
return NONE
}
val angle = atan2((y - centerY).toDouble(), (x - centerX).toDouble())
val angle = atan2(dy, dx)
return when (angle) {
in -0.875 * Math.PI..<-0.625 * Math.PI -> UP or LEFT
in -0.625 * Math.PI..<-0.375 * Math.PI -> UP
@@ -164,7 +169,9 @@ class DPadInput(
}
override fun isInside(x: Float, y: Float): Boolean {
return (x - centerX) * (x - centerX) + (y - centerY) * (y - centerY) <= radius2
val dx = x - centerX
val dy = y - centerY
return dx * dx + dy * dy <= radius2
}
override fun drawInput(canvas: Canvas) {
@@ -15,6 +15,7 @@ class RoundButton(
private var centerX: Float = 0f
private var centerY: Float = 0f
private var radius: Float = 0f
private var radius2: Float = 0f
init {
configure()
@@ -24,6 +25,7 @@ class RoundButton(
centerX = rect.centerX().toFloat()
centerY = rect.centerY().toFloat()
radius = min(rect.width().toFloat(), rect.height().toFloat()) / 2f
radius2 = radius * radius
innerDrawing.configure(rect, alpha)
configureColors(alpha)
}
@@ -43,6 +45,8 @@ class RoundButton(
}
override fun isInside(x: Float, y: Float): Boolean {
return (x - centerX) * (x - centerX) + (y - centerY) * (y - centerY) <= radius * radius
val dx = x - centerX
val dy = y - centerY
return dx * dx + dy * dy <= radius2
}
}