• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
RetroPie forum home
  • Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login

Would you like to play Nokia (J2ME) games on Retropie?

Scheduled Pinned Locked Moved Ideas and Development
sdlemulatorawesome
304 Posts 22 Posters 145.9k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    recompile @Hex
    last edited by recompile 14 Aug 2017, 21:17

    @hex Mine is quite different A:1 B:0 X: 3 Y:2 L:4 R:5 St:6 Sl:7

    The dpad doesn't make any sense. Pressing Up, Down, Left, Right generates:

    : -1
    : -32768
    : -1
    : -32768
    : -32768
    : -32768
    : -32768
    : -32768
    : -32768
    : -32768
    : -32768
    : -32768

    While that output is handy, this version is very broken.

    1 Reply Last reply Reply Quote 0
    • H
      Hex
      last edited by 14 Aug 2017, 21:19

      @recompile I have got unique keys for all dpad keys now. I shall update C and let you know ASAP.

      Sent from 20,000 leagues under the sea.

      Powersaver Emulation station : https://github.com/hex007/EmulationStation
      ES dev script : https://github.com/hex007/es-dev/blob/master/es-tests.sh

      1 Reply Last reply Reply Quote 0
      • H
        Hex
        last edited by 14 Aug 2017, 21:37

        @recompile Can you try it now? I have updated the C source

        Sent from 20,000 leagues under the sea.

        Powersaver Emulation station : https://github.com/hex007/EmulationStation
        ES dev script : https://github.com/hex007/es-dev/blob/master/es-tests.sh

        R 1 Reply Last reply 14 Aug 2017, 22:28 Reply Quote 0
        • R
          recompile @Hex
          last edited by 14 Aug 2017, 22:28

          @hex I get nothing from the dpad, but I do get events from the analog sticks.

          1 Reply Last reply Reply Quote 0
          • H
            Hex
            last edited by Hex 14 Aug 2017, 23:10

            @recompile I have written some print statements to debug this issue. Can you try it standalone rather than using it with J. I have updated the source.

            ./sdl_interface 1 1 nearest

            All prints are in string while testing.

            Check line 179. That is where I dont know how to handle. Currently what I am doing is registering event if position is zero or Max on either sides. I got two controllers for testing , an SNES gamepad and Xbox controller.

            The Dpad on xbox controller does not yield max values and hence was getting ignored. What should be done in such case

            The Dpad on SNES controller works as expected and provides accurate values.

            Sent from 20,000 leagues under the sea.

            Powersaver Emulation station : https://github.com/hex007/EmulationStation
            ES dev script : https://github.com/hex007/es-dev/blob/master/es-tests.sh

            R 1 Reply Last reply 15 Aug 2017, 03:53 Reply Quote 0
            • R
              recompile @Hex
              last edited by recompile 15 Aug 2017, 03:53

              @hex Let's make this easy.

              What we want: simple pressed/released events from the dpad

              What we have: a 'changed' event with a value range, giving us the current state of an axis.

              We know that when an axis state changes to 0, neither button related to that axis is pressed.

              We know that an axis can be in only 1 of three possible states +N | 0 | -N If Up is + and Down is -, then we know Up is pressed if value > 0 and Down is pressed if value < 0 ** That should answer your question about what to do with values outside the three points you were checking, as no points in the range remain unchecked.

              We can store the dpad's state in only four bits, using one bit for each direction. i.e. UDLR

              On each axis motion event, we make a copy of the old state and update it to reflect the current state. We can then compare the old state to the current state to generate events. (We need to make a copy to preserve the old state of the other axis.)

              For example if the old state is 1001 and the new state is 0101 we know we need to generate two events: up released and down pressed. If there's no change in state, we don't generate any events. Even a noisy analog control will look like a normal button on the J side.

              ** our comparisons could also look like >=1, <=-1, and >-1 & <1 if you want a little buffer around 0

              1 Reply Last reply Reply Quote 0
              • H
                Hex
                last edited by 15 Aug 2017, 04:12

                @recompile Good morning. Firstly I am adding rotation support for frames. So rotation param can be sent from J. As I go on exposing features it will be better if J only sends necessary params. Only if user specifies in config should J opt to send optional params.

                Let me recap what you are saying so we are on the same page

                • Always store prev state (will need to account for multiple analog sticks' axis)
                • Convert state in onStateChange into {0,1} per direction and check with prev value in {U,D,L,R} .
                • If value differs then fire event.

                I can have a threshold that acts like a cuttoff for event detection and have this working :)

                Another thing to note is these joysticks are capable of moving in two dimensions so will fire two events if moved diagonally. which should be acceptable.

                Sent from 20,000 leagues under the sea.

                Powersaver Emulation station : https://github.com/hex007/EmulationStation
                ES dev script : https://github.com/hex007/es-dev/blob/master/es-tests.sh

                R 1 Reply Last reply 15 Aug 2017, 04:28 Reply Quote 0
                • R
                  recompile @Hex
                  last edited by 15 Aug 2017, 04:28

                  @hex said in Would you like to play Nokia (J2ME) games on Retropie?:

                  Firstly I am adding rotation support for frames.

                  That's fine, I'm just not sure why we'd want/need it? Not very many games detect orientation, but those that do base it on the screen resolution and detect those changes by overriding the sizeChanged method on Displayable. (It's the only way to detect orientation changes.) Changing orientation, then, requires changing resolution. Changing resolution means killing sdl_interface and starting it again, so we wouldn't need to rotate there anyway.

                  @hex said in Would you like to play Nokia (J2ME) games on Retropie?:

                  Another thing to note is these joysticks are capable of moving in two dimensions so will fire two events if moved diagonally.

                  Yep. If you press up/left you'll generate an "up pressed" and a "left pressed". If the user slides their thumb so they're only moving up, you'll fire a "left released" The games don't know about gamepads, so J will convert those to the relevant key events.

                  1 Reply Last reply Reply Quote 0
                  • H
                    Hex
                    last edited by Hex 15 Aug 2017, 04:35

                    I downloaded a game with landscape resolution and it still displays as portrait but is to be viewed from the left. This is for games made for devices with unconventional screen placements. It is quite easy and handled by SDL.

                    Regarding the joystick , it might take some time (20 mins). I am looking at how ES handles these things so if the code is usable I will just copy and modify that.

                    Sent from 20,000 leagues under the sea.

                    Powersaver Emulation station : https://github.com/hex007/EmulationStation
                    ES dev script : https://github.com/hex007/es-dev/blob/master/es-tests.sh

                    R 1 Reply Last reply 15 Aug 2017, 04:49 Reply Quote 0
                    • R
                      recompile @Hex
                      last edited by 15 Aug 2017, 04:49

                      @hex said in Would you like to play Nokia (J2ME) games on Retropie?:

                      I downloaded a game with landscape resolution and it still displays as portrait

                      I have a few games like that. Rotating the image, however, won't make any difference. From the games perspective, nothing has changed.

                      The only way to tell the game that the device is on its side is to change the resolution. J2ME doesn't have a concept of 'orientation'. As I explained above, games that want to watch for orientation changes must override the Displayable sizeChanged method and infer orientation based on changes to the display resolution.

                      If you're running a game in 240x320, and the game expects landscape, the only way to change that is to change the resolution to 320x240.

                      I appreciate that it's easy to add rotation, but it's not going to add any value. Remember, the game has no idea that the image is being rotated. You can see this for yourself by rotating frames from J 90 degrees. If the game was in portrait, it will still be in portrait, just rotated 90 degrees. Running a landscape game in 240x320 rotated 90 degrees will still look the same, it'll just be on its side.

                      1 Reply Last reply Reply Quote 0
                      • H
                        Hex
                        last edited by Hex 15 Aug 2017, 05:00

                        @recompile I have got all events to be binary now including the joysticks. I will tidy up the code and let you know once it is ready.

                        I will be testing the rotation too. Now that i have a sample if it works then its in as a feature else i will just discard that code.

                        Sent from 20,000 leagues under the sea.

                        Powersaver Emulation station : https://github.com/hex007/EmulationStation
                        ES dev script : https://github.com/hex007/es-dev/blob/master/es-tests.sh

                        R 1 Reply Last reply 15 Aug 2017, 05:22 Reply Quote 0
                        • R
                          recompile @Hex
                          last edited by 15 Aug 2017, 05:22

                          @hex Out of curiosity, what is the game you want rotated?

                          1 Reply Last reply Reply Quote 0
                          • H
                            Hex
                            last edited by Hex 15 Aug 2017, 05:36

                            @recompile Asphalt6 (480x800)

                            Rotation is proving to be much difficult that anticipated. Working on this till I get controller back

                            Also I lost the Xbox controller. Cant have it back till the little bro finishes playing Minecraft :|

                            Sent from 20,000 leagues under the sea.

                            Powersaver Emulation station : https://github.com/hex007/EmulationStation
                            ES dev script : https://github.com/hex007/es-dev/blob/master/es-tests.sh

                            R 1 Reply Last reply 15 Aug 2017, 05:42 Reply Quote 0
                            • R
                              recompile @Hex
                              last edited by 15 Aug 2017, 05:42

                              @hex I see what you mean now. Rotation makes sense for those cases.

                              1 Reply Last reply Reply Quote 0
                              • H
                                Hex
                                last edited by 15 Aug 2017, 06:08

                                @recompile Can we change the parameter to not need the file:// part ?

                                So you could have -f ./Asphalt6.jar
                                else -u http://.....

                                Sent from 20,000 leagues under the sea.

                                Powersaver Emulation station : https://github.com/hex007/EmulationStation
                                ES dev script : https://github.com/hex007/es-dev/blob/master/es-tests.sh

                                R 1 Reply Last reply 15 Aug 2017, 06:27 Reply Quote 0
                                • R
                                  recompile @Hex
                                  last edited by 15 Aug 2017, 06:27

                                  @hex Probably, but the only people who will see it are you and I. Everyone else will launch games from ES. Are you just looking to use relative paths, or are you just sick of typing the whole path every time?

                                  1 Reply Last reply Reply Quote 0
                                  • H
                                    Hex
                                    last edited by 15 Aug 2017, 06:36

                                    @recompile Sick of typing. File:// does not auto complete so while trying different games for testing i have to copy paste or type very carefully. defeats the purpose of running it from terminal.

                                    suggested changes would be much better. Very few will leverage "-u" option anyways so it will make testing easier.

                                    Sent from 20,000 leagues under the sea.

                                    Powersaver Emulation station : https://github.com/hex007/EmulationStation
                                    ES dev script : https://github.com/hex007/es-dev/blob/master/es-tests.sh

                                    R 1 Reply Last reply 15 Aug 2017, 06:48 Reply Quote 0
                                    • R
                                      recompile @Hex
                                      last edited by 15 Aug 2017, 06:48

                                      @hex I just use a shell script:

                                      #!/bin/sh
                                      java -jar freej2me-rpi.jar file:/home/pi/RetroPie/roms/j2me/ShadoWalker.jar 240 320

                                      I have nine or so named like test.sh, test2.sh, nokia.sh, etc. for whatever I'm looking to check at the moment. It saves a lot of time and typing.

                                      Also, pressing up on the command line will scroll through previous commands. Very handy.

                                      I like simple.

                                      1 Reply Last reply Reply Quote 0
                                      • H
                                        Hex
                                        last edited by 15 Aug 2017, 06:53

                                        Can it be please modified to take shell paths like /home/hex/a.jar or ./a.jar or a.jar

                                        Syntax wise I am thinking this

                                        java -jar freej2me.jar file/url W H [-r 90] [-i interpolation]

                                        Sent from 20,000 leagues under the sea.

                                        Powersaver Emulation station : https://github.com/hex007/EmulationStation
                                        ES dev script : https://github.com/hex007/es-dev/blob/master/es-tests.sh

                                        R 1 Reply Last reply 15 Aug 2017, 07:40 Reply Quote 0
                                        • R
                                          recompile @Hex
                                          last edited by 15 Aug 2017, 07:40

                                          @hex Yes, but it adds a lot of unnecessary complexity, can be very fragile, and still ambiguous. Is the path intended to be relative to the current working directory or the location of the jar file?

                                          I like simple. I see this as adding complexity without adding any value.

                                          Simplicity is actually the reason why it takes a url instead of a 'normal' path. It was simpler to implement and required less code.

                                          To your specific problem: It looks like you just want to reference a file in the current directory. Here's how you do that:

                                          java -jar freej2me.jar file:./a.jar
                                          

                                          @hex said in Would you like to play Nokia (J2ME) games on Retropie?:

                                          Syntax wise I am thinking this

                                          That's fine. How do you want to receive it on the C side? Just W H R I?

                                          1 Reply Last reply Reply Quote 0
                                          160 out of 304
                                          • First post
                                            160/304
                                            Last post

                                          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.

                                            This community forum collects and processes your personal information.
                                            consent.not_received