Would you like to play Nokia (J2ME) games on Retropie?
-
- 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.
-
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.cppYour 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... :(
-
@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;
-
@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.
-
@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.
-
@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.
-
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?
-
@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.
-
@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
-
@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.
-
@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?
-
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!
-
@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.
-
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.
-
@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
-
@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 defaultThe 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
-
@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 ?
-
This post is deleted! -
@recompile Can you share the build files and sources. I wanted to see how the events are handled on J's end
-
Here's a libretro build:
http://drichardson-shared.s3.amazonaws.com/freej2me_libretro_2017-08-25.zipFor the moment, you're stuck in 240x320 mode, but you'll find quite a few games work just fine or were specifically designed for that mode (from what I can tell, it's the most common). Once I add per-game configs, you'll be able to play more.
I have some instructions in the zip, but I'll put them here for convenience.
Step 1: Install Oracle's JDK:
sudo apt-get update
sudo apt-get install oracle-java8-jdk
sudo update-alternatives --config javac
sudo update-alternatives --config java
Step 2:
Add the files:emulators.cfg
andretroarch.cfg
to:/opt/retropie/configs/j2me
Be sure to set permissions to 666:
sudo chmod 666 /opt/retropie/configs/j2me/*
Step 3: Add the following to:
/etc/emulationstation/es_systems.cfg
<system> <name>J2ME</name> <fullname>Java 2 MicroEdition</fullname> <path>/home/pi/RetroPie/roms/j2me</path> <extension>.jar</extension> <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ j2me %ROM%</command> <platform>j2me</platform> <theme>j2me</theme> </system>
Step 4:
Copy the files:freej2me_libretro.so
andfreej2me-lr.jar
to:/opt/retropie/libretrocores/lr-freej2me
Be sure to set permissions to 755:
sudo chmod 755 /opt/retropie/libretrocores/lr-freej2me/*
Step 5: Have fun
Add a j2me directory to your roms directory and copy over your game jars. Restart EmulationStation and play some games.RetroPad mappings are as follows (hard-coded for the moment):
D-Pad (UDLR): 2, 8, 4, 6
A: 9
B: 7
X : 0
Y: 5
Start: Soft2
Select: Soft1
L1: 1
R1: 3
L2: *
R2: #On the keyboard, arrows work as expected, numbers are numbers, and the numpad has 123 and 789 inverted. Additional mappings: q: soft1, w: soft2, e: *, r: #
Sorry for the delay, but I had to not look at this project for a while or I'd have lost my interest.
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.