nikita36078 / J2ME-Loader

A J2ME emulator for Android.
Apache License 2.0
1.72k stars 195 forks source link

Keymapping issue on Blackberry Devices #812

Closed benknam closed 2 years ago

benknam commented 2 years ago

Emulator version: 1.7.0-open

Game version: Multi

Game resolution: Multi

Device: Blackberry Classic (Q20)

Android version: Android 4.3 (VM via BBOS 10)

Description of the issue: The key mapping action keep telling "KEYCODE_UNKNOWN", then failed mapping the blackberry key to the game. 6A068AEED6B188E019B08FCBD553599B

woesss commented 2 years ago

Are the buttons really not assigned or just the button names are not displayed? Was it before or appeared in a new version?

benknam commented 2 years ago

Are the buttons really not assigned or just the button names are not displayed? Was it before or appeared in a new version?

Yeah the buttons were not assigned to the game. If I add a new profile, Once I assign the key to replace the default one, the next tap of this key will show "KEYCODE_UNKNOWN", I'm sure this was cause by the Blackberry keyboard.

034CDE70-A884-4469-9D46-DA78AD49E328 the default keycode before assign the key.

09D2B6BA-46A2-4353-ADCF-4986D749C6AA the failed one.

woesss commented 2 years ago

We do not understand each other. The name of the buttons may not be determined, but they will be assigned and they will work in the game. Have you checked them in the game?
If the buttons do not work in the game, test the keyboard with this (or a similar) application: https://play.google.com/store/apps/details?id=aws.apps.keyeventdisplay and show us the output.

benknam commented 2 years ago

We do not understand each other. The name of the buttons may not be determined, but they will be assigned and they will work in the game. Have you checked them in the game?

Sorry for my bad explanation :( . Yeah, I checked in the game too, it's not working.

Otherwise as I test again, once the second key was assigned, the previous assigned-key will be cleared (being empty). I guess the keyboard just only send a same code to the loader, once we assign the next key, the loader will think about this is the same code from the keyboard, so the last one will be cleared.

Attached a log file if its helping. log.txt

JoseskVolpe commented 2 years ago

I suggest to test the assigned keys on a key tester j2me application too. As woesss said, the name could not be obtained but the keycode was asigned. So, sometimes it's the game's problem and not the emulator, because the game is receiving a input but it's not recognizing that emulated keycode, and to solve this, you can try setting the device from Nokia to Siemens, Motorola or any other device listed.

You can check if this MIDlet returns a keycode, and send here if so. If it's not returning anything after you press the assigned key, or it returns a different one from the listed device, so it's a problem with the emulator.

https://ufile.io/apues0r3

benknam commented 2 years ago

We do not understand each other. The name of the buttons may not be determined, but they will be assigned and they will work in the game. Have you checked them in the game? If the buttons do not work in the game, test the keyboard with this (or a similar) application: https://play.google.com/store/apps/details?id=aws.apps.keyeventdisplay and show us the output.

Great idea, here's the result:

(Taping: q w e r t y u I o p)

69A92129A1218B22AE37BE4DC6C63C02 Capture from the device

keyevent_2021-07-19-170536+0800.txt The saved log file.

woesss commented 2 years ago

Strange, the keyboard sends normal events.
Perhaps the BB incorrectly transfers them to the dialogue - an additional test is needed.

Run this test app: keys-test.zip (APK in ZIP, github doesn't allow adding APKs), press the buttons, then open the dialog via the options menu and press the same buttons again. Compare and show the result.

benknam commented 2 years ago

Strange, the keyboard sends normal events.
Perhaps the BB incorrectly transfers them to the dialogue - an additional test is needed.

Run this test app: keys-test.zip (APK in ZIP, github doesn't allow adding APKs), press the buttons, then open the dialog via the options menu and press the same buttons again. Compare and show the result.

Thanks woesss, this could be useful.

I'm keeping testing during this couple hours, I found that actually the blackberry device keyboard is working at all, but once I selected NK/SE layout (or any others except Custom), the BB keyboard should be "alt-lock" so it could directly input "number" but not "letter", then it will work as well as the NOKIA or SonyErrison device. So I modified a couple values of "Keymapping" line in the Config.json, which was located in the app config folder, then seems some keys are working directly without alt-lock. Maybe I got the wrong keycode or something, not all the key was setting as what I want, but I will test again with the key-test app comparation results.

benknam commented 2 years ago

Strange, the keyboard sends normal events. Perhaps the BB incorrectly transfers them to the dialogue - an additional test is needed.

Run this test app: keys-test.zip (APK in ZIP, github doesn't allow adding APKs), press the buttons, then open the dialog via the options menu and press the same buttons again. Compare and show the result.

Good day woesss, here's result capture from keys-test:

91B5E4C1385639DB4E81C397D7400B29 Upper two lines showing normally while I press "q", down two showing "KEYCODE_UNKNOWN" while I press "q" in dialog window.

0418F49AE2730072F13FD71C400FF95F open the dialog from menu, and showing "KEYCODE_UNKNOWN"

What does it mean?

woesss commented 2 years ago

As I suspected, the problem is in the dialogue. Another test is dialogue only: test-keys2.zip If this test fails, we need to somehow get rid of the dialogue. In the meantime, you can edit the mapping in text mode, a list of all android keycodes can be viewed here: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/view/KeyEvent.java#L94

benknam commented 2 years ago

As I suspected, the problem is in the dialogue. Another test is dialogue only: test-keys2.zip If this test fails, we need to somehow get rid of the dialogue. In the meantime, you can edit the mapping in text mode, a list of all android keycodes can be viewed here: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/view/KeyEvent.java#L94

Thanks woesss, here's the result of test-key2, yes it was failed to detect the input ( pressed "q")

0A5092E632D56B625D7327EF2AADAAD0

woesss commented 2 years ago

KeyTest3.zip Another try.

By the way, are the "scan" values different for different buttons?

benknam commented 2 years ago

KeyTest3.zip Another try.

By the way, are the "scan" values different for different buttons?

Thanks woesss, I'm back onboard,

key-test1 showing no "scan" value. and yes, in key-test2 & key-test3 app, it's showing in different value for different button, but this just happens while the dialogue box showing, after press "OK" of the dialogue box, the "scan" value keeps showing 0 at all. Here's the capture below:

IMG_20210721_144758 This is the capture with taping "q w e r t y u I o p" within a dialogue box.

IMG_20210721_144809 This is the capture with taping "q w e r t y u I o p" after pressing the "OK" of the dialogue box.

woesss commented 2 years ago

It is clear that nothing is clear!
I haven't found a way to match scan codes to keys.
Thus, the only way to solve this problem is to change the GUI of the mapping settings window to do without the dialog.

woesss commented 2 years ago

I came up with a fix, a test build of my mod can be downloaded here: https://install.appcenter.ms/users/j2me.forever/apps/jl-mod/distribution_groups/testers

benknam commented 2 years ago

I came up with a fix, a test build of my mod can be downloaded here: https://install.appcenter.ms/users/j2me.forever/apps/jl-mod/distribution_groups/testers

Wooooow that's reallllllllly cooooooooool, woesss!! You did a really great job! This one works so perfectly on my Blackberry Q20 !!! Very perfect !!! I will tell my BB group members as they have another type of keyboard device, so let's test if this one works, too!

alemanto commented 2 months ago

It actually detects key presses and kind of works, but continuess press not working (holding down the button). You have to tap key so character moves in games.