add patch for nesoid

This commit is contained in:
David Black 2012-09-06 18:10:57 +01:00
parent e35f36bef6
commit d51e929e44
2 changed files with 119 additions and 2 deletions

View file

@ -13,9 +13,8 @@ who in turn used code of FCEUltra (currently known as FCEUX).
Repo Type:git Repo Type:git
Repo:git://git.code.sf.net/p/nesoid/code Repo:git://git.code.sf.net/p/nesoid/code
Build Version:2.5,61,2.5,subdir=Nesoid,buildjni=yes,submodules=yes,target=android-10 Build Version:2.5,61,2.5,subdir=Nesoid,buildjni=yes,submodules=yes,target=android-15,patch=target_api_10.diff
Update Check Mode:RepoManifest Update Check Mode:RepoManifest
Current Version:2.5 Current Version:2.5
Current Version Code:61 Current Version Code:61

View file

@ -0,0 +1,118 @@
diff -Naur Nesoid.pristine/Nesoid/AndroidManifest.xml Nesoid.new/Nesoid/AndroidManifest.xml
--- Nesoid.pristine/Nesoid/AndroidManifest.xml 2012-06-28 11:24:39.728928405 +1100
+++ Nesoid.new/Nesoid/AndroidManifest.xml 2012-06-28 14:25:18.930194334 +1100
@@ -4,7 +4,7 @@
android:versionName="2.5"
android:installLocation="preferExternal">
- <uses-sdk android:minSdkVersion="3" />
+ <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="10"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
@@ -14,7 +14,8 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:label="@string/app_label"
- android:icon="@drawable/app_icon">
+ android:icon="@drawable/app_icon" android:hardwareAccelerated="true"
+ android:theme="@style/MyTheme">
<activity android:name="MainActivity"
android:configChanges="orientation|keyboardHidden">
diff -Naur Nesoid.pristine/Nesoid/res/values/themes.xml Nesoid.new/Nesoid/res/values/themes.xml
--- Nesoid.pristine/Nesoid/res/values/themes.xml 1970-01-01 10:00:00.000000000 +1000
+++ Nesoid.new/Nesoid/res/values/themes.xml 2012-06-28 12:13:04.642987859 +1100
@@ -0,0 +1,5 @@
+<resources>
+ <style name="MyTheme" parent="@android:style/Theme">
+ <!-- Any customizations for your app running on pre-3.0 devices here -->
+ </style>
+</resources>
diff -Naur Nesoid.pristine/Nesoid/res/values-v11/themes.xml Nesoid.new/Nesoid/res/values-v11/themes.xml
--- Nesoid.pristine/Nesoid/res/values-v11/themes.xml 1970-01-01 10:00:00.000000000 +1000
+++ Nesoid.new/Nesoid/res/values-v11/themes.xml 2012-06-28 12:13:34.089492940 +1100
@@ -0,0 +1,5 @@
+<resources>
+ <style name="MyTheme" parent="@android:style/Theme.Holo">
+ <!-- Any customizations for your app running on devices with Theme.Holo here -->
+ </style>
+</resources>
diff -Naur Nesoid.pristine/Nesoid/res/values-v14/themes.xml Nesoid.new/Nesoid/res/values-v14/themes.xml
--- Nesoid.pristine/Nesoid/res/values-v14/themes.xml 1970-01-01 10:00:00.000000000 +1000
+++ Nesoid.new/Nesoid/res/values-v14/themes.xml 2012-06-28 12:14:36.515817043 +1100
@@ -0,0 +1,5 @@
+<resources>
+ <style name="MyTheme" parent="@android:style/Theme.DeviceDefault">
+ <!-- Any customizations for your app running on devices with Theme.Holo here -->
+ </style>
+</resources>
diff -Naur Nesoid.pristine/Nesoid/src/com/androidemu/nes/EmulatorService.java Nesoid.new/Nesoid/src/com/androidemu/nes/EmulatorService.java
--- Nesoid.pristine/Nesoid/src/com/androidemu/nes/EmulatorService.java 2012-06-28 11:24:40.682256521 +1100
+++ Nesoid.new/Nesoid/src/com/androidemu/nes/EmulatorService.java 2012-06-28 12:05:08.782265676 +1100
@@ -49,9 +49,10 @@
private NotificationManager mNM;
private Method mStartForeground;
private Method mStopForeground;
+ private Method mSetForeground = null;
private Object[] mStartForegroundArgs = new Object[2];
private Object[] mStopForegroundArgs = new Object[1];
-
+
@Override
public void onCreate() {
mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
@@ -63,6 +64,11 @@
} catch (NoSuchMethodException e) {
// Running on an older platform.
mStartForeground = mStopForeground = null;
+ try {
+ mSetForeground = getClass().getMethod("setForeground", mStopForegroundSignature);
+ } catch (NoSuchMethodException crap) {
+ Log.w(LOG_TAG, "OS doesn't have Service.startForeground OR Service.setForeground!", crap);
+ }
}
}
@@ -128,7 +134,19 @@
}
// Fall back on the old API.
- setForeground(true);
+ if (mSetForeground != null) {
+ mStopForegroundArgs[0] = Boolean.TRUE;
+ try {
+ mSetForeground.invoke(this, mStopForegroundArgs);
+ } catch (InvocationTargetException e) {
+ // Should not happen.
+ Log.w(LOG_TAG, "Unable to invoke setForeground", e);
+ } catch (IllegalAccessException e) {
+ // Should not happen.
+ Log.w(LOG_TAG, "Unable to invoke setForeground", e);
+ }
+ return;
+ }
mNM.notify(id, notification);
}
@@ -155,7 +173,19 @@
// Fall back on the old API. Note to cancel BEFORE changing the
// foreground state, since we could be killed at that point.
mNM.cancel(id);
- setForeground(false);
+ if (mSetForeground != null) {
+ mStopForegroundArgs[0] = Boolean.FALSE;
+ try {
+ mSetForeground.invoke(this, mStopForegroundArgs);
+ } catch (InvocationTargetException e) {
+ // Should not happen.
+ Log.w(LOG_TAG, "Unable to invoke setForeground", e);
+ } catch (IllegalAccessException e) {
+ // Should not happen.
+ Log.w(LOG_TAG, "Unable to invoke setForeground", e);
+ }
+ return;
+ }
}
@Override