Fixed keycode remapper
This commit is contained in:
@@ -496,7 +496,7 @@ class SDL_Keys
|
|||||||
public static String [] names = null;
|
public static String [] names = null;
|
||||||
public static Integer [] values = null;
|
public static Integer [] values = null;
|
||||||
|
|
||||||
static final JAVA_KEYCODE_LAST = android.view.KeyEvent.KEYCODE_MUTE; // = 91
|
static final int JAVA_KEYCODE_LAST = android.view.KeyEvent.KEYCODE_MUTE; // = 91
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class Settings
|
|||||||
out.writeInt(SDL_Keys.JAVA_KEYCODE_LAST);
|
out.writeInt(SDL_Keys.JAVA_KEYCODE_LAST);
|
||||||
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
||||||
{
|
{
|
||||||
out.writeInt(RemapHwKeycode[i]);
|
out.writeInt(Globals.RemapHwKeycode[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.close();
|
out.close();
|
||||||
@@ -83,7 +83,12 @@ class Settings
|
|||||||
nativeInitKeymap();
|
nativeInitKeymap();
|
||||||
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
||||||
{
|
{
|
||||||
RemapHwKeycode[i] = nativeGetKeymapKey(i);
|
int sdlKey = nativeGetKeymapKey(i);
|
||||||
|
int idx = 0;
|
||||||
|
for(int ii = 0; ii < SDL_Keys.values.length; ii++)
|
||||||
|
if(SDL_Keys.values[ii] == sdlKey)
|
||||||
|
idx = ii;
|
||||||
|
Globals.RemapHwKeycode[i] = idx;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
|
ObjectInputStream settingsFile = new ObjectInputStream(new FileInputStream( p.getFilesDir().getAbsolutePath() + "/" + SettingsFileName ));
|
||||||
@@ -115,7 +120,7 @@ class Settings
|
|||||||
throw new IOException();
|
throw new IOException();
|
||||||
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
||||||
{
|
{
|
||||||
RemapHwKeycode[i] = settingsFile.readInt();
|
Globals.RemapHwKeycode[i] = settingsFile.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsLoaded = true;
|
settingsLoaded = true;
|
||||||
@@ -921,7 +926,7 @@ class Settings
|
|||||||
SetupTouchscreenKeyboardGraphics(p);
|
SetupTouchscreenKeyboardGraphics(p);
|
||||||
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
for( int i = 0; i < SDL_Keys.JAVA_KEYCODE_LAST; i++ )
|
||||||
{
|
{
|
||||||
nativeSetKeymapKey(i, RemapHwKeycode[i]);
|
nativeSetKeymapKey(i, SDL_Keys.values[Globals.RemapHwKeycode[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
String lang = new String(Locale.getDefault().getLanguage());
|
String lang = new String(Locale.getDefault().getLanguage());
|
||||||
|
|||||||
Reference in New Issue
Block a user