Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Add new build config "legacyOptimized", which targets an older Android SDK version #19401

Merged
merged 3 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions UI/DevScreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,9 @@ void SystemInfoScreen::CreateTabs() {
#ifdef JENKINS
buildConfig->Add(new InfoItem(si->T("Built by"), "Jenkins"));
#endif
#ifdef ANDROID_LEGACY
buildConfig->Add(new InfoItem("ANDROID_LEGACY", ""));
#endif
#ifdef _DEBUG
buildConfig->Add(new InfoItem("_DEBUG", ""));
#else
Expand Down
28 changes: 27 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ android {
vr {
manifest.srcFile 'VRManifest.xml'
}
legacy {
res.srcDirs = ['legacy/res']
}
}
productFlavors {
normal {
Expand Down Expand Up @@ -161,6 +164,25 @@ android {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
}
}
legacy {
applicationId 'org.ppsspp.ppsspplegacy'
dimension "variant"
targetSdkVersion 29 // This is the point of legacy.
externalNativeBuild {
cmake {
// Available arguments listed at https://developer.android.com/ndk/guides/cmake.html
arguments '-DANDROID=true',
'-DANDROID_PLATFORM=android-16',
'-DANDROID_TOOLCHAIN=clang',
'-DANDROID_CPP_FEATURES=',
'-DANDROID_STL=c++_static',
'-DANDROID_LEGACY=TRUE'
}
}
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}
vr {
applicationId 'org.ppsspp.ppssppvr'
dimension "variant"
Expand All @@ -174,14 +196,17 @@ android {
'-DANDROID_CPP_FEATURES=',
'-DANDROID_STL=c++_static',
'-DANDROID_ARM_NEON=TRUE',
'-DOPENXR=TRUE'
'-DOPENXR=TRUE',
'-DANDROID_LEGACY=TRUE'
}
}
ndk {
abiFilters 'arm64-v8a'
}
}
}
// TODO: This is deprecated and needs a replacement. See https://stackoverflow.com/questions/67330818/android-gradle-plugin7-0-0-alpha15-removed-variantfilter-property-how-to-rest
// Though, not really that important.
variantFilter { variant ->
def needed = variant.name in [
'normalDebug', // for debugging
Expand All @@ -191,6 +216,7 @@ android {
'vrDebug', // for VR debugging
'vrOptimized', // for VR testing
'vrRelease', // for VR releases
'legacyOptimized', // for legacy releases
]
variant.setIgnore(!needed)
}
Expand Down
39 changes: 39 additions & 0 deletions android/legacy/conv_color.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# Wirtten by ChatGPT

# Define the base directory to start the search
BASE_DIR="$1"

# Check if the base directory is provided and exists
if [ -z "$BASE_DIR" ]; then
echo "Usage: $0 /path/to/directory"
exit 1
fi

if [ ! -d "$BASE_DIR" ]; then
echo "Directory $BASE_DIR does not exist."
exit 1
fi

# Function to process images
process_image() {
local image_path="$1"

# Define output path (can be modified to save to a different location)
local output_path="$1" # ${image_path%.*}_tinted.${image_path##*.}"

# Apply the tint and darkening
convert "$image_path" \
-modulate 80,50,55 \
"$output_path"

echo "Processed $image_path -> $output_path"
}

export -f process_image

# Find and process image files
find "$BASE_DIR" -type f \( -iname '*.png' \) -exec bash -c 'process_image "$0"' {} \;

echo "Image processing completed."
3 changes: 3 additions & 0 deletions android/legacy/icon_color.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# How to create legacy icons from regular icons

convert ic_launcher.png -modulate 80,50,55 ic_launcher.png
Binary file added android/legacy/res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/legacy/res/drawable-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/legacy/res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/legacy/res/drawable-xhdpi/tv_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions android/legacy/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions android/legacy/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file added android/legacy/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/legacy/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/legacy/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/legacy/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions android/legacy/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#404040</color>
</resources>
4 changes: 4 additions & 0 deletions android/legacy/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">PPSSPP Legacy</string>
</resources>
Binary file removed android/res/drawable-xhdpi/ouya_icon.png
Binary file not shown.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.5.1'
classpath 'com.android.tools.build:gradle:8.5.2'
}
}

Expand Down