Author Topic: Beta Testing Has Begun!  (Read 807234 times)

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Beta Testing Has Begun!
« Reply #60 on: January 01, 2012, 08:39:44 AM »
it didnt recognize the key up event (Mario walks slow and dont stop his move). Ah, and from time to time while Im setting the analog key in the mapping section, the key scancode is 81 and not 21 (but this was only 2 times of 8 trys).

Ok, we'll have to do a little debugging to figure out what's wrong.  Please install this version and provide a logcat after experiencing the two problems:

1) Calculating SDL scancode 81 instead of Android keycode 21
2) Not recognizing key up

For the first problem, does your IME ever return the base keycode 21 instead of the high keycode 21## (for example if the strength were 0 or 64, or if it were a key up event?)  If so, could you change it to always return the high keycodes for analog keys (otherwise I have no way of distinguishing an analog key event by your IME from a normal key event which must have the Android key code converted to a standard SDL scancode to pass to SDL).  This is the only scenario I can think of off hand that would produce an 81 instead of the expected 21 (although I'll know more after you post the logcat)

Analog Key Problems Test
« Last Edit: January 01, 2012, 10:56:40 AM by Paul »
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline firstpoke

  • byte
  • *
  • Posts: 27
    • View Profile
Re: Beta Testing Has Begun!
« Reply #61 on: January 01, 2012, 01:20:38 PM »
Thanks for the new version.

Here is the Logcat:

01-01 20:03:57.654: V/SDLSurface(32670): onKey, received keyCode: 1914
01-01 20:03:57.654: V/SDLSurface(32670):     KeyEvent.ACTION_DOWN
01-01 20:03:57.654: V/SDLSurface(32670): High keyCode, converted to normal keyCode: 19
01-01 20:03:57.654: V/SDLSurface(32670):     Key strength: 14.0
01-01 20:03:57.654: V/SDLSurface(32670): Mapped to Controller #1
01-01 20:03:57.654: V/SDLSurface(32670): Old axisX: 28
01-01 20:03:57.654: V/SDLSurface(32670): Old axisY: 22
01-01 20:03:57.654: V/SDLSurface(32670): New axisX: 28
01-01 20:03:57.654: V/SDLSurface(32670): New axisY: 17


It seems that's correct.

Quote
For the first problem, does your IME ever return the base keycode 21 instead of the high keycode 21

My IME sends never <255 Keycodes for the analog sticks. It sends everytime "keyXX" codes (21 = 21xx).
But that does not matter. If the analog stick crossed the deadzone point (>) it will send a KeyDown and a KeyUp if the analog stick fall under the deadzone point (<). So you have to take a look at KeyDown and KeyUp only.

It seems that you never use KeyUps:

01-01 20:21:35.204: V/SDLSurface(32670): onKey, received keyCode: 1929
01-01 20:21:35.204: V/SDLSurface(32670):     KeyEvent.ACTION_DOWN
01-01 20:21:35.204: V/SDLSurface(32670): High keyCode, converted to normal keyCode: 19
01-01 20:21:35.204: V/SDLSurface(32670):     Key strength: 29.0
01-01 20:21:35.204: V/SDLSurface(32670): Mapped to Controller #1
01-01 20:21:35.204: V/SDLSurface(32670): Old axisX: -12
01-01 20:21:35.204: V/SDLSurface(32670): Old axisY: 33
01-01 20:21:35.204: V/SDLSurface(32670): New axisX: -12
01-01 20:21:35.204: V/SDLSurface(32670): New axisY: 36
01-01 20:21:35.224: V/SDLSurface(32670): onKey, received keyCode: 1932
01-01 20:21:35.224: V/SDLSurface(32670):     KeyEvent.ACTION_DOWN
01-01 20:21:35.224: V/SDLSurface(32670): High keyCode, converted to normal keyCode: 19
01-01 20:21:35.224: V/SDLSurface(32670):     Key strength: 32.0
01-01 20:21:35.224: V/SDLSurface(32670): Mapped to Controller #1
01-01 20:21:35.224: V/SDLSurface(32670): Old axisX: -12
01-01 20:21:35.224: V/SDLSurface(32670): Old axisY: 36
01-01 20:21:35.224: V/SDLSurface(32670): New axisX: -12
01-01 20:21:35.224: V/SDLSurface(32670): New axisY: 40
01-01 20:21:35.814: V/SDLSurface(32670): onKey, received keyCode: 1924
01-01 20:21:35.814: V/SDLSurface(32670):     KeyEvent.ACTION_DOWN
01-01 20:21:35.814: V/SDLSurface(32670): High keyCode, converted to normal keyCode: 19
01-01 20:21:35.814: V/SDLSurface(32670):     Key strength: 24.0
01-01 20:21:35.814: V/SDLSurface(32670): Mapped to Controller #1
01-01 20:21:35.814: V/SDLSurface(32670): Old axisX: -12
01-01 20:21:35.814: V/SDLSurface(32670): Old axisY: 40
01-01 20:21:35.814: V/SDLSurface(32670): New axisX: -12
01-01 20:21:35.814: V/SDLSurface(32670): New axisY: 30
01-01 20:21:35.824: V/SDLSurface(32670): onKey, received keyCode: 19
01-01 20:21:35.824: V/SDLSurface(32670):     KeyEvent.ACTION_DOWN
01-01 20:21:35.824: V/SDL_androidkeyboard(32670): Converted Android KeyCode 19 into SDL ScanCode 82

« Last Edit: January 01, 2012, 01:23:20 PM by firstpoke »

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Beta Testing Has Begun!
« Reply #62 on: January 01, 2012, 01:27:38 PM »
That logcat was just from an example of a key event where there was no problem (i.e. the key strength was 14, so Mario should be moving, not stopped).

1) Please post the full logcat after experiencing the problem where Mario doesn't stop walking when you release the analog stick.

2) Please post the full logcat after experiencing the problem where the Key Listener dialog reports scancode 81 instead of 21.

--EDIT-- thanks for adding more logcat output.  I'll post another answer shortly
« Last Edit: January 01, 2012, 01:54:58 PM by Paul »
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Beta Testing Has Begun!
« Reply #63 on: January 01, 2012, 01:42:13 PM »
OK, the messages about KEY_DOWN were just a typo in my code (gotta love copy/paste, haha)  Please do the same tests again with this version and post the logcat:

Analog Key Problems Test #2

Secondly, according to the logcat you posted, a keyCode of 19 was sent, instead of 19##, so that is why it was converted into SDL scancode 82:

Code: [Select]
01-01 20:21:35.824: V/SDLSurface(32670): onKey, received keyCode: 19
01-01 20:21:35.824: V/SDLSurface(32670):     KeyEvent.ACTION_DOWN
01-01 20:21:35.824: V/SDL_androidkeyboard(32670): Converted Android KeyCode 19 into SDL ScanCode 82

This must be coming from the IME, because these messages get printed out at the very top of onKey before any additional processing:

Code: [Select]
    public boolean onKey( View  v, int keyCode, KeyEvent event )
    {
        if( SDLActivity.mSingleton == null || SDLActivity.mSingleton.noInputPlugin )
            return false;

Log.v( "SDLSurface", "onKey, received keyCode: " + keyCode );
if( event.getAction() == KeyEvent.ACTION_DOWN )
    Log.v( "SDLSurface", "    KeyEvent.ACTION_DOWN" );
else if( event.getAction() == KeyEvent.ACTION_UP )
    Log.v( "SDLSurface", "    KeyEvent.ACTION_UP" );

...etc

This is the reason for the Key Listener code conversion problem and probably also the problem of Mario not stopping (if it is the ACTION_UP events that are getting the keyCodes < 255, which we'll see in the logcat now that I've fixed the typo).
« Last Edit: January 01, 2012, 01:58:45 PM by Paul »
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline firstpoke

  • byte
  • *
  • Posts: 27
    • View Profile
Re: Beta Testing Has Begun!
« Reply #64 on: January 01, 2012, 02:38:48 PM »
01-01 21:34:54.160: V/SDLSurface(2783): onKey, received keyCode: 2012
01-01 21:34:54.160: V/SDLSurface(2783):     KeyEvent.ACTION_DOWN
01-01 21:34:54.160: V/SDLSurface(2783): High keyCode, converted to normal keyCode: 20
01-01 21:34:54.160: V/SDLSurface(2783):     Key strength: 12.0
01-01 21:34:54.160: V/SDLSurface(2783): Mapped to Controller #1
01-01 21:34:54.160: V/SDLSurface(2783): Old axisX: -13
01-01 21:34:54.160: V/SDLSurface(2783): Old axisY: -18
01-01 21:34:54.160: V/SDLSurface(2783): New axisX: -13
01-01 21:34:54.160: V/SDLSurface(2783): New axisY: -15
01-01 21:34:54.170: V/SDLSurface(2783): onKey, received keyCode: 20
01-01 21:34:54.170: V/SDLSurface(2783):     KeyEvent.ACTION_UP
01-01 21:34:54.170: V/SDL_androidkeyboard(2783): Converted Android KeyCode 20 into SDL ScanCode 81

Mario is walking fine... but after KeyUp ... Mario doesnt stop. Maybe you doesnt set the y speed to 0 after keyup? It seems the old y speed of 12 (Key strength: 12.0) is still there.
« Last Edit: January 01, 2012, 02:47:03 PM by firstpoke »

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Beta Testing Has Begun!
« Reply #65 on: January 01, 2012, 02:46:31 PM »
It looks like the keyCodes for the key up events are being sent as < 255.  Any chance you can update your code to send the high keycodes for key up events? (i.e 2000 instead of 20)
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline firstpoke

  • byte
  • *
  • Posts: 27
    • View Profile
Re: Beta Testing Has Begun!
« Reply #66 on: January 01, 2012, 02:50:17 PM »
It looks like the keyCodes for the key up events are being sent as < 255.  Any chance you can update your code to send the high keycodes for key up events? (i.e 2000 instead of 20)

I think yes, but the Key Strength of a KeyUp Event is always 0 :)  So... no 20xx is neccessary. Maybe you need the High KeyUp code to filter it hum? :)

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Beta Testing Has Begun!
« Reply #67 on: January 01, 2012, 02:57:32 PM »
It is necessary in this case, because I need go know whether or not to convert it to an SDL scancode or not.  I expect any other project using the Android port of SDL would have this same issue.  I suppose alternately I could just do the conversion anyway after getting the base keycode (that would limit the possible base codes to like 110, because that is the maximum supported by the conversion function).  Which way would you prefer? (I don't want to make you change your code just to support this project)
« Last Edit: January 01, 2012, 03:00:19 PM by Paul »
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline firstpoke

  • byte
  • *
  • Posts: 27
    • View Profile
Re: Beta Testing Has Begun!
« Reply #68 on: January 01, 2012, 03:14:58 PM »
I suppose alternately I could just do the conversion anyway after getting the base keycode (that would limit the possible base codes to like 110, because that is the maximum supported by the conversion function).  Which way would you prefer? (I don't want to make you change your code just to support this project)

I've tried to change my code... but it doesnt help (confusing results). So, I would prefer to "the conversion anyway after getting the base keycode".

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Beta Testing Has Begun!
« Reply #69 on: January 01, 2012, 04:10:12 PM »
Ok, done:

Analog Key Problems Test #3

If there is any other unexpected behavior, please post the full logcat after experiencing the problem.

Also, how likely is it to get base keycodes higher than 110?  I assume the user assigns them through the IME, so I should probably add a pop-up that explains why they cant use keycodes higher than 110 in my app.  Like I said, anyone else with an app using the Android port of SDL will have this same issue (in case it comes up again, you'll be able to help other developers out who might be in the same boat as I am).
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline firstpoke

  • byte
  • *
  • Posts: 27
    • View Profile
Re: Beta Testing Has Begun!
« Reply #70 on: January 01, 2012, 10:55:58 PM »
If I mapped the stick to the "Analog Right/Left/Up/Down" then I see random codes R:79/22, L:80/21, U:82/19 and D:81/20.


First number of each line is the visible scancode Text in the settings after mapped a key

79 => 01-02 05:32:52.730: V/ScancodeDialog(2037): onKey, received keyCode: 22
80 => 01-02 05:33:01.090: V/ScancodeDialog(2037): onKey, received keyCode: 21
21 => 01-02 05:33:01.090: V/ScancodeDialog(2037): onKey, received keyCode: 2111
          01-02 05:33:01.090: V/ScancodeDialog(2037): High keyCode, converted to normal keyCode: 21
81 => 01-02 05:33:11.000: V/ScancodeDialog(2037): onKey, received keyCode: 20
20 => 01-02 05:33:11.000: V/ScancodeDialog(2037): onKey, received keyCode: 2012
           01-02 05:33:11.000: V/ScancodeDialog(2037): High keyCode, converted to normal keyCode: 20
82 =>  01-02 05:33:14.210: V/ScancodeDialog(2037): onKey, received keyCode: 19


So its very random to hit the right code. This problem is still there, because I think you dont use my "int[] getKeyData(int keyCode, KeyEvent event)" function after each onKey() Event. With my function you will get never High-KeyCodes... you will get everytime 19,20,21,22 ... and a strength value that you can use to move mario with different speeds (strength multiplicator).

Anyway... if I get the scancodes 79,80,81,82 ... then its working like a charm, and mario stop his walk  ;)

With the scancodes 19,20,21,22 mario can not move.


Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Beta Testing Has Begun!
« Reply #71 on: January 01, 2012, 11:32:55 PM »
I don't need your getKeyData method in the Key Listener dialog - the strength there is irrelevant.  I just need the base Android key code to convert to an SDL scancode.  I can get this by simply dividing by 100 if the code is >255 and running it through the SDL scancode conversion matrix.

Do you mean that it sometimes calculates 22 for Right, and other times it calculates 79?  If it is working correctly, it should always calculate 79 for Right (that is the SDL scancode for the "Right" arrow key on a standard keyboard).

I just want to make sure I understand what you are seeing.  79, 80, 82, and 81 are the correct values for the direction keys when converted to SDL scancodes, so those are the only values it should be calculating.  If it is randomly calculating 22, 21, 19, and 20, then there is a problem somewhere in my code.

--EDIT--
From your description, I can't tell if you mean the problem of random codes is happening in the Key Listener or in-game.  If the problem is happening in-game, could you please post the full logcat output produced by SDLSurface when the problem occurs, so I can track down the bug in my code?
« Last Edit: January 01, 2012, 11:44:30 PM by Paul »
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline firstpoke

  • byte
  • *
  • Posts: 27
    • View Profile
Re: Beta Testing Has Begun!
« Reply #72 on: January 02, 2012, 03:13:21 PM »
I just want to make sure I understand what you are seeing.  79, 80, 82, and 81 are the correct values for the direction keys when converted to SDL scancodes, so those are the only values it should be calculating.  If it is randomly calculating 22, 21, 19, and 20, then there is a problem somewhere in my code.

--EDIT--
From your description, I can't tell if you mean the problem of random codes is happening in the Key Listener or in-game. 

No its not in the game... only in the KeyListener. If the KeyListener get the correct values (79,80,81,82) then it is working fine in the game. Maybe in your code only the High CodeKeys were converted to SDL codes and not the codes < 255.

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Beta Testing Has Begun!
« Reply #73 on: January 02, 2012, 03:47:00 PM »
I found the problem (small typo).  Sorry about that, it should work fine now:

Analog Keys Test
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3495
  • Developer
    • View Profile
    • PaulsCode.Com
Re: Beta Testing Has Begun!
« Reply #74 on: January 02, 2012, 07:11:32 PM »
I went ahead and uploaded the update here and the Android Market.  If it turns out there are still problems with input from the USB Joystick Center IME, I'll fix them (but I'm pretty sure this will be working fine now).

I will now start on the first in a series of optimizations.  I'm going to start with the "800 lb. gorilla in the room" as they say.. removing the SDL library.  Mupen64Plus only requires a very small piece of SDL, so it is a waste of resources to include the entire thing with this project.  Instead, I will create a tiny faux SDL library with only the functions that are used by Mupen64Plus (keyboard, audio, and joystick).  These functions will directly interface with Android/ Java through JNI.  The main thing this will do is chop the memory footprint way down (which should have a positive effect on games like Banjo Tooie).  Secondarily, it will make the code easier to navigate and profile for future optimizations.  And finally, by having a faux library in place, I will not have to touch the original Mupen64Plus code (making patches back to the original project much easier).  I'll keep everyone posted on the progress.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted