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

      @recompile if you can get it running then I would get on it ASAP. Let me know how it goes. I am currently focusing on PS and hence unable to divert much time in things i dont know about. Can you set it up and let me know how it goes. Thanks.

      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

        That wasn't too bad. I installed the JavaSE JDK (I haven't used Java in ~10 years) and Apache Ant.

        You'll need to add a couple environment variables: JAVA_HOME and ANT_HOME

        After that, I ripped out as much as I could from the source, and wrote a build.xml file for Ant to use to build the project. (For simplicity, it creates just one jar file.)

        I had to hunt down a missing 3rd party library (picking the newest version that would work) and added it in. A few minor tweeks, and it builds... with a few warnings.

        The resulting jar works. It loads and plays games. Inexplicably, it plays a few games that the last official release was unable to play. (Though Doom RPG, Orcs and Elves, and Doom 2 RPG run at hyperspeed. Wolfenstein RPG seems to run normally.)

        Anyhow, you can download what I've done here:

        [http://drichardson-shared.s3.amazonaws.com/microemu_src_ant_2017-7-10.zip](link url)

        From the command line, navigate to the directory and type 'ant' It will pick up the build.xml file and build the project. The resulting Jar will be in the "build" directory.

        Happily, you can start a game from the command line as well:
        java -jar microemu.jar game.jar

        Right now, it uses Swing and AWT which won't work without X11. Rumor has it that JavaFX on ARM doesn't share that requirement, and would be suitable for porting MicroEmulator to RetroPie.

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

          @recompile This is excellent. I will get to it asap. I plan on trying to incorporate Java SDL for video out is possible.

          Did you notice that one core was always maxed out while running the emulator?

          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 Just tried it out, but it didn't happen for me. What game were you running?

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

              Prince of Persia Two thrones with 240x320 screen size

              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 Wow, that one hammers the CPU, though it does improve during game play. Fortunately, it looks like it's not the application, but the game, that's causing that.

                MicroEmulator doesn't emulate so much as it provides an environment for j2me games. The JRE is executing the bytecode, so there isn't much that can be done about performance there.

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

                  @recompile I shall get the environment setup later in the day and checkout SDL bindings for java. If this works out nicely then It would be great. Considering the game were made for old nokia phones, I have no idea why it is taking so much processing. If this can be debugged then nearly most games should be fun to play I must say.

                  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 It's not likely a bug, just a poorly written game. (None of the other games I tested hit the CPU like that one.) I know it seems crazy that an old game would peg the CPU, but a tight loop will thrash a modern processor just as easily as an old one.

                    Remember that the JVM is actually running the game. MicroEmulator just provides the MIDP and CLDC API's and loads the game jar. I wouldn't spend too much time chasing that rabbit.

                    JavaFX looks like it's out, unfortunately. Oracle killed it on ARM for some crazy reason. It would have been nice to have just one build for Windows, Mac, Linux, and Raspbain. I'm trying to find a simple way to get OpenJFX working, but I'm not hopeful.

                    SDL is just as bad, I haven't found anything serviceable. Hopefully, you've had better luck.

                    I'm looking at JOGL/NEWT and LWJGL now. Let me know if you find something usable.

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

                      @recompile JavaFx would anyway be useless as it might need X11.

                      What do you mean SDL is bad. Can you elaborate on that?

                      Seems like more than me you are qualified to work on this. Lets see if this project looks promising before taking too much of time.

                      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 The reason I thought we should use JavaFX was that it doesn't need X11. If we had X11, we'd be done already. Sadly, Oracle decided they'd rather not support JavaFX on ARM.

                        SDL would be fine, but the newest SDL Java binding project I could find is 12 years old. It would need updated for SDL 2 and compiled for ARM. It seemed like a lot of effort when we could just use something else.

                        Though our options for that "something else" are getting limited... Anyone have any good ideas?

                        I doubt I'm more qualified for the project (I haven't touched Java in more than decade) I've just spent more time digging through the MicroEmulator source.

                        Anyhow, if you can get Java to draw a line on the screen, I'm on board. Otherwise, I doubt I'll do much with MicroEmulator beyond stripping out the last of the applet stuff and squashing a few irritating bugs.

                        If nothing else, MicroEmulator is now slightly less dead than it was a few days ago. That can't be a bad thing.

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

                          @recompile When you say draw a line, are you saying with SDL2 ?

                          EDIT: This thread is full of useful info https://www.raspberrypi.org/forums/viewtopic.php?f=81&t=73489

                          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 I mean with anything. If you can get Java working with SDL, that's the way to go. If you can get it working with something else, that's great too. The only requirement is that it doesn't need X11.

                            Ha! That's the link than got me started on JavaFX.

                            Anyhow, JOGL/NEWT is a possibility. Give it a go. If you can get a working example project, we can start porting MicroEmulator. It looks like they have an armv6-hardfloat noawt build, so that's positive.

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

                              Here is a OpenFX/JavaFX demo that i managed to get working on Pi zero. Needs root access to write to Framebuffer but works none the lesss.

                              alt text

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

                                @hex Perfect!

                                I'll get to porting MicroEmulator from Swing to JavaFX. See if you can work out a process to get that JavaFX test you have working on the Raspbain Retropie build for the pi2/3.

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

                                  @recompile I ran it on zero. It would definitely run on 2/3. give me half an hour.

                                  EDIT : You can get the proper sources from here https://github.com/tisoft/microemu
                                  and binaries for openFX from https://chriswhocodes.com/

                                  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 I don't know what you mean by "proper sources", but I don't have any interest in starting that process over again. I've made quite a few changes already, and I'd rather not move backward.

                                    I couldn't get my JavaFX test to run using the binaries from chriswhocodes.com on my pi 3 using Oracle's JVM. Are you using OpenJDK?

                                    Ed: I installed OpenJDK and copied the binaries over. That didn't work either, so I switched back to Oracle (update-alternatives --config java) and it magically worked.

                                    Very strange. I have no explanation.

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

                                      @recompile at the end of the day that is what matters. As for the proper sources, the repository has proper directory structure, feel free to check it out. I didnt mean to imply that you should switch to that codebase.

                                      The binaries on the website are arm6 and Pi3 is arm7. That might have caused some issues. I am planning on compiling from source so i have a arm7 binary. That way it can be tested on both architectures.

                                      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 As it turns out, the structure is identical to the sources on Google code and sourceforge. (I suspect that the code is identical as well) I removed the 'java' subdirectories for convenience as the entire project is in just one language.

                                        "The binaries on the website are arm6 and Pi3 is arm7." Good to know. Still, as long as it's working I can test it.

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

                                          I think we can change the openfx runtime framework "jfxrt.jar" for a better one later for performance.

                                          I shall till then start working on getting the button mapping transformed.

                                          Shall we create a github repo for managing the code ? You can host it on your profile or I can have it on my profile with the other as a contributor. Let me know what you think.

                                          EDIT : Mapper file in microemu/microemu-javase-swing/src/org/microemu/device/j2se/J2SEButtonDefaultKeyCodes.java#76

                                          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 I wouldn't bother with that. I'm going to move all the mappings to config files. One for a default config, and one per-game. (We won't be building anything in the swing branch anyway once we've moved to JavaFX.)

                                            If you want to work on key mappings, figure out what you want the format to look like. Be sure to include display resolution as some games won't work, or won't work correctly, if the display is the wrong size.

                                            I'm working on it now, thought it may take a few days to get running. (Fortunately, I think we can simplify the code rather dramatically.) Once I have a working JavaFX build, we can put it up on github or wherever.

                                            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.