change storage location and app version

This commit is contained in:
2026-07-07 21:28:20 +02:00
parent 1a65c41458
commit 9d7f653cec
7 changed files with 99 additions and 14 deletions

11
.gitignore vendored
View File

@@ -58,6 +58,15 @@ google-services.json
# Android Profiling
*.hprof
# Signing key
*.key
# APK for release upload
*1_20*
# APK from recompile
*_fix*
out/
# Decompiled APK files
out*
# Savesates
save*
# Backups
*~

View File

@@ -1,12 +1,18 @@
# bejeweled-classic
## The issue
## The main issue
Bejewled Classic (v3.8.1) has issues with newer high resolution screens, which results in forced landscape mode. In some cases, the inputs are all over the place.
![](.res/Screenshot_20260609_224457_Classic.png)
## What's different
- [v2026.7.7] Changed storage location from `/data/app/0/...` to `/storage/emulated/0/Android/media/com.ea.gp.bej3/` for exposing the savestates and stored settings
- [v2026.6.10] Changed the `xlargeScreens` afrom `false` to `true` to fix the forced landscape issue
## Fix
### Download
[Download from releases]()
@@ -20,24 +26,30 @@ Bejewled Classic (v3.8.1) has issues with newer high resolution screens, which r
> - [apktool](https://apktool.org/docs/install) (newer versions do work better than what comes from the debian repos)
> - aapt
> - adb (optional)
> - [diff](https://man7.org/linux/man-pages/man1/diff.1.html) (optional)
> - [patch](https://man7.org/linux/man-pages/man1/patch.1.html) (optional if changes are applied by hand)
1. Download the apk or use the one which comes within this repo (I got it from [apkpure](https://apkpure.com/bejeweled-classic/com.ea.gp.bej3/download))
2. decompile the apk `apktool d bejeweled_classic_3.8.1.apk -o out`
3. edit the `out/AndroidManifest.xml` and change in the `<supports-screens>` section the value for the attribute `xlargeScreens` from `false` to `true`
4. Recompile the apk `apktool b out -o bejeweled_classic_3.8.1_fix.apk`
5. Generate a key to sign the apk
3. Run `sh apply_patch.sh`
4. Generate a key to sign the apk
- `keytool -genkeypair -keystore bejeweled-classic.key -alias mykey -keyalg RSA -keysize 2048 -validity 10000`
- Set a password for the key, for example using `openssl rand -hex 20`
- Answer every question, except the organisation (use anything like your nickname or whatever), with a `.` dot and finally confirm with `yes`
6. Sign the apk `apksigner sign --ks bejeweled-classic.key bejeweled_classic_3.8.1_fix.apk`
7. Install the `bejeweled_classic_3.8.1_fix.apk` by transfering it to your phone or via adb, make sure to uninstall the existing app beforehand
5. Recompile and sign the apk with `sh recompile_and_sign.sh`
- Alternativly run `sh recompile_and_install.sh` for directly installing it via adb
6. Install the `bejeweled_classic_3.8.1_fix.apk` by transfering it to your phone or via adb, make sure to uninstall the existing app beforehand
### XML Line
### Patching
```xml
<supports-screens android:largeScreens="true" android:normalScreens="true" android:requiresSmallestWidthDp="240" android:smallScreens="true" android:xlargeScreens="false"/>
#### Apply patch
```sh
sh apply_patch.sh
```
Needs to be changed to
```xml
<supports-screens android:largeScreens="true" android:normalScreens="true" android:requiresSmallestWidthDp="240" android:smallScreens="true" android:xlargeScreens="true"/>
```
#### Generate `changes.patch`
Decompile the same APK to `./out_orig/` and do you chancges in `./out/`
```sh
sh generate_patch_diff.sh
```
You may want to add a different app version like `android:versionCode='18101' android:versionName='3.8.1_2026.7.7'` to the `AndroidManifest.xml` file, otherwise the version which will be displayed in app info will be `3.8.1`.

2
apply_patch.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
cd out && patch -p1 < ../changes.patch && cd -

55
changes.patch Normal file
View File

@@ -0,0 +1,55 @@
diff -ru out_orig/AndroidManifest.xml out/AndroidManifest.xml
--- out_orig/AndroidManifest.xml 2026-07-07 19:54:08.644033630 +0200
+++ out/AndroidManifest.xml 2026-07-07 21:06:25.467129268 +0200
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:compileSdkVersion="34" android:compileSdkVersionCodename="14" android:installLocation="auto" package="com.ea.gp.bej3" platformBuildVersionCode="34" platformBuildVersionName="14">
- <supports-screens android:largeScreens="true" android:normalScreens="true" android:requiresSmallestWidthDp="240" android:smallScreens="true" android:xlargeScreens="false"/>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode='18101' android:versionName='3.8.1_2026.7.7' android:compileSdkVersion="34" android:compileSdkVersionCodename="14" android:installLocation="auto" package="com.ea.gp.bej3" platformBuildVersionCode="34" platformBuildVersionName="14">
+ <supports-screens android:largeScreens="true" android:normalScreens="true" android:requiresSmallestWidthDp="240" android:smallScreens="true" android:xlargeScreens="true"/>
<uses-feature android:glEsVersion="0x20000"/>
<queries>
<package android:name="com.ea.gp.bejeweledskies"/>
Nur in out/: build.
diff -ru out_orig/smali_classes2/com/ea/EAMIO/StorageDirectory.smali out/smali_classes2/com/ea/EAMIO/StorageDirectory.smali
--- out_orig/smali_classes2/com/ea/EAMIO/StorageDirectory.smali 2026-07-07 19:54:03.076990838 +0200
+++ out/smali_classes2/com/ea/EAMIO/StorageDirectory.smali 2026-07-07 20:24:46.756970752 +0200
@@ -20,35 +20,15 @@
.method public static GetInternalStorageDirectory()Ljava/lang/String;
.locals 1
- sget-object v0, Lcom/ea/EAMIO/StorageDirectory;->sActivity:Landroid/app/Activity;
-
- .line 30
- invoke-virtual {v0}, Landroid/app/Activity;->getFilesDir()Ljava/io/File;
-
- move-result-object v0
-
- invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;
-
- move-result-object v0
+ const-string v0, "/storage/emulated/0/Android/media/com.ea.gp.bej3/files_internal/"
return-object v0
.end method
.method public static GetPrimaryExternalStorageDirectory()Ljava/lang/String;
- .locals 2
-
- sget-object v0, Lcom/ea/EAMIO/StorageDirectory;->sActivity:Landroid/app/Activity;
-
- const/4 v1, 0x0
-
- .line 40
- invoke-virtual {v0, v1}, Landroid/app/Activity;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File;
-
- move-result-object v0
-
- invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;
+ .locals 1
- move-result-object v0
+ const-string v0, "/storage/emulated/0/Android/media/com.ea.gp.bej3/files_external/"
return-object v0
.end method

2
generate_patch_diff.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
diff -ru out_orig out/ > changes.patch

2
recompile_and_install.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
sh ./recompile_and_sign.sh && adb install bejeweled_classic_fix.apk

3
recompile_and_sign.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
apktool b out -o bejeweled_classic_fix.apk && \
apksigner sign --ks bejeweled-classic.key bejeweled_classic_fix.apk