diff --git a/ChangeAppSettings.sh b/ChangeAppSettings.sh index 11520730f..79193a553 100755 --- a/ChangeAppSettings.sh +++ b/ChangeAppSettings.sh @@ -564,6 +564,7 @@ rm -rf project/$OUT/local/*/libsdl-*.so rm -rf project/$OUT/local/*/objs/sdl-*/src/*/android rm -rf project/$OUT/local/*/objs/sdl-*/src/video/SDL_video.o rm -rf project/$OUT/local/*/objs/sdl-*/SDL_renderer_gles.o +rm -rf project/$OUT/local/*/libsdl_fake_stdout.a project/$OUT/local/*/objs/sdl_fake_stdout/* # Do not rebuild several huge libraries that do not depend on SDL version for LIB in freetype intl jpeg png lua mad stlport tremor xerces xml2; do for ARCH in armeabi armeabi-v7a; do diff --git a/project/java/Keycodes.java b/project/java/Keycodes.java index 7e4e653a0..106b8c42d 100644 --- a/project/java/Keycodes.java +++ b/project/java/Keycodes.java @@ -3,6 +3,7 @@ package net.sourceforge.clonekeenplus; import java.lang.String; import java.util.ArrayList; +import java.util.Arrays; import java.lang.reflect.Field; @@ -495,6 +496,10 @@ class SDL_Keys { public static String [] names = null; public static Integer [] values = null; + + public static String [] namesSorted = null; + public static Integer [] namesSortedIdx = null; + public static Integer [] namesSortedBackIdx = null; static final int JAVA_KEYCODE_LAST = 110; // Android 2.3 added several new gaming keys, it ends up at keycode 110 currently - plz keep in sync with javakeycodes.h @@ -535,5 +540,21 @@ class SDL_Keys names = Names.toArray(new String[0]); values = Values.toArray(new Integer[0]); + namesSorted = Names.toArray(new String[0]); + namesSortedIdx = new Integer[values.length]; + namesSortedBackIdx = new Integer[values.length]; + Arrays.sort(namesSorted); + for( int i = 0; i < namesSorted.length; i++ ) + { + for( int j = 0; j < namesSorted.length; j++ ) + { + if( namesSorted[i].equals( names[j] ) ) + { + namesSortedIdx[i] = j; + namesSortedBackIdx[j] = i; + break; + } + } + } } } diff --git a/project/java/Settings.java b/project/java/Settings.java index 55ccdef03..c1f6e89bd 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -19,6 +19,7 @@ import java.util.Locale; import java.util.ArrayList; import java.util.Arrays; import java.util.zip.GZIPInputStream; +import java.util.Collections; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; @@ -1518,11 +1519,11 @@ class Settings final int KeyIndexFinal = keyIndex; AlertDialog.Builder builder = new AlertDialog.Builder(p); builder.setTitle(R.string.remap_hwkeys_select); - builder.setSingleChoiceItems(SDL_Keys.names, Globals.RemapHwKeycode[keyIndex], new DialogInterface.OnClickListener() + builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapHwKeycode[keyIndex]], new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { - Globals.RemapHwKeycode[KeyIndexFinal] = item; + Globals.RemapHwKeycode[KeyIndexFinal] = SDL_Keys.namesSortedIdx[item]; dialog.dismiss(); showConfigMainMenu(p); @@ -1620,11 +1621,11 @@ class Settings AlertDialog.Builder builder = new AlertDialog.Builder(p); builder.setTitle(items[currentButton]); - builder.setSingleChoiceItems(SDL_Keys.names, Globals.RemapScreenKbKeycode[currentButton], new DialogInterface.OnClickListener() + builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapScreenKbKeycode[currentButton]], new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { - Globals.RemapScreenKbKeycode[currentButton] = item; + Globals.RemapScreenKbKeycode[currentButton] = SDL_Keys.namesSortedIdx[item]; dialog.dismiss(); showRemapScreenKbConfig2(p, currentButton + 1); @@ -1742,11 +1743,11 @@ class Settings AlertDialog.Builder builder = new AlertDialog.Builder(p); builder.setTitle(items[currentButton]); - builder.setSingleChoiceItems(SDL_Keys.names, Globals.RemapMultitouchGestureKeycode[currentButton], new DialogInterface.OnClickListener() + builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapMultitouchGestureKeycode[currentButton]], new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { - Globals.RemapMultitouchGestureKeycode[currentButton] = item; + Globals.RemapMultitouchGestureKeycode[currentButton] = SDL_Keys.namesSortedIdx[item]; dialog.dismiss(); showScreenGesturesConfig3(p, currentButton + 1); diff --git a/project/jni/application/src b/project/jni/application/src index 40a028993..59d41f41e 120000 --- a/project/jni/application/src +++ b/project/jni/application/src @@ -1 +1 @@ -dosbox \ No newline at end of file +fheroes2 \ No newline at end of file