nintendo ds programming (programming environment) 한신대학교 컴퓨터공학과 대학원...

Post on 16-Jan-2016

224 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Nintendo DS ProgrammingNintendo DS Programming(Programming Environment)(Programming Environment)

Nintendo DS ProgrammingNintendo DS Programming(Programming Environment)(Programming Environment)

한신대학교 컴퓨터공학과 대학원류승택

2008. Spring

2

Programming Environment

■ Prerequisite Programming language (C, C++ ...)

■ Setup Environment PC(Operation System): Windows or Linux

• Installing Software Visual C++ 2005 Express .Net Framework : Get it here ! devkitPro : devkitPro updater PAlib : PAlib Installer

Nintendo DS (Lite) or NDS Emulator• NDSL Homebrew : Passthrough Device

Ex) R4 Card + SD Memory(MoonShell)

• Emulator : No$GBA, Dualis, iDeaS, DeSmuMe

3

Nintendo DS

■ handheld game console released in 2004 in Canada, U.S., and Japan

■ HARDWARE Input and output

• Dual Screen : 2 Color LCD screens each 256 x 192 pixels Touchscreen(Bottom) : input from the included stylus, the user's fingers

• Left: D-pad (= directional pad) , narrow Power buttopn• Right: A, B, X, and Y buttons, narrow Select and Start butt

on • Shoulder buttons L and R • stereo speakers providing virtual surround sound • A built-in microphone

4

Nintendo DS Lite

■ Nintendo DS Lite a slimmer, brighter, and more lightweight redesign of the

Nintendo DS It was announced on January 26, 2006 As of December 2007, sales of the DS Lite have reached 45.97 millio

n units worldwide Differences in the DS Lite over the original DS

• Weight: 218 g / 7.69 oz (21% lighter than the DS). • Dimensions: 133 mm × 73.9 mm × 21.5 mm (42% less volume tha

n the DS)• Battery life: With a full 3 hour charge the battery will last 15 to 19

hours on the lowest brightness setting and 5 to 8 hours on the highest brightness setting

• Brighter, more durable top and bottom LCD screens, with four levels of brightness

5

Nintendo DS Lite

■ Nintendo DS (Lite) CPU : 67 MHz ARM9 and 33 MHz ARM7 Media : GBA cartridges & Nintendo DS Game Cards System storage : 4 MB RAM Connectivity: Wi-Fi and LAN

• Speed: 1 Mbps or 2Mbps• supports wireless IEEE 802.11 (Wi-Fi) standards (10–30

m, depending on conditions) • online with the Nintendo Wi-Fi Connection service

Best Selling Video Console

6NDS HardWare (Front Face)

7NDS HardWare (Back Face)

8

NDS Homebrew

■ Politics of the Nintendo DS Homebrew Movement most people will never receive the contract with Nintendo Dedicated hobbyists spend weeks reverse engineering the

Nintendo DS hardware • These people make up the homebrew movement

■ Is Homebrew Legal? Homebrew is legal for a number of reasons impossible to publish a game made with homebrew tools

■ The downside of homebrew software pirates often steal from the discoveries of

homebrew

9

Passthrough Device

■ The purpose of the pass through allow the running of programs on the Nintendo DS through the

Game Boy Advance (GBA) cartridge slot or the Nintendo DS (NDS) card slot

The Slot-1 port : DS Flash Cartridge The Slot-2 port : GBA Flash Cartridge

11

Compiling Test

■ Emulators No$GBA

• contains almost full NDS emulation support including 3D and WIFI emulation.

Dualis• it works pretty well for home brew, but isn’t as accurate as

No$GBA. iDeaS

• It was the first to support 3d and sound, and... well, DeSmuMe

• maybe the fastest emulator for DS. • doesn’t support sound and zooming/rotation

12

Using PALib With Visual C++

■ Using PALib With Visual C++ 2005 or Express Environment Setup

• DKP_HOME C:\devkitPro AppWizard: Get the AppWizard here

• extract the contents VC8_Express_Setup.js VC8_Setup.js double click

13

Using PALib With Visual C++

■ Building the First Project the “make” tool we use to compile PALib project doesn’t like long fil

ename and directories with spaces

• Tools Options Projects and Solution General

• Change the field “Visual Studio Projects Location” to a folder with no spaces

Execute Visual C++ : File New Select New Project

14

Using PALib With Visual C++

■ the files that were generated by the wizard logo.bmp → this is the image your app will sho

w in DS Loaders. logo_wifi.bmp → the logo to use with WiFi. main.cpp → the main program file, with some c

ode already written for you. Makefile → a PALib makefile optimized for Vis

ual Studio. ReadMe.txt → some info.

■ Add Include Tools → Options → Project & Solutions → VC+

+ Directories select “Include files”

• <path to PALib>\include\nds• <path to PALib>\libnds\include

■ Bulid F7

15

Using PALib With Visual C++

■ Compiling Error 1 Invalid conversion error

C:\devkitPro\PAlib\include\nds\arm9\PA_Sound.h add (u32*)

16

Using PALib With Visual C++

■ Compiling Error 2 File Open error

C:\devkitPro\PAlib\lib\arm7\arm7.bin • add arm7.bin current project folder

17

Setting Up an Emulator inside Visual C++

■ setup a NDS emulator as an External Tool Click on “Tools”, “External Tools” click on “Add” to create a new External Tool

Command: Select NO$GBA.exeArgument: TargetDir)\$(TargetName).ndsInitial directory: $(TargetDir)

18

Setting Up an Emulator inside Visual C++

Make a keyboard shortcut• “Tools” “Options” “Environment” “Keyboard”

Tools.ExternalCommand9 Assign Shift+F10

19

First NDS Programming

■ Template's Main Code

// PALib Template Application// Includes#include <PA9.h> // Include for PA_Libint main(){

PA_Init(); // Initializes PA_LibPA_InitVBL(); // Initializes a standard VBL

PA_InitText(1, 2);PA_OutputSimpleText(1, 1, 2, "Hello World!");

// Infinite loop to keep the program runningwhile (1){

PA_WaitForVBL();}return 0;

}

20

First NDS Programming

■ Decoding the Code ! #include <PA9.h> : include PAlib into my code int main(int argc, char ** argv) : the start of your program PA_Init(); // Initializes PA_Lib

• a general initialization PA_Lib PA_InitVBL(); // Initializes a standard VBL

• VBL(Verticle Blanking Interrupt) synchronize the program with the screen, at 60 frames per s

econd If you don’t initialize the VBL, either the program will work w

ay faster (like 100000 frames per second, which is unplayable) or not work at all

21

First NDS Programming

■ Decoding the Code ! PA_InitText(1,2); //Tell it to use text on screen 1, background number 2

• Argument 1: screen (0 for bottom, 1 for top screen)• Argument 2: background to use

0 for topmost layet, 1 for next, 2, and 3 for the bottom PA_OutputSimpleText(1,1,1,"Hello World !"); //Print the text on scr

een 1

• Argument 1: Screen (0-1) • Argument 2: Horizontal (X) from which to start (from 0 to 3

1) Each tile is a 8×8 pixel square

• Argument 3: Vertical (Y) (from 0 to 23)

• Argument 4: Text While(1) { PA_WaitForVBL(); }

• synchronizes the infinite loop (60 fps).

256 x 192 pixels

22

Presentaion Schedule발표 주제 과제 발표자

00 NDS Programming 담당교수

01 Installing and Compiling 담당교수

02 Input/Output Wiki 한글화 및 발표자료준비 송기원

03 Sprites 곽용식

04 Backgrounds 김태수

05 Dev-related Math Stuff 중간프로젝트 송현돈

06 Sound (추가조사 )

이은정DS Hardware

07 중간 프로젝트 시연  

08

PA File System

박진수3D-Functions (추가조사 )

Video Functions

10 Quick Demos 김인기

11 Starting a Platform Game 김경현

12 More Platform Game 기말프로젝트 유원희

13

Carré Rouge지성우Data transfer and Multiplayer (추가조

사 )

23

■ PAlib Reference PAlib Modules

• http://www.palib.info/Doc/PAlibDoc%20Eng/modules.html PAlib Wiki Tutorial

• http://www.palib.info/wiki/doku.php PAlib Tutorial

• http://www.aaronrogers.com/nintendods/PA_Lib/ WiFiMe

• http://www.aaronrogers.com/nintendods/wifime.php

24

Reference

■ 외국사이트 PAlib's DS Dev Wiki Tutorial  (General : PAlib's DS Dev Wiki Tutorial) Introduction to Nintendo DS Programming (Patater)  (Jaden Amero) Nintendo DS Development Tutorial (Aaron Rogers) DS Developer dsdev.org/ en.wikipedia.org/wiki/Nintendo_DS GBA Developer Forum Homebrew NDS NDS/Tutorials A guide to homebrew development for the Nintendo DS Other DS Wiki

■ 국내사이트 Nintendo DS Homebrew Tutor beodeulsoft.com/ 네이버 블로그 NDS 프로그래밍 네이버 블로그 2 kkamagui 프로그래밍 세상 TISTORY 네이버 카페

top related