[TUTORIAL] Setting up Visual Studio 2015 environment for Nintendo 3DS homebrew development

Discussion in '3DS - Homebrew Development and Emulators' started by Manurocker95, Feb 14, 2017.

  1. Manurocker95
    OP

    Manurocker95 Game Dev & Pokémon Master

    Member
    689
    182
    May 29, 2016
    Spain
    Madrid
    Hello! The github page of this https://www.reddit.com/r/3dshacks/comments/4ne82e/setting_up_visual_studio_2015_environment_for/ is down and it helped me so much to start in the scene, so I'd like to remake here the tutorial (as noob friendly as possible). I've reached for something like this in the forum and didn't find anything so here I am.

    First of all, credits to wedr2 for the original guide. I'm just rewriting it for those who want to start here. :)

    This is mainly made for Windows, so there are maybe some things you cannot use on MAC/Linux. Just change those as needed.

    I've updated the tutorial to the library PP2D made by @EventAssistant. Nowadays, it has better results than Xerpi's stuff.

    Introduction:

    This guide shows how to set up the initial 3DS homebrew development environment using Visual Studio 2015 Community Edition. This guide should also apply to Visual Studio 2015 Professional and up. This setup will allow you to use Visual Studio's IntelliSense when working with your code, while being able to compile your code into .3DSX and .ELF files for homebrew applications. We can create .cia, .cci and .3ds of our homebrews.

    By following this guide, you will be creating your own project from scratch. However, should you feel like using a pre-made Visual Studio project template, you may use https://github.com/usagirei/3DS-VS-Template or my own test examples: https://github.com/Manurocker95/3DS-Homebrew-Test-Example

    You have here a template with .cia compiling, Stereoscopic 3D, romfs, image loading from romfs, sounds and savedata with SF2D, SFTD and SFIL:

    https://github.com/Manurocker95/3DS-Homebrew-Template-With-Libraries

    And a template with .cia compiling, image loading from romfs, shared fonts, sounds and savedata with PP2D:

    https://github.com/Manurocker95/3DS-Homebrew-Template-With-PP2D

    We will call Visual Studio 2015 Community as "VS2015" from here on out.

    Microsoft Visual C/C++ is not bundled with VS2015 by default. You must choose to install this package, as it is required for 3DS homebrew development. If you cannot find it in the VS2015 Installer, you can follow the instructions to obtain this package below.

    Minum Requirements:

    - Latest version of Visual Studio 2015 Community: https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx
    - Microsoft Visual C/C++ package for Visual Studio 2015 Community.
    - Latest stable version of devkitPro: http://devkitpro.org/wiki/Getting_Started
    - Xerpi's Portlibs installed
    - Creativity to make good stuff.

    Extras:

    - Additional Libraries (We will install some of them below): https://www.3dbrew.org/wiki/Homebrew_Libraries_and_Tools
    - Templates mentioned above:

    https://github.com/usagirei/3DS-VS-Template
    https://github.com/Manurocker95/3DS-Homebrew-Test-Example
    https://github.com/Manurocker95/3DS-Homebrew-Template-With-Libraries
    https://github.com/Manurocker95/3DS-Homebrew-Template-With-PP2D

    Notes:

    To explain the inconsistencies of slashes, "\" and "/", used in this guide:

    In Windows, of any editions, it uses backslashes "\" as file separators, and not forward slashes "/". This also means in Visual Studio of any editions, it natively uses backslashes "\" as file separators. If you see forward slashes "/", this clearly means it is used in Makefiles.

    The usage of backslashes "\" was due to the forward slashes "/" being used as indicators for "switches" or "flags" (cmd.exe /w, or /help) in IBM software, and is not compatible to parse as file separators. MS-DOS adopted this, and to this day, forward slash switches are still used in many places.

    Setup:

    Warning: Spoilers inside!

    Adding PP2D to our homebrew:

    Warning: Spoilers inside!

    [OUTDATED] Installing and Adding SF2D, SFTD and SFIL to our homebrew:

    Only if you want to use them. No need to do this if you do your homebrew with PP2D.

    This part is mainly my own as I experienced some problems setting up the libraries. It may help you.

    Warning: Spoilers inside!

    Credits:
    Warning: Spoilers inside!

    If this tutorial has been useful for you, credits are appreciated :3
     
    Last edited by Manurocker95, Oct 31, 2017
  2. Manurocker95
    OP

    Manurocker95 Game Dev & Pokémon Master

    Member
    689
    182
    May 29, 2016
    Spain
    Madrid
    Hope this helps someone to start x)

    If you want me to add something else to the tutorial, just tell me :D
     
    Last edited by Manurocker95, Feb 14, 2017
    iAqua likes this.
  3. proflayton123

    proflayton123 Undeclared Shitposter 2.1

    Member
    5,905
    2,235
    Jan 11, 2016
    Japan
    日本
    This is lovely, thanks very much I'll sure to be giving this a go
     
    Manurocker95 likes this.
  4. adrifcastr

    adrifcastr GBAtemp Advanced Maniac

    Member
    1,799
    839
    Sep 12, 2016
    Germany
    already tried that with the original guide, but I´m still getting errors


    nn.png
     
  5. Manurocker95
    OP

    Manurocker95 Game Dev & Pokémon Master

    Member
    689
    182
    May 29, 2016
    Spain
    Madrid
    In Output what error does it show?

    Hope to see new homebrews soon ^^
     
    Last edited by Manurocker95, Feb 14, 2017
  6. adrifcastr

    adrifcastr GBAtemp Advanced Maniac

    Member
    1,799
    839
    Sep 12, 2016
    Germany
    wait I'mma take a look, btw, I assume it is still the same process if I'd rather use c then c++?

    — Posts automatically merged - Please don't double post! —

    @Manurocker95 there you go it says that the 3dsx is not found. I ´m really mad also the original guide did not worked for me

    1>------ Build started: Project: Test1, Configuration: Debug Win32 ------
    1> Datei *.3dsx nicht gefunden
    1> make: *** [all] Error 2
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(41,5): error MSB3073: The command "make" exited with code 2.
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
     
  7. Manurocker95
    OP

    Manurocker95 Game Dev & Pokémon Master

    Member
    689
    182
    May 29, 2016
    Spain
    Madrid
    Did you link everything correctly? How is your code and makefile?
     
  8. adrifcastr

    adrifcastr GBAtemp Advanced Maniac

    Member
    1,799
    839
    Sep 12, 2016
    Germany
    its just a test project to see if it builds the files now the source files just contains whats also in the guide so yeah its just for testing if it builds the files.
     
  9. Manurocker95
    OP

    Manurocker95 Game Dev & Pokémon Master

    Member
    689
    182
    May 29, 2016
    Spain
    Madrid
    I made a test example for those who want to use it. It compiles without any issue. Try it and report if it gives you any problem while compiling: https://drive.google.com/open?id=0B66zoi0CftI2NjNXeGpBR3NyZmM

    You need to have devkitpro installed in C:\devkitPro and the portlibs installed.
     
  10. adrifcastr

    adrifcastr GBAtemp Advanced Maniac

    Member
    1,799
    839
    Sep 12, 2016
    Germany
    Im not dumb. I have devkupro since ages. (updates of course) and yeah I'll take a look.
     
  11. Manurocker95
    OP

    Manurocker95 Game Dev & Pokémon Master

    Member
    689
    182
    May 29, 2016
    Spain
    Madrid
    I meant you need installed portlibs and devkitpro in that path (You may have it in other path) for this example. If it gives you any issue compiling, delete the build folder and try again. It should work.
     
    adrifcastr likes this.
  12. adrifcastr

    adrifcastr GBAtemp Advanced Maniac

    Member
    1,799
    839
    Sep 12, 2016
    Germany
    k thanks. damn i spelled devkitpro wrong. wow.

    — Posts automatically merged - Please don't double post! —
     
  13. Shikkichu

    Shikkichu GBAtemp Advanced Fan

    Member
    612
    497
    Jan 28, 2017
    Cyprus
    Awesome guide, it seems very noob friendly.. well for those who can read xD
     
  14. Evernew

    Evernew Member

    Newcomer
    39
    7
    Nov 18, 2016
    I tried many times create a project from 0 with this guide but I can't do it.I put a image from the errors for if someone can help me.
    I have devkitpro, portlibs, visual studio 2017, windows sdk and windows redistributable c++

    [​IMG]
     
  15. Manurocker95
    OP

    Manurocker95 Game Dev & Pokémon Master

    Member
    689
    182
    May 29, 2016
    Spain
    Madrid
    Delete the Build folder of my test project, I 4got it only compiles on my computer. Did you set up the include paths correctly for devkit?
     
  16. Manurocker95
    OP

    Manurocker95 Game Dev & Pokémon Master

    Member
    689
    182
    May 29, 2016
    Spain
    Madrid
    Edited some confusing parts with Portlibs and deleted no needed stuff in the simple template. Now should be totally noob-friendly.

    Created a new template with .cia compiling, Stereoscopic 3D, use of romfs, SF2D, SFTD and SFIL (including .cia compiling).

    You can use it as base for what you want.
     
    Last edited by Manurocker95, Apr 18, 2017
  17. Manurocker95
    OP

    Manurocker95 Game Dev & Pokémon Master

    Member
    689
    182
    May 29, 2016
    Spain
    Madrid
    Tutorial updated to @EventAssistant 's PP2D library. Template made with it too.
     
  18. Sciencejet

    Sciencejet Newbie

    Newcomer
    1
    0
    Feb 27, 2017
    United States
    Do you have to do these steps with every project that you do?

    — Posts automatically merged - Please don't double post! —

    That and everytime I try and make the example code shown up above, it fails.
     

    Attached Files:

  19. Manurocker95
    OP

    Manurocker95 Game Dev & Pokémon Master

    Member
    689
    182
    May 29, 2016
    Spain
    Madrid
    Once you setup the environment, you don't need to set it up again. Just the project.


    Do you have everything well set up? Portlibs included?

    Can you compile any of the examples?
     
    Last edited by Manurocker95, Oct 31, 2017