Views: 9,367,109 | Homepage | Main | Rules/FAQ | Memberlist | Active users | Last posts | Calendar | Stats | Online users | Search | 09-20-24 11:27 AM |
Guest: |
0 users reading Android port | 1 bot |
Main - Development - Android port | Hide post layouts | New reply |
MAGNUM_PT |
| ||
Member Normal user Level: 8 Posts: 1/10 EXP: 1460 Next: 727 Since: 11-19-18 Last post: 764 days ago Last view: 136 days ago |
So, for the past couple of days I've been trying to port melonDS to Android and I managed to get it to run. Here's a small video of it (kinda) working on a OnePlus X (Snapdragon 801):
As you can see, performance is terrible, making it completely unplayable. Sound does not work properly and only touch input is implemented (as a proof of concept). Some changes were made to melonDS's source code (to make some aspects more abstract) and can be found here: https://github.com/rafaelvcaetano/melonDS-android-lib The frontend source code will be released soon once I have it in a more user-friendly state (scale screens properly, proper input, BIOS location selection, and sound maybe?). Regarding the culprits of bad performance, I don't have a clear idea of what is the main bottleneck. Currently, I have the emulation running on a separate thread and rendering is done on a separate thread using OpenGL, where I simply fetch the framebuffer and draw it. I didn't even bother implementing synchronization between those threads since the performance was so bad that the chances of having tearing were so low. |
Hydr8gon |
| ||
Member Dragon Trainer Level: 8 Posts: 1/11 EXP: 1692 Next: 495 Since: 10-29-18 Last post: 1052 days ago Last view: 95 days ago |
Nice work on this. It's really weird that the performance is so bad... I skimmed over your code and nothing jumps out to me as something that would cause slowdown. I wouldn't expect it to reach full speed, but I would expect it to be much faster than this. I have a Switch port of melonDS (check it out here) and it doesn't run full speed, but it runs pretty good considering the Switch hardware and desktop melonDS performance. I have a similar setup too; drawing the framebuffer with OpenGL, and emulation and audio on a separate thread. So I can only imagine it would be a problem with the Java code. Wonky Android stuff, or some weird thread priority issue maybe? I have some Android experience, I'd be interested in taking a look at your code if you upload it all and maybe help find the problem. |
Arisotura |
| ||
Big fire melon magical melon girl Level: 58 Posts: 235/941 EXP: 1509153 Next: 68393 Since: 03-28-17 From: France Last post: 15 days ago Last view: 11 hours ago |
might just be that some OpenGL drivers for Android are total shit. dunno tho.
Android is crap too tbh. but, like... dunno maybe this is not running in performance mode or whatever. I don't know shit about Android. ____________________ Kuribo64 |
Hydr8gon |
| ||
Member Dragon Trainer Level: 8 Posts: 2/11 EXP: 1692 Next: 495 Since: 10-29-18 Last post: 1052 days ago Last view: 95 days ago |
Posted by StapleButter True, OpenGL drivers on Android are usually pretty bad. But for just drawing the framebuffer (and on a separate thread no less) it really shouldn't affect performance too much. Some sort of performance throttling could be happening, but that usually doesn't kick in until something's been running for a little while and the CPU starts to heat up. But yeah, there are so many Android devices out there and some do stupid shit with performance so it very well could be that. |
MAGNUM_PT |
| ||
Member Normal user Level: 8 Posts: 2/10 EXP: 1460 Next: 727 Since: 11-19-18 Last post: 764 days ago Last view: 136 days ago |
After remembering that doing a release build could a good idea, I managed to get between 20 to 30 FPS when starting the game. However, it quickly goes down back to 10 FPS. I will try to upload the frontend code today. |
Hydr8gon |
| ||
Member Dragon Trainer Level: 8 Posts: 3/11 EXP: 1692 Next: 495 Since: 10-29-18 Last post: 1052 days ago Last view: 95 days ago |
Posted by MAGNUM_PT Lol, debug build will do that to you. The release build FPS drop sounds like aggressive performance throttling. How long does it take before the FPS drops? When you upload the frontend code I'll give it a compile and test performance on my OnePlus 5T. |
Arisotura |
| ||
Big fire melon magical melon girl Level: 58 Posts: 236/941 EXP: 1509153 Next: 68393 Since: 03-28-17 From: France Last post: 15 days ago Last view: 11 hours ago |
well yeah debug builds are slow as shit
that's why the CodeBlocks project has that DebugFast config btw it gets all the optimizations so it's fast, but it gets shit like the debug console though it's not well suited to actual debugging or profiling ____________________ Kuribo64 |
MAGNUM_PT |
| ||
Member Normal user Level: 8 Posts: 3/10 EXP: 1460 Next: 727 Since: 11-19-18 Last post: 764 days ago Last view: 136 days ago |
The frontend source code has been (finally) published. You can find it here: https://github.com/rafaelvcaetano/melonDS-android
A testing build can be found here: https://github.com/rafaelvcaetano/melonDS-android/releases You will need to have the BIOS files (arm7, arm9 and firmware) in a directory to be able to use the emulator. |
Hydr8gon |
| ||
Member Dragon Trainer Level: 8 Posts: 4/11 EXP: 1692 Next: 495 Since: 10-29-18 Last post: 1052 days ago Last view: 95 days ago |
Posted by MAGNUM_PT Thanks. I ran the test build and noticed a few things: -Sound works, even though your readme says it doesn't? -On my phone, 2D performance is at least double my Switch build but 3D performance is only slightly better. Threaded rendering should be enabled by default, so there's probably something in your thread implementation that could be optimized. -I had a save file already that I tried to use, but it wasn't loaded. My guess is that you didn't pass the right SRAM path to the LoadROM function? I haven't looked at the code yet, but I'll try to look into these things after I finish some of my pesky assignments. |
Arisotura |
| ||
Big fire melon magical melon girl Level: 58 Posts: 238/941 EXP: 1509153 Next: 68393 Since: 03-28-17 From: France Last post: 15 days ago Last view: 11 hours ago |
hey hey hey comrades
how 'bout joining the melonDS IRC so we could exchange about all that irc.badnik.net #melonds ____________________ Kuribo64 |
MAGNUM_PT |
| ||
Member Normal user Level: 8 Posts: 4/10 EXP: 1460 Next: 727 Since: 11-19-18 Last post: 764 days ago Last view: 136 days ago |
Just to finish the conversation:
- Regarding sound, on my device it sound more like ear rape that anything else. Due to the low framerate that was expected, but it didn't seem right. I'll try to check on a better device - Regardint 3D performance, it's quite possible that performance may be lacking. Android does not natively support semaphores, so I had to implement them using mutexes. However, I was not sure how SemTryWait() was supposed to be implemented and that might be causing problems. The other related methods could also use another revision - Currently, the path to the SRAM is hardcoded to be inside the app's data directory. I'll add an option to specify a directory or use the same directory as the ROM From now on, I'll try to be around IRC, as StapleButter suggested, so that we can start discussing some things there. |
Arisotura |
| ||
Big fire melon magical melon girl Level: 58 Posts: 239/941 EXP: 1509153 Next: 68393 Since: 03-28-17 From: France Last post: 15 days ago Last view: 11 hours ago |
re: semaphores
in the case of the 3D thread, there is a semaphore that is incremented each time the renderer finishes a scanline, and decremented each time a scanline is read to be composited in the final video output. there's another semaphore that tells the renderer when it can start, and one that the renderer uses to signal when it has completed a frame. ____________________ Kuribo64 |
CrashGamer |
| ||
Newcomer Inactive Level: 2 Posts: 1/1 EXP: 43 Next: 3 Since: 06-24-19 Last post: 1906 days ago Last view: 1902 days ago |
How an nds emulator is created on android
|
kevincrans |
| ||
Melon seeds DSI-Brewer Level: 7 Posts: 1/8 EXP: 988 Next: 460 Since: 07-02-19 From: Kingdom of the United Netherlands Last post: 305 days ago Last view: 134 days ago |
Why OpenGL ES and not Vulkan?
I don't know shit about Android either. |
Diego29 |
|
Diego29 |
| ||
Newcomer Inactive Level: 3 Posts: 2/2 EXP: 114 Next: 14 Since: 04-09-20 Last post: 1622 days ago Last view: 1540 days ago |
Hello a question they are still with the melonds port I want to know why I want to use it but it will also have a local or online multiplayer |
Hyla |
| ||
Newcomer Inactive Level: 2 Posts: 1/1 EXP: 40 Next: 6 Since: 04-14-20 Last post: 1619 days ago Last view: 1379 days ago |
Please keep trying to port MelonDs to android, possibly this will be the only emulator with multiplayer for nds games running on Android, and that would be really amazing. ❤️ |
MAGNUM_PT |
| ||
Member Normal user Level: 8 Posts: 5/10 EXP: 1460 Next: 727 Since: 11-19-18 Last post: 764 days ago Last view: 136 days ago |
Hey! Sorry for the late replies. Yeah. I've been keeping a close eye on developments and this week I ended up addnig support for GBA ROMs. I also took a look at the OpenGL renderer but unfortunately my knowledge in this area is limited.
I've also been looking at Wi-Fi support but I'm still not sure how viable it will be. To support direct mode, root is required, which is far from ideal. I'll keep making some tests but there is absolutely nothing I can promise. |
Generic aka RSDuck |
| ||
Big fire melon Administrator Level: 45 Posts: 47/608 EXP: 636904 Next: 23260 Since: 10-12-19 Last post: 10 days ago Last view: 13 hours ago |
The OpenGL is probably to slow for a lot of devices anyway (especially with those allegedly terrible mobile GL ES driver). When I'm finished with the JIT I want to write a faster neon software renderer.
when the indirect mode gets improved wi-fi, we only need normal sockets. For your port the aarch64 JIT and the neon renderer 2d developed with my switch port might be interesting for you https://github.com/RSDuck/melonDS ____________________ Take me to your heart / never let me go! "clearly you need to mow more lawns and buy a better pc" - Hydr8gon |
Arisotura |
| ||
Big fire melon magical melon girl Level: 58 Posts: 516/941 EXP: 1509153 Next: 68393 Since: 03-28-17 From: France Last post: 15 days ago Last view: 11 hours ago |
alternately we could make a 'consumer-toy' GL renderer that sacrifices accuracy in the name of betterer speeds (doing more aggressive polygon batching, etc) ____________________ Kuribo64 |
Main - Development - Android port | Hide post layouts | New reply |
Page rendered in 0.070 seconds. (2048KB of memory used) MySQL - queries: 28, rows: 115/115, time: 0.044 seconds. Acmlmboard 2.064 (2018-07-20) © 2005-2008 Acmlm, Xkeeper, blackhole89 et al. |