Skip to content

Commit

Permalink
Updated release 1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
seleuco committed Sep 14, 2020
1 parent dd21091 commit a2b818a
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 27 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.seleuco.mame4droid"
minSdkVersion 9
targetSdkVersion 30
versionCode 46
versionName '1.15'
versionCode 48
versionName '1.15.2'
setProperty("archivesBaseName", "MAME4droid 0.139u1-$versionName")
ndk {
moduleName "mame4droid-jni"
Expand Down
62 changes: 42 additions & 20 deletions app/src/main/java/com/seleuco/mame4droid/Emulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import android.view.View;
import android.widget.Toast;

import com.seleuco.mame4droid.helpers.DialogHelper;
import com.seleuco.mame4droid.helpers.PrefsHelper;
import com.seleuco.mame4droid.views.EmulatorViewGL;

Expand Down Expand Up @@ -676,31 +677,52 @@ public void run() {
//android.os.Debug.waitForDebugger();
Uri _uri = intent.getData();
System.out.println("URI: "+_uri.toString());
boolean error = false;

String filePath = null;
Log.d("","URI = "+ _uri);
if (_uri != null && "content".equals(_uri.getScheme())) {
Cursor cursor = mm.getContentResolver().query(_uri, new String[] { android.provider.MediaStore.Images.ImageColumns.DATA }, null, null, null);
cursor.moveToFirst();
filePath = cursor.getString(0);
cursor.close();
} else {
filePath = _uri.getPath();
try {
if (_uri != null && "content".equals(_uri.getScheme())) {
Cursor cursor = mm.getContentResolver().query(_uri, new String[]{android.provider.MediaStore.Images.ImageColumns.DATA}, null, null, null);
cursor.moveToFirst();
filePath = cursor.getString(0);
cursor.close();
} else {
filePath = _uri.getPath();
}
}catch(Exception e){
error = true;
}

java.io.File f = new java.io.File(filePath);
final String name = f.getName();
String path = f.getAbsolutePath().substring(0,f.getAbsolutePath().lastIndexOf(File.separator));
Emulator.setValueStr(Emulator.ROM_NAME, name);
Emulator.setValueStr(Emulator.ROM_PATH, path);
System.out.println("XX name: "+name);
System.out.println("XX path: "+path);
extROM = true;
mm.runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(mm, "MAME4droid (0.139) "+ versionName +" by David Valdeita (Seleuco). Launching: "+name, Toast.LENGTH_LONG).show();
}
});
if(filePath==null)
error = true;

if(error)
{
mm.runOnUiThread(new Runnable() {
public void run() {
mm.getDialogHelper().setInfoMsg("Error opening file...");
mm.showDialog(DialogHelper.DIALOG_INFO);
}
});
}
else {

java.io.File f = new java.io.File(filePath);
final String name = f.getName();
String path = f.getAbsolutePath().substring(0, f.getAbsolutePath().lastIndexOf(File.separator));
Emulator.setValueStr(Emulator.ROM_NAME, name);
Emulator.setValueStr(Emulator.ROM_PATH, path);
System.out.println("XX name: " + name);
System.out.println("XX path: " + path);
extROM = true;

mm.runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(mm, "MAME4droid (0.139) " + versionName + " by David Valdeita (Seleuco). Launching: " + name, Toast.LENGTH_LONG).show();
}
});
}
}
else
{
Expand Down
10 changes: 7 additions & 3 deletions app/src/main/java/com/seleuco/mame4droid/helpers/MainHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -696,29 +696,33 @@ public void updateMAME4droid() {
/*
https://stackoverflow.com/questions/7199492/what-are-the-aspect-ratios-for-all-android-phone-and-tablet-devices
asus rog --> 2160x1080 18:9
oneplus 6 --> 2280x1080 19:9 6.28
oneplus 7 --> 2340x1080 19.5:9 6.21
oneplus 8 --> 2400x1080 20.9 6.55
oneplus 8 pro --> 3168x1440 19.8:9 6.78
galaxy sde --> 2560x1600 16:10
19.8:9 -> 2.2
20/9 -> 2,22222
19.5:9 -> 2,16666
19/9 -> 2,11111
18/9 -> 2
16/9 -> 1,7
5/3 -> 1,6666
4/3 -> 1,3
*/
// System.out.println("--->>> "+w+" "+h+ " "+w/h+ " "+ (float)(16.0/9.0));
float ar = w / h;
if ( ar >= (float) (19.0 / 9.0)) {
if ( ar >= (float) (18.0 / 9.0)) {
System.out.println("--->>> ULTRA WIDE");
inputHandler.readControllerValues(R.raw.controller_landscape_19_9);
} else if ( ar >= (float) (16.0 / 9.0) && ar < (float) (19.0 / 9.0)){
} else if ( ar >= (float) (16.0 / 9.0) && ar < (float) (18.0 / 9.0)){
System.out.println("--->>> WIDE");
inputHandler.readControllerValues(R.raw.controller_landscape_16_9);
}
else {
else { //5 : 3
System.out.println("--->>> NORMAL");
inputHandler.readControllerValues(R.raw.controller_landscape);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,14 @@ public InputHandler(MAME4droid value){
public static Boolean hasMethodControllerNumber = false;
public static int getGamePadId(InputDevice id)
{
int iDeviceId = id.getId();
int iDeviceId = 0;
int iControllerNumber = 0;


try{
iDeviceId = id.getId();
} catch (Exception e) {
}

if(hasMethodControllerNumber) { // upper android 4.4
try {
Method method = id.getClass().getMethod("getControllerNumber");
Expand Down
Binary file modified app/src/main/jniLibs/armeabi-v7a/libMAME4droid.so
Binary file not shown.

0 comments on commit a2b818a

Please sign in to comment.