{"id":186,"date":"2020-06-22T21:25:03","date_gmt":"2020-06-22T19:25:03","guid":{"rendered":"http:\/\/www.virtualparadise.org\/edwin\/?p=186"},"modified":"2025-01-11T17:54:36","modified_gmt":"2025-01-11T16:54:36","slug":"porting-virtual-paradise-to-the-3ds-part-2","status":"publish","type":"post","link":"https:\/\/www.virtualparadise.org\/edwin\/2020\/06\/porting-virtual-paradise-to-the-3ds-part-2\/","title":{"rendered":"Porting Virtual Paradise to the 3DS (part 2)"},"content":{"rendered":"\n<p>In <a href=\"http:\/\/www.virtualparadise.org\/edwin\/2020\/06\/porting-virtual-paradise-to-the-3ds-part-1\/\">part 1<\/a> I was able to build most of VP&#8217;s code for the Nintendo 3DS target using the homebrew SDK, but only a small part of it was running: just enough to make it log in.<\/p>\n\n\n\n<p>At the end of the previous article I mentioned that other parts of the code need a functioning renderer. Actually, it just needs to have a renderer that pretends to be functioning. For situations like this VP has a fake renderer. It doesn&#8217;t render anything, it just tell the rest of the code that it did and that everything is fine. Let&#8217;s use that and see what happens when running it in a 3DS emulator.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"480\" src=\"http:\/\/www.virtualparadise.org\/edwin\/wp-content\/uploads\/2020\/06\/citra-qt_2020-06-21_15-49-54.png\" alt=\"\" class=\"wp-image-187\"\/><\/figure>\n\n\n\n<p>It enters the world! You can tell from the screenshot above that the user count for testworld went from 2 to 3. And on the PC the avatar can be seen as well:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.virtualparadise.org\/edwin\/wp-content\/uploads\/2020\/06\/VirtualParadise_2020-06-21_15-53-44.png\" alt=\"\" class=\"wp-image-188\" width=\"456\" height=\"472\"\/><\/figure>\n\n\n\n<p>Unfortunately, when I tried this on the real 3DS it just crashed. After some online searching I found out that it is possible to enable a remote debugger on the (softmodded) 3DS through the Rosalina menu, which can be accessed by pressing L + Down + Select. I enabled the debugger attached to it using GDB:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(gdb) target remote 192.168.1.51:4003\nRemote debugging using 192.168.1.51:4003\n0x00100000 in _start ()\n(gdb) c\nContinuing.\n&#91;New Thread 216]\n&#91;New Thread 219]\n\nThread 1 received signal SIGSEGV, Segmentation fault.\n0x00320328 in strlen ()\n(gdb) bt\n#0  0x00320328 in strlen ()\n#1  0x001bd75c in ObjectPath::getCachePath&#91;abi:cxx11]() ()\n... more stack frames<\/code><\/pre>\n\n\n\n<p>Something appears to be going wrong when trying to find where to put cache files. It&#8217;s running the code path that is also used on Linux systems. This code path uses <code>getenv(\"HOME\")<\/code> to find the home directory and because the 3DS most likely doesn&#8217;t have this it returns a null pointer. Adding some 3DS-specific code to determine the cache location fixed this.<\/p>\n\n\n\n<p>There were also some easier to fix issues before it would work. Here it is running on a real 3DS:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"1008\" src=\"http:\/\/www.virtualparadise.org\/edwin\/wp-content\/uploads\/2020\/06\/IMG_20200621_181836_2.jpg\" alt=\"\" class=\"wp-image-191\"\/><\/figure>\n\n\n\n<p>After this I started working on a renderer implementation for the 3DS. I managed to make it clear the screen with a color, but it&#8217;s not rendering anything yet.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"480\" src=\"http:\/\/www.virtualparadise.org\/edwin\/wp-content\/uploads\/2020\/06\/citra-qt_2020-06-21_22-47-58.png\" alt=\"\" class=\"wp-image-193\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>In part 1 I was able to build most of VP&#8217;s code for the Nintendo 3DS target using the homebrew SDK, but only a small part of it was running: just enough to make it log in. At the end &hellip; <a href=\"https:\/\/www.virtualparadise.org\/edwin\/2020\/06\/porting-virtual-paradise-to-the-3ds-part-2\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[27],"class_list":["post-186","post","type-post","status-publish","format-standard","hentry","category-development","tag-3ds"],"_links":{"self":[{"href":"https:\/\/www.virtualparadise.org\/edwin\/wp-json\/wp\/v2\/posts\/186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virtualparadise.org\/edwin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virtualparadise.org\/edwin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virtualparadise.org\/edwin\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virtualparadise.org\/edwin\/wp-json\/wp\/v2\/comments?post=186"}],"version-history":[{"count":6,"href":"https:\/\/www.virtualparadise.org\/edwin\/wp-json\/wp\/v2\/posts\/186\/revisions"}],"predecessor-version":[{"id":196,"href":"https:\/\/www.virtualparadise.org\/edwin\/wp-json\/wp\/v2\/posts\/186\/revisions\/196"}],"wp:attachment":[{"href":"https:\/\/www.virtualparadise.org\/edwin\/wp-json\/wp\/v2\/media?parent=186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virtualparadise.org\/edwin\/wp-json\/wp\/v2\/categories?post=186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virtualparadise.org\/edwin\/wp-json\/wp\/v2\/tags?post=186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}