changeset 1843:13abdc98379e mame_interp

Get Android build target working on mame_interp branch
author Michael Pavone <pavone@retrodev.com>
date Thu, 18 Apr 2019 22:06:47 -0700
parents 49f65d240299
children
files Android.mk android/jni/Android.mk android/jni/Application.mk android/src/org/libsdl/app/SDLActivity.java musashi/m68kcpu.h nuklear_ui/font_android.c nuklear_ui/nuklear.h
diffstat 7 files changed, 31 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/Android.mk	Sun Apr 14 23:38:02 2019 -0700
+++ b/Android.mk	Thu Apr 18 22:06:47 2019 -0700
@@ -8,12 +8,12 @@
 
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include
 
-LOCAL_CFLAGS += -std=gnu99 -DX86_32 -DUSE_GLES
+LOCAL_CFLAGS += -std=gnu99 -DUSE_GLES
 
 # Add your application source files here...
 LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \
-	68kinst.c debug.c gst.c psg.c z80_to_x86.c backend.c io.c render_sdl.c \
-	tern.c backend_x86.c gdb_remote.c m68k_core.c romdb.c m68k_core_x86.c \
+	68kinst.c psg.c z80.c backend.c io.c render_sdl.c \
+	tern.c m68k_core.c musashi/m68kops.c musashi/m68kcpu.c \
 	util.c wave.c blastem.c gen.c mem.c vdp.c ym2612.c config.c gen_x86.c \
 	terminal.c z80inst.c menu.c arena.c zlib/adler32.c zlib/compress.c \
 	zlib/crc32.c zlib/deflate.c zlib/gzclose.c zlib/gzlib.c zlib/gzread.c \
@@ -22,7 +22,7 @@
 	nuklear_ui/font_android.c nuklear_ui/blastem_nuklear.c nuklear_ui/sfnt.c \
 	ppm.c controller_info.c png.c system.c genesis.c sms.c serialize.c \
 	saves.c hash.c xband.c zip.c bindings.c jcart.c paths.c megawifi.c \
-	nor.c i2c.c sega_mapper.c realtec.c multi_game.c net.c
+	nor.c i2c.c sega_mapper.c realtec.c multi_game.c net.c romdb.c 
 
 LOCAL_SHARED_LIBRARIES := SDL2
 
--- a/android/jni/Android.mk	Sun Apr 14 23:38:02 2019 -0700
+++ b/android/jni/Android.mk	Thu Apr 18 22:06:47 2019 -0700
@@ -1,2 +1,1 @@
-APP_ABI=x86
 include $(call all-subdir-makefiles)
--- a/android/jni/Application.mk	Sun Apr 14 23:38:02 2019 -0700
+++ b/android/jni/Application.mk	Thu Apr 18 22:06:47 2019 -0700
@@ -3,6 +3,5 @@
 # See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
 # APP_STL := stlport_static 
 
-APP_ABI := x86
 APP_PLATFORM := android-16
 APP_OPTIM := release
--- a/android/src/org/libsdl/app/SDLActivity.java	Sun Apr 14 23:38:02 2019 -0700
+++ b/android/src/org/libsdl/app/SDLActivity.java	Thu Apr 18 22:06:47 2019 -0700
@@ -4,6 +4,7 @@
 import java.io.InputStream;
 import java.util.Arrays;
 import java.lang.reflect.Method;
+import java.lang.NullPointerException;
 import java.util.Objects;
 
 import android.app.*;
@@ -195,7 +196,12 @@
         SDL.setContext(this);
 
         if (Build.VERSION.SDK_INT >= 11) {
-            mClipboardHandler = new SDLClipboardHandler_API11();
+			try {
+				mClipboardHandler = new SDLClipboardHandler_API11();
+			} catch (NullPointerException e) {
+				//deal with shitty emulation boxes
+				mClipboardHandler = new SDLClipboardHandler_Old();
+			}
         } else {
             /* Before API 11, no clipboard notification (eg no SDL_CLIPBOARDUPDATE) */
             mClipboardHandler = new SDLClipboardHandler_Old();
--- a/musashi/m68kcpu.h	Sun Apr 14 23:38:02 2019 -0700
+++ b/musashi/m68kcpu.h	Thu Apr 18 22:06:47 2019 -0700
@@ -510,12 +510,6 @@
 /* =============================== PROTOTYPES ============================= */
 /* ======================================================================== */
 
-union fp_reg
-{
-	uint64_t i;
-	double f;
-};
-
 void m68ki_exception_interrupt(m68000_base_device *m68k, uint32_t int_level);
 
 
--- a/nuklear_ui/font_android.c	Sun Apr 14 23:38:02 2019 -0700
+++ b/nuklear_ui/font_android.c	Thu Apr 18 22:06:47 2019 -0700
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <limits.h>
+#include <string.h>
 #include "../util.h"
 #include "../paths.h"
 #include "sfnt.h"
@@ -186,9 +187,9 @@
 	}
 error:
 	//try some likely suspects if we failed to parse fonts.xml or failed to find the indicated font
-	ret = try_load_font("/system/fonts/Roboto-Regular.ttf", size_out);
+	ret = try_load_font(strdup("/system/fonts/Roboto-Regular.ttf"), size_out);
 	if (!ret) {
-		ret = try_load_font("/system/fonts/DroidSans.ttf", size_out);
+		ret = try_load_font(strdup("/system/fonts/DroidSans.ttf"), size_out);
 	}
 	return ret;
 }
--- a/nuklear_ui/nuklear.h	Sun Apr 14 23:38:02 2019 -0700
+++ b/nuklear_ui/nuklear.h	Thu Apr 18 22:06:47 2019 -0700
@@ -5557,23 +5557,35 @@
 {
     /* 32-Bit MurmurHash3: https://code.google.com/p/smhasher/wiki/MurmurHash3*/
     #define NK_ROTL(x,r) ((x) << (r) | ((x) >> (32 - r)))
-    union {const nk_uint *i; const nk_byte *b;} conv = {0};
     const nk_byte *data = (const nk_byte*)key;
     const int nblocks = len/4;
     nk_uint h1 = seed;
     const nk_uint c1 = 0xcc9e2d51;
     const nk_uint c2 = 0x1b873593;
     const nk_byte *tail;
+#if defined(X86_32) || defined(X86_64)
     const nk_uint *blocks;
+#else
+	const nk_byte *blocks;
+#endif
     nk_uint k1;
     int i;
 
     /* body */
     if (!key) return 0;
-    conv.b = (data + nblocks*4);
-    blocks = (const nk_uint*)conv.i;
-    for (i = -nblocks; i; ++i) {
-        k1 = blocks[i];
+#if defined(X86_32) || defined(X86_64)
+    blocks = (const nk_uint*)(data + nblocks*4);
+	for (i = -nblocks; i; ++i) {
+		k1 = blocks[i];
+#else
+	blocks = data + nblocks*4;
+	for (i = -4 * nblocks; i; ++i) {
+		k1 = blocks[i++] << 24;
+		k1 |= blocks[i++] << 16;
+		k1 |= blocks[i++] << 8;
+		k1 |= blocks[i] << 16;
+#endif
+        
         k1 *= c1;
         k1 = NK_ROTL(k1,15);
         k1 *= c2;