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.5k 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 Unfortunate. I gave up and fixed hat, etc. myself. I tried to change as little as possible. Well, you can merge, I guess.

      http://drichardson-shared.s3.amazonaws.com/sdl_interface.cpp

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

        @recompile Hat does not need much. Is that not working with your Controller ?

        case SDL_JOYHATMOTION:
        	key = 100 + event.jhat.value;
        	sendKey(key, event.jhat.value, true);
        	break;
        
        //Last bit of value is pressed or released. That works well.
        

        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

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

          @hex No, that's why I changed it. I also wanted pressed/released events, rather than just the state so hat would look identical to joy.

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

            @recompile

            • Can you please test my code and point me what you are expecting and what is happening.
            • Can you tell me which keys are not working as expected and on which controller?
            • Do you want button, hat and axis events to be identifiable differently?

            Any other comments. I am all ears.

            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
            • recompileR
              recompile
              last edited by

              This works on my pi3 with my controllers:

              http://drichardson-shared.s3.amazonaws.com/freej2me-rpi.jar
              http://drichardson-shared.s3.amazonaws.com/sdl_interface.cpp

              Your buttons are very likely to be different, which is where config will come it. If you can steal them RetroArch or wherever, we could just send key events instead of joypadbuttons/hat|joy events

              I'm out for a few hours... :(

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

                @recompile I am capturing exactly the same data as ES is. Can you test your controller in ES. Force reconfigure input and test if all events are detected as expected.

                // ES Code for Hat 
                case SDL_JOYHATMOTION:
                	window->input(getInputConfigByDevice(ev.jhat.which), Input(ev.jhat.which, TYPE_HAT, ev.jhat.hat, ev.jhat.value, false));
                	// Input(int dev, InputType t, int i, int val, bool conf) 
                	return true;
                
                // My code for hat
                case SDL_JOYHATMOTION:
                	key = event.jhat.value;
                	sendKey(key << 16, event.jhat.value, true);
                	break;
                

                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
                • HexH
                  Hex
                  last edited by

                  @recompile Your code crashes when moving from joystick to keyboard. Let me run some more tests till you are out. Can you tell me which controller you are using so i can debug.

                  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
                  • HexH
                    Hex
                    last edited by Hex

                    @recompile Please have a look at the key output generated using my source : https://pastebin.com/K07QU1wu and your source : https://pastebin.com/SC75ebY5

                    Can you do the same for your controller.

                    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
                    • recompileR
                      recompile
                      last edited by

                      @Hex I think we just wasted a lot of time.

                      Your goal was to make this a libretro core, right? If that's the case, we're doing things backwards. A libretro frontend with launch C, which will be the libretro core. C will launch J. Libretro will supply C with a 'RetroPad' abstraction for the controller, and other API's.

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

                        No actually. My first goal was to get it working and stable. Those modifications will need a fork any ways.

                        Gambatte, the emu for Gameboy has an application and libreteo core in separate repos. Similarly libretro core for j2me could be done at a later stage when the implementation is stable and consistent.

                        This project is a great experience for me. Learnt lots. SDL is screwing me with rotation :(

                        Did you see my files? What do you think?

                        Edit: is it possible emulate j2me without Java?

                        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

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

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

                          Edit: is it possible emulate j2me without Java?

                          Yes and no. Midlets are Java apps, after all, and Java apps run on a Java Virtual Machine. You could write your own JVM, but it's not exactly a weekend project. I say yes and no as writing your own JVM to run j2me games doesn't seem to qualify as running them "without Java", but others might disagree.

                          I get the sentiment. I don't like Java either.

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

                          No actually. My first goal was to get it working and stable. Those modifications will need a fork any ways.
                          [...] libretro core for j2me could be done at a later stage when the implementation is stable and consistent.

                          You want to maintain two branches just for retropie? We may be at cross purposes.

                          My primary goal is to play j2me games, on my pi3, on my couch. To that end, we've been successful. The next big thing, for me, is to launch them from ES.

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

                          Gambatte, the emu for Gameboy has an application and libreteo core in separate repos.

                          That I understand. It's convenient having different builds for different purposes. When I build, I get the AWT, JavaFx, and RetroPie versions. I can run the AWT and JavaFx builds just about everywhere I want, except my pi3.

                          What I don't want is to maintain 2 different builds just for RetroPie. Granted, while each build only differs by one smallish (5k-7k) file, I don't even like having both an AWT and JavaFX build as they now serve the same purpose.

                          I'll add the command line switches you want to the current build, but I'm probably going to step back from this part a bit. Not completely gone, I just won't be putting as much time in to it. You likely won't need much from me for this part anyway as there won't be much, if anything, to change.

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

                            @recompile I am in no way prioritizing libretro. We both have same goal. Integrate into Es and retropie.

                            I just didnt know if ES will officially accept it or not without libretro and hence i suggested it. It is no way important if retropie is ok without libretro support.

                            We are pretty much headed in the same direction.

                            Edit : Can you tell me which controller you are using. Your program is crashing with segmentation faults (illegal memory access). I would like to get your controller working with a single source for C so it is easier to maintain. Did you see the paste bin files. What do you think of the syntax? If that works for you and i add your controller support then we are done. I would really like to keep this pace and get this project out of the garage.

                            Feel free to pass all parameters passed after game Jar to C. That way i can add support as needed without needing changes to J

                            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

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

                              @hex It's a Logitech f310

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

                              I just didnt know if ES will officially accept it or not without libretro

                              I don't know what this means.

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

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

                                I don't know what this means.

                                nevermind. We are not going ahead with libretro


                                We still have to get audio working, key config page and m3g i believe.

                                Would you be fine with me hosting the project on GitHub after we are done with audio and key config?

                                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
                                • pjftP
                                  pjft
                                  last edited by

                                  I think this would be accepted even not being libretro. There are several such emulators.

                                  Of course, having a way to get the controllers easily set up, and ideally from the same config that ES uses would be a big help, though it can be done from the ES/RetroPie-Setup side where it writes a config file for your emulator. I think that's done for other emulators as well.

                                  Thanks for pursuing this!

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

                                    @recompile for the command line parameters, can you pass all of the parameters passed after game file? C shall handle everything from there. If the parameters are insufficient/incorrect C shall just ingnore them. All j has to do is check if W and H params are proper ints or not. This way we save some of your time.

                                    I have got rotation working nicely.

                                    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
                                    • A
                                      Allanbuzzy
                                      last edited by

                                      I noticed it's pretty hard to find J2ME roms around the internet for some reason. I'm not sure this'll be possible as finding J2ME roms are pretty hard and risky, as the sites I tried to find looked too suspicious and malicious.

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

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

                                        @Allanbuzzy These sites are mostly defunct but have working links including downloads. These were optimized for mobile so might look funky on desktop. Probably thats what you are looking at rather than shady.

                                        Most of these sites were known as "WAP sites". WAP was the internet protocol on Java phones >> https://en.wikipedia.org/wiki/Wireless_Application_Protocol

                                        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
                                        • HexH
                                          Hex
                                          last edited by Hex

                                          @recompile
                                          [v0.8.1]
                                          A few changes to C :

                                          • Source is now anbu.cpp in dropbox folder
                                          • Added rotation support
                                          • Binary to be compiled as "anbu" (Call accordingly from J)
                                          • Changed command line syntax
                                          • Added help text and credits.
                                          • Added Jhat mod (needs testing)

                                          I didnt want the name to remain "sdl_" related. Hence the change.

                                          Syntax :

                                          anbu width height [-i interpolator] [-r]

                                          [] optional params
                                          -r to rotate frame. Save this in per game config
                                          -i nearest default

                                          The optional params will come from J if needed. Optional params are order insensitive.

                                          java -jar freej2me.jar game.jar width height -i nearest -r
                                          `-----------Not for C---------' `J chks int' `--J passes all to C
                                          

                                          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
                                          • HexH
                                            Hex
                                            last edited by Hex

                                            @recompile I tried to run it on pi3 for the first time. The games are not that playable. Do you tweak any JVM options for smoother playback? It takes a long time to see the game update on click.

                                            EDIT : Oracle JDK has considerably better performance.

                                            Also are you taping into sdterr from C ?

                                            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
                                            • 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.