Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android

Conflicts:
	todo.txt
This commit is contained in:
pelya
2016-03-17 12:20:07 +02:00
22 changed files with 84 additions and 49 deletions

3
.gitmodules vendored
View File

@@ -71,3 +71,6 @@
[submodule "project/jni/application/xserver/pulseaudio"]
path = project/jni/application/xserver/pulseaudio
url = git@github.com:pelya/pulseaudio-android.git
[submodule "project/jni/application/bochs/bochs"]
path = project/jni/application/bochs/bochs
url = git@github.com:lubomyr/bochs.git

View File

@@ -265,6 +265,20 @@ class DataDownloader extends Thread
if( ! matched )
throw new IOException();
Status.setText( res.getString(R.string.download_unneeded) );
for( int i = 1; i < downloadUrls.length; i++ )
{
if( downloadUrls[i].indexOf("obb:") == 0 ) // APK expansion file provided by Google Play
{
String url = getObbFilePath(downloadUrls[i]);
if (new File(url).length() > 256)
{
Writer writer = new OutputStreamWriter(new FileOutputStream(url), "UTF-8");
writer.write("Extracted and truncated\n");
writer.close();
Log.i("SDL", "Truncated file from expansion: " + url);
}
}
}
return true;
} catch ( IOException e ) {
forceOverwrite = true;
@@ -322,9 +336,7 @@ class DataDownloader extends Thread
Status.setText( downloadCount + "/" + downloadTotal + ": " + res.getString(R.string.connecting_to, url) );
if( url.indexOf("obb:") == 0 ) // APK expansion file provided by Google Play
{
url = url.substring("obb:".length());
url = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" +
Parent.getPackageName() + "/" + url + "." + Parent.getPackageName() + ".obb";
url = getObbFilePath(url);
InputStream stream1 = null;
try {
stream1 = new FileInputStream(url);
@@ -764,7 +776,13 @@ class DataDownloader extends Thread
{
return outFilesDir + "/" + filename;
};
private String getObbFilePath(final String url)
{
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/obb/" +
Parent.getPackageName() + "/" + url.substring("obb:".length()) + "." + Parent.getPackageName() + ".obb";
}
private static DefaultHttpClient HttpWithDisabledSslCertCheck()
{
return new DefaultHttpClient();

View File

@@ -247,6 +247,7 @@ class SettingsMenu
new SettingsMenuKeyboard.RemapHwKeysConfig(),
new SettingsMenuKeyboard.ScreenGesturesConfig(),
new SettingsMenuMisc.VideoSettingsConfig(),
new SettingsMenuMisc.CommandlineConfig(),
new SettingsMenuMisc.ResetToDefaultsConfig(),
new OkButton(),
};

View File

@@ -74,6 +74,7 @@ import android.hardware.SensorEventListener;
import android.hardware.SensorEvent;
import android.hardware.Sensor;
import android.widget.Toast;
import android.text.InputType;
class SettingsMenuMisc extends SettingsMenu
@@ -148,38 +149,6 @@ class SettingsMenuMisc extends SettingsMenu
{
Globals.DataDir = edit.getText().toString();
dialog.dismiss();
showCommandLineConfig(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showCommandLineConfig(final MainActivity p)
{
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.storage_commandline));
final EditText edit = new EditText(p);
edit.setFocusableInTouchMode(true);
edit.setFocusable(true);
edit.setText(Globals.CommandLine);
builder.setView(edit);
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.CommandLine = edit.getText().toString();
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
@@ -569,6 +538,48 @@ class SettingsMenuMisc extends SettingsMenu
}
}
static class CommandlineConfig extends Menu
{
String title(final MainActivity p)
{
return p.getResources().getString(R.string.storage_commandline);
}
void run (final MainActivity p)
{
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.storage_commandline));
final EditText edit = new EditText(p);
edit.setFocusableInTouchMode(true);
edit.setFocusable(true);
edit.setText(Globals.CommandLine.replace(" ", "\n").replace(" ", " "));
edit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
edit.setMinLines(2);
//edit.setMaxLines(100);
builder.setView(edit);
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.CommandLine = edit.getText().toString().replace(" ", " ").replace("\n", " ");
dialog.dismiss();
goBack(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
goBack(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
}
static class ResetToDefaultsConfig extends Menu
{
String title(final MainActivity p)

View File

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

View File

@@ -0,0 +1 @@
bochs/android/bochs/AndroidAppSettings.cfg

View File

@@ -0,0 +1 @@
bochs/android/bochs/AndroidBuild.sh

View File

@@ -0,0 +1 @@
bochs/android/bochs/AndroidData

View File

@@ -0,0 +1 @@
bochs/android/bochs/icon.png

View File

@@ -18,8 +18,6 @@ NDK=`which ndk-build`
NDK=`dirname $NDK`
NDK=`readlink -f $NDK`
grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"
#echo NDK $NDK
GCCPREFIX=arm-linux-androideabi
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9

View File

@@ -18,8 +18,6 @@ NDK=`which ndk-build`
NDK=`dirname $NDK`
NDK=`readlink -f $NDK`
grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"
#echo NDK $NDK
GCCPREFIX=arm-linux-androideabi
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9

View File

@@ -18,8 +18,6 @@ NDK=`which ndk-build`
NDK=`dirname $NDK`
NDK=`readlink -f $NDK`
grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"
#echo NDK $NDK
GCCPREFIX=mipsel-linux-android
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9

View File

@@ -18,8 +18,6 @@ NDK=`which ndk-build`
NDK=`dirname $NDK`
NDK=`readlink -f $NDK`
grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"
#echo NDK $NDK
GCCPREFIX=i686-linux-android
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9

View File

@@ -18,8 +18,6 @@ NDK=`which ndk-build`
NDK=`dirname $NDK`
NDK=`readlink -f $NDK`
grep "64.bit" "$NDK/RELEASE.TXT" >/dev/null 2>&1 && MYARCH="${MYARCH}_64"
#echo NDK $NDK
GCCPREFIX=arm-linux-androideabi
[ -z "$NDK_TOOLCHAIN_VERSION" ] && NDK_TOOLCHAIN_VERSION=4.9

View File

@@ -700,7 +700,7 @@ void glshim_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
list = glstate.list.active;
normalize_indices(sindices, &max, &min, count);
list = arrays_to_renderlist(list, mode, 0, max + 1 - min);
list = arrays_to_renderlist(list, mode, min, max + 1);
list->indices = sindices;
list->ilen = count;
list->indice_cap = count;
@@ -715,7 +715,7 @@ void glshim_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
GLsizei min, max;
normalize_indices(sindices, &max, &min, count);
list = arrays_to_renderlist(list, mode, 0, max + 1 - min);
list = arrays_to_renderlist(list, mode, min, max + 1);
list->indices = sindices;
list->ilen = count;
list->indice_cap = count;

View File

@@ -755,7 +755,7 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
}
return true;
}
if ((src_format == GL_BGR) && (dst_format == GL_RGB) && (dst_type = GL_UNSIGNED_SHORT_5_6_5) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
if (((src_format == GL_BGR) || (src_format == GL_BGRA)) && (dst_format == GL_RGB) && (dst_type = GL_UNSIGNED_SHORT_5_6_5) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
GLuint tmp;
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {

View File

@@ -129,6 +129,12 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring
}
}
for (i = 0; i < argc; i++)
{
while( strchr(argv[i], '\t') != NULL )
strchr(argv[i], '\t')[0] = ' ';
}
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Calling SDL_main(\"%s\")", str);
(*env)->ReleaseStringUTFChars(env, cmdline, jstr);