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 149.0k 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.
    • recompileR
      recompile @Hex
      last edited by

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

      do you have a communication standard in mind for Events or am I free to select?

      Feel free to use whatever you'd like. It could be as simple as a byte for the event type and a byte for event data for keyboard/joystick, maybe a pair of shorts for mouse events. I like simple.

      1 Reply Last reply Reply Quote 1
      • recompileR
        recompile @Hex
        last edited by

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

        Is there a way for J to know resolution once a jar is loaded?

        Sadly, no. Most games get the display size from the phone, and either adapt to it or fail. A few games have a preferred display size in the manifest, but it's not reliable. This is why I was passing the display resolution in as a parameter.

        I had planned to add a configuration editor that would start and ask for things like display size, control configuration, etc. that starts if a configuration for a game can't be found on load, or that can be manually started to modify a games configuration.

        This is what I'm thinking. I could pass a byte along with the frame that signals that what follows is either a frame or a change in resolution. Something like [0, ...frame data...] or [1, shortW, shortH]

        1 Reply Last reply Reply Quote 0
        • HexH
          Hex
          last edited by Hex

          @recompile is is ok for me to check for incomming events between frames? I dont know if incoming frames can be guaranteed. So will something like this work for you in "C"? Else I will need to make it multi threaded so that polling and drawing can be done independently.

          //wait for incomming frame, blocking call
          while true {
              read_frame()
              //Render frame
              show_frame()
          
              // Check if input event occurred
              if SDL_PollEvent()
                  send_event()
          }
              
          
          
          
          1 Reply Last reply Reply Quote 0
          • HexH
            Hex
            last edited by

            @recompile Regarding the resolution problem, I would like to suggest this :

            If config found

            • Read config
            • Read resolution from config
            • Start C based on resolution

            If config not found

            • Get screen resolution
            • Start C based on resolution
            • Send frames for config.
            • Get map of all required info
            • Write config file
            • End C by closing C.stdin pipe
            • GOTO : if config found

            Will this work ?

            I would like to keep communications to a minimum. Killing and restarting is not much of a big deal.

            recompileR 1 Reply Last reply Reply Quote 0
            • recompileR
              recompile @Hex
              last edited by

              @hex That'll work. If freely killing and restarting 'C' isn't going to be a problem then the problem is solved.

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

              @recompile is is ok for me to check for incomming events between frames? I dont know if incoming frames can be guaranteed.

              There's no guarantee at all. Some games will just sit and not repaint while waiting for an event. Other games will draw frames as fast as they can, even if nothing changes.

              1 Reply Last reply Reply Quote 0
              • HexH
                Hex
                last edited by Hex

                @recompile Ok so we will need a multi threaded solution. Currently C can wait forever for new frames to come whilst showing last received frame. I shall get back to you as soon as I have it working.

                I also had a question about how audio will be handled. Will Java take care of it?

                SDL Controls are working nicely. I can send J ascii codes for the buttons clicked followed by a delimiter if necessary. Some special key codes are >256 (eg Shift, Tab Ctrl, Alt)

                Do you need joystick and mouse ? Considering no mobile phone had that.

                recompileR 1 Reply Last reply Reply Quote 0
                • pjftP
                  pjft
                  last edited by

                  I just want to say that even though this thread has no other active participants, it's highly enjoyable, educational and even exiting to watch this unfold.

                  Thank you for pursuing this and for doing this in the forums! Looking forward to seeing what comes out of this.

                  Best.

                  1 Reply Last reply Reply Quote 1
                  • HexH
                    Hex
                    last edited by Hex

                    @pjft The timing of this was awesome. I just finished PS by your help and @recompile ended up getting is working. I am of the opinion that pair programming is freaking awesome. It is way faster than if a single person were to do it. I will mostly archive these conversations in a README file once this is nearing an alpha release.

                    1 Reply Last reply Reply Quote 1
                    • recompileR
                      recompile @Hex
                      last edited by recompile

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

                      I also had a question about how audio will be handled. Will Java take care of it?

                      I don't know. I haven't even tried to properly implement audio yet. I would assume that it can be done on the java side.

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

                      Do you need joystick and mouse ? Considering no mobile phone had that.

                      Believe it or not, some games used a touchscreen. Doom II RPG isn't playable without it. Of course, it's the only game I know that requires it, so it's not exactly a priority.

                      As for joystick, I expect most people will want to play with their controller.

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

                      Some special key codes are >256

                      Not really a big deal to send a short instead of a byte. As long as it's consistent, it doesn't really matter. An int for type and an int for code if you want to really go wild.

                      I'm out for a few hours. I have to go earn a living.

                      1 Reply Last reply Reply Quote 0
                      • HexH
                        Hex
                        last edited by Hex

                        @recompile I have updated the source code to have separate threads for Streaming (frames) and Capturing (keys).

                        C communicates all keyboard events over stdout as an (int) key code followed by \n
                        Key codes can be found here : https://wiki.libsdl.org/SDLKeycodeLookup

                        If F4 is received, C terminates cleanly. C also communicates that it received F4 by sending -1 as key code.

                        Another way to terminate C is to close its stdin. This tells C to terminate cleanly.

                        Is this sufficient?

                        To compile : g++ -lSDL2 -lpthread -o sdl_interface sdl_interface.cpp

                        recompileR 1 Reply Last reply Reply Quote 0
                        • HexH
                          Hex
                          last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • recompileR
                            recompile @Hex
                            last edited by

                            @hex We'll need both keydown and keyup events.

                            1 Reply Last reply Reply Quote 0
                            • HexH
                              Hex
                              last edited by

                              @recompile Missed that. Will make changes and updoad new file.

                              Also how do you want the key up down difference? Your choice.

                              KEY 1 <-- Pressed
                              KEY 0 <-- lifted

                              recompileR 1 Reply Last reply Reply Quote 0
                              • recompileR
                                recompile @Hex
                                last edited by

                                @hex It doesn't really matter as long as I can tell the difference. A flag like that before the code should be just fine.

                                1 Reply Last reply Reply Quote 0
                                • HexH
                                  Hex
                                  last edited by Hex

                                  @recompile I have updated the code. Syntax is

                                  KEY CODE\n

                                  KEY = 1 : Down / 0 : Up
                                  CODE -> As provided in url above

                                  1 Reply Last reply Reply Quote 0
                                  • recompileR
                                    recompile
                                    last edited by

                                    I guess back to you.
                                    http://drichardson-shared.s3.amazonaws.com/freej2me-rpi.jar

                                    I get a black screen and a mouse pointer.

                                    1 Reply Last reply Reply Quote 0
                                    • Z
                                      Zigurana
                                      last edited by

                                      This is great!
                                      It's like witnessing the birth of a new emulator (not exactly, but close enough).

                                      Keep up the momentum guys!

                                      If tetris has thought me anything, it's that errors pile up and that accomplishments dissappear.

                                      1 Reply Last reply Reply Quote 2
                                      • HexH
                                        Hex
                                        last edited by

                                        @recompile is there a syntax for that? I am getting an Array out of bounds exception

                                        Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
                                        	at org.recompile.freej2me.RetroPie.<init>(RetroPie.java:64)
                                        	at org.recompile.freej2me.RetroPie.main(RetroPie.java:22)
                                        
                                        
                                        recompileR 1 Reply Last reply Reply Quote 0
                                        • A
                                          Allanbuzzy
                                          last edited by

                                          Yes, I'd love to play these mobile games on my RetroPie. And you probably know what my next splash screen might be...
                                          wink

                                          alt text

                                          "What do you play games on?"
                                          "A LEGO brick."
                                          "LEGO What?

                                          1 Reply Last reply Reply Quote 0
                                          • recompileR
                                            recompile @Hex
                                            last edited by

                                            @hex You need to pass a jar.

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

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              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.