Initial work to make MAME work on Android [Miodrag Milanovic]

This commit is contained in:
Miodrag Milanovic 2016-03-27 14:06:51 +02:00
parent 5640305d0e
commit 158c90cf11
37 changed files with 2197 additions and 58 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@
/*
/*/
!/3rdparty/
!/android-project/
!/benchmarks/
!/artwork/
!/bgfx/

7
android-project/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
.idea
.gradle
local.properties
*.iml
*.so
*.apk
build

View File

@ -0,0 +1,29 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 18
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "org.mamedev.mame"
minSdkVersion 18
targetSdkVersion 18
ndk {
moduleName 'main'
}
}
sourceSets.main {
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Replace org.libsdl.app with the identifier of your game below, e.g.
com.gamemaker.game
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mamedev.mame"
android:versionCode="1"
android:versionName="0.137"
android:installLocation="auto">
<!-- Android 4.0 -->
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14" />
<!-- OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" />
<!-- Allow writing to external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Create a Java class extending SDLActivity and place it in a
directory under src matching the package, e.g.
src/com/gamemaker/game/MyGame.java
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
in the XML below.
An example Java class can be found in README-android.txt
-->
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:allowBackup="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true" >
<activity android:name="MAME"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Drop file event -->
<!--
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
-->
</activity>
</application>
</manifest>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
package org.mamedev.mame;
import org.libsdl.app.SDLActivity;
/**
SDL Activity
*/
public class MAME extends SDLActivity {
}

View File

@ -0,0 +1 @@
*.so

View File

@ -0,0 +1 @@
*.so

View File

@ -0,0 +1 @@
*.so

View File

@ -0,0 +1 @@
*.so

View File

@ -0,0 +1 @@
*.so

View File

@ -0,0 +1 @@
*.so

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, SDLActivity"
/>
</LinearLayout>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MAME</string>
</resources>

View File

@ -0,0 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

164
android-project/gradlew vendored Normal file
View File

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
android-project/gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1 @@
include ':app'

View File

@ -978,145 +978,145 @@ endif
# android-arm
#-------------------------------------------------
$(PROJECTDIR_MINI)/gmake-android-arm/Makefile: makefile $(SCRIPTS) $(GENIE)
$(PROJECTDIR_SDL)/gmake-android-arm/Makefile: makefile $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_ARM
$(error ANDROID_NDK_ARM is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-arm --gcc_version=3.8.0 --osd=osdmini --targetos=android-arm --targetos=android --PLATFORM=arm --NOASM=1 gmake
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-arm --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=arm --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 --NOASM=1 gmake
.PHONY: android-arm
android-arm: generate $(PROJECTDIR_MINI)/gmake-android-arm/Makefile
android-arm: generate $(PROJECTDIR_SDL)/gmake-android-arm/Makefile
ifndef ANDROID_NDK_ARM
$(error ANDROID_NDK_ARM is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-arm config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-arm config=$(CONFIG)
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-arm config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-arm config=$(CONFIG)
#-------------------------------------------------
# android-arm64
#-------------------------------------------------
$(PROJECTDIR_MINI)/gmake-android-arm64/Makefile: makefile $(SCRIPTS) $(GENIE)
$(PROJECTDIR_SDL)/gmake-android-arm64/Makefile: makefile $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_ARM64
$(error ANDROID_NDK_ARM64 is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-arm64 --gcc_version=3.8.0 --osd=osdmini --targetos=android-arm64 --targetos=android --PLATFORM=arm64 --NOASM=1 gmake
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-arm64 --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=arm64 --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 --NOASM=1 gmake
.PHONY: android-arm64
android-arm64: generate $(PROJECTDIR_MINI)/gmake-android-arm64/Makefile
android-arm64: generate $(PROJECTDIR_SDL)/gmake-android-arm64/Makefile
ifndef ANDROID_NDK_ARM64
$(error ANDROID_NDK_ARM64 is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-arm64 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-arm64 config=$(CONFIG)
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-arm64 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-arm64 config=$(CONFIG)
#-------------------------------------------------
# android-mips
#-------------------------------------------------
$(PROJECTDIR_MINI)/gmake-android-mips/Makefile: makefile $(SCRIPTS) $(GENIE)
$(PROJECTDIR_SDL)/gmake-android-mips/Makefile: makefile $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_MIPS
$(error ANDROID_NDK_MIPS is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-mips --gcc_version=3.8.0 --osd=osdmini --targetos=android-mips --targetos=android --PLATFORM=mips --NOASM=1 gmake
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-mips --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=mips --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 --NOASM=1 gmake
.PHONY: android-mips
android-mips: generate $(PROJECTDIR_MINI)/gmake-android-mips/Makefile
android-mips: generate $(PROJECTDIR_SDL)/gmake-android-mips/Makefile
ifndef ANDROID_NDK_MIPS
$(error ANDROID_NDK_MIPS is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-mips config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-mips config=$(CONFIG)
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-mips config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-mips config=$(CONFIG)
#-------------------------------------------------
# android-mips64
#-------------------------------------------------
$(PROJECTDIR_MINI)/gmake-android-mips64/Makefile: makefile $(SCRIPTS) $(GENIE)
$(PROJECTDIR_SDL)/gmake-android-mips64/Makefile: makefile $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_MIPS64
$(error ANDROID_NDK_MIPS64 is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-mips64 --gcc_version=3.8.0 --osd=osdmini --targetos=android-mips64 --targetos=android --PLATFORM=mips64 --NOASM=1 gmake
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-mips64 --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=mips64 --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 --NOASM=1 gmake
.PHONY: android-mips64
android-mips64: generate $(PROJECTDIR_MINI)/gmake-android-mips64/Makefile
android-mips64: generate $(PROJECTDIR_SDL)/gmake-android-mips64/Makefile
ifndef ANDROID_NDK_MIPS64
$(error ANDROID_NDK_MIPS64 is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-mips64 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-mips64 config=$(CONFIG)
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-mips64 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-mips64 config=$(CONFIG)
#-------------------------------------------------
# android-x86
#-------------------------------------------------
$(PROJECTDIR_MINI)/gmake-android-x86/Makefile: makefile $(SCRIPTS) $(GENIE)
$(PROJECTDIR_SDL)/gmake-android-x86/Makefile: makefile $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_X86
$(error ANDROID_NDK_X86 is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-x86 --gcc_version=3.8.0 --osd=osdmini --targetos=android-x86 --targetos=android --PLATFORM=x86 gmake
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-x86 --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=x86 --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 gmake
.PHONY: android-x86
android-x86: generate $(PROJECTDIR_MINI)/gmake-android-x86/Makefile
android-x86: generate $(PROJECTDIR_SDL)/gmake-android-x86/Makefile
ifndef ANDROID_NDK_X86
$(error ANDROID_NDK_X86 is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-x86 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-x86 config=$(CONFIG)
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-x86 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-x86 config=$(CONFIG)
#-------------------------------------------------
# android-x64
#-------------------------------------------------
$(PROJECTDIR_MINI)/gmake-android-x64/Makefile: makefile $(SCRIPTS) $(GENIE)
$(PROJECTDIR_SDL)/gmake-android-x64/Makefile: makefile $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_X64
$(error ANDROID_NDK_X64 is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-x64 --gcc_version=3.8.0 --osd=osdmini --targetos=android-x64 --targetos=android --PLATFORM=x64 gmake
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-x64 --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=x64 --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 gmake
.PHONY: android-x64
android-x64: generate $(PROJECTDIR_MINI)/gmake-android-x64/Makefile
android-x64: generate $(PROJECTDIR_SDL)/gmake-android-x64/Makefile
ifndef ANDROID_NDK_X64
$(error ANDROID_NDK_X64 is not set)
endif
ifndef ANDROID_NDK_ROOT
$(error ANDROID_NDK_ROOT is not set)
endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-x64 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-x64 config=$(CONFIG)
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-x64 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-x64 config=$(CONFIG)
#-------------------------------------------------
# asmjs / Emscripten

View File

@ -1182,9 +1182,38 @@ end
if _OPTIONS["with-bundled-sdl2"] then
project "SDL2"
uuid "caab3327-574f-4abf-b25b-74d5238ae59b"
if _OPTIONS["targetos"]=="android" then
kind "SharedLib"
targetextension ".so"
targetprefix "lib"
links {
"GLESv1_CM",
"GLESv2",
"log",
}
if _OPTIONS["SEPARATE_BIN"]~="1" then
if _OPTIONS["PLATFORM"]=="arm" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/armeabi-v7a")
end
if _OPTIONS["PLATFORM"]=="arm64" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/arm64-v8a")
end
if _OPTIONS["PLATFORM"]=="mips" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/mips")
end
if _OPTIONS["PLATFORM"]=="mips64" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/mips64")
end
if _OPTIONS["PLATFORM"]=="x86" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/x86")
end
if _OPTIONS["PLATFORM"]=="x64" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/x86_64")
end
end
else
kind "StaticLib"
configuration { }
end
files {
MAME_DIR .. "3rdparty/SDL2/include/begin_code.h",
@ -1356,7 +1385,6 @@ project "SDL2"
MAME_DIR .. "3rdparty/SDL2/src/stdlib/SDL_qsort.c",
MAME_DIR .. "3rdparty/SDL2/src/stdlib/SDL_stdlib.c",
MAME_DIR .. "3rdparty/SDL2/src/stdlib/SDL_string.c",
MAME_DIR .. "3rdparty/SDL2/src/thread/generic/SDL_syscond.c",
MAME_DIR .. "3rdparty/SDL2/src/thread/SDL_systhread.h",
MAME_DIR .. "3rdparty/SDL2/src/thread/SDL_thread.c",
MAME_DIR .. "3rdparty/SDL2/src/thread/SDL_thread_c.h",
@ -1520,6 +1548,7 @@ project "SDL2"
if _OPTIONS["targetos"]=="windows" then
files {
MAME_DIR .. "3rdparty/SDL2/src/thread/generic/SDL_syscond.c",
MAME_DIR .. "3rdparty/SDL2/src/audio/directsound/SDL_directsound.c",
MAME_DIR .. "3rdparty/SDL2/src/audio/directsound/SDL_directsound.h",
MAME_DIR .. "3rdparty/SDL2/src/audio/winmm/SDL_winmm.c",

View File

@ -27,13 +27,17 @@ end
kind "ConsoleApp"
configuration { "android*" }
targetprefix "lib"
targetname "main"
targetextension ".so"
linkoptions {
"-shared",
}
links {
"EGL",
"GLESv1_CM",
"GLESv2",
"SDL2",
}
configuration { "pnacl" }
kind "ConsoleApp"
@ -132,8 +136,38 @@ end
configuration { }
if _OPTIONS["SEPARATE_BIN"]~="1" then
targetdir(MAME_DIR)
if _OPTIONS["targetos"]=="android" then
includedirs {
MAME_DIR .. "3rdparty/SDL2/include",
}
files {
MAME_DIR .. "3rdparty/SDL2/src/main/android/SDL_android_main.c",
}
if _OPTIONS["SEPARATE_BIN"]~="1" then
if _OPTIONS["PLATFORM"]=="arm" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/armeabi-v7a")
end
if _OPTIONS["PLATFORM"]=="arm64" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/arm64-v8a")
end
if _OPTIONS["PLATFORM"]=="mips" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/mips")
end
if _OPTIONS["PLATFORM"]=="mips64" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/mips64")
end
if _OPTIONS["PLATFORM"]=="x86" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/x86")
end
if _OPTIONS["PLATFORM"]=="x64" then
targetdir(MAME_DIR .. "android-project/app/src/main/libs/x86_64")
end
end
else
if _OPTIONS["SEPARATE_BIN"]~="1" then
targetdir(MAME_DIR)
end
end
findfunction("linkProjects_" .. _OPTIONS["target"] .. "_" .. _OPTIONS["subtarget"])(_OPTIONS["target"], _OPTIONS["subtarget"])

View File

@ -122,6 +122,12 @@ function osdmodulesbuild()
end
end
defines {
"__STDC_LIMIT_MACROS",
"__STDC_FORMAT_MACROS",
"__STDC_CONSTANT_MACROS",
}
files {
MAME_DIR .. "src/osd/modules/render/drawbgfx.cpp",
MAME_DIR .. "src/osd/modules/render/binpacker.cpp",

View File

@ -38,7 +38,7 @@ function maintargetosdoptions(_target,_subtarget)
}
end
if BASE_TARGETOS=="unix" and _OPTIONS["targetos"]~="macosx" then
if BASE_TARGETOS=="unix" and _OPTIONS["targetos"]~="macosx" and _OPTIONS["targetos"]~="android" then
links {
"SDL2_ttf",
}
@ -239,7 +239,7 @@ elseif _OPTIONS["targetos"]=="macosx" then
SDL_NETWORK = "pcap"
end
if _OPTIONS["with-bundled-sdl2"]~=nil then
if _OPTIONS["with-bundled-sdl2"]~=nil or _OPTIONS["targetos"]=="android" then
includedirs {
GEN_DIR .. "includes",
}
@ -295,7 +295,7 @@ if BASE_TARGETOS=="unix" then
"/usr/openwin/lib",
}
end
if _OPTIONS["with-bundled-sdl2"]~=nil then
if _OPTIONS["with-bundled-sdl2"]~=nil and _OPTIONS["targetos"]~="android" then
links {
"SDL2",
}
@ -305,7 +305,7 @@ if BASE_TARGETOS=="unix" then
addoptionsfromstring(str)
end
if _OPTIONS["targetos"]~="haiku" then
if _OPTIONS["targetos"]~="haiku" and _OPTIONS["targetos"]~="android" then
links {
"m",
"pthread",

View File

@ -88,7 +88,7 @@ public:
{
ssize_t result;
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(EMSCRIPTEN)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(EMSCRIPTEN) || defined(__ANDROID__)
result = ::pread(m_fd, buffer, size_t(count), off_t(std::make_unsigned_t<off_t>(offset)));
#elif defined(WIN32) || defined(SDLMAME_NO64BITIO)
if (lseek(m_fd, off_t(std::make_unsigned_t<off_t>(offset)), SEEK_SET) < 0)
@ -109,7 +109,7 @@ public:
{
ssize_t result;
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(EMSCRIPTEN)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(EMSCRIPTEN) || defined(__ANDROID__)
result = ::pwrite(m_fd, buffer, size_t(count), off_t(std::make_unsigned_t<off_t>(offset)));
#elif defined(WIN32) || defined(SDLMAME_NO64BITIO)
if (lseek(m_fd, off_t(std::make_unsigned_t<off_t>(offset)), SEEK_SET) < 0)
@ -130,7 +130,7 @@ public:
{
int result;
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(EMSCRIPTEN) || defined(WIN32) || defined(SDLMAME_NO64BITIO)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(EMSCRIPTEN) || defined(WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__)
result = ::ftruncate(m_fd, off_t(std::make_unsigned_t<off_t>(offset)));
#else
result = ::ftruncate64(m_fd, off64_t(offset));
@ -236,7 +236,7 @@ osd_file::error osd_file::open(std::string const &path, std::uint32_t openflags,
// attempt to open the file
int fd = -1;
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__)
fd = ::open(dst.c_str(), access, 0666);
#else
fd = ::open64(dst.c_str(), access, 0666);
@ -256,7 +256,7 @@ osd_file::error osd_file::open(std::string const &path, std::uint32_t openflags,
// attempt to reopen the file
if (error == osd_file::error::NONE)
{
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__)
fd = ::open(dst.c_str(), access, 0666);
#else
fd = ::open64(dst.c_str(), access, 0666);
@ -273,7 +273,7 @@ osd_file::error osd_file::open(std::string const &path, std::uint32_t openflags,
}
// get the file size
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__)
struct stat st;
if (::fstat(fd, &st) < 0)
#else
@ -340,7 +340,7 @@ int osd_get_physical_drive_geometry(const char *filename, UINT32 *cylinders, UIN
osd_directory_entry *osd_stat(const std::string &path)
{
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__)
struct stat st;
int const err = ::stat(path.c_str(), &st);
#else

View File

@ -22,7 +22,7 @@
#if defined(__FreeBSD__) || defined(__DragonFly__)
#include <termios.h>
#include <libutil.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__ANDROID__)
#include <termios.h>
#include <util.h>
#elif defined(__linux__) || defined(EMSCRIPTEN)
@ -141,7 +141,10 @@ osd_file::error posix_open_ptty(std::uint32_t openflags, osd_file::ptr &file, st
::close(masterfd);
return errno_to_file_error(err);
}
#else
#elif defined(__ANDROID__)
int masterfd = -1, slavefd = -1;
char slavepath[PATH_MAX];
#else
struct termios tios;
std::memset(&tios, 0, sizeof(tios));
::cfmakeraw(&tios);

View File

@ -8,7 +8,7 @@
#include "font_module.h"
#include "modules/osdmodule.h"
#if defined(SDLMAME_UNIX) && !defined(SDLMAME_MACOSX) && !defined(SDLMAME_SOLARIS) && !defined(SDLMAME_HAIKU)
#if defined(SDLMAME_UNIX) && !defined(SDLMAME_MACOSX) && !defined(SDLMAME_SOLARIS) && !defined(SDLMAME_HAIKU) && !defined(SDLMAME_ANDROID)
#include "corestr.h"
#include "corealloc.h"

View File

@ -5,10 +5,6 @@
// drawbgfx.cpp - BGFX renderer
//
//============================================================
#define __STDC_LIMIT_MACROS
#define __STDC_FORMAT_MACROS
#define __STDC_CONSTANT_MACROS
#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
// standard windows headers
#define WIN32_LEAN_AND_MEAN
@ -95,7 +91,7 @@ static void* sdlNativeWindowHandle(SDL_Window* _window)
return wmi.info.win.window;
# elif BX_PLATFORM_STEAMLINK
return wmi.info.vivante.window;
# elif BX_PLATFORM_EMSCRIPTEN
# elif BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_ANDROID
return nullptr;
# endif // BX_PLATFORM_
}

View File

@ -50,7 +50,7 @@
#define INVPATHSEPCH '\\'
#endif
#if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_HAIKU) || defined(SDLMAME_EMSCRIPTEN)
#if defined(SDLMAME_DARWIN) || defined(SDLMAME_WIN32) || defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_HAIKU) || defined(SDLMAME_EMSCRIPTEN) || defined(SDLMAME_ANDROID)
typedef struct dirent sdl_dirent;
typedef struct stat sdl_stat;
#define sdl_readdir readdir

View File

@ -10,7 +10,7 @@
#ifdef SDLMAME_UNIX
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_EMSCRIPTEN))
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_EMSCRIPTEN)) && (!defined(SDLMAME_ANDROID))
#ifndef SDLMAME_HAIKU
#include <fontconfig/fontconfig.h>
#endif
@ -202,7 +202,7 @@ int main(int argc, char *argv[])
#ifdef SDLMAME_UNIX
sdl_entered_debugger = 0;
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN)) && (!defined(SDLMAME_ANDROID))
FcInit();
#endif
#endif
@ -216,7 +216,7 @@ int main(int argc, char *argv[])
}
#ifdef SDLMAME_UNIX
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN)) && (!defined(SDLMAME_ANDROID))
if (!sdl_entered_debugger)
{
FcFini();

View File

@ -23,6 +23,12 @@
// MAME headers
#include "osdcore.h"
#ifdef SDLMAME_ANDROID
char *osd_get_clipboard_text(void)
{
return nullptr;
}
#else
//============================================================
// osd_get_clipboard_text
//============================================================
@ -40,3 +46,5 @@ char *osd_get_clipboard_text(void)
}
return result;
}
#endif

View File

@ -70,6 +70,10 @@
struct _IO_FILE {}; //_IO_FILE is an opaque type in the emscripten libc which makes clang cranky
#endif
#if defined(__ANDROID__)
#define SDLMAME_ANDROID 1
#endif
// fix for Ubuntu 8.10
#ifdef _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE