Forráskód Böngészése

add new system support nes

ZengGengSen 2 éve
szülő
commit
8dd5fcaac5

+ 12 - 2
app/build.gradle

@@ -13,10 +13,15 @@ android {
         versionName "1.0"
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+
+        ndk{
+            abiFilters  "x86_64","arm64-v8a"
+        }
     }
+
     sourceSets {
         main {
-            jniLibs.srcDirs 'src/main/libs'
+            // jniLibs.srcDirs 'src/main/libs'
             assets.srcDirs = ['src/main/assets']
             jni.srcDirs = []
             java.srcDirs = ['src/main/java']
@@ -32,10 +37,15 @@ android {
         sourceCompatibility JavaVersion.VERSION_1_8
         targetCompatibility JavaVersion.VERSION_1_8
     }
+
+    externalNativeBuild {
+        cmake {
+            path 'src/main/cpp/CMakeLists.txt'
+        }
+    }
 }
 
 dependencies {
-
     implementation 'androidx.appcompat:appcompat:1.3.0'
     implementation 'com.google.android.material:material:1.4.0'
     implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

+ 4 - 9
app/src/main/java/com/retroarch/browser/retroactivity/RetroActivityCommon.java

@@ -463,13 +463,11 @@ public class RetroActivityCommon extends NativeActivity
     PlayCoreManager.getInstance().deleteCore(coreName);
   }
 
-
-
   /////////////// JNI methods ///////////////
-public native void clickBack();
-
-
-
+  /**
+   * 点击返回时,退出库
+   */
+  public native void clickBack();
 
   /**
    * Called when a core install is initiated.
@@ -493,9 +491,6 @@ public native void clickBack();
 
 
   /////////////// Private methods ///////////////
-
-
-
   /**
    * Sanitizes a core name so that it can be used when dealing with
    * Dynamic Feature Modules. Needed because Gradle modules cannot use

+ 15 - 1
app/src/main/java/com/xugame/gameconsole/TextCopyFileActivity.java

@@ -30,7 +30,7 @@ import java.io.InputStream;
 
 public class TextCopyFileActivity extends Activity {
     private static final String TAG = "TextCopyFileActivity";
-    private Button btn1, btn2;
+    private Button btn1, btn2, btn3;
     private Context mContext;
 
     @Override
@@ -72,6 +72,7 @@ public class TextCopyFileActivity extends Activity {
     private void init() {
         btn1 = findViewById(R.id.btn1);
         btn2 = findViewById(R.id.btn2);
+        btn3 = findViewById(R.id.btn3);
         btn1.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
@@ -90,6 +91,15 @@ public class TextCopyFileActivity extends Activity {
 
             }
         });
+        btn3.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startGame(Environment.getExternalStorageDirectory().getAbsolutePath() + "/arcade/rom/super_mario_bros_world.nes",
+                        mContext.getFilesDir().getParent() + "/cores/mesen_libretro_android.so",
+                        EmulatorType.NES);
+
+            }
+        });
     }
 
     private void startGame(String rompath, String corepath, EmulatorType Type) {
@@ -109,6 +119,9 @@ public class TextCopyFileActivity extends Activity {
                 case NEOGEO:
                     coreName = "fbalpha2012_neogeo_libretro_android.so";
                     break;
+                case NES:
+                    coreName = "mesen_libretro_android.so";
+                    break;
             }
             if (!TextUtils.isEmpty(coreName))
                 startCopy(coreName,
@@ -174,6 +187,7 @@ public class TextCopyFileActivity extends Activity {
         try {
             InputStream in = null;
             in = this.getResources().getAssets().open("cores/"+fileName);
+//            in = openFileInput("/storage/emulated/0/arcade/cores/" + fileName);
             BufferedOutputStream outStream
                     = new BufferedOutputStream(new FileOutputStream(file_path, false));
             byte[] buffer = new byte[1024];

+ 1 - 0
app/src/main/java/com/xugame/gameconsole/emulator/EmulatorType.java

@@ -1,6 +1,7 @@
 package com.xugame.gameconsole.emulator;
 
 public enum EmulatorType {
+    NES,
     NEOGEO,
     CPS1,
     CPS2,

+ 8 - 0
app/src/main/res/layout/textcopp_layout.xml

@@ -15,4 +15,12 @@
         android:layout_width="wrap_content"
         android:text="GIGAWing"
         android:layout_height="wrap_content"></Button>
+
+    <Button
+        android:id="@+id/btn3"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/btn1"
+        android:layout_marginTop="54dp"
+        android:text="Super Mario"></Button>
 </RelativeLayout>

+ 8 - 13
gradle.properties

@@ -1,21 +1,16 @@
-# Project-wide Gradle settings.
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-# For more details on how to configure your build environment visit
+## For more details on how to configure your build environment visit
 # http://www.gradle.org/docs/current/userguide/build_environment.html
+#
 # Specifies the JVM arguments used for the daemon process.
 # The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# Default value: -Xmx1024m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+#
 # When configured, Gradle will run in incubating parallel mode.
 # This option should only be used with decoupled projects. More details, visit
 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
 # org.gradle.parallel=true
-# AndroidX package structure to make it clearer which packages are bundled with the
-# Android operating system, and which are packaged with your app"s APK
-# https://developer.android.com/topic/libraries/support-library/androidx-rn
+#Fri Jun 09 15:06:28 CST 2023
+android.nonTransitiveRClass=true
+org.gradle.jvmargs=-Xmx1536M -Dkotlin.daemon.jvm.options\="-Xmx1536M" -Dfile.encoding\=UTF-8
 android.useAndroidX=true
-# Enables namespacing of each library's R class so that its R class includes only the
-# resources declared in the library itself and none from the library's dependencies,
-# thereby reducing the size of the R class for that library
-android.nonTransitiveRClass=true