Skip to content

Commit

Permalink
Treewide: Make "Nokia/Sony/Samsung" the standard input mapping
Browse files Browse the repository at this point in the history
At least this is far more standard than J2ME Canvas' input maps,
and since Canvas was recently rewritten to map each vendor's keys
to its own, i don't think there's much use for that old "Standard"
mapping anymore.
  • Loading branch information
AShiningRay committed Dec 12, 2024
1 parent 0dfa65c commit 5132a38
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 146 deletions.
13 changes: 6 additions & 7 deletions src/libretro/freej2me_libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ char** params; /* Char matrix containing launch arguments */
unsigned int optstrlen; /* length of the string above */
unsigned long int screenRes[2]; /* {width, height} */
int rotateScreen; /* Acts as a boolean */
int phoneType; /* 0=J2ME Standard, 1=LG, 2=Motorola/SoftBank, 3=Motorola Triplets... refer to freej2me_libretro.h's "Phone Key Layout" */
int phoneType = 0; /* 0=Standard (Nokia/Sony/Samsung), 1=LG, 2=Motorola/SoftBank, 3=Motorola Triplets... refer to freej2me_libretro.h's "Phone Key Layout" */
int gameFPS; /* Auto(0), 60, 30, 15 */
int soundEnabled; /* also acts as a boolean */
int customMidi; /* Also acts as a boolean */
Expand Down Expand Up @@ -315,16 +315,15 @@ static void check_variables(bool first_time_startup)
var.key = "freej2me_phone";
if (Environ(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "J2ME Standard")) { phoneType = 0; }
if (!strcmp(var.value, "Nokia/Sony/Samsung (Standard)")) { phoneType = 0; }
else if (!strcmp(var.value, "LG")) { phoneType = 1; }
else if (!strcmp(var.value, "Motorola/SoftBank")) { phoneType = 2; }
else if (!strcmp(var.value, "Motorola Triplets")) { phoneType = 3; }
else if (!strcmp(var.value, "Motorola V8")) { phoneType = 4; }
else if (!strcmp(var.value, "Nokia/Sony/Samsung")) { phoneType = 5; }
else if (!strcmp(var.value, "Nokia Keyboard")) { phoneType = 6; }
else if (!strcmp(var.value, "Sagem")) { phoneType = 7; }
else if (!strcmp(var.value, "Siemens")) { phoneType = 8; }
else if (!strcmp(var.value, "Siemens Old")) { phoneType = 9; }
else if (!strcmp(var.value, "Nokia Keyboard")) { phoneType = 5; }
else if (!strcmp(var.value, "Sagem")) { phoneType = 6; }
else if (!strcmp(var.value, "Siemens")) { phoneType = 7; }
else if (!strcmp(var.value, "Siemens Old")) { phoneType = 8; }
}


Expand Down
44 changes: 21 additions & 23 deletions src/libretro/freej2me_libretro.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,18 @@ struct retro_core_option_v2_definition core_options[] =
"Due to the different mobile phone manufacturers on the J2ME space, it's usual to have some games expecting a certain phone's key layout like Nokia's for example. If a game is not responding to the inputs correctly, try changing this option.",
"system_settings",
{
{ "J2ME Standard", NULL },
{ "LG", NULL },
{ "Motorola/SoftBank", NULL },
{ "Motorola Triplets", NULL },
{ "Motorola V8", NULL },
{ "Nokia/Sony/Samsung", NULL },
{ "Nokia Keyboard", NULL },
{ "Sagem", NULL },
{ "Siemens", NULL },
{ "Siemens Old", NULL },
{ "LG", NULL },
{ "Motorola/SoftBank", NULL },
{ "Motorola Triplets", NULL },
{ "Motorola V8", NULL },
{ "Nokia/Sony/Samsung (Standard)", NULL },
{ "Nokia Keyboard", NULL },
{ "Sagem", NULL },
{ "Siemens", NULL },
{ "Siemens Old", NULL },
{ NULL, NULL },
},
"J2ME Standard"
"Nokia/Sony/Samsung (Standard)"
},
{
"freej2me_fps",
Expand Down Expand Up @@ -463,19 +462,18 @@ struct retro_core_option_definition core_options_v1 [] =
"Phone Key Layout",
"Due to the different mobile phone manufacturers on the J2ME space, it's usual to have some games expecting a certain phone's key layout like Nokia's for example. If a game is not responding to the inputs correctly, try changing this option.",
{
{ "J2ME Standard", NULL },
{ "LG", NULL },
{ "Motorola/SoftBank", NULL },
{ "Motorola Triplets", NULL },
{ "Motorola V8", NULL },
{ "Nokia/Sony/Samsung", NULL },
{ "Nokia Keyboard", NULL },
{ "Sagem", NULL },
{ "Siemens", NULL },
{ "Siemens Old", NULL },
{ "LG", NULL },
{ "Motorola/SoftBank", NULL },
{ "Motorola Triplets", NULL },
{ "Motorola V8", NULL },
{ "Nokia/Sony/Samsung (Standard)", NULL },
{ "Nokia Keyboard", NULL },
{ "Sagem", NULL },
{ "Siemens", NULL },
{ "Siemens Old", NULL },
{ NULL, NULL },
},
"J2ME Standard"
"Nokia/Sony/Samsung (Standard)"
},
{
"freej2me_fps",
Expand Down Expand Up @@ -667,7 +665,7 @@ static const struct retro_variable vars[] =
},
{ /* Phone Control Type */
"freej2me_phone",
"Phone Key Layout; J2ME Standard|LG|Motorola/SoftBank|Motorola Triplets|Motorola V8|Nokia/Sony/Samsung|Nokia Keyboard|Sagem|Siemens|Siemens Old"
"Phone Key Layout; Nokia/Sony/Samsung (Standard)|LG|Motorola/SoftBank|Motorola Triplets|Motorola V8|Nokia Keyboard|Sagem|Siemens|Siemens Old"
},
{ /* Game FPS limit */
"freej2me_fps",
Expand Down
52 changes: 9 additions & 43 deletions src/org/recompile/freej2me/AWTGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,11 @@ public final class AWTGUI
final CheckboxMenuItem enableRotation = new CheckboxMenuItem("Rotate Screen", false);
final CheckboxMenuItem useCustomMidi = new CheckboxMenuItem("Use custom midi soundfont", false);

final CheckboxMenuItem stdLayout = new CheckboxMenuItem("J2ME Standard", true);
final CheckboxMenuItem lgLayout = new CheckboxMenuItem("LG", false);
final CheckboxMenuItem motorolaLayout = new CheckboxMenuItem("Motorola/SoftBank", false);
final CheckboxMenuItem motov8Layout = new CheckboxMenuItem("Motorola V8", false);
final CheckboxMenuItem tripletsLayout = new CheckboxMenuItem("Motorola Triplets", false);
final CheckboxMenuItem nokiaLayout = new CheckboxMenuItem("Nokia/Sony/Samsung", false);
final CheckboxMenuItem stdLayout = new CheckboxMenuItem("Nokia/Sony/Samsung (Standard)", true);
final CheckboxMenuItem nokiaKbLayout = new CheckboxMenuItem("Nokia Keyboard", false);
final CheckboxMenuItem sagemLayout = new CheckboxMenuItem("Sagem", false);
final CheckboxMenuItem siemensLayout = new CheckboxMenuItem("Siemens", false);
Expand Down Expand Up @@ -441,29 +440,6 @@ public void itemStateChanged(ItemEvent e)
motorolaLayout.setState(false);
motov8Layout.setState(false);
tripletsLayout.setState(false);
nokiaLayout.setState(false);
nokiaKbLayout.setState(false);
sagemLayout.setState(false);
siemensLayout.setState(false);
siemensOldLayout.setState(false);
hasPendingChange = true;
}
}
});

nokiaLayout.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent e)
{
if(!nokiaLayout.getState()){ nokiaLayout.setState(true); }
if(nokiaLayout.getState())
{
config.updatePhone("Nokia");
stdLayout.setState(false);
lgLayout.setState(false);
motorolaLayout.setState(false);
motov8Layout.setState(false);
tripletsLayout.setState(false);
nokiaKbLayout.setState(false);
sagemLayout.setState(false);
siemensLayout.setState(false);
Expand All @@ -481,12 +457,11 @@ public void itemStateChanged(ItemEvent e)
if(nokiaKbLayout.getState())
{
config.updatePhone("NokiaKeyboard");
stdLayout.setState(false);
lgLayout.setState(false);
motorolaLayout.setState(false);
motov8Layout.setState(false);
tripletsLayout.setState(false);
nokiaLayout.setState(false);
stdLayout.setState(false);
sagemLayout.setState(false);
siemensLayout.setState(false);
siemensOldLayout.setState(false);
Expand All @@ -503,12 +478,11 @@ public void itemStateChanged(ItemEvent e)
if(siemensLayout.getState())
{
config.updatePhone("Siemens");
stdLayout.setState(false);
lgLayout.setState(false);
motorolaLayout.setState(false);
motov8Layout.setState(false);
tripletsLayout.setState(false);
nokiaLayout.setState(false);
stdLayout.setState(false);
nokiaKbLayout.setState(false);
sagemLayout.setState(false);
siemensOldLayout.setState(false);
Expand All @@ -525,11 +499,10 @@ public void itemStateChanged(ItemEvent e)
if(motorolaLayout.getState())
{
config.updatePhone("Motorola");
stdLayout.setState(false);
lgLayout.setState(false);
motov8Layout.setState(false);
tripletsLayout.setState(false);
nokiaLayout.setState(false);
stdLayout.setState(false);
nokiaKbLayout.setState(false);
sagemLayout.setState(false);
siemensLayout.setState(false);
Expand All @@ -547,11 +520,10 @@ public void itemStateChanged(ItemEvent e)
if(lgLayout.getState())
{
config.updatePhone("LG");
stdLayout.setState(false);
motorolaLayout.setState(false);
motov8Layout.setState(false);
tripletsLayout.setState(false);
nokiaLayout.setState(false);
stdLayout.setState(false);
nokiaKbLayout.setState(false);
sagemLayout.setState(false);
siemensLayout.setState(false);
Expand All @@ -569,11 +541,10 @@ public void itemStateChanged(ItemEvent e)
if(motov8Layout.getState())
{
config.updatePhone("MotoV8");
stdLayout.setState(false);
lgLayout.setState(false);
motorolaLayout.setState(false);
tripletsLayout.setState(false);
nokiaLayout.setState(false);
stdLayout.setState(false);
nokiaKbLayout.setState(false);
sagemLayout.setState(false);
siemensLayout.setState(false);
Expand All @@ -591,11 +562,10 @@ public void itemStateChanged(ItemEvent e)
if(tripletsLayout.getState())
{
config.updatePhone("MotoTriplets");
stdLayout.setState(false);
lgLayout.setState(false);
motov8Layout.setState(false);
motorolaLayout.setState(false);
nokiaLayout.setState(false);
stdLayout.setState(false);
nokiaKbLayout.setState(false);
sagemLayout.setState(false);
siemensLayout.setState(false);
Expand All @@ -613,11 +583,10 @@ public void itemStateChanged(ItemEvent e)
if(sagemLayout.getState())
{
config.updatePhone("Sagem");
stdLayout.setState(false);
lgLayout.setState(false);
motov8Layout.setState(false);
motorolaLayout.setState(false);
nokiaLayout.setState(false);
stdLayout.setState(false);
nokiaKbLayout.setState(false);
tripletsLayout.setState(false);
siemensLayout.setState(false);
Expand All @@ -635,11 +604,10 @@ public void itemStateChanged(ItemEvent e)
if(siemensOldLayout.getState())
{
config.updatePhone("SiemensOld");
stdLayout.setState(false);
lgLayout.setState(false);
motov8Layout.setState(false);
motorolaLayout.setState(false);
nokiaLayout.setState(false);
stdLayout.setState(false);
nokiaKbLayout.setState(false);
tripletsLayout.setState(false);
siemensLayout.setState(false);
Expand Down Expand Up @@ -958,7 +926,6 @@ private void buildMenuBar()
phoneType.add(motorolaLayout);
phoneType.add(tripletsLayout);
phoneType.add(motov8Layout);
phoneType.add(nokiaLayout);
phoneType.add(nokiaKbLayout);
phoneType.add(sagemLayout);
phoneType.add(siemensLayout);
Expand Down Expand Up @@ -994,7 +961,6 @@ public void updateOptions()
fpsCap60.setState(config.settings.get("fps").equals("60"));

stdLayout.setState(config.settings.get("phone").equals("Standard"));
nokiaLayout.setState(config.settings.get("phone").equals("Nokia"));
siemensLayout.setState(config.settings.get("phone").equals("Siemens"));
siemensOldLayout.setState(config.settings.get("phone").equals("SiemensOld"));
motov8Layout.setState(config.settings.get("phone").equals("MotoV8"));
Expand Down
2 changes: 0 additions & 2 deletions src/org/recompile/freej2me/Anbu.java
Original file line number Diff line number Diff line change
Expand Up @@ -742,15 +742,13 @@ void settingsChanged()
Mobile.motorola = false;
Mobile.motoTriplets = false;
Mobile.motoV8 = false;
Mobile.nokia = false;
Mobile.nokiaKeyboard = false;
Mobile.sagem = false;
Mobile.siemens = false;
if(phone.equals("LG")) { Mobile.lg = true;}
if(phone.equals("Motorola")) { Mobile.motorola = true;}
if(phone.equals("MotoTriplets")) { Mobile.motoTriplets = true;}
if(phone.equals("MotoV8")) { Mobile.motoV8 = true;}
if(phone.equals("Nokia")) { Mobile.nokia = true;}
if(phone.equals("NokiaKeyboard")) { Mobile.nokiaKeyboard = true;}
if(phone.equals("Sagem")) { Mobile.sagem = true;}
if(phone.equals("Siemens")) { Mobile.siemens = true;}
Expand Down
8 changes: 2 additions & 6 deletions src/org/recompile/freej2me/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,8 @@ public void init()
parts[1] = parts[1].trim();
if(parts[0]!="" && parts[1]!="")
{
//Compatibility with the deprecated "nokia" boolean setting
if(parts[0].equals("nokia"))
{
parts[0] = "phone";
if(parts[1].equals("on")) { parts[1] = "Nokia"; } else { parts[0] = "Standard"; }
}
// Compatibility with the deprecated "Nokia" input mapping, which is now the Standard mapping (as Canvas was reworked to not need J2ME's default mappings)
if(parts[0].equals("phone") && parts[1].equals("Nokia") ) { parts[1] = "Standard"; }
settings.put(parts[0], parts[1]);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/org/recompile/freej2me/FreeJ2ME.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ private void settingsChanged()
Mobile.motorola = false;
Mobile.motoTriplets = false;
Mobile.motoV8 = false;
Mobile.nokia = false;
Mobile.nokiaKeyboard = false;
Mobile.sagem = false;
Mobile.siemens = false;
Expand All @@ -375,7 +374,6 @@ private void settingsChanged()
if(phone.equals("Motorola")) { Mobile.motorola = true;}
if(phone.equals("MotoTriplets")) { Mobile.motoTriplets = true;}
if(phone.equals("MotoV8")) { Mobile.motoV8 = true;}
if(phone.equals("Nokia")) { Mobile.nokia = true;}
if(phone.equals("NokiaKeyboard")) { Mobile.nokiaKeyboard = true;}
if(phone.equals("Sagem")) { Mobile.sagem = true;}
if(phone.equals("Siemens")) { Mobile.siemens = true;}
Expand Down
22 changes: 8 additions & 14 deletions src/org/recompile/freej2me/Libretro.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public Libretro(String args[])
Mobile.motorola = false;
Mobile.motoTriplets = false;
Mobile.motoV8 = false;
Mobile.nokia = false;
Mobile.nokiaKeyboard = false;
Mobile.sagem = false;
Mobile.siemens = false;
Expand All @@ -114,11 +113,10 @@ public Libretro(String args[])
else if(Integer.parseInt(args[3]) == 2) { Mobile.motorola = true; }
else if(Integer.parseInt(args[3]) == 3) { Mobile.motoTriplets = true; }
else if(Integer.parseInt(args[3]) == 4) { Mobile.motoV8 = true; }
else if(Integer.parseInt(args[3]) == 5) { Mobile.nokia = true; }
else if(Integer.parseInt(args[3]) == 6) { Mobile.nokiaKeyboard = true; }
else if(Integer.parseInt(args[3]) == 7) { Mobile.sagem = true; }
else if(Integer.parseInt(args[3]) == 8) { Mobile.siemens = true; }
else if(Integer.parseInt(args[3]) == 9) { Mobile.siemensold = true; }
else if(Integer.parseInt(args[3]) == 5) { Mobile.nokiaKeyboard = true; }
else if(Integer.parseInt(args[3]) == 6) { Mobile.sagem = true; }
else if(Integer.parseInt(args[3]) == 7) { Mobile.siemens = true; }
else if(Integer.parseInt(args[3]) == 8) { Mobile.siemensold = true; }

Mobile.limitFPS = Integer.parseInt(args[4]);

Expand Down Expand Up @@ -285,7 +283,6 @@ public void run()
else if(Mobile.motorola) { config.settings.put("phone", "Motorola"); }
else if(Mobile.motoTriplets) { config.settings.put("phone", "MotoTriplets"); }
else if(Mobile.motoV8) { config.settings.put("phone", "MotoV8"); }
else if(Mobile.nokia) { config.settings.put("phone", "Nokia"); }
else if(Mobile.nokiaKeyboard) { config.settings.put("phone", "NokiaKeyboard"); }
else if(Mobile.sagem) { config.settings.put("phone", "Sagem"); }
else if(Mobile.siemens) { config.settings.put("phone", "Siemens"); }
Expand Down Expand Up @@ -353,11 +350,10 @@ public void run()
if(Integer.parseInt(cfgtokens[4])==2) { config.settings.put("phone", "Motorola"); }
if(Integer.parseInt(cfgtokens[4])==3) { config.settings.put("phone", "MotoTriplets"); }
if(Integer.parseInt(cfgtokens[4])==4) { config.settings.put("phone", "MotoV8"); }
if(Integer.parseInt(cfgtokens[4])==5) { config.settings.put("phone", "Nokia"); }
if(Integer.parseInt(cfgtokens[4])==6) { config.settings.put("phone", "NokiaKeyboard"); }
if(Integer.parseInt(cfgtokens[4])==7) { config.settings.put("phone", "Sagem"); }
if(Integer.parseInt(cfgtokens[4])==8) { config.settings.put("phone", "Siemens"); }
if(Integer.parseInt(cfgtokens[4])==9) { config.settings.put("phone", "SiemensOld"); }
if(Integer.parseInt(cfgtokens[4])==5) { config.settings.put("phone", "NokiaKeyboard"); }
if(Integer.parseInt(cfgtokens[4])==6) { config.settings.put("phone", "Sagem"); }
if(Integer.parseInt(cfgtokens[4])==7) { config.settings.put("phone", "Siemens"); }
if(Integer.parseInt(cfgtokens[4])==8) { config.settings.put("phone", "SiemensOld"); }

config.settings.put("fps", ""+cfgtokens[5]);

Expand Down Expand Up @@ -449,7 +445,6 @@ private void settingsChanged()
Mobile.motorola = false;
Mobile.motoTriplets = false;
Mobile.motoV8 = false;
Mobile.nokia = false;
Mobile.nokiaKeyboard = false;
Mobile.sagem = false;
Mobile.siemens = false;
Expand All @@ -458,7 +453,6 @@ private void settingsChanged()
if(phone.equals("Motorola")) { Mobile.motorola = true;}
if(phone.equals("MotoTriplets")) { Mobile.motoTriplets = true;}
if(phone.equals("MotoV8")) { Mobile.motoV8 = true;}
if(phone.equals("Nokia")) { Mobile.nokia = true;}
if(phone.equals("NokiaKeyboard")) { Mobile.nokiaKeyboard = true;}
if(phone.equals("Sagem")) { Mobile.sagem = true;}
if(phone.equals("Siemens")) { Mobile.siemens = true;}
Expand Down
Loading

0 comments on commit 5132a38

Please sign in to comment.