# Working on a 3DS Port

**URL:** <https://community.easyrpg.org/t/working-on-a-3ds-port/201>\
**Category:** Player\
**Created:** [March 19, 2016, 4:56pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201 "2016-03-19T16:56:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 19, 2016, 4:56pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/1 "2016-03-19T16:56:16Z")

</div>

![](https://community.easyrpg.org/uploads/default/original/1X/a1214b1006af8a2a3582326227316c6ec5629f38.png)

 ![](https://community.easyrpg.org/uploads/default/original/1X/b19ddc1e72cf3fe50c01dd0cadc7e9b046f6525d.jpeg)[/spoiler]  
[color=#00b300]  
Introduction[/color]

Hello everybody, i recently started working on a port for 3DS of EasyRPG, a player for games wrote with RPG Maker 2000/2003.  
At the moment the interpreter is in an early stage of development but runs quite smooth on both O3DS and N3DS.  
BGM Audio is supported only in .wav format and sounds are available only in .wav/.ogg format.

[color=#00b300]Can i help you working on this?[/color]

- Developers : If you have C/C++ knowledges you can take a look to the issues in my repository and try to work on them ( [https://github.com/Rinnegatamante/easyrpg-player-3ds/issues](https://github.com/Rinnegatamante/easyrpg-player-3ds/issues) ). If you need libraries already compiled (since it has a lot of dependencies) just send me a PM and i’ll give you prebuilded libs.
- Testers : I also need some betatesters to test modifications i make to the interpreter constantly. If you want to test it, you can find a download at the end of this post with informations about what i currently need to be tested.

[color=#00b300]Can i play “INSERT NAME HERE” game with this?[/color]

As i said before, this is in an early stage of development and the link you can find at the end of his topic IS NOT FOR GAMING PURPOSES. You’ll not receive any kind of support by me trying to fix errors to play a game you want to play.

[color=#00b300]Test Build[/color]

What i currently need to be tested is the sound engine i’m writing and the svchax execution, so i need to know:

1. Your firmware and console (O3DS/N3DS)
2. Debug console what says if a crash/freeze occurs (take in mind that the interpreter is slow to load stuffs so just wait a bit before concluding it’s a freeze).
3. If you reach the main menu, i need to know if the sounds are playing fine.
4. Since this build uses svchax, i need to know how many tries you made to start it (since svchax can fail and you’ll have a system freeze).

Download Test Build (with old 3dsx): [http://rinnegatamante.it/easyrpg\_player.rar](http://rinnegatamante.it/easyrpg_player.rar)  
Updated 3dsx file: [http://gbatemp.net/attachments/easyrpg-player-rar.44166/](http://gbatemp.net/attachments/easyrpg-player-rar.44166/)  
GitHub Repository: [https://github.com/Rinnegatamante/easyrpg-player-3ds](https://github.com/Rinnegatamante/easyrpg-player-3ds)

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [March 19, 2016, 6:54pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/2 "2016-03-19T18:54:21Z")

</div>

Hello.  
That 3ds branch is horribly outdated and needs a rebase to get on par with the current Player development but otherwise it’s a good base. EDIT: My 3ds branch is now rebased on 0.4.1

You can also use Windows if you have msys installed. Msys provides autotools, make and other build tools that are required. For building you can use the 3ds Makefile in builds/3ds

SDL2 is not required for the 3DS because there is no proper port for SDL2. SDL is a wrapper around video, input and audio. Video and input is easy to solve but we have no idea about the audio. Audio will be probably most of the work to get working because games can come in lots of sound formats (WAV (PCM, ADPCM, Mono, Stereo…), MP3, Midi)  
I guess you can use openal\_audio (in the Player repo) as a reference. It uses libsndfile to process all audio files except MIDI and MP3. For MIDI and MP3 we are currently working on solutions that can be easily integrated also for 3DS if you figure out how to do audio with 3ds. 😃

Cross compiling the dependencies is not really rocket science and works the same for all platforms.

The devkitpro wiki has [useful information](http://devkitpro.org/wiki/portlibs) about cross compiling libraries. The libpng way works for almost all platforms. You only have to also pass the arguments “-march=armv6k -mtune=mpcore -mfloat-abi=hard” otherwise you get strange “VFP register argument” errors.

For a minimal build you need at least: iconv (for liblcf), liblcf, libpng, zlib, freetype, pixman, SDL replacements for 3ds (pick any ^^).

What I can offer to you is that we provide all dependencies for the libraries. Then you can directly work on the Player without worrying about porting the libraries. This is no big deal for us because we already offer libraries for Wii, Android, OSX and others. So we are experienced in doing this ;).

---

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 20, 2016, 10:49am UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/3 "2016-03-20T10:49:13Z")

</div>

[quote=“Ghabry”]Hello.  
That 3ds branch is horribly outdated and needs a rebase to get on par with the current Player development but otherwise it’s a good base. EDIT: My 3ds branch is now rebased on 0.4.1

You can also use Windows if you have msys installed. Msys provides autotools, make and other build tools that are required. For building you can use the 3ds Makefile in builds/3ds

SDL2 is not required for the 3DS because there is no proper port for SDL2. SDL is a wrapper around video, input and audio. Video and input is easy to solve but we have no idea about the audio. Audio will be probably most of the work to get working because games can come in lots of sound formats (WAV (PCM, ADPCM, Mono, Stereo…), MP3, Midi)  
I guess you can use openal\_audio (in the Player repo) as a reference. It uses libsndfile to process all audio files except MIDI and MP3. For MIDI and MP3 we are currently working on solutions that can be easily integrated also for 3DS if you figure out how to do audio with 3ds. 😃

Cross compiling the dependencies is not really rocket science and works the same for all platforms.

The devkitpro wiki has [useful information](http://devkitpro.org/wiki/portlibs) about cross compiling libraries. The libpng way works for almost all platforms. You only have to also pass the arguments “-march=armv6k -mtune=mpcore -mfloat-abi=hard” otherwise you get strange “VFP register argument” errors.

For a minimal build you need at least: iconv (for liblcf), liblcf, libpng, zlib, freetype, pixman, SDL replacements for 3ds (pick any ^^).

What I can offer to you is that we provide all dependencies for the libraries. Then you can directly work on the Player without worrying about porting the libraries. This is no big deal for us because we already offer libraries for Wii, Android, OSX and others. So we are experienced in doing this ;).[/quote]

It could be awesome to have dependencies already compiled. As for the system crash, do you have any idea what could cause the problem? (Maybe some race condition for secondary threads or similar or a RAM allocation problem)

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [March 20, 2016, 3:59pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/4 "2016-03-20T15:59:50Z")

</div>

Here are PORTLIBS for easyrpg: [Download](https://easy-rpg.org/downloads/easyrpg_arm_portlibs.tar.bz2)  
I assume you know how to deal with them because you already ported many apps to 3ds ^^.

For the 3ds port the only files you will need to touch (in my branch) are: src/3ds\_ui.[cpp,h] and builds/3ds/Makefile

Then it should “just work” when you set the PORTLIBS variable correctly. Though I didn’t try it. Tell me when you get any linker errors in the end of the compile step.

It crashed during startup and only on real hardware, not in Citra :/. Maybe we fixed it already because the startup code of the Player changed during the last months.  
And you need a target application with lots of space. The new youtube app is the best location because it has 10 MB 🙂

---

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 20, 2016, 7:18pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/5 "2016-03-20T19:18:36Z")

</div>

Noticed right now that Makefile uses hardware floating points. vorbisfile has problem with this setting so i need portlibs compiled with mfloat-abi=softfp.

EDIT: I also have some linking problem:

`linking easyrpg-player.elf
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_io.ao): In function `nothing()':
ucnv_io.cpp:(.text+0x5a0): multiple definition of `nothing()'
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_bld.ao):ucnv_bld.cpp:(.text+0x590): first defined here
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnvmbcs.ao): In function `nothing()':
ucnvmbcs.cpp:(.text+0x5678): multiple definition of `nothing()'
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_bld.ao):ucnv_bld.cpp:(.text+0x590): first defined here
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ustr_cnv.ao): In function `nothing()':
ustr_cnv.cpp:(.text+0x0): multiple definition of `nothing()'
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_bld.ao):ucnv_bld.cpp:(.text+0x590): first defined here
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(putil.ao): In function `nothing()':
putil.cpp:(.text+0x26c): multiple definition of `nothing()'
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_bld.ao):ucnv_bld.cpp:(.text+0x590): first defined here
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(umutex.ao): In function `nothing()':
umutex.cpp:(.text+0x0): multiple definition of `nothing()'
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_bld.ao):ucnv_bld.cpp:(.text+0x590): first defined here
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucln_cmn.ao): In function `nothing()':
ucln_cmn.cpp:(.text+0x0): multiple definition of `nothing()'
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_bld.ao):ucnv_bld.cpp:(.text+0x590): first defined here
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(udata.ao): In function `nothing()':
udata.cpp:(.text+0x710): multiple definition of `nothing()'
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_bld.ao):ucnv_bld.cpp:(.text+0x590): first defined here
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(unistr.ao): In function `nothing()':
unistr.cpp:(.text+0x16c): multiple definition of `nothing()'
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_bld.ao):ucnv_bld.cpp:(.text+0x590): first defined here
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicui18n.a(csdetect.ao): In function `nothing()':
csdetect.cpp:(.text+0xa68): multiple definition of `nothing()'
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_bld.ao):ucnv_bld.cpp:(.text+0x590): first defined here
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicui18n.a(ucln_in.ao): In function `nothing()':
ucln_in.cpp:(.text+0x38): multiple definition of `nothing()'
c:/Users/Alessio/Desktop/easyrpg-player-3ds/easyrpg-player-3ds/lib\libicuuc.a(ucnv_bld.ao):ucnv_bld.cpp:(.text+0x590): first defined here
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/5.3.0/../../../../arm-none-eabi/bin/ld.exe: cannot find -lpixman-arm-neon
c:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/5.3.0/../../../../arm-none-eabi/bin/ld.exe: cannot find -lexpat`

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [March 20, 2016, 7:25pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/6 "2016-03-20T19:25:27Z")

</div>

What does “has problems” mean?

---

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 20, 2016, 7:32pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/7 "2016-03-20T19:32:02Z")

</div>

It decode OGG audiobuffer in a wrong way giving you a distorted output (that’s why my lua interpreter uses softfp for floating points).

P.S. I edited the previous message with some linking errors i got.

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [March 20, 2016, 8:04pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/8 "2016-03-20T20:04:09Z")

</div>

You can remove -lexpat and -lpixman-arm-neon they are optional.  
I tred to fix the linker Errors in ICU. I don’t think soft fp is the way to go. This will waste CPU cycles everywhere. We heavily depend on floating point in our code.

Updated the portlibs. Same link as above: [easyrpg.org/downloads/easyrpg\_ … bs.tar.bz2](https://easyrpg.org/downloads/easyrpg_arm_portlibs.tar.bz2)  
I added the integer implementation of libvorbis “tremor”. Just replace the “-lvorbis” with “-lvorbisidec”, maybe it works?

---

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 20, 2016, 8:44pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/9 "2016-03-20T20:44:50Z")

</div>

Ok, compiled successfully but still same system crash it looks like. (I’ve tested it on NH1.1B fw 4.5 (personally) and NH2.6 fw 10.6 with Youtube app as target (tested by ihaveamac)).

Looks like on NH2.6 it also shows some glitchy pixels on the left side of the top screen and app also stucks on a red screen on bottom screen (it’s probably something related to payload debug).

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [March 20, 2016, 8:52pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/10 "2016-03-20T20:52:25Z")

</div>

Test in Citra if you get Invalid read/write errors in the console. If yes it will not work.  
Also the homebrew Needs for some reason ca. 30 seconds to boot up.  
When you see a easyrpg\_log.txt in the game directory something was executed.

---

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 20, 2016, 9:04pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/11 "2016-03-20T21:04:57Z")

</div>

Got it to work on real HW, problem was caused by missing services init (gfxInitDefault, hidInit etc). Going to trying to improve a bit performances now 😃

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [March 20, 2016, 9:08pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/12 "2016-03-20T21:08:36Z")

</div>

Cool when you think the port is good enough for sharing (no rush ^^) I would be happy about the source code. Then we can provide nightly builds via our [Jenkins Service](https://easy-rpg.org/jenkins/). We already do this for other special platforms like the Wii.

---

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 20, 2016, 9:11pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/13 "2016-03-20T21:11:28Z")

</div>

Looks like the framerate is really good even on O3DS (moving on world map is like 60 fps i think).  
Anyway i’m going to start a repository on my Github account for progresses about this and i’ll use this thread to update you about any big progress i make.

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [March 20, 2016, 9:18pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/14 "2016-03-20T21:18:07Z")

</div>

I got only ~15 FPS when running EasyRPG the last time. Maybe my Rendering logic was wrong because I had no experience with 3DS ^^

The default button mapping (in my branch) maps “Toggle FPS” to the L trigger. This should render a FPS Counter on the Screen. Would be interested in the real number 😃

---

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 20, 2016, 9:22pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/15 "2016-03-20T21:22:34Z")

</div>

By pressing L trigger i only get a grey rect on top-left part of the screen \<.\<

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [March 20, 2016, 9:26pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/16 "2016-03-20T21:26:30Z")

</div>

Uhm yeah, this sounds like a Problem with the transparency oO.

This is usually caused by an incorrect “DynamicFormat” Setting:  
[github.com/Ghabry/easyrpg-playe … ui.cpp#L50](https://github.com/Ghabry/easyrpg-player/blob/3ds/src/3ds_ui.cpp#L50)

The other versions use the following:  
[github.com/EasyRPG/Player/blob/ … i.cpp#L479](https://github.com/EasyRPG/Player/blob/master/src/sdl_ui.cpp#L479)

So NoAlpha instead of Alpha. Maybe it helps…

And the SetFormat call afterwards looks also different. The sdl\_ui uses:  
So the SetFormat call is porbably just wrong ^^

```auto
Bitmap::SetFormat(Bitmap::ChooseFormat(format));
```

---

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 20, 2016, 9:37pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/17 "2016-03-20T21:37:05Z")

</div>

Even if i use NoAlpha and the same SetFormat used by sdl\_ui, i get the same grey rect. Could it be related to something like the fps counter is spammed on the texture and then is like if it gets printed more then once in a frame and so it just increase alpha value?

---

<div class="post-metadata">

**Author:** ![Ghabry](https://community.easyrpg.org/user_avatar/community.easyrpg.org/ghabry/32/121_2.png) [@Ghabry](https://community.easyrpg.org/u/Ghabry)\
**Post date:** [March 20, 2016, 9:42pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/18 "2016-03-20T21:42:44Z")

</div>

Strange. We use 100% software Rendering so I don’t see a reason why this Fails on the 3ds but nowhere else. Very strange.

Uhm, then do it the hacky way. If you have a working console just output “real\_fps” before the “UpdateTitle” call in Graphics::Update

---

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 20, 2016, 9:47pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/19 "2016-03-20T21:47:37Z")

</div>

Uploaded the repository here just to let you know: [github.com/Rinnegatamante/easyr … ree/master](https://github.com/Rinnegatamante/easyrpg-player-3ds/tree/master) .  
Going to do that hacky test.

---

<div class="post-metadata">

**Author:** ![Rinnegatamante](https://community.easyrpg.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@Rinnegatamante](https://community.easyrpg.org/u/Rinnegatamante)\
**Post date:** [March 20, 2016, 9:53pm UTC](https://community.easyrpg.org/t/working-on-a-3ds-port/201/20 "2016-03-20T21:53:52Z")

</div>

Mmmhhh it says 16 but i’m quite sure it’s running at higher framerate (or at least, to me it looks playable).

[Next page](https://community.easyrpg.org/t/working-on-a-3ds-port/201.md?page=2)
