Difference between revisions of "Devkitppc setup (Windows)"

From WiiBrew
Jump to: navigation, search
(Some Code snippets)
m (Updated emulator information)
 
(45 intermediate revisions by 26 users not shown)
Line 1: Line 1:
 +
devkitPPC is the toolchain provided by [[DevkitPro]] for Wii and Gamecube development. This guide describes setting up such a system under Windows. A guide for Mac OS X 10.5.x users can be found [[Getting started with DevkitPPC on Mac OS X|here]] and a guide for Linux [[Getting started with DevkitPPC on Linux|here]]
 +
 
== Introduction ==
 
== Introduction ==
 
This tutorial aims to:
 
This tutorial aims to:
* Show you how to setup the devkitppc development enviroment on a Windows computer
+
* Show you how to setup the devkitppc development environment on a Windows computer
* Run a hello world example on the include Gcube emulator
+
* Run a hello world example on the included Gcube emulator
* Set you on the road to creating your own homebrew software to be loaded with the Twilight Hack
+
* Run a hello world example on the Wii using [[wiiload]]
 +
* Set you on the road to creating your own homebrew software to be loaded with the [[Twilight Hack]] or [[Homebrew Channel]]
  
== Installing devkitpro ==
+
== Installing devkitPPC ==
* Goto [[http://sourceforge.net/project/showfiles.php?group_id=114505&package_id=160396]] and download the latest Windows installer.
+
* Go to [https://sourceforge.net/projects/devkitpro/files/Automated%20Installer/ this page] and download the latest Windows installer.
 
* Let it install to the C:\devkitPro\ to make it easier to follow the tutorial for now.
 
* Let it install to the C:\devkitPro\ to make it easier to follow the tutorial for now.
* When installing it, you can deselect devkitarm and devkitpsp
+
* When installing it, you can deselect devkitARM and devkitPSP
 
* Click next until it finishes installing
 
* Click next until it finishes installing
  
 
== Setup your project folder ==
 
== Setup your project folder ==
  
* Browse to C:\devkitPro\msys\ and run msys.bat. This will open a command prompt type window. This is where a bit of your time will be taking place. Close it for now.
+
* Under no circumstances should you place projects within the devkitPro folder. The windows updater can and will overwrite/delete your files.
* Now, browse to C:\devkitPro\msys\home\. Depending on your windows username, there should be a folder in here. From now on, I will refer to this folder as your home directory.
+
* Create a new folder outside the devkitPro folder, c:\projects\wii for example. This path should not contain spaces.
* Copy the folder C:\devkitPro\examples\wii\template\ to (your home directory) and rename it to "helloworld" so that the full path is C:\devkitPro\msys\home\(your username)\helloworld\
+
* Copy the folder C:\devkitPro\examples\wii\template\ to this new directory and rename it to "helloworld" so that the full path is c:\projects\wii\helloworld\
  
 
== Compile the Hello World Example ==
 
== Compile the Hello World Example ==
  
* Run msys.bat again.
+
* Assuming you installed Programmer's Notepad through the installer, double click the .pnproj file in your new project.
* type "ls" and press enter to see the directories in your home directory
+
* Click on Tools->make or use the ALT+1 key combination
* type "cd helloworld" and press enter to switch into the helloworld directory
+
* The output window at the bottom will show the build progress
* type "make" and press enter to complile the example
+
Note: If you are having trouble compiling some programs under Windows Vista (eg. libogc cvs), try unsetting PLATFORM variable. (in msys shell, "unset PLATFORM")
== Run the Hello World Example ==
+
 
 +
== Run the Hello World Example on the emulator ==
 
* Now, browse to the helloworld folder. There should be a helloworld.dol file here now.
 
* Now, browse to the helloworld folder. There should be a helloworld.dol file here now.
* Open this file, and when windows asks what program to use, tell it to use C:\devkitpro\emulators\gcube\gcube.exe
+
* Run the helloworld.dol in an emulator. As of 23-Feb-2019, emulators for the Wii are mostly compatible and feature complete. [[Dolphin]] can successfully boot all GameCube games, most Wii games and most homebrew. See the [[Dolphin]] page for more information. Another emulator is [[Gcube]]. Gcube does not run homebrew compiled in Wii mode, but can run homebrew if compiled for the GameCube mode. See the [[Gcube]] page for more information.
  
The resulting dol should be compatible with the Twilight Hack
+
== Run the Hello World Example on the Wii using wiiload ==
 +
* For this to work, you need to have the [[Homebrew Channel]] installed on your Wii and a way to access the Wii via TCP.
 +
* Get wiiload.exe from the [http://hbc.hackmii.com/download/ Homebrew Channel archive] (should be in wiiload\win32) and copy it to C:\devkitPro\msys\bin.
 +
* Set the environment variable WIILOAD to something like "tcp:192.168.0.30" (replace the IP with your Wii's IP). This can be done via Control Panel -> System -> Advanced -> Environment Variables. Then restart windows.
 +
* Start the Homebrew Channel on your Wii.
 +
* Click on Tools -> run or use the ALT+R key combination.
 +
* The output window at the bottom will show the upload progress (so does the Homebrew Channel) and the example will be started on your Wii when it's done.
  
== Some Code snippets ==
+
== Edit the msys etc/profile file ==
 +
The etc/profile file loads some settings at each launch of the msys shell.
 +
It can be used to set some environement variable for the compiler/linker
  
Here are some code snippets, that can be very usefully (all without quotes!):
+
<source lang="bash">
 +
export CC=powerpc-eabi-gcc
 +
export CXX=powerpc-eabi-g++
 +
export DEVKITPRO=/c/usr/devkitpro
 +
export DEVKITPPC=$DEVKITPRO/devkitPPC
 +
export SDL_CONFIG=$DEVKITPRO/libogc/bin/sdl-config
 +
export WIILOAD="tcp:192.168.1.57"
 +
export PATH="$DEVKITPPC/bin:$DEVKITPPC/powerpc-eabi/bin:$DEVKITPPC\libexec\gcc\powerpc-eabi\4.4.3:$PATH"
 +
export LDFLAGS="-L$DEVKITPRO/libogc/lib/wii"
 +
</source>
  
'''Reload .elf:'''
+
Set the $DEVKITPRO variable to the devkitpro directory and the WIILOAD with the Wii IP.  
  
''"((void(*)())(0x80001800))();"''
+
CC: C Compiler to use
  
 +
CXX: C++ compiler to use (note: CPP stand for C preprocessor)
  
'''Return to Loader (i.e. USBGecko with geckoloader) on START+Z-Trigger:'''
+
DEVKITPRO: Needed by the Devkitpro Makefiles
* Add this to your definitions on the top of your source file:
 
  
''typedef void (*Loader_Entry)(void);''
+
WIILOAD: Needed by the wiiload program
  
''Loader_Entry loader = (Loader_Entry)0x80001800;''
+
PATH: Search in bin and libexec in order to perform a gcc or g++ command without a makefile, followed by your Windows existing variables.
  
 +
== Some Code snippets ==
 +
:''See also: [[Developer Tips]]''
 +
libogc provides a jump back to the loader through the standard libc exit function. exit(0) will immediately return, all other values will display a console screen with the exit code.
  
* Add this in your main while loop, under "VIDEO_WaitVSync()":
+
== Links ==
 
+
* [http://wiki.devkitpro.org/index.php/Getting_Started devkitPro's 'Getting Started' Wiki]
''PAD_ScanPads();''
+
* [[Devkitppc setup (Mac OS X)|Getting started with DevkitPPC on Mac OS X]]
 
+
* [[Devkitppc setup (Linux)|Getting started with DevkitPPC on Linux]]
''int buttonsDown = PAD_ButtonsHeld(0);''
 
 
 
''if( (buttonsDown & PAD_TRIGGER_Z) && (buttonsDown & PAD_BUTTON_START)) {''
 
 
 
''loader();''
 
 
 
''}''
 
 
 
[[User:Roto|Roto]] 17:25, 24 March 2008 (PDT)
 
  
==Links==
+
[[Category:Development]]
[http://wiki.devkitpro.org/index.php/Getting_Started devkitPro's 'Getting Started' Wiki]
 

Latest revision as of 14:58, 23 February 2019

devkitPPC is the toolchain provided by DevkitPro for Wii and Gamecube development. This guide describes setting up such a system under Windows. A guide for Mac OS X 10.5.x users can be found here and a guide for Linux here

Introduction

This tutorial aims to:

  • Show you how to setup the devkitppc development environment on a Windows computer
  • Run a hello world example on the included Gcube emulator
  • Run a hello world example on the Wii using wiiload
  • Set you on the road to creating your own homebrew software to be loaded with the Twilight Hack or Homebrew Channel

Installing devkitPPC

  • Go to this page and download the latest Windows installer.
  • Let it install to the C:\devkitPro\ to make it easier to follow the tutorial for now.
  • When installing it, you can deselect devkitARM and devkitPSP
  • Click next until it finishes installing

Setup your project folder

  • Under no circumstances should you place projects within the devkitPro folder. The windows updater can and will overwrite/delete your files.
  • Create a new folder outside the devkitPro folder, c:\projects\wii for example. This path should not contain spaces.
  • Copy the folder C:\devkitPro\examples\wii\template\ to this new directory and rename it to "helloworld" so that the full path is c:\projects\wii\helloworld\

Compile the Hello World Example

  • Assuming you installed Programmer's Notepad through the installer, double click the .pnproj file in your new project.
  • Click on Tools->make or use the ALT+1 key combination
  • The output window at the bottom will show the build progress

Note: If you are having trouble compiling some programs under Windows Vista (eg. libogc cvs), try unsetting PLATFORM variable. (in msys shell, "unset PLATFORM")

Run the Hello World Example on the emulator

  • Now, browse to the helloworld folder. There should be a helloworld.dol file here now.
  • Run the helloworld.dol in an emulator. As of 23-Feb-2019, emulators for the Wii are mostly compatible and feature complete. Dolphin can successfully boot all GameCube games, most Wii games and most homebrew. See the Dolphin page for more information. Another emulator is Gcube. Gcube does not run homebrew compiled in Wii mode, but can run homebrew if compiled for the GameCube mode. See the Gcube page for more information.

Run the Hello World Example on the Wii using wiiload

  • For this to work, you need to have the Homebrew Channel installed on your Wii and a way to access the Wii via TCP.
  • Get wiiload.exe from the Homebrew Channel archive (should be in wiiload\win32) and copy it to C:\devkitPro\msys\bin.
  • Set the environment variable WIILOAD to something like "tcp:192.168.0.30" (replace the IP with your Wii's IP). This can be done via Control Panel -> System -> Advanced -> Environment Variables. Then restart windows.
  • Start the Homebrew Channel on your Wii.
  • Click on Tools -> run or use the ALT+R key combination.
  • The output window at the bottom will show the upload progress (so does the Homebrew Channel) and the example will be started on your Wii when it's done.

Edit the msys etc/profile file

The etc/profile file loads some settings at each launch of the msys shell. It can be used to set some environement variable for the compiler/linker

export CC=powerpc-eabi-gcc
export CXX=powerpc-eabi-g++
export DEVKITPRO=/c/usr/devkitpro
export DEVKITPPC=$DEVKITPRO/devkitPPC
export SDL_CONFIG=$DEVKITPRO/libogc/bin/sdl-config 
export WIILOAD="tcp:192.168.1.57"
export PATH="$DEVKITPPC/bin:$DEVKITPPC/powerpc-eabi/bin:$DEVKITPPC\libexec\gcc\powerpc-eabi\4.4.3:$PATH"
export LDFLAGS="-L$DEVKITPRO/libogc/lib/wii"

Set the $DEVKITPRO variable to the devkitpro directory and the WIILOAD with the Wii IP.

CC: C Compiler to use

CXX: C++ compiler to use (note: CPP stand for C preprocessor)

DEVKITPRO: Needed by the Devkitpro Makefiles

WIILOAD: Needed by the wiiload program

PATH: Search in bin and libexec in order to perform a gcc or g++ command without a makefile, followed by your Windows existing variables.

Some Code snippets

See also: Developer Tips

libogc provides a jump back to the loader through the standard libc exit function. exit(0) will immediately return, all other values will display a console screen with the exit code.

Links