1. sirhiro

    OP sirhiro Member
    Newcomer

    Joined:
    Jul 28, 2008
    Messages:
    21
    Country:
    United States
    Your journey into Wii homebrew programming

    So, you're interested in more than just enjoying the entertainment of playing homebrew games? You're ready to begin creating your own adventures and puzzles? Well this guide will teach you how to begin your journey into Wii homebrew and programming!

    Separated by Operating System!

    Windows
    I. Setting Up
    II. Your first program
    III. Running it on the Wii

    I. Setting Up

    To begin this massive journey. You must first obtain all the essentials required and set them up properly. They are as follows:

    DevKitPPC: This is the heart of Wii homebrew development.
    Download

    When installing you can safely deselect the following items:
    - devKitARM
    - devkitPSP
    - Inside devKitPPC - (Gamecube Examples and Gcube)

    Make sure to install to a location that contains no spaces. The preferred location is "C:\Wii\DevKitPro\".
    Because the applications used to compile and run your projects cannot contain spaces in it's arguments

    Projects: Where we will store anything we create.
    You should create a new folder to maintain your active projects in a similiar location. Such as "C:\Wii\Projects\". Again, this location can contain no spaces.
    WARNING: DO NOT MAKE THE PROJECTS FOLDER INSIDE THE DEVKITPRO FOLDER.
    This is to keep your projects from being overwritten or deleted from DevKitPPC

    WiiLoad: Used to wirelessly send your project for testing to the Wii.
    Next up, so that you can test your homebrew on your Wii you will want a working homebrew channel.
    You must download a program entitled WiiLoad from:
    Download

    Once downloaded move the file to "C:\Wii\DevKitPro\msys\bin\wiiload.exe"

    Now we must set an Environmental Variable located with your Wii's IP so we know where to upload the file for testing.
    To do this go to your Control Panel, System and Security, System, Advanced System Settings, Click the Advanced tab on the popped up Window, Environment Variables, Under system variables add a new variable for WIILOAD and set the value for "tcp:YOUR.WIIS.IP".
    ( If you don't know how to find this you can launch homebrew channel, hit the home button and look at the top left. )

    WiiLoad is now successfully configured!

    That's it!
    You now have the basic setup for developing Wii Homebrew! Time to move onto the actual creation!

    II. Your first program
    So now that you have your environment setup, the creation process begins! As with every programming language that a new user begins to learn. We shall start with our beloved 'Hello World' Project.
    Getting into exactly what code does what and how to program certain features is not covered in this guide, as this guide is just to teach you how to begin the journey. Not a walk through on how to make it to te final boss (=P). Make sure to read through the Hello World project as it is commented throughout and helps for learning the very bare bone basics on what does what.

    Browse to: C:\Wii\DevKitPro\Examples\
    and Copy the folder "Template" from there to C:\Wii\Projects.

    Now Run Programmer's Notepad which can be found in: C:\Wii\devkitPro\Programmers Notepad\pn.exe
    It is possible to use Visual Studio with DevKitPPC, but using Programmers Notepad is much more convient.

    Go to File -> Open Project(s) and choose the 'template.pnproj' file from the Template folder you just copied.

    It will open your hello world homebrew and be ready for compiling.

    Go to Tools -> Make and you should come up with:
    Code:
    > "make"
    template.c
    linking ... template.elf
    output ... template.dol
    
    > Process Exit Code: 0
    > Time Taken: 00:02
    Compiling isn't necessary to test your project. This was only covered so you know how to compile your projects

    That's it! You've successfully loaded a project, and compiled the homebrew into an elf!
    Next up? How to test your project!

    III. Running it on the Wii
    Running a project on the Wii is simple once everything is set up!

    First launch your Wii and have Homebrew Channel open. Make sure the Connection bar at the bottom right is solid and not blinking or dim.
    Now go back to Programmer's Notepad that has your Hello World template project loaded.
    Go to Tools -> Run.

    It will load the WIILOAD IP you provided earlier and then launch the File on your Wii! Now look how magical that little elf is.

    If correctly launched you should notice a black screen with the words "Hello World" at the top left.

    That's it! You have successfully:
    + Setup all the required files
    + Loaded a Project
    + Launched your project to the Wii
    Mac OS X
    I. Setting Up
    II. Your first program
    III. Running it on the Wii

    I. Setting Up
    Before you can begin making your first project, you must first acquire the essentials!

    You will need XCode tools which is provided from apple: Download
    (You will need a Developers account which is FREE To create)

    Mount and install the above Download and then proceed with the rest of this How-To.

    We will now need to setup DevKit Pro. Forgive me, as I do not actually own a Mac and these commands were taken from various sources around the web.

    Start by Opening Terminal and doing the following:
    Code:
    sudo mkdir -p /opt/devkitpro
    This will make a directory with admin privelages for DevKit.

    Code:
    sudo chmod 777 /opt/devkitpro
    This will then add permissions the folder to allow it to fully be read and written to!

    Now you must actually download the DevKitPro via THIS LINK.

    Once downloaded, perform this command:
    Code:
    cd /opt/devkitpro
    tar -xvjf [Path to DevKitPro TarFile]
    For the path of the file, you may drag the file into the terminal window and it will auto-complete the path for you. This command will send you to the devkitpro directory and then extract the files there.

    We are almost there!

    The main files have been obtained, but now we must get the libraries so our code will actually work!
    Library #1
    Code:
    mkdir libogc
    cd libogc
    tar -xvjf [OGC Library File]
    Making a new directory inside the devkitpro folder, then extracting the files into it.

    Library #2
    While in the same directory in terminal, execute:
    Code:
    tar -xvjf [OGC Fat File]
    Wii Examples
    Code:
    cd ..
    mkdir -p examples/wii
    tar -xvjf [Wii Example File]
    (Optional) Gamecube Examples
    Code:
    cd ..
    mkdir -p examples/gamecube
    tar -xvjf [Gamecube Examples]
    Whew. What a pain, right?
    One last step!
    In you're Home folder you will need to create a new file with any text editor. The text file must be called ".bashrc" with NO extension. Inside the file you will need to add just these two lines:
    Code:
    export DEVKITPRO=/opt/devkitpro
    export DEVKITPPC=$DEVKITPRO/devkitPPC
    That's it! You now have the proper setup to develop Wii homebrew on your Mac OS X! Now how about we make something?

    II. Your first program
    Go ahead and open up your XCode tools!
    Create a new project from the File Menu and make sure to choose "External Build System" under the Other category.
    Once loaded you must drag the 'makefile' AND source folder from the example "Template" into your workspace.
    Find "Targets" in the sidebar and make sure it's set to your project name by double-clicking it, it will open a new window. In this window you must add two settings for build by hitting the plus.
    The values should be:
    DEVKITPRO=/opt/devkitpro
    DEVKITPPC=$DEVKITPRO/devkitPPC

    Once the setup for XCode is finished you can succesfully build your project into a Dol and Elf!

    III. Running it on the Wii
    Now that you have a dol and an elf of your project you can execute them on your Wii! It's not as simple as on Windows but it's still not to complicated.
    Have you ever added an application to your SD Card so Homebrew Channel can read it? Well it's similiar to that process!
    Insert your SD Card, in the apps folder create a new one entitled whatever you wish and inside this folder put the Elf that you built.
    You can now put the SD Card in your Wii and run the file from the Homebrew channel! You will be greeted by a black screen with the words "Hello World" in the top left!

    Ta-dah! You have successfully Setup your environment, Loaded a project, built your elf, and test ran it on your Wii! Your journey has begun. Now you can continue on your own and begin the programming trek!
    Linux
    I. Setting Up
    II. Your first program
    III. Running it on the Wii

    I. Setting Up
    Before you can begin making your first project, you must first acquire the essentials!

    We will need to setup DevKit Pro. Forgive me, as I do not actually have Linux and these commands were taken from various sources around the web.

    Start by Opening Terminal and doing the following:
    Code:
    sudo mkdir -p /opt/devkitpro
    This will make a directory with admin privelages for DevKit.

    Code:
    sudo chmod 777 /opt/devkitpro
    This will then add permissions the folder to allow it to fully be read and written to!

    Now you must actually download the DevKitPro via THIS LINK.

    Once downloaded, perform this command:
    Code:
    cd /opt/devkitpro
    tar -xvjf [Path to DevKitPro TarFile]
    We are almost there!

    The main files have been obtained, but now we must get the libraries so our code will actually work!
    Library #1
    Code:
    mkdir libogc
    cd libogc
    tar -xvjf [OGC Library File]
    Making a new directory inside the devkitpro folder, then extracting the files into it.

    Library #2
    While in the same directory in terminal, execute:
    Code:
    tar -xvjf [OGC Fat File]
    Wii Examples
    Code:
    cd ..
    mkdir -p examples/wii
    tar -xvjf [Wii Example File]
    (Optional) Gamecube Examples
    Code:
    cd ..
    mkdir -p examples/gamecube
    tar -xvjf [Gamecube Examples]
    Whew. What a pain, right?
    One last step!
    In you're root folder you will need to create a new file with any text editor. The text file must be called ".bashrc" with NO extension. Inside the file you will need to add just these two lines:
    Code:
    export DEVKITPRO=/opt/devkitpro
    export DEVKITPPC=$DEVKITPRO/devkitPPC
    export WIILOAD=tcp:WII.IP.ADDRESS
    ( If you don't know how to find this you can launch homebrew channel, hit the home button and look at the top left. )

    That's it! You now have the proper setup to develop Wii homebrew on your Linux System! Now how about we make something?


    I. Your first program
    Navigate to DevKitPro\Wii-Examples\Template
    This folder will contain the source for a Hello World project.
    You can compile the project by opening a terminal window here and simply typing 'make'.
    It will compile the project by using the MakeFile as instructions.
    You will then end up with a Elf file.

    I. Running it on the Wii
    To run your Hello World project on the Wii is simple as well!
    Start up Homebrew Channel on your Wii then,
    In terminal, navigate to the Template folder again. And type 'make run'.
    This will compile the project, then run it using WiiLoad to send it to your Wii!
    Ta-dah! You should be greeted by a black screen with the words "Hello World"

    Hopefully now that you're machine is setup properly to compile Wii homebrew and you've successfully compiled your first program you have an understanding of the process involved in accomplishing such tasks. From here you should be able to lift-off into your own realm and provide the world with new and inventive homebrew to enjoy on their consoles!

    Lua
    The way we setup our machine for development is the default way. This means that anything you want to make for the Wii must be programmed in C++.
    Well.
    There is an alternative!

    A simpler language that you can program in is available. It is called Lua.
    Lua is commonly used as of recently for it's simplicity in programming; It's used to program all the GUI's in World of Warcraft, and to make any object you see in Gary's Mod.

    As for the challenge of C++ vs. Lua. Well C++ is more versatile and more of a complete language for the Wii. While Lua is partially limited as it's not fully implemented.
    Programmers usually create their base of their game or application in C/C++ and then use Lua to generate the Interface, Levels, or any other content as such.

    If you would prefer Lua over C++ Then i'll go over a general quick-setup guide.

    Setup
    1. First you will want to download Lua. Download
    2. Extract it to wherever you please
    3. Now open command prompt (or terminal) and navigate into the lua-5.1.3 folder.
    4. Run the following command: make local
    5. If the above didn't work for you, here is a more extensive command set:
      Code:
      cd lua-5.1.3/
      make
      make install
      cd ..
      make
    6. Copy the following files to your DevKitPro directory.
      Liblua.a -> Lib Directory
      Lauxlib.h, lua.h, lua.hpp, luaconf.h, lualib.h -> Include\Lua
    7. In any project you make you'll have a 'Makefile' file. Inside this there will be a line titled "LIBS :=" you will need to append to this line right after the '='; "-llua".
      That's it! Lua is now setup. You can use Programmers Notepad to modify the Lua launcher (Just make sure to always append the above line to your 'Makefile'.). And you can use any standard text editor to create your *.Lua script files!

    When you want to test your program you would go to Tools -> Make; It will create a lua.elf. This file gets copied to the apps folder on your SD card so it can be ran through Homebrew Channel.
    This lua.elf is pretty much just the launcher for you're actual Lua.
    Then you would get whatever script you have (In this case the "test.lua" example script that was included). And throw it on the ROOT of your SD Card.
    That's all there is to it!

    Here is a wonderful example of a piece of Wii homebrew done in Lua: Link


    Resources:
    Wii Programming Tutorials

    Collection of Developer Tutorials

    Libraries for Advanced Development
     
    Covert Maverick and XDel like this.
  2. nintendoom

    nintendoom Nintendoom
    Member

    Joined:
    Sep 12, 2009
    Messages:
    1,127
    tl;dr

    looks nice anyway.
     
  3. sirhiro

    OP sirhiro Member
    Newcomer

    Joined:
    Jul 28, 2008
    Messages:
    21
    Country:
    United States
    Haha, Thanks for the compliment even though you ';dr' it. =P.
     
  4. Slimmmmmm

    Slimmmmmm GBAtemp MoNkEeE
    Member

    Joined:
    Nov 1, 2007
    Messages:
    1,770
    Country:
    I like this guide and I think it should be continued to include libwiigui,portlibs, grrrlib ntfs,ext2fs etc.
     
    RiCK420 likes this.
  5. Krafter

    Krafter Advanced Member
    Newcomer

    Joined:
    Dec 31, 2009
    Messages:
    52
    Country:
    United States
    What am I missing? I am using Win 7 for this tut. I open the template and I don't see anything about Hello World. I am also getting an error when I try to make it.

    Template code
    CODE
    ÂÂÂÂ
    ÂÂÂÂÂÂÂÂ
    ÂÂÂÂ
    ÂÂÂÂ
    ÂÂÂÂ


    Make error
    Code:
    > "make" 
    
    > Failed to create process: The system cannot find the file specified.
    
    > Process Exit Code: 0
    > Time Taken: 00:00
    edit: the hello world is in the template.c file. I understand that now, lol but why am I getting a compile error?

    edit edit: programmers notepade doesn't like Win 7. I compiled it using XP mode and it worked great. Thanks.. Now I just need to test it. [​IMG]
     
  6. loco365

    loco365 GBAtemp Guru
    Member

    Joined:
    Sep 1, 2010
    Messages:
    5,457
    Ok. I dunno what is wrong. I installed it to your specifications, ran Programmer's Notepad in compatibility mode, but I get this when compiling the Hello World template:

    Code:
    > "make" 
    template.c
    c:/wii/projects/template/source/template.c:3:20: fatal error: gccore.h: No such file or directory
    compilation terminated.
    make[1]: *** [template.o] Error 1
    "make": *** [build] Error 2
    
    > Process Exit Code: 2
    > Time Taken: 00:00
    What is happening and how can it be fixed?

    EDIT: NVM. It was the directory it was in. I had to install it to C:\devkitPro to get it working.
     
  7. Slimmmmmm

    Slimmmmmm GBAtemp MoNkEeE
    Member

    Joined:
    Nov 1, 2007
    Messages:
    1,770
    Country:
    Well this was a short journey...:P


    I'd love to see someone with time add more to this, doubt that will happen though... D:
     
  8. JoostinOnline

    JoostinOnline Certified Crash Test Dummy
    Member

    Joined:
    Apr 2, 2011
    Messages:
    10,993
    Country:
    United States
    I add lots of documentation to almost all of my apps, explaining what stuff does. I would have loved to have it when I started, so I add explanations for any beginners. ProgressiveSwitch v1.3 Detailed Source is a good place to start, as I added extra details and de-optimized it for simplicity. After that, you could switch to Settings Editor GUI. I've got a new update with even more coming as soon as I get some people to test it (all my testers quit on me :( ).
     
  9. goembario

    goembario GBAtemp Regular
    Member

    Joined:
    Sep 14, 2009
    Messages:
    155
    Country:
    Netherlands
    What do you want others to test??
    If just having a homebrew channel is enough, I'll have some time to test I guess.
     
  10. JoostinOnline

    JoostinOnline Certified Crash Test Dummy
    Member

    Joined:
    Apr 2, 2011
    Messages:
    10,993
    Country:
    United States
    Sure, that would be great. I added you to the conversation. Just read the messages by me on the last two pages for details on this latest beta. Also, no sharing what I've added until it's released. :)
     
  11. goembario

    goembario GBAtemp Regular
    Member

    Joined:
    Sep 14, 2009
    Messages:
    155
    Country:
    Netherlands
    Sure, no problem.
     
    JoostinOnline likes this.
  12. Gizametalman

    Gizametalman Banned
    Banned

    Joined:
    Dec 18, 2015
    Messages:
    974
    Country:
    Mexico
    Wait... DevKit will allow me to make both 3DS and Wii homebrew?
    Or do I need certain DevKits for each platform?
     
  13. Dodain47

    Dodain47 GBAtemp Addict
    Member

    Joined:
    Jan 1, 2017
    Messages:
    2,670
    Country:
    Austria
    You will need ARM Version of Devkitpro for 3DS homebrew and PowerPC (PPC) Version Devkitpro for Wii homebrew. They usually come with the whole package.
     
    Gizametalman likes this.
  14. Gizametalman

    Gizametalman Banned
    Banned

    Joined:
    Dec 18, 2015
    Messages:
    974
    Country:
    Mexico
    ^_^
     
  15. GreyWolf

    GreyWolf GBAtemp Guru
    Member

    Joined:
    Mar 2, 2015
    Messages:
    5,401
    Country:
    United States
    Just install the whole devkitPro and uncheck the PSP one if you aren't interested in the PlayStation Portable.
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - Programming, Journey,