Player 3DS Port


#21

Tried build 98 yesterday and that one works. I believe that it doesn’t have any changes done prior to the things you want to test, am I right? (didn’t try build 100 which is the latest at the time I write this though). So yeah, latest build works


#22

no, any build in the last 25 days is fine. Just wanted to know if this is a bug in the new code or general breakage. Thanks :).
So a proper fixed version will come when I have access to hardware again, then.


#23

Oh… well, 'til december then?


#24

Actually @Mr.Faq2014 I just asked on 3dsdev and they told me a different technique for playing audio through a callback based API. (the current theory is that the audio thread takes too much cpu time)

https://easyrpg.org/downloads/tmp/3ds-new-audio-test.zip
(same URL as above, make sure the zip contains files from the 21 october)

EDIT:
And here is a version using an updated ctrulib and again some changed code.
https://easyrpg.org/downloads/tmp/3ds-new-audio-test2.zip

And here a version without audio. When this version crashes, too. Something else is flawed.
https://easyrpg.org/downloads/tmp/3ds-new-audio-test-no-audio.zip


#25

Tried all three of them right away. Dunno if it’s unfortunate though, but both audio test builds crash (they don’t respond input at all, maybe more like they softlock themselves) after easyrpg logo too (still talking about the same problem). However, the no-audio version crashed the same way as well, which as you stated means that something else might be flawed


#26

That sounds bad :confused:

Do you use the easyrpg-player.xml file that is provided by the official release? (otherwise it uses the wrong target title and just crashes).

And I found a mistake in the code, because it is compiled with “citra support” (which disables the romfs code) and in that case the project_path is not set at all… It’s likely that this is the crash reason ^^’

Sooo I updated the 3 zip archives listed above (and added the missing XML) with the fixed project_path. This version is compiled in debug mode, the bottom renders a console (first output should be "Project path “.”) instead of the keyboard (so not Yume Nikki friendly, at least no wakeup :smiley: )


#27

Tried them again. Good news, they work! :smiley:
Unfortunately, seems like it has the same issue as the wii port. Music cracks if framerate is too low. Also games reach 60 fps in menus, but still there framerate lowers and music cracks (guess that music implementation). Should try on a new3ds though, maybe in there music may not crack.
It’s something to worry about because framerate is pretty unstable. Gonna try do a test with a friend’s new3ds if I can, maybe it won’t be that severe in a new3ds. I’ll do a video to show you how it works in my 3ds too

Edit: Seems not to happen too often with .wavs though, .mp3 and midis on the other hand still aren’t ear-comfortable


#28

This is actually worse then before because MP3 worked flawless.

Really strange that a bad framerate influences the audio playback because the audio runs on an extra thread. Maybe it’s the way how the “buffer exhausted” is signalled now.

I added two additional builds:
https://easyrpg.org/downloads/tmp/3ds-new-audio-test3.zip - This ones runs a thread on the 2nd core that polls if the audio buffer is empty (this is almost how it was handled in the original version)

https://easyrpg.org/downloads/tmp/3ds-new-audio-test4.zip - This one fills the buffer in the dsp callback (I expect the worst results here)


#29

All right, tested both builds. Audio still cracks, but test4 seems to work a little better. Test3’s audio performance is pretty unstable overall, although it seems to have a better framerate than test4. On the other hand, test4’s audio performance is sort of smoother, having the audio to continue playing but the playing speed getting slower. However, as a result it seems to have pretty severe framerate droppings and several game crashes as well, where the player can’t render stuff. Mostly when trying to load stuff like maps or animations, the screen dyes red and text appears saying “Couldn’t create “size number” x “size number”, EasyRPG will close now, Press Enter to exit.”. Here’s an example with a Standstill Girl map, where framerate dropped drastically after loading the savefile:

The crashes happened several times during testings, but I wouldn’t say it’s something new to the builds though, I should test previous builds and see if the same crashes occur to be sure. Anyway, this also happened with build test3 as well, but it happened only once while testing the area in the screenshot; entered a battle and the player crashed when trying to do one of the battle animations (something worth mentioning, the savefile I used to reach that point in the game is an rm2k one so the lack of parallax background must be related to that).
Back to music stuff, .wav files play pretty flawlessly compared to .mp3 and midis, but some parts when the audio would crack appeared still (Testgame - WAV Title Screen is one example). I tested .ogg with the Testgame - OGG as well, and gotta say that audio cracks as well, but it seems to have a better performance when it comes to the framerate.
Lastly, .mp3 files work a little better than midis in test3, finding out that mp3 playing is kinda more stable than midi playing (gaps between audio get bigger as the midi keeps playing, while this doesn’t happen in mp3 playing). About .ogg playing, it has the same performance as mp3 playing. Also Test4 seems not to have this issue, but audio still may get cracked and won’t play properly.
Well, I guess that’s the most important stuff I can say about the tests I’ve been doing this morning. Tell me if you need more details. See you around!


#30

The “Could not create X” is actually a memory allocation issue and some unrelated problem. I have no idea why the 3DS runs out of memory, we have 128 MB available, more then the Wii. But we have plans to reduce the memory footprint someday. This should help against this…

Sorry to bug you again but the tests 1 to 4 were updated again. I found a critical bug in the invalidation of the audio-buffer (half of the memory was not flushed, so is possible that the DSP saw the wrong buffer content).

When the 1 sounds as before it’s probably not worth to test the rest :frowning:


#31

Tried test1, no luck, audio but .wav still doesn’t play properly :frowning:


#32

Good news.
Music and Sound should now play fine. I observed problems with pitch changed (speed up/down) music but otherwise it works quite fine. Sound effects will hang the first time they are played because they are cached, afterwards it’s lagfree (same strategy as the Wii version, just with more lag because 3DS is slow).
I also noticed that the performance got worse in general but this in unrelated to the audio code and must be something else… (but is still on a playable level on old 3ds in my opinion)
Furthermore the heap size got adjusted, games should run much later out of memory now.

The code is not yet in our repo, so here are the downloads:
https://easyrpg.org/downloads/tmp/easyrpg-player-latest.cia

https://easyrpg.org/downloads/tmp/easyrpg-player-3ds-latest.zip

Note about MIDI: I added the midi instruments to the romfs but I still have no a9lh, so can’t test the CIA ;). If MIDI does NOT work you have to take the wildmidi.cfg and instruments folder from the zip and place the files in /easyrpg-player/wildmidi/ on your SD card.


#33

Oh god, if I had read this earlier…

Unfortunately, I tested the cia and so far it doesn’t have midi playback (.3dsx does and it’s flawless, enough for me), and it doesn’t give any error. It just doesn’t play. Checked the app log and it says that the format is not supported even having the instruments and the .cfg file in place.
In both format versions sound effects play as intended, and overall gameplay is ok, most of games run at around 30 fps average on my old 3ds and they are playable. Games may get a little stuck during transitions, but that can’t be helped as it’s because 3ds is slow.
The cia version sometimes crashes the console if suspended and closed with the X button, mostly if you suspend it in mid-gameplay (if you suspend on a title screen or in easyrpg’s game selection menu it doesn’t crash). Also noticed that the bgm doesn’t continue when suspending as before, cool!
Well, other than this, everything worked as intended, just a little slow as the 3DS is doing its best, should find someone with a new3DS to see what happens.

Overall, it works like a charm. Awesome work! Better late than never, it’s like a wonderful Christmas present :stuck_out_tongue: Hope you had a Merry Christmas and have a happy New Year :slight_smile: Seriously guys, thanks a lot!


#34

Happy new year.

Thanks for the feedback. Conveniently I finally have a9lh installed now (finished it a few hours before new year :D) so a CIA with working MIDI should be available in a few days (or hours depending on how much time I find :smiley: )

Right, that sentence about “place in /easyrpg-player/wildmidi/ on your SD card” will not work either, because I have a bug in my code. I noticed that WildMidi will not find the audio files when I prefix the path with “sdmc:/”. So I specified the paths without this and with the CIA this will fail because the default path is the romfs, not the sd card (though this assumption was also wrong, because you don’t get MIDI playback, or I screwed up when making the romfs… not sure)


#35

Found the problem in the wildmidi code, midi works now in the CIA. (just redownload the file I linked)

Further updates:
Disabled pitch changes (playback speed up/down) for BGM (background music) on the old3ds because the CPU can’t handle this (I run the BGM code on the 2nd CPU core and you only get 30% CPU time on this core because the operating system runs there. So the CPU time is very limited and pitch changing (which postprocesses the bgm buffer and for speedup even has to decode more samples) exceeds it and the music starts to crackle). Advantage of this solution: BGM does not influence the frame rate at all.

I’m sometimes getting a “data abort” crash when shutting down the Player. No idea why this happens, yet.


#36

Sorry for delaying a little. Tested it, yup, midi now works :slight_smile:
Gotta admit that I didn’t do a thorough test this time, but I’d surely recommend grabbing a new3ds to use EasyRPG on a 3DS. I wonder if someone tested it already.
Anyway, truth is that the cia version crashes when exiting, despite that the idea is to exit the app. Do you know why is that?
Oh well, I’d like to do a suggestion, and it’s to map a reset key combination if you can (aka F12 on PC). The 3DS port doesn’t have one as far as I know (tell me if I’m mistaken). I’ll look forward to build cias with this. See you around :slight_smile:


#37

Just thought about using some key combination for this, for example for some gamboy games you could press A + B + START + SELECT to return to the title screen.
Another idea I had before is adding a bar on top of the second screen for some touch buttons, like for reset, menu, graphic options, etc.


#38

I like those ideas. About the key combination however I’d recommend another combination, mostly one that doesn’t involve keys with an actual function, just in case (afaik the buttons without function are X,Y and SELECT, tell me if I’m wrong). I thought of Y+SELECT (or backwards), avoiding X as X+Y brings up NTR in the cia version which in case you don’t know is a tool you can use to do in-game stuff like cheating, taking screenshots and also recording on new3DS only. Wouldn’t affect the player as it stops everything to display a menu in the bottom screen (would be sort of like pressing HOME I believe), but just in case…


#39

Quick question, sorry for double posting:
Are the changes made to audio implemented in the latest nightly?


#40

Not yet. Have some other audio work to finish (unrelated to 3DS) before I’m ready. Expect it by February.