Add TwlSystem + fix naming of files for rsf

This commit is contained in:
rmc 2023-12-16 16:20:48 -05:00
parent 0ca1d3e0ee
commit c250db2bee
No known key found for this signature in database
GPG Key ID: 5633EC10309D77D1
2139 changed files with 409661 additions and 110 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.DS_Store
._*
/add-ins/TwlSDK/

31
add-ins/TwlSystem/Makefile Executable file
View File

@ -0,0 +1,31 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = \
build
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,150 @@
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
 Readme-NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp.txt       ■
■                                     ■
 NITRO-System for TWL 080408 ( TWL-SDK5.0 FC plus5 対応版 )        ■
■                                     ■
 Jul. 1, 2008                              ■
■                                     ■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
目次
==============================================================================
  1. はじめに
  2. ファイルリスト
1. はじめに
==============================================================================
  このパッチは、NITRO-System for TWL 2008/04/08版をTWL-SDK5.0 FC plus5に
  対応させるためのものです。NITRO-System for TWLのライブラリをTWL-SDK5.0 FC plus5
  を用いてビルドしたものに差し替えます。
  このパッチをインストールするためには、同梱されているファイルをNITRO-System
   for TWL 2008/04/08版がインストールされているディレクトリに上書きコ
  ピーしてください。
2. 修正内容
===============================================================================
(1) snd: driverInfoサンプルデモの不具合修正
・sndライブラリのdriverInfoサンプルデモに問題があり、
TWL-SDK5.0 FC plus5では動作しませんでしたが、これを修正しました。
3. ファイルリスト
===============================================================================
  ■ライブラリ
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsfnd.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsfnd.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsfnd.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsfnd.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsfnd.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsfnd.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg2d.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg2d.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg2d.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg2d.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg2d.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg2d.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg3d.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg3d.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg3d.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg3d.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg3d.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsg3d.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsgfd.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsgfd.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsgfd.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsgfd.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsgfd.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsgfd.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsmcs.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsmcs.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsmcs.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsmcs.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsmcs.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnsmcs.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnssnd.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnssnd.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnssnd.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnssnd.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnssnd.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Debug/libnnssnd.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsfnd.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsfnd.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsfnd.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsfnd.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsfnd.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsfnd.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg2d.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg2d.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg2d.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg2d.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg2d.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg2d.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg3d.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg3d.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg3d.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg3d.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg3d.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsg3d.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsgfd.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsgfd.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsgfd.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsgfd.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsgfd.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsgfd.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsmcs.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsmcs.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsmcs.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsmcs.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsmcs.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnsmcs.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnssnd.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnssnd.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnssnd.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnssnd.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnssnd.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Release/libnnssnd.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsfnd.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsfnd.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsfnd.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsfnd.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsfnd.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsfnd.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg2d.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg2d.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg2d.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg2d.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg2d.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg2d.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg3d.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg3d.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg3d.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg3d.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg3d.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsg3d.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsgfd.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsgfd.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsgfd.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsgfd.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsgfd.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsgfd.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsmcs.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsmcs.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsmcs.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsmcs.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsmcs.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnsmcs.TWL.LTD.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnssnd.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnssnd.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnssnd.TWL.HYB.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnssnd.TWL.HYB.thumb.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnssnd.TWL.LTD.a
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/lib/ARM9-TS/Rom/libnnssnd.TWL.LTD.thumb.a
  ■サンプルデモ
NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp/NitroSystem/build/demos/snd/driverInfo/src/main.c

View File

@ -0,0 +1,20 @@
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■                                     ■
 NITRO-System for TWL 080408 ( TWL-SDK5.0 FC plus5 対応版 )       ■
■                                     ■
 Jul. 1, 2008                              ■
■                                     ■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
このパッチは、NITRO-System for TWL 2008/04/08版をTWL-SDK5.0 FC plus5に
対応させるためのものです。NITRO-System for TWLのライブラリをTWL-SDK5.0 FC plus5
を用いてビルドしたものに差し替えます。
このパッチをインストールするためには、同梱されているファイルをNITRO-System
for TWL 2008/04/08版がインストールされているディレクトリに上書きコ
ピーしてください。
詳しくは、NitroSystemディレクトリの
Readme-NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp.txt をご覧下さい。

View File

@ -0,0 +1,115 @@
-------------------------------------------------------------------------------
Project: NITRO-System
File: SourceTreeMap.txt
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 661 $
-------------------------------------------------------------------------------
■NITRO-Systemパッケージのディレクトリ構成図2008-04-08
NitroSystem NITRO-Systemのトップ
├─docs ドキュメント
│ │
│ ├─ReleaseNotes.html - NITRO-System リリースに関するドキュメント
│ ├─QuickStart.pdf - NITRO-System クイックスタートドキュメント
│ │
│ ├─Changelog - 各ライブラリとツールの更新履歴
│ ├─Overview - 各開発環境の概要説明書
│ ├─TechnicalNotes - 技術説明書
│ ├─Xerces-C++ - Xerces-C++のライセンス書類
│ ├─Foundation - NITRO-Foundationライブラリのドキュメント
│ ├─GraphicsFoundation - NITRO-GraphicsFoundationライブラリのドキュメント
│ ├─G2D - NITRO-2DGraphicsライブラリのドキュメント
│ ├─G3D - NITRO-3DGraphicsライブラリのドキュメント
│ ├─NitroComposer - NITRO-Composerのドキュメント
│ ├─mcs - Multiple Channel Streamライブラリのドキュメント
│ ├─3DFileFormat - 3Dファイルフォーマットのドキュメント
│ ├─3DMaterialEditor - 3D MaterialEditorのドキュメント
│ ├─NitroSoundMaker - NITRO-SoundMakerのドキュメント
│ ├─NitroPlayer - NITRO-Playerのドキュメント
│ ├─NitroViewer - NITRO-Viewerのドキュメント
│ └─3DPlugins - プラグインのドキュメント
│ │
│ ├─Maya - - MAYAプラグインのドキュメント
│ ├─3dsmax - - 3dsmaxプラグインのドキュメント
│ ├─SoftimageXSI - - Softimage|XSIプラグインのドキュメント
│ └─Photoshop - - Photoshopプラグインのドキュメント
├─build ビルドディレクトリ
│ │
│ ├─buildtools - ビルドに必要なファイル
│ │
│ ├─demos - デモアプリケーション
│ │ │
│ │ ├─fnd - - NITRO-Foundationライブラリのデモ
│ │ ├─gfd - - NITRO-GraphicsFoundationライブラリのデモ
│ │ ├─g2d - - NITRO-2DGraphicsライブラリのデモ
│ │ ├─g3d - - NITRO-3DGraphicsライブラリのデモ
│ │ ├─snd - - NITRO-Composerライブラリのデモ
│ │ ├─mcs - - Muitiple Channel Streamライブラリのデモ
│ │ └─IDE - - CodeWarrior IDE プロジェクトサンプル
│ │
│ └─libraries - ライブラリのソース
│ │
│ ├─fnd - - NITRO-Foundationライブラリのソース
│ ├─gfd - - NITRO-GraphincsFoundationライブラリのソース
│ ├─g2d - - NITRO-2DGraphicsライブラリのソース
│ ├─g3d - - NITRO-3DGraphicsライブラリのソース
│ ├─snd - - NITRO-Composerライブラリのソース
│ └─mcs - - Muitiple Channel Streamライブラリのソース
├─include インクルードファイル
│ │
│ └─nnsys - NITRO-System用ヘッダファイル
│ │
│ ├─fnd - - NITRO-Foundationヘッダファイル
│ ├─gfd - - NITRO-GraphincsFoundationヘッダファイル
│ ├─g2d - - NITRO-2DGraphicsヘッダファイル
│ ├─g3d - - NITRO-3DGraphicsヘッダファイル
│ ├─snd - - NITRO-Composerヘッダファイル
│ └─mcs - - Muitiple Channel Streamヘッダファイル
├─man リファレンスマニュアルHTML
│ │
│ └─ja_JP - 日本語
├─lib ライブラリの作成先
│ │
│ └─ARM9-TS - メインプロセッサ TS以降用ライブラリ
│ │
│ ├─Debug - - Debug 版
│ ├─Release - - Release 版
│ └─Rom - - 最終ROM 版
└─tools NITRO-Systemツール
├─bin - コンバータ等の実行ファイル
├─fontcvtr - フォントコンバータ
├─mcsserver - mcsサーバ
├─NNS_3DMaterialEditor - 3D MaterialEditor
├─NitroSoundMaker - NITRO-SoundMaker
├─SoundPlayer - サウンドプレイヤ
├─NitroPlayer - NITRO-Player
├─NitroViewer - NITRO-Viewer
└─3DPlugins - 3Dプラグイン
├─Maya - - MAYAプラグイン
├─3dsmax - - 3dsmaxプラグイン
├─SoftimageXSI - - Softimage|XSIプラグイン
└─Photoshop - - Photoshopプラグイン

View File

@ -0,0 +1,49 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - build
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
ifndef NITRO_WITHOUT_DEMOS
SUBDIRS.DEMOS = $(wildcard demos)
ifdef NITROSYSTEM_PRIVATE
SUBDIRS.BUILDSETUP = $(wildcard buildsetup)
SUBDIRS.TESTS = $(wildcard tests)
endif
endif
ifdef NITROSYSTEM_PRIVATE
SUBDIRS.TOOLS = $(wildcard tools)
endif
SUBDIRS.LIBRARIES = $(wildcard libraries)
SUBDIRS = \
$(SUBDIRS.BUILDSETUP) \
$(SUBDIRS.LIBRARIES) \
$(SUBDIRS.TOOLS) \
$(SUBDIRS.DEMOS) \
$(SUBDIRS.TESTS)
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,93 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - buildtools
# File: commondefs
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 518 $
#----------------------------------------------------------------------------
ifndef NITROSYSTEM_COMMONDEFS_
NITROSYSTEM_COMMONDEFS_ := TRUE
#----------------------------------------------------------------------------
#
# NITRO-System Root directory
#
NITROSYSTEM_ROOT ?= C:/NitroSystem
TWLSYSTEM_ROOT ?= $(NITROSYSTEM_ROOT)
NNS_ALLLIBS := fnd mcs gfd g2d g3d snd
NNS_LIB_MODULES = LibFnd LibMcs LibGfd LibG2d LibG3d LibSnd
ROOT_MODULES := FND MCS GFD G2D G3D SND
#----------------------------------------------------------------------------
#
# import TWL-SDK commondefs
#
include $(TWLSDK_ROOT)/build/buildtools/commondefs
NITRO_BUILDTYPE ?= $(TWL_BUILDTYPE)
NITRO_LIBTYPE ?= $(TWL_LIBTYPE)
NITRO_CCTYPE ?= $(TWL_CCTYPE)
#----------------------------------------------------------------------------
#
# NITRO-System Path settings
#
NNS_ROOT := $(call eupath,$(NITROSYSTEM_ROOT))
NITROSYSTEM_BUILDTOOLSDIR := $(NNS_ROOT)/build/buildtools
NITROSYSTEM_TOOLSDIR := $(NNS_ROOT)/tools
# $(foreach module,$(ROOT_MODULES),$(eval NITROSYSTEM_$(module)_ROOT = $$(NNS_ROOT)))
NITROSYSTEM_FND_ROOT = $(NNS_ROOT)
NITROSYSTEM_MCS_ROOT = $(NNS_ROOT)
NITROSYSTEM_GFD_ROOT = $(NNS_ROOT)
NITROSYSTEM_G2D_ROOT = $(NNS_ROOT)
NITROSYSTEM_G3D_ROOT = $(NNS_ROOT)
NITROSYSTEM_SND_ROOT = $(NNS_ROOT)
#----------------------------------------------------------------------------
# PRIVATE FLAGS
#
-include $(NITROSYSTEM_BUILDTOOLSDIR)/private/commondefs
-include $(NITROSYSTEM_BUILDTOOLSDIR)/internal/commondefs
#----------------------------------------------------------------------------
#
# NITROSYSTEM_INSTALL_ROOT
#
ifdef NITROSYSTEM_INSTALL_ROOT
override NITROSYSTEM_INSTALL_ROOT := $(call eupath,$(NITROSYSTEM_INSTALL_ROOT))
endif
NITROSYSTEM_INSTALL_ROOT ?= $(NNS_ROOT)
NITROSYSTEM_INSTALL_INCDIR := $(NITROSYSTEM_INSTALL_ROOT)/include
NITROSYSTEM_INSTALL_TOOLSDIR := $(NITROSYSTEM_INSTALL_ROOT)/tools
NITROSYSTEM_INSTALL_LIBDIR := $(NITROSYSTEM_INSTALL_ROOT)/lib/$(NITRO_LIBTYPE)
#----------------------------------------------------------------------------
### Compiler settings
-include $(NITROSYSTEM_BUILDTOOLSDIR)/commondefs.cctype.$(NITRO_CCTYPE)
# NITROSYSTEM_COMMONDEFS_
endif
#----- End of commondefs -----

View File

@ -0,0 +1,51 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - buildtools
# File: commondefs.cctype.CW
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# switch by codegen platform TEG/TS
MACRO_FLAGS += -DNNS_$(TARGET_PLATFORM)
#----------------------------------------------------------------------------
# switch by codegen processor ARM7/ARM9
MACRO_FLAGS += -DNNS_$(CODEGEN_PROC)
#----------------------------------------------------------------------------
# switch by DEBUG/RELEASE/FINALROM
#
MACRO_FLAGS += -DNNS_$(TWL_BUILD_TYPE)
#----------------------------------------------------------------------------
# switch by C Compiler CW/ADS/GCC
#
MACRO_FLAGS += -DNNS_$(TWL_CCTYPE)
#----------------------------------------------------------------------------
# switch by codegen target ARM/THUMB
MACRO_FLAGS_CC += -DNNS_CODE_$(CODEGEN_CC)
MACRO_FLAGS_AS += -DNNS_CODE_$(CODEGEN_AS)
#----- End of commondefs.cctype.CW -----

View File

@ -0,0 +1,24 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - buildtools
# File: modulerules
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 268 $
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
# PRIVATE FLAGS
#
-include $(NITROSYSTEM_BUILDTOOLSDIR)/private/modulerules
#----- End of modulerules -----

View File

@ -0,0 +1,72 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - buildtools
# File: nnslibdefs
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: $
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
#
# このファイルnnslibdefsは、SDKのcommondefsからincludeされます
#
# このファイル中で設定した以下のMAKE変数が、SDKのcommondefsから参照されます。
# ・NITROSYSTEM_INCDIR
# ・NITROSYSTEM_LIBDIR
# ・NITROSYSTEM_LIBS
#
NITRO_LIBTYPE ?= $(TWL_LIBTYPE)
NITRO_LIBSUFFIX ?= $(TWL_LIBSUFFIX)
ifdef NITROSYSTEM_ROOT
NITROSYSTEM_ROOT_ := $(subst $(SPACE),\ ,$(subst \,/,$(NITROSYSTEM_ROOT)))
-include $(NITROSYSTEM_ROOT_)/build/buildtools/private/nnslibdefs
#----------------------------------------------------------------------------
#
# NITRO-System Library settings
#
# NITRO-Systemのcommondefsが使用されている場合は、NITRO-Systemライブラリを使
# 用するための設定をします。
#
ifdef NITROSYSTEM_COMMONDEFS_
NITROSYSTEM_INCDIR ?= $(NITROSYSTEM_ROOT_)/include
NITROSYSTEM_LIBDIR ?= $(NITROSYSTEM_ROOT_)/lib/$(NITRO_LIBTYPE)
NNS_USELIBS ?= $(NNS_ALLLIBS)
ifeq ($(CODEGEN_PROC),ARM9)
NITROSYSTEM_LIBS := $(foreach lib,$(NNS_USELIBS),libnns$(lib)$(NITRO_LIBSUFFIX).a)
else # ($(CODEGEN_PROC),ARM7)
NITROSYSTEM_LIBS :=
endif
TWLSYSTEM_INCDIR = $(NITROSYSTEM_INCDIR)
TWLSYSTEM_LIBDIR = $(NITROSYSTEM_LIBDIR)
TWLSYSTEM_LIBS = $(NITROSYSTEM_LIBS)
# NITROSYSTEM_COMMONDEFS_
endif
# NITROSYSTEM_ROOT
endif
#----- End of nnslibdefs -----

View File

@ -0,0 +1,395 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - IDE - IDE_Archive
# File: Nitro.lcf
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
MEMORY
{
main (RWX) : ORIGIN = 0x02000000, LENGTH = 0x0 > main.sbin
ITCM (RWX) : ORIGIN = 0x01ff8000, LENGTH = 0x0 >> main.sbin
DTCM (RWX) : ORIGIN = 0x027e0000, LENGTH = 0x0 >> main.sbin
binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin
binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin
main_defs (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_defs.sbin
main_table (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_table.sbin
dummy.MAIN_EX (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0
arena.MAIN (RW) : ORIGIN = AFTER(main), LENGTH = 0x0
arena.MAIN_EX (RW) : ORIGIN = AFTER(dummy.MAIN_EX), LENGTH = 0x0
arena.ITCM (RW) : ORIGIN = AFTER(ITCM), LENGTH = 0x0
arena.DTCM (RW) : ORIGIN = AFTER(DTCM), LENGTH = 0x0
binary.MODULE_FILES (RW) : ORIGIN = 0x0, LENGTH = 0x0 > component.files
check.ITCM (RWX) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check
check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check
}
FORCE_ACTIVE
{
SVC_SoftReset
}
KEEP_SECTION
{
.sinit
}
SECTIONS
{
############################ STATIC #################################
.main:
{
ALIGNALL(4); . = ALIGN(32); # Fit to cache line
#
# TEXT BLOCK: READ ONLY
#
SDK_STATIC_START =.;
SDK_STATIC_TEXT_START =.;
#:::::::::: text/rodata
libsyscall.a (.text)
crt0.o (.text)
crt0.o (.rodata)
#
# .version セクションを追加しています。
# このセクションに含まれる情報はロットチェックの際に
# 必要となりますので、必ずこの位置に残すようにして下さい。
#
* (.version)
OBJECT(NitroMain,*)
GROUP(ROOT) (.text)
. = ALIGN(4);
* (.exception)
. = ALIGN(4);
SDK_STATIC_ETABLE_START =.;
EXCEPTION
SDK_STATIC_ETABLE_END =.;
. = ALIGN(4);
GROUP(ROOT) (.init)
. = ALIGN(4);
GROUP(ROOT) (.rodata)
. = ALIGN(4);
SDK_STATIC_SINIT_START =.;
#:::::::::: ctor
GROUP(ROOT) (.ctor)
GROUP(ROOT) (.sinit)
WRITEW 0;
#:::::::::: ctor
SDK_STATIC_SINIT_END =.;
#:::::::::: text/rodata
. = ALIGN(32);
SDK_STATIC_TEXT_END =.;
#
# DATA BLOCK: READ WRITE
#
SDK_STATIC_DATA_START =.;
#:::::::::: data
GROUP(ROOT) (.sdata)
. = ALIGN(4);
GROUP(ROOT) (.data)
. = ALIGN(4);
SDK_OVERLAY_DIGEST =.;
# NO DIGEST
SDK_OVERLAY_DIGEST_END =.;
#:::::::::: data
. = ALIGN(32);
SDK_STATIC_DATA_END =.;
SDK_STATIC_END =.;
SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START;
SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START;
SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START;
__sinit__ = SDK_STATIC_SINIT_START; # for static initializer
__exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table
__exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table
} > main
.main.bss:
{
ALIGNALL(4); . = ALIGN(32);
#
# BSS BLOCK
#
SDK_STATIC_BSS_START =.;
#:::::::::: bss
GROUP(ROOT) (.sbss)
. = ALIGN(4);
GROUP(ROOT) (.bss)
. = ALIGN(4);
#:::::::::: bss
. = ALIGN(32);
SDK_STATIC_BSS_END = .;
SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START;
} >> main
############################ AUTOLOADS ##############################
SDK_AUTOLOAD.ITCM.START = 0x01ff8000;
SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START;
SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START;
SDK_AUTOLOAD.ITCM.SIZE = 0;
SDK_AUTOLOAD.ITCM.BSS_SIZE = 0;
SDK_AUTOLOAD.DTCM.START = 0x027e0000;
SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START;
SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START;
SDK_AUTOLOAD.DTCM.SIZE = 0;
SDK_AUTOLOAD.DTCM.BSS_SIZE = 0;
SDK_AUTOLOAD_START = SDK_STATIC_END;
SDK_AUTOLOAD_SIZE = 0;
SDK_AUTOLOAD_NUMBER = 2;
.ITCM:
{
ALIGNALL(4); . = ALIGN(32);
#
# TEXT BLOCK: READ ONLY
#
SDK_AUTOLOAD_ITCM_ID =0;
SDK_AUTOLOAD.ITCM.ID =0;
SDK_AUTOLOAD.ITCM.START =.;
SDK_AUTOLOAD.ITCM.TEXT_START =.;
#:::::::::: text/rodata
. = ALIGN(4);
* (.itcm)
. = ALIGN(4);
. = ALIGN(4);
#:::::::::: text/rodata
SDK_AUTOLOAD.ITCM.TEXT_END =.;
#
# DATA BLOCK: READ WRITE BLOCK
#
SDK_AUTOLOAD.ITCM.DATA_START =.;
#:::::::::: data
. = ALIGN(4);
. = ALIGN(4);
. = ALIGN(4);
#:::::::::: data
. = ALIGN(32);
SDK_AUTOLOAD.ITCM.DATA_END =.;
SDK_AUTOLOAD.ITCM.END =.;
SDK_AUTOLOAD.ITCM.TEXT_SIZE = SDK_AUTOLOAD.ITCM.TEXT_END - SDK_AUTOLOAD.ITCM.TEXT_START;
SDK_AUTOLOAD.ITCM.DATA_SIZE = SDK_AUTOLOAD.ITCM.DATA_END - SDK_AUTOLOAD.ITCM.DATA_START;
SDK_AUTOLOAD.ITCM.SIZE = SDK_AUTOLOAD.ITCM.END - SDK_AUTOLOAD.ITCM.START;
SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.ITCM.SIZE;
} > ITCM
.ITCM.bss:
{
ALIGNALL(4); . = ALIGN(32);
#
# BSS BLOCK
#
SDK_AUTOLOAD.ITCM.BSS_START = .;
#:::::::::: bss
. = ALIGN(4);
. = ALIGN(4);
. = ALIGN(4);
* (.itcm.bss)
. = ALIGN(4);
#:::::::::: bss
. = ALIGN(32);
SDK_AUTOLOAD.ITCM.BSS_END = .;
SDK_AUTOLOAD.ITCM.BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_END - SDK_AUTOLOAD.ITCM.BSS_START;
} >> ITCM
.DTCM:
{
ALIGNALL(4); . = ALIGN(32);
#
# TEXT BLOCK: READ ONLY
#
SDK_AUTOLOAD_DTCM_ID =1;
SDK_AUTOLOAD.DTCM.ID =1;
SDK_AUTOLOAD.DTCM.START =.;
SDK_AUTOLOAD.DTCM.TEXT_START =.;
#:::::::::: text/rodata
. = ALIGN(4);
. = ALIGN(4);
. = ALIGN(4);
#:::::::::: text/rodata
SDK_AUTOLOAD.DTCM.TEXT_END =.;
#
# DATA BLOCK: READ WRITE BLOCK
#
SDK_AUTOLOAD.DTCM.DATA_START =.;
#:::::::::: data
. = ALIGN(4);
. = ALIGN(4);
* (.dtcm)
. = ALIGN(4);
#:::::::::: data
. = ALIGN(32);
SDK_AUTOLOAD.DTCM.DATA_END =.;
SDK_AUTOLOAD.DTCM.END =.;
SDK_AUTOLOAD.DTCM.TEXT_SIZE = SDK_AUTOLOAD.DTCM.TEXT_END - SDK_AUTOLOAD.DTCM.TEXT_START;
SDK_AUTOLOAD.DTCM.DATA_SIZE = SDK_AUTOLOAD.DTCM.DATA_END - SDK_AUTOLOAD.DTCM.DATA_START;
SDK_AUTOLOAD.DTCM.SIZE = SDK_AUTOLOAD.DTCM.END - SDK_AUTOLOAD.DTCM.START;
SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.DTCM.SIZE;
} > DTCM
.DTCM.bss:
{
ALIGNALL(4); . = ALIGN(32);
#
# BSS BLOCK
#
SDK_AUTOLOAD.DTCM.BSS_START = .;
#:::::::::: bss
. = ALIGN(4);
. = ALIGN(4);
* (.dtcm.bss)
. = ALIGN(4);
. = ALIGN(4);
#:::::::::: bss
. = ALIGN(32);
SDK_AUTOLOAD.DTCM.BSS_END = .;
SDK_AUTOLOAD.DTCM.BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_END - SDK_AUTOLOAD.DTCM.BSS_START;
} >> DTCM
SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START;
SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END;
SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END;
SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE;
SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE;
SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START;
SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END;
SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END;
SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE;
SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE;
############################ AUTOLOAD_INFO ##########################
.binary.AUTOLOAD_INFO:
{
WRITEW ADDR(.ITCM);
WRITEW SDK_AUTOLOAD.ITCM.SIZE;
WRITEW SDK_AUTOLOAD.ITCM.BSS_SIZE;
WRITEW ADDR(.DTCM);
WRITEW SDK_AUTOLOAD.DTCM.SIZE;
WRITEW SDK_AUTOLOAD.DTCM.BSS_SIZE;
} > binary.AUTOLOAD_INFO
SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE;
SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO);
SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO);
############################ STATIC_FOOTER ##########################
.binary.STATIC_FOOTER:
{
WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE
WRITEW _start_ModuleParams - ADDR(.main);
WRITEW 0; # NO DIGEST
} > binary.STATIC_FOOTER
############################ OVERLAYS ###############################
SDK_OVERLAY_NUMBER = 0;
############################ MAIN EX ##################################
# MAIN EX Area
.dummy.MAIN_EX:
{
. = ALIGN(32);
} > dummy.MAIN_EX
############################ ARENA ##################################
.arena.MAIN:
{
. = ALIGN(32);
SDK_SECTION_ARENA_START =.;
} > arena.MAIN
.arena.MAIN_EX:
{
. = ALIGN(32);
SDK_SECTION_ARENA_EX_START =.;
} > arena.MAIN_EX
.arena.ITCM:
{
. = ALIGN(32);
SDK_SECTION_ARENA_ITCM_START =.;
} > arena.ITCM
.arena.DTCM:
{
. = ALIGN(32);
SDK_SECTION_ARENA_DTCM_START =.;
} > arena.DTCM
############################ OVERLAYDEFS ############################
.main_defs:
{
### main module information
WRITEW ADDR(.main); # load address
WRITEW _start; # entry address
WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module
WRITEW _start_AutoloadDoneCallback; # callback autoload done
### overlay filename
} > main_defs
############################ OVERLAYTABLE ###########################
.main_table:
{
} > main_table
############################ OTHERS #################################
SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START;
SDK_IRQ_STACKSIZE = 1024; # allocated in DTCM
SDK_SYS_STACKSIZE = 0; # when 0 means all remains of DTCM
# Module filelist
.binary.MODULE_FILES:
{
WRITES ("main.sbin");
WRITES ("main_defs.sbin");
WRITES ("main_table.sbin");
} > binary.MODULE_FILES
# ITCM/DTCM size checker => check AUTOLOAD_ITCM/DTCM
.check.ITCM:
{
. = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE;
} > check.ITCM
SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1;
.check.DTCM:
{
. = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE;
. = . + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN;
} > check.DTCM
}

View File

@ -0,0 +1,45 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_Archive
File: Nitro_TS.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
/*
header file to include NITRO precompile header file
*/
#if !__option (precompile)
#ifdef __cplusplus
/* include precompiled header for C++ source */
#ifdef SDK_DEBUG
#include "Nitro_TS_Debug.mch++" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch++" */
#elif SDK_RELEASE
#include "Nitro_TS_Release.mch++" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch++" */
#elif SDK_FINALROM
#include "Nitro_TS_ROM.mch++" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch++" */
#else
#error("no SDK_ define")
#endif
#else
/* include precompiled header for C source */
#ifdef SDK_DEBUG
#include "Nitro_TS_Debug.mch" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch" */
#elif SDK_RELEASE
#include "Nitro_TS_Release.mch" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch" */
#elif SDK_FINALROM
#include "Nitro_TS_ROM.mch" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch" */
#else
#error("no SDK_ define")
#endif
#endif
#endif

View File

@ -0,0 +1,22 @@
/*
precompiled header for NITRO C target
*/
/* include precompiled header for C source */
#ifdef SDK_DEBUG
#pragma precompile_target "Nitro_TS_Debug.mch"
#elif SDK_RELEASE
#pragma precompile_target "Nitro_TS_Release.mch"
#elif SDK_FINALROM
#pragma precompile_target "Nitro_TS_ROM.mch"
#else
#error("no SDK_ define")
#endif
/* include header for NITRO */
#include <nitro_TS_prefix.h>
#include <nitro.h>
/* include header for NITRO-System */
#include <nnsys_prefix.h>
#include <nnsys.h>

View File

@ -0,0 +1,21 @@
/*
precompiled header for NITRO C++ target
*/
/* include precompiled header for C++ source */
#ifdef SDK_DEBUG
#pragma precompile_target "Nitro_TS_Debug.mch++"
#elif SDK_RELEASE
#pragma precompile_target "Nitro_TS_Release.mch++"
#elif SDK_FINALROM
#pragma precompile_target "Nitro_TS_ROM.mch++"
#else
#error("no SDK_ define")
#endif
/* include header for NITRO */
#include <nitro_TS_prefix.h>
#include <nitro.h>
/* include header for NITRO-System */
#include <nnsys_prefix.h>
#include <nnsys.h>

View File

@ -0,0 +1,98 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - IDE - IDE_Archive
# File: ROM-TS.rsf
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
#
# Nitro ROM SPEC FILE
#
Arm9
{
Static "$(MAKEROM_ARM9:r).sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.sbin$(COMPSUFFIX9)"
Elf "$(MAKEROM_ARM9:r).nef"
}
Arm7
{
Static "$(MAKEROM_ARM7:r).sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7:r)_defs.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7:r)_table.sbin$(COMPSUFFIX7)"
Elf "$(MAKEROM_ARM7:r).nef"
}
Property
{
###
### Settings for FinalROM
###
#### BEGIN
#
# TITLE NAME: Your product name within 12bytes
#
#TitleName "YourAppName"
#
# MAKER CODE: Your company ID# in 2 ascii words
# issued by NINTENDO
#
#MakerCode "00"
#
# REMASTER VERSION: Mastering version
#
#RomVersion 0
#
# ROM SPEED TYPE: [MROM/1TROM/UNDEFINED]
#
RomSpeedType $(MAKEROM_ROMSPEED)
#
# ROM SIZE: in bit [64M/128M/256M/512M/1G/2G]
#
#RomSize 128M
#RomSize 256M
#
# ROM PADDING: TRUE if finalrom
#
#RomFootPadding TRUE
#
# ROM HEADER TEMPLATE: Provided to every product by NINTENDO
#
#RomHeaderTemplate ./etc/rom_header.template.sbin
#
# BANNER FILE: generated from Banner Spec File
#
#BannerFile ./etc/myGameBanner.bnr
BannerFile $(NITROSDK_ROOT)/include/nitro/specfiles/default.bnr
###
###
###
#### END
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot $(MAKEROM_ROMROOT)
Root /
File $(MAKEROM_ROMFILES)
}

View File

@ -0,0 +1,145 @@
===========================================================================
Stationery for Nitro SDK 3.0
Japanese description is available at the second half of this file.
===========================================================================
This stationery uses precompiled headers.
1. The files and settings relating to the use of the precompiled header.
- Nitro_TS.pch
This is the pch file to generate a mch file which is used by the C source.
The actual mch file name depends on the build target you chose.
"nitro_TS_prefix.h" and "nitro.h" are included in the precompiled header.
If you want to include other header files in the precompiled header, please
add the files to the bottom of this pch file.
- Nitro_TS.pch++
This is the pch file to generate a mch file which is used by the C++ source.
The actual mch file name depends on the build target you chose.
"nitro_TS_prefix.h" and "nitro.h" are included in the precompiled header.
If you want to include other header files in the precompiled header, please
add the files to the bottom of this pch file.
- Nitro_TS.h
This is the header file for each C and C++ source file to include
the proper precompiled header.
This header file is included from the Prefix Text field in the C/C++
Preprocessor panel thus making it automatically included in each
C/C++ source file.
- The settings in the C/C++ Preprocessor panel
The settings in the C/C++ Preprocessor panel ("Target Settings"
-> "Language Settings" -> "C/C++ Preprocessor") is the following.
1) "Nitro_TS.h" is included by the Prefix Text.
2) "nitro_TS_prefix.h" is not included by the Prefix Text.
3) "Use prefix text in precompiled header" is checked.
2. The behavior when building is as follows.
1) Nitro_TS.pch (or Nitro_TS.pch++) is precompiled.
The mch file with the proper file name is generated.
2) Each C source and each C++ source is compiled.
Nitro_TS.h is included by the Prefix Text in the C/C++
Preprocessor panel.
The proper mch file is included.
3. If you don't want to use precompiled headers, please follow the steps below.
1) Remove Nitro_TS.pch from Project.
2) Remove Nitro_TS.pch++ from Project.
3) Remove Nitro_TS.h from Project.
4) Change the contents of Prefix Text field on C/C++ Preprocessor panel.
- Remove the line " #include "Nitro_TS.h" ".
- Remove the comment out of the line "#include <nitro_TS_prefix.h>" to
make this #include effective.
4. You may be able to remove Nitro_TS.pch or Nitro_TS.pch++.
Both of Nitro_TS.pch and Nitro_TS.pch++ are used in both the stationery
for C and C++ Project because both C and C++ source may be used
in one Project.
- If the precompiled header for C++ is unnecessary in your C Project,
you can remove the Nitro_TS.pch++ from your Project.
- If the precompiled header for C is unnecessary in your C++ Project,
you can remove the Nitro_TS.pch from your Project.
/*--- The lines below are written in Japanese character set ---*/
===========================================================================
Nitro SDK 3.0 用ステーショナリ
プリコンパイルヘッダの使用について
===========================================================================
このステーショナリではプリコンパイルヘッダを使用しています。
1.プリコンパイルヘッダの使用に関連した設定、ファイル
・ Nitro_TS.pch
Cソースが使うmchファイルを生成する為のpchファイルです。
生成されるmchファイルのファイル名はビルドターゲットによって異なります。
プリコンパイルヘッダには nitro_TS_prefix.h と nitro.h を含めています。
ユーザーが用意したヘッダファイルも含める場合は、このファイルの末尾に
追記して下さい。
・ Nitro_TS.pch++
C++ソースが使うmchファイルを生成する為のpchファイルです。
生成されるmchファイルのファイル名はビルドターゲットによって異なります。
プリコンパイルヘッダには nitro_TS_prefix.h と nitro.h を含めています。
ユーザーが用意したヘッダファイルも含める場合は、このファイルの末尾に
追記して下さい。
・ Nitro_TS.h
各Cソース又はC++ソースが適切なプリコンパイルヘッダをインクルードする
為のヘッダファイルです。
各Cソース又はC++ソースのコンパイル時に必ずこのヘッダファイルが使用
されるように、ターゲット設定パネル 言語設定 C/C++ Preprocessor の
Prefix Text でインクルードされています。
・ C/C++ Preprocessor パネル内の設定
ターゲット設定パネル 言語設定 C/C++ Preprocessor において次の設定
がされています。
1) Nitro_TS.h を Prefix Text でインクルードする
2) nitro_TS_prefix.h は Prefix Text ではインクルードしない
3) Use prefix text in precompiled header チェックボックスがオン
2.ビルド時の動きは下記のようになります。
1) Nitro_TS.pch またはNitro_TS.pch++)がプリコンパイルされ、ビルド
ターゲットに応じた適切なファイル名のmchファイルが生成される。
2) 各Cソース又はC++ソースがコンパイルされる。
この時、C/C++ Preprocessorパネルの Prefix Textの指定により、Nitro_TS.h
が暗黙的にインクルードされ、適切なファイル名のmchファイルがインクルード
される。
3.プリコンパイルヘッダを使用しない構成に変更するには、下記の手順を行って
下さい。
1) プロジェクトから Nitro_TS.pch を削除する
2) プロジェクトから Nitro_TS.pch++ を削除する
3) プロジェクトから Nitro_TS.h を削除する
4) ターゲット設定パネル 言語設定 C/C++ Preprocessor の Prefix Text の
内容について、下記の変更を行う
・「#include "Nitro_TS.h"」の行を削除する。
・「#include <nitro_TS_prefix.h>」の行のコメントアウトを解除し、
このインクルードを有効にする。
4.不要な Nitro_TS.pch 又は Nitro_TS.pch++ について。
Cのプロジェクト用のステーショナリ及びC++プロジェクト用のステーショナリ
の両方において、Cソース及びC++ソースが混在可能とする為に、Nitro_TS.pch と
Nitro_TS.pch++ の両方が組み込まれています。
もし、CのプロジェクトでC++用のプリコンパイルヘッダが全く不要であるな
らば、プロジェクトから Nitro_TS.pch++ を削除して頂いてかまいません。
同様に、C++のプロジェクトでC用のプリコンパイルヘッダが全く不要である
ならば、プロジェクトから Nitro_TS.pch を削除して頂いてかまいません。

View File

@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_Archive
File: nns_util.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef NNS_UTIL_H_
#define NNS_UTIL_H_
// プリコンパイルヘッダを使用する。
// #include <nitro.h>
// #include <nnsys/fnd.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
u16 trigger;
u16 release;
u16 button;
}
GamePad;
extern GamePad gGamePad;
extern NNSFndHeapHandle gSysHeap; // システムヒープ
extern NNSFndHeapHandle gAppHeap; // アプリケーションヒープ
#define IS_TRIGGER(key) (gGamePad.trigger & key)
#define IS_RELEASE(key) (gGamePad.release & key)
#define IS_PRESS(key) (gGamePad.button & key)
#define ROUND_UP(value, alignment) \
(((u32)(value) + (alignment-1)) & ~(alignment-1))
#define ROUND_DOWN(value, alignment) \
((u32)(value) & ~(alignment-1))
void ReadGamePad(void);
void InitMemory(void);
NNSFndArchive* LoadArchive(const char* name, const char* path);
void RemoveArchive(NNSFndArchive* archive);
#ifdef __cplusplus
}/* extern "C" */
#endif
// NNS_UTIL_H_
#endif

View File

@ -0,0 +1,20 @@
/*****************************************************************************
Archive file index definition.
File: picture.naix
This file was created by NINTENDO NITRO-System Archiver.
Update:2004-05-26T17:45:19
*****************************************************************************/
#ifndef NARC_PICTURE_NAIX_
#define NARC_PICTURE_NAIX_
enum {
NARC_picture_dog256_chr = 0,
NARC_picture_dog256_pal = 1,
NARC_picture_dog256_scn = 2
};
/* NARC_PICTURE_NAIX_ */
#endif

View File

@ -0,0 +1,39 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_Archive
File: sdk_init.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef SDK_INIT_H_
#define SDK_INIT_H_
// プリコンパイルヘッダを使用する。
// #include <nitro.h>
#ifdef __cplusplus
extern "C" {
#endif
void VBlankIntr(void);
void InitSystem(void);
void InitVRAM(void);
void InitDisplay(void);
#ifdef __cplusplus
}/* extern "C" */
#endif
// SDK_INIT_H_
#endif

View File

@ -0,0 +1,92 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_Archive
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "sdk_init.h"
#include "nns_util.h"
// アーカイブのインデックス定義ファイル
#include "picture.naix"
static void LoadPicture(void);
/* -------------------------------------------------------------------------
Name: NitroMain
Description:
Arguments:
Returns:
------------------------------------------------------------------------- */
void
NitroMain(void)
{
InitSystem();
InitMemory();
InitVRAM();
InitDisplay();
LoadPicture();
G2_SetBG0Offset(0,20);
for(;;)
{
SVC_WaitVBlankIntr();
ReadGamePad();
}
}
/*---------------------------------------------------------------------------*
Name: LoadPicture
Description:
VRAMに転送します
VRAMに転送した後
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void
LoadPicture(void)
{
NNSFndArchive* archive;
// アーカイブをメインメモリに読み込み、ファイルシステムにマウントします。
// LoadArchive()内でDC_FlushRange()の呼び出しが行われています。
// LoadArchive()は、nns_util.c内にあります。
if ((archive = LoadArchive("PCT", "/data/picture.narc")) != NULL)
{
// パス名を指定してデータを取得。
void* chrData = NNS_FndGetArchiveFileByName("PCT:/picture/dog/dog256.chr");
void* scnData = NNS_FndGetArchiveFileByName("PCT:/picture/dog/dog256.scn");
// インデックスを指定してデータを取得。
void* palData = NNS_FndGetArchiveFileByIndex(archive, NARC_picture_dog256_pal);
// データをVRAMのロード。
GX_LoadBG0Char(chrData, 0, 0x10000);
GX_LoadBG0Scr (scnData, 0, 0x00800);
GX_LoadBGPltt (palData, 0, 0x00200);
// VRAMにデータをロードした後は、メインメモリ上のデータは不要な為、
// アーカイブを削除します。
// RemoveArchive()は、nns_util.c内にあります。
RemoveArchive(archive);
}
}

View File

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_Archive
File: nns_util.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "nns_util.h"
#define SYSTEM_HEAP_SIZE 64*1024
GamePad gGamePad; // ゲームパッド
NNSFndHeapHandle gSysHeap; // システムヒープ    (拡張ヒープを使用)
NNSFndHeapHandle gAppHeap; // アプリケーションヒープ(拡張ヒープを使用)
/*---------------------------------------------------------------------------*
Name: InitMemory
Description:
NITRO-Systemの拡張ヒープを使用しています
SYSTEM_HEAP_SIZE分をメインア
使
使使
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitMemory(void)
{
void* sysHeapMemory = OS_AllocFromMainArenaLo(SYSTEM_HEAP_SIZE, 16);
u32 arenaLow = ROUND_UP (OS_GetMainArenaLo(), 16);
u32 arenaHigh = ROUND_DOWN(OS_GetMainArenaHi(), 16);
u32 appHeapSize = arenaHigh - arenaLow;
void* appHeapMemory = OS_AllocFromMainArenaLo(appHeapSize, 16);
gSysHeap = NNS_FndCreateExpHeap(sysHeapMemory, SYSTEM_HEAP_SIZE);
gAppHeap = NNS_FndCreateExpHeap(appHeapMemory, appHeapSize );
}
/*---------------------------------------------------------------------------*
Name: LoadArchive
Description:
DC_FlushRange
NNSFndArchive
Arguments: name:
path:
Returns: NNSFndArchive
NULLを返します
*---------------------------------------------------------------------------*/
NNSFndArchive*
LoadArchive(const char* name, const char* path)
{
FSFile file;
NNSFndArchive* archive = NULL;
FS_InitFile(&file);
if (FS_OpenFile(&file, path))
{
u32 binarySize = FS_GetLength(&file);
u32 memorySize = ROUND_UP(sizeof(NNSFndArchive), 16) + ROUND_UP(binarySize, 16);
u8* memory = (u8*)NNS_FndAllocFromExpHeapEx(gAppHeap, memorySize, 16);
if (memory != NULL)
{
u8* binary = memory + ROUND_UP(sizeof(NNSFndArchive), 16);
if (FS_ReadFile(&file, binary, (s32)binarySize) == binarySize)
{
DC_FlushRange(binary, binarySize);
if (NNS_FndMountArchive((NNSFndArchive*)memory, name, binary))
{
archive = (NNSFndArchive*)memory;
}
else
{
NNS_FndFreeToExpHeap(gAppHeap, memory);
}
}
}
(void)FS_CloseFile(&file);
}
return archive;
}
/*---------------------------------------------------------------------------*
Name: RemoveArchive
Description:
Arguments: archive: NNSアーカイブ構造体へのポインタ
Returns:
*---------------------------------------------------------------------------*/
void
RemoveArchive(NNSFndArchive* archive)
{
(void)NNS_FndUnmountArchive(archive);
NNS_FndFreeToExpHeap(gAppHeap, archive);
}
/*---------------------------------------------------------------------------*
Name: ReadGamePad
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void ReadGamePad(void)
{
u16 status = PAD_Read();
gGamePad.trigger = (u16)(status & (status ^ gGamePad.button));
gGamePad.release = (u16)(gGamePad.button & (status ^ gGamePad.button));
gGamePad.button = status;
}

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_Archive
File: sdk_init.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "sdk_init.h"
#define DEFAULT_DMA_NUMBER MI_DMA_MAX_NUM
/* -------------------------------------------------------------------------
V-blank callback
------------------------------------------------------------------------- */
void
VBlankIntr(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK);
}
/*---------------------------------------------------------------------------*
Name: InitSystem
Description: NITROの初期化を行います
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitSystem(void)
{
OS_Init();
FX_Init();
GX_SetPower(GX_POWER_ALL);
GX_Init();
GX_DispOff();
GXS_DispOff();
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)OS_EnableIrqMask(OS_IE_FIFO_RECV);
(void)OS_EnableIrq();
FS_Init(DEFAULT_DMA_NUMBER);
(void)GX_VBlankIntr(TRUE); // to generate VBlank interrupt request
}
/*---------------------------------------------------------------------------*
Name: InitVRAM
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitVRAM(void)
{
// 全てのバンクをLCDCに割り当てる
GX_SetBankForLCDC(GX_VRAM_LCDC_ALL);
// LCDC空間全てをクリア
MI_CpuClearFast( (void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE );
// LCDCに割り当てられたバンクをDisable
(void)GX_DisableBankForLCDC();
MI_CpuFillFast ((void*)HW_OAM , 192, HW_OAM_SIZE ); // OAM クリア
MI_CpuFillFast ((void*)HW_DB_OAM , 192, HW_DB_OAM_SIZE); // clear OAM
MI_CpuClearFast((void*)HW_PLTT , HW_PLTT_SIZE ); // パレット クリア
MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); // clear the standard palette
}
/*---------------------------------------------------------------------------*
Name: InitDisplay
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitDisplay(void)
{
GX_SetBankForBG (GX_VRAM_BG_128_A ); // バンクAをBGに割り当てる
GX_SetBGCharOffset(GX_BGCHAROFFSET_0x00000);
GX_SetBGScrOffset ( GX_BGSCROFFSET_0x10000);
GX_SetGraphicsMode(
GX_DISPMODE_GRAPHICS, // グラフィックス表示モードにする
GX_BGMODE_0, // BGMODEを0に設定
GX_BG0_AS_2D); // BG0を2D表示に設定
GX_SetVisiblePlane(
GX_PLANEMASK_BG0 // BG0を表示。
);
G2_SetBG0Control(
GX_BG_SCRSIZE_TEXT_256x256, // 256×256ドット
GX_BG_COLORMODE_256, // 256色モード。
GX_BG_SCRBASE_0x0000, // スクリーンベース。
GX_BG_CHARBASE_0x00000, // キャラクタベース。
GX_BG_EXTPLTT_01 // BGExtPlttスロット。
);
GX_DispOn();
}

View File

@ -0,0 +1,145 @@
===========================================================================
Stationery for Nitro SDK 3.0
Japanese description is available at the second half of this file.
===========================================================================
This stationery uses precompiled headers.
1. The files and settings relating to the use of the precompiled header.
- Nitro_TS.pch
This is the pch file to generate a mch file which is used by the C source.
The actual mch file name depends on the build target you chose.
"nitro_TS_prefix.h" and "nitro.h" are included in the precompiled header.
If you want to include other header files in the precompiled header, please
add the files to the bottom of this pch file.
- Nitro_TS.pch++
This is the pch file to generate a mch file which is used by the C++ source.
The actual mch file name depends on the build target you chose.
"nitro_TS_prefix.h" and "nitro.h" are included in the precompiled header.
If you want to include other header files in the precompiled header, please
add the files to the bottom of this pch file.
- Nitro_TS.h
This is the header file for each C and C++ source file to include
the proper precompiled header.
This header file is included from the Prefix Text field in the C/C++
Preprocessor panel thus making it automatically included in each
C/C++ source file.
- The settings in the C/C++ Preprocessor panel
The settings in the C/C++ Preprocessor panel ("Target Settings"
-> "Language Settings" -> "C/C++ Preprocessor") is the following.
1) "Nitro_TS.h" is included by the Prefix Text.
2) "nitro_TS_prefix.h" is not included by the Prefix Text.
3) "Use prefix text in precompiled header" is checked.
2. The behavior when building is as follows.
1) Nitro_TS.pch (or Nitro_TS.pch++) is precompiled.
The mch file with the proper file name is generated.
2) Each C source and each C++ source is compiled.
Nitro_TS.h is included by the Prefix Text in the C/C++
Preprocessor panel.
The proper mch file is included.
3. If you don't want to use precompiled headers, please follow the steps below.
1) Remove Nitro_TS.pch from Project.
2) Remove Nitro_TS.pch++ from Project.
3) Remove Nitro_TS.h from Project.
4) Change the contents of Prefix Text field on C/C++ Preprocessor panel.
- Remove the line " #include "Nitro_TS.h" ".
- Remove the comment out of the line "#include <nitro_TS_prefix.h>" to
make this #include effective.
4. You may be able to remove Nitro_TS.pch or Nitro_TS.pch++.
Both of Nitro_TS.pch and Nitro_TS.pch++ are used in both the stationery
for C and C++ Project because both C and C++ source may be used
in one Project.
- If the precompiled header for C++ is unnecessary in your C Project,
you can remove the Nitro_TS.pch++ from your Project.
- If the precompiled header for C is unnecessary in your C++ Project,
you can remove the Nitro_TS.pch from your Project.
/*--- The lines below are written in Japanese character set ---*/
===========================================================================
Nitro SDK 3.0 用ステーショナリ
プリコンパイルヘッダの使用について
===========================================================================
このステーショナリではプリコンパイルヘッダを使用しています。
1.プリコンパイルヘッダの使用に関連した設定、ファイル
・ Nitro_TS.pch
Cソースが使うmchファイルを生成する為のpchファイルです。
生成されるmchファイルのファイル名はビルドターゲットによって異なります。
プリコンパイルヘッダには nitro_TS_prefix.h と nitro.h を含めています。
ユーザーが用意したヘッダファイルも含める場合は、このファイルの末尾に
追記して下さい。
・ Nitro_TS.pch++
C++ソースが使うmchファイルを生成する為のpchファイルです。
生成されるmchファイルのファイル名はビルドターゲットによって異なります。
プリコンパイルヘッダには nitro_TS_prefix.h と nitro.h を含めています。
ユーザーが用意したヘッダファイルも含める場合は、このファイルの末尾に
追記して下さい。
・ Nitro_TS.h
各Cソース又はC++ソースが適切なプリコンパイルヘッダをインクルードする
為のヘッダファイルです。
各Cソース又はC++ソースのコンパイル時に必ずこのヘッダファイルが使用
されるように、ターゲット設定パネル 言語設定 C/C++ Preprocessor の
Prefix Text でインクルードされています。
・ C/C++ Preprocessor パネル内の設定
ターゲット設定パネル 言語設定 C/C++ Preprocessor において次の設定
がされています。
1) Nitro_TS.h を Prefix Text でインクルードする
2) nitro_TS_prefix.h は Prefix Text ではインクルードしない
3) Use prefix text in precompiled header チェックボックスがオン
2.ビルド時の動きは下記のようになります。
1) Nitro_TS.pch またはNitro_TS.pch++)がプリコンパイルされ、ビルド
ターゲットに応じた適切なファイル名のmchファイルが生成される。
2) 各Cソース又はC++ソースがコンパイルされる。
この時、C/C++ Preprocessorパネルの Prefix Textの指定により、Nitro_TS.h
が暗黙的にインクルードされ、適切なファイル名のmchファイルがインクルード
される。
3.プリコンパイルヘッダを使用しない構成に変更するには、下記の手順を行って
下さい。
1) プロジェクトから Nitro_TS.pch を削除する
2) プロジェクトから Nitro_TS.pch++ を削除する
3) プロジェクトから Nitro_TS.h を削除する
4) ターゲット設定パネル 言語設定 C/C++ Preprocessor の Prefix Text の
内容について、下記の変更を行う
・「#include "Nitro_TS.h"」の行を削除する。
・「#include <nitro_TS_prefix.h>」の行のコメントアウトを解除し、
このインクルードを有効にする。
4.不要な Nitro_TS.pch 又は Nitro_TS.pch++ について。
Cのプロジェクト用のステーショナリ及びC++プロジェクト用のステーショナリ
の両方において、Cソース及びC++ソースが混在可能とする為に、Nitro_TS.pch と
Nitro_TS.pch++ の両方が組み込まれています。
もし、CのプロジェクトでC++用のプリコンパイルヘッダが全く不要であるな
らば、プロジェクトから Nitro_TS.pch++ を削除して頂いてかまいません。
同様に、C++のプロジェクトでC用のプリコンパイルヘッダが全く不要である
ならば、プロジェクトから Nitro_TS.pch を削除して頂いてかまいません。

View File

@ -0,0 +1 @@
NITRO-System/build/demos/IDE/IDE_G2dDemoLib/bin/ARM9-TS/Debug

View File

@ -0,0 +1 @@
NITRO-System/build/demos/IDE/IDE_G2dDemoLib/bin/ARM9-TS/Release

View File

@ -0,0 +1 @@
NITRO-System/build/demos/IDE/IDE_G2dDemoLib/bin/ARM9-TS/Rom

View File

@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_G2dDemoLib
File: g2d_demolib.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef G2D_DEMOLIB_H_
#define G2D_DEMOLIB_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <nitro.h>
#include <nnsys/fnd.h>
#include <nnsys/g2d.h>
#include "g2d_demolib/system.h"
#include "g2d_demolib/loader.h"
#include "g2d_demolib/print.h"
#ifdef __cplusplus
}/* extern "C" */
#endif
// G2D_DEMOLIB_H_
#endif

View File

@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_G2dDemoLib - include - g2d_demolib
File: fontData.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef G2D_DEMOLIB_FONTDATA_H_
#define G2D_DEMOLIB_FONTDATA_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <nitro.h>
extern const u32 fontCharData[16 * 256];
extern const u16 fontPlttData[16][256];
#ifdef __cplusplus
}/* extern "C" */
#endif
// G2D_DEMOLIB_FONTDATA_H_
#endif

View File

@ -0,0 +1,41 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_G2dDemoLib - include - g2d_demolib
File: loader.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef G2D_DEMOLIB_LOADER_H_
#define G2D_DEMOLIB_LOADER_H_
#ifdef __cplusplus
extern "C" {
#endif
void* G2DDemo_LoadNCER( NNSG2dCellDataBank** ppCellBank, const char* pFname );
void* G2DDemo_LoadNANR( NNSG2dAnimBankData** ppAnimBank, const char* pFname );
void* G2DDemo_LoadNMCR( NNSG2dMultiCellDataBank** ppMCBank, const char* pFname );
void* G2DDemo_LoadNMAR( NNSG2dMultiCellAnimBankData** ppMCABank, const char* pFname );
void* G2DDemo_LoadNCGR( NNSG2dCharacterData** ppCharData, const char* pFname );
void* G2DDemo_LoadNCLR( NNSG2dPaletteData** ppPltData, const char* pFname );
void* G2DDemo_LoadNENR( NNSG2dEntityDataBank** ppEntityBank, const char* pFname );
void* G2DDemo_LoadNCBR( NNSG2dCharacterData** ppCharData, const char* pFname );
void* G2DDemo_LoadNSCR( NNSG2dScreenData** ppScreenData, const char* pFname );
void* G2DDemo_LoadNCGREx( NNSG2dCharacterData** ppCharData, NNSG2dCharacterPosInfo** ppCharPosInfo, const char* pFname );
#ifdef __cplusplus
}/* extern "C" */
#endif
// G2D_DEMOLIB_LOADER_H_
#endif

View File

@ -0,0 +1,36 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_G2dDemoLib - include - g2d_demolib
File: print.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef G2D_DEMOLIB_PRINT_H_
#define G2D_DEMOLIB_PRINT_H_
#ifdef __cplusplus
extern "C" {
#endif
void G2DDemo_PrintInit(void);
void G2DDemo_PrintClear(void);
void G2DDemo_PrintOut(int x, int y, const char* string);
void G2DDemo_PrintOutf(int x, int y, const char* format, ...);
void G2DDemo_PrintApplyToHW(void);
#ifdef __cplusplus
}/* extern "C" */
#endif
// G2D_DEMOLIB_PRINT_H_
#endif

View File

@ -0,0 +1,111 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_G2dDemoLib - include - g2d_demolib
File: system.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef G2D_DEMO_SYSTEM_H_
#define G2D_DEMO_SYSTEM_H_
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
void G2DDemo_CommonInit(void);
void G2DDemo_CameraSetup(void);
void G2DDemo_MaterialSetup(void);
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
// ゲームパッド構造体
typedef struct
{
u16 trigger;
u16 release;
u16 button;
}
G2DDemoGamePad;
// ゲームパッドワーク。
extern G2DDemoGamePad gGamePad;
#define G2DDEMO_IS_TRIGGER(key) (gGamePad.trigger & key)
#define G2DDEMO_IS_RELEASE(key) (gGamePad.release & key)
#define G2DDEMO_IS_PRESS(key) (gGamePad.button & key)
void G2DDemo_ReadGamePad(void);
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
extern NNSFndHeapHandle gHeapHandle; // ヒープハンドル
NNSG2dCellAnimation* G2DDemo_GetNewCellAnimation( u16 num );
NNSG2dNode* G2DDemo_GetNewNode( u16 num );
/*
NNSG2dMultiCellAnimation* G2DDemo_GetNewMultiCellAnimation
(
u16 numNode,
const NNSG2dCellAnimBankData* pAnimBank,
const NNSG2dCellDataBank* pCellDataBank ,
const NNSG2dMultiCellDataBank* pMultiCellDataBank
);
*/
NNSG2dMultiCellAnimation* G2DDemo_GetNewMultiCellAnimation
(
const NNSG2dCellAnimBankData* pAnimBank,
const NNSG2dCellDataBank* pCellDataBank ,
const NNSG2dMultiCellDataBank* pMultiCellDataBank,
NNSG2dMCType mcType
);
static inline void G2DDemo_MTX_Rot22( MtxFx22* m, fx32 sinVal, fx32 cosVal )
{
SDK_NULL_ASSERT( m );
m->_00 = cosVal;
m->_01 = sinVal;
m->_10 = -sinVal;
m->_11 = cosVal;
}
inline void* G2DDemo_Alloc(u32 size)
{
SDK_ASSERT( size > 0 );
return NNS_FndAllocFromExpHeap(gHeapHandle, size);
}
inline void G2DDemo_Free(void* memBlock)
{
SDK_ASSERT( NNS_FndFindContainHeap(memBlock) == gHeapHandle );
NNS_FndFreeToExpHeap(gHeapHandle, memBlock);
}
extern void VBlankIntr( void );
#ifdef __cplusplus
}/* extern "C" */
#endif
// G2D_DEMO_SYSTEM_H_
#endif

View File

@ -0,0 +1,548 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_G2dDemoLib
File: fontData.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "g2d_demolib/fontData.h"
/*---------------------- パレットデータ ---------------------------*/
#define RGB555(r,g,b) (b<<10|g<<5|r)
const u16 fontPlttData[16][256] = {
{RGB555(0,0,0), RGB555(0, 0, 0 ), RGB555(0, 0, 0 ), RGB555(0, 0, 0 ),}, // Black
{RGB555(0,0,0), RGB555(31,0, 0 ), RGB555(31,0, 0 ), RGB555(31,0, 0 ),}, // Red
{RGB555(0,0,0), RGB555(0, 31,0 ), RGB555(0, 31,0 ), RGB555(0, 31,0 ),}, // Green
{RGB555(0,0,0), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue
{RGB555(0,0,0), RGB555(31,31,0 ), RGB555(31,31,0 ), RGB555(31,31,0 ),}, // Yellow
{RGB555(0,0,0), RGB555(0, 31,31), RGB555(0, 31,31), RGB555(0, 31,31),}, // Cyan
{RGB555(0,0,0), RGB555(31,0, 31), RGB555(31,0, 31), RGB555(31,0, 31),}, // Purple
{RGB555(0,0,0), RGB555(31,31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White
};
/*---------------------- キャラクタデータ -------------------------*/
const u32 fontCharData[16 * 256] = {
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000100,0x00010001,0x00000100,0x00010001,0x00010100,0x00000000,
0x01000100,0x00000001,0x00000100,0x00010100,0x00000100,0x00000000,0x00000100,0x00000000,
0x00000000,0x00000000,0x01000100,0x00010001,0x00000100,0x00010001,0x00000100,0x00000001,
0x00000100,0x00000100,0x00000100,0x00000100,0x00000001,0x00000100,0x00000001,0x00000100,
0x00000000,0x00000000,0x00000001,0x00010001,0x00000001,0x00010001,0x01010101,0x00010101,
0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x01010100,0x00010101,
0x00000000,0x00000000,0x00000000,0x00010001,0x01010101,0x00010101,0x00000000,0x00000100,
0x00000000,0x00000100,0x00000000,0x00000001,0x01000000,0x00000000,0x00010100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010001,0x00010000,0x00010001,0x01000100,0x00000000,
0x00000001,0x00000001,0x00000001,0x00000100,0x00000000,0x00010000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01000000,0x00010001,0x01000000,0x00010001,0x01010101,0x00010101,
0x01000000,0x00000000,0x01000100,0x00000100,0x01000100,0x00010000,0x01000001,0x00010000,
0x00000000,0x00000000,0x00000100,0x00010001,0x01010101,0x00010100,0x00000100,0x00010001,
0x00000100,0x00000001,0x00000100,0x00000001,0x00000100,0x00000001,0x01000001,0x00000000,
0x00000000,0x00000000,0x00000100,0x00010001,0x01010101,0x00010001,0x00010000,0x00000000,
0x01010101,0x00000001,0x01000000,0x00000000,0x00000001,0x00000000,0x01010100,0x00000001,
0x00000000,0x00000000,0x00000000,0x00010001,0x01000000,0x00010001,0x00010100,0x00000000,
0x00000001,0x00000000,0x00010100,0x00000000,0x01000000,0x00000001,0x00000000,0x00000100,
0x00000000,0x00000000,0x00000000,0x00010001,0x01010001,0x00010101,0x00000001,0x00000001,
0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x00000001,0x01000100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010001,0x01010100,0x00010001,0x00000000,0x00000100,
0x00000000,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x01010100,0x00000101,
0x00000000,0x00000000,0x00010000,0x00010001,0x01010101,0x00010001,0x01000000,0x00000000,
0x00000000,0x00000001,0x00000001,0x00000000,0x00000001,0x00000000,0x01010100,0x00000001,
0x00000000,0x00000000,0x00000001,0x00010001,0x00000001,0x00010001,0x00000001,0x00000000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000100,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00000000,0x00010001,0x01010101,0x00010101,0x01000000,0x00000001,
0x00010000,0x00000001,0x00010000,0x00000001,0x01000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000100,0x00010001,0x01010101,0x00010101,0x00000100,0x00000001,
0x00000100,0x00000001,0x00000100,0x00000000,0x00000100,0x00000000,0x01010000,0x00000101,
0x00000000,0x00000000,0x01010100,0x00000000,0x00010000,0x00010001,0x00000100,0x00010001,
0x01010101,0x00000101,0x00010000,0x00000000,0x00010000,0x00000000,0x01000000,0x00000001,
0x00000000,0x00000000,0x00010000,0x00010001,0x01010101,0x00010001,0x00010000,0x00000000,
0x00010000,0x00010101,0x00000100,0x00000000,0x01000100,0x00000000,0x00000100,0x00010101,
0x00000000,0x00000000,0x00010000,0x00010001,0x01010101,0x00010001,0x00000100,0x00000000,
0x01010100,0x00000001,0x00000001,0x00000100,0x00000000,0x00000100,0x01010100,0x00000001,
0x00000000,0x00000000,0x00000000,0x00010001,0x01010000,0x00010001,0x00000101,0x00000100,
0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00000000,0x00010001,0x01010101,0x00010101,0x00000000,0x00000001,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x00000000,0x00000101,
0x00000000,0x00000000,0x00000100,0x00010001,0x00000100,0x00010001,0x01010000,0x00000000,
0x00000100,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x01010100,0x00000101,
0x00000000,0x00000000,0x00000001,0x00010001,0x01010001,0x00010101,0x00000001,0x00000001,
0x00000001,0x00000001,0x01000001,0x00000101,0x00010001,0x00010001,0x01000001,0x00000001,
0x00000000,0x00000000,0x00010000,0x00010001,0x00000101,0x00010001,0x00000100,0x00010101,
0x00000001,0x00000001,0x00000001,0x00000001,0x01000100,0x00000000,0x00010000,0x00000000,
0x00000000,0x00000000,0x01010100,0x00010001,0x01000000,0x00010001,0x00010000,0x00000000,
0x01000001,0x00000100,0x00000001,0x00010001,0x00000001,0x00010001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010001,0x01010000,0x00010001,0x00000100,0x00000001,
0x00000100,0x00000001,0x00000001,0x00000100,0x00000000,0x00010000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01010001,0x00010001,0x00000001,0x00010001,0x01010001,0x00000101,
0x00000001,0x00000001,0x01000001,0x00000001,0x00010001,0x00000101,0x01000001,0x00000000,
0x00000000,0x00000000,0x00000001,0x00010101,0x01010001,0x00010001,0x00000001,0x00000101,
0x00000001,0x00000001,0x01000001,0x00000101,0x00010001,0x00010001,0x01000001,0x00000001,
0x00000000,0x00000000,0x00010000,0x00010101,0x00000101,0x00010001,0x00000100,0x00000101,
0x00000001,0x00000001,0x00000001,0x00000001,0x01000100,0x00000000,0x00010000,0x00000000,
0x00000000,0x00000000,0x01010100,0x00010100,0x01000000,0x00010001,0x00010000,0x00000100,
0x01000001,0x00000100,0x00000001,0x00010001,0x00000001,0x00010001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010101,0x01010000,0x00010001,0x00000100,0x00000101,
0x00000100,0x00000001,0x00000001,0x00000100,0x00000000,0x00010000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01010001,0x00010101,0x00000001,0x00010001,0x01010001,0x00000101,
0x00000001,0x00000001,0x01000001,0x00000001,0x00010001,0x00000101,0x01000001,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x01000000,0x00000000,0x01000000,0x00000000,0x00000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x01010000,0x00010100,0x01000000,0x00010000,0x00010000,0x00000100,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00010000,0x00000100,0x01010101,0x00010101,0x00010000,0x00000100,
0x00010000,0x00000100,0x01010101,0x00010101,0x00000100,0x00000001,0x00000100,0x00000001,
0x00000000,0x00000000,0x01000000,0x00000000,0x01010100,0x00010101,0x01000001,0x00000000,
0x01010100,0x00000101,0x01000000,0x00010000,0x01010101,0x00000101,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000100,0x00010000,0x00010001,0x00000100,0x00000100,0x00000001,
0x01000000,0x00000000,0x00010000,0x00000100,0x00000100,0x00010001,0x00000001,0x00000100,
0x00000000,0x00000000,0x01010100,0x00000000,0x00000001,0x00000001,0x01000001,0x00000000,
0x00010100,0x00010000,0x01000001,0x00000100,0x00000001,0x00000101,0x01010100,0x00010000,
0x00000000,0x00000000,0x01000000,0x00000001,0x00000000,0x00000001,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010101,0x01000000,0x00000000,0x00010000,0x00000000,
0x00010000,0x00000000,0x00010000,0x00000000,0x01000000,0x00000000,0x00000000,0x00010101,
0x00000000,0x00000000,0x00010101,0x00000000,0x01000000,0x00000000,0x00000000,0x00000001,
0x00000000,0x00000001,0x00000000,0x00000001,0x01000000,0x00000000,0x00010101,0x00000000,
0x00000000,0x00000000,0x01000000,0x00000000,0x01000001,0x00010000,0x01000100,0x00000100,
0x01010000,0x00000001,0x01000100,0x00000100,0x01000001,0x00010000,0x01000000,0x00000000,
0x00000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x01010101,0x00010101,0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01010000,0x00000000,0x01000000,0x00000000,0x00010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x01010101,0x00010101,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010000,0x00000000,0x00000100,0x00000000,0x00000001,
0x01000000,0x00000000,0x00010000,0x00000000,0x00000100,0x00000000,0x00000001,0x00000000,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x01010000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,
0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000001,0x00010000,0x00000000,0x00010000,
0x01010100,0x00000101,0x00000001,0x00000000,0x00000001,0x00000000,0x01010101,0x00010101,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000001,0x00010000,0x00000000,0x00010000,
0x01010100,0x00000101,0x00000000,0x00010000,0x00000001,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x00000000,0x00000100,0x00000000,0x00000101,0x01000000,0x00000100,
0x00010000,0x00000100,0x00000100,0x00000100,0x01010101,0x00010101,0x00000000,0x00000100,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000001,0x00000000,0x01010101,0x00000101,
0x00000000,0x00010000,0x00000000,0x00010000,0x00000001,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000001,0x00000000,0x01010101,0x00000101,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00000100,0x00000000,0x00000100,
0x00000000,0x00000001,0x00000000,0x00000001,0x01000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,
0x01010100,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000001,0x00010000,0x01010100,0x00010101,0x00000000,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01010000,0x00000000,0x01000000,0x00000000,0x00010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010100,0x01000000,0x00000001,0x00010100,0x00000000,
0x00000001,0x00000000,0x00010100,0x00000000,0x01000000,0x00000001,0x00000000,0x00010100,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000101,0x00000000,0x01010000,0x00000000,0x00000000,0x00000101,
0x00000000,0x00010000,0x00000000,0x00000101,0x01010000,0x00000000,0x00000101,0x00000000,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000000,0x00000101,0x01000000,0x00000000,0x00000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x01010000,0x00000001,0x00000100,0x00000100,0x01000001,0x00010000,
0x00010001,0x00010001,0x00010001,0x00010001,0x00010001,0x00010001,0x01000100,0x00000101,
0x00000000,0x00000000,0x01000000,0x00000000,0x00010000,0x00000001,0x00010000,0x00000001,
0x00000100,0x00000100,0x01010100,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000000,0x00000000,0x01010101,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,
0x01010101,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,0x01010101,0x00000101,
0x00000000,0x00000000,0x01010000,0x00000101,0x00000100,0x00010000,0x00000001,0x00000000,
0x00000001,0x00000000,0x00000001,0x00000000,0x00000100,0x00010000,0x01010000,0x00000101,
0x00000000,0x00000000,0x01010101,0x00000001,0x00000001,0x00000100,0x00000001,0x00010000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00000100,0x01010101,0x00000001,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000001,0x00000000,0x00000001,0x00000000,
0x01010101,0x00010101,0x00000001,0x00000000,0x00000001,0x00000000,0x01010101,0x00010101,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000001,0x00000000,0x00000001,0x00000000,
0x01010101,0x00000101,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,
0x00000000,0x00000000,0x01010000,0x00000101,0x00000100,0x00010000,0x00000001,0x00000000,
0x01000001,0x00010101,0x00000001,0x00010000,0x00000100,0x00010000,0x01010000,0x00000101,
0x00000000,0x00000000,0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,
0x01010101,0x00010101,0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000000,0x00000000,0x01010100,0x00000101,0x01000000,0x00000000,0x01000000,0x00000000,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01010100,0x00000101,
0x00000000,0x00000000,0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x00010000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000100,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00000001,0x00010100,0x01000001,0x00000001,0x00010001,0x00000000,
0x00000101,0x00000000,0x00010001,0x00000000,0x01000001,0x00000001,0x00000001,0x00010100,
0x00000000,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,
0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x01010101,0x00010101,
0x00000000,0x00000000,0x00000001,0x00010000,0x00000101,0x00010100,0x00010001,0x00010001,
0x01000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000000,0x00000000,0x00000001,0x00010000,0x00000101,0x00010000,0x00010001,0x00010000,
0x01000001,0x00010000,0x00000001,0x00010001,0x00000001,0x00010100,0x00000001,0x00010000,
0x00000000,0x00000000,0x01010000,0x00000001,0x00000100,0x00000100,0x00000001,0x00010000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000100,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x01010101,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,
0x01010101,0x00000101,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,
0x00000000,0x00000000,0x01010000,0x00000001,0x00000100,0x00000100,0x00000001,0x00010000,
0x00000001,0x00010000,0x01000001,0x00010001,0x00000100,0x00000100,0x01010000,0x00010001,
0x00000000,0x00000000,0x01010101,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,
0x01010101,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000001,0x00010000,0x00000001,0x00000000,
0x01010100,0x00000101,0x00000000,0x00010000,0x00000001,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x01010101,0x00010101,0x01000000,0x00000000,0x01000000,0x00000000,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000100,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00000001,0x00010000,0x00000001,0x00010000,0x00000100,0x00000100,
0x00000100,0x00000100,0x00010000,0x00000001,0x00010000,0x00000001,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,
0x01000001,0x00010000,0x00010001,0x00010001,0x00000101,0x00010100,0x00000001,0x00010000,
0x00000000,0x00000000,0x00000001,0x00010000,0x00000100,0x00000100,0x00010000,0x00000001,
0x01000000,0x00000000,0x00010000,0x00000001,0x00000100,0x00000100,0x00000001,0x00010000,
0x00000000,0x00000000,0x00000001,0x00010000,0x00000100,0x00000100,0x00010000,0x00000001,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00000100,0x00000000,0x00000001,
0x01000000,0x00000000,0x00010000,0x00000000,0x00000100,0x00000000,0x01010101,0x00010101,
0x00000000,0x00000000,0x01010000,0x00010101,0x00010000,0x00000000,0x00010000,0x00000000,
0x00010000,0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x01010000,0x00010101,
0x00000000,0x00000000,0x00000100,0x00000100,0x00010000,0x00000001,0x01010100,0x00000101,
0x01000000,0x00000000,0x01010100,0x00000101,0x01000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x01010101,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,
0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x01010101,0x00000001,
0x00000000,0x00000000,0x01000000,0x00000000,0x00010000,0x00000001,0x00000100,0x00000100,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x01010101,0x00010101,
0x00000000,0x00000000,0x00000000,0x00000001,0x01000000,0x00000000,0x01000000,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00000001,0x00000001,0x00000100,
0x01010100,0x00000101,0x00000001,0x00000100,0x00000001,0x00000100,0x01010100,0x00010001,
0x00000000,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x01010101,0x00000101,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,0x01010101,0x00000101,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000101,0x00000100,0x00010000,
0x00000001,0x00000000,0x00000001,0x00000000,0x00000100,0x00010000,0x01010000,0x00000101,
0x00000000,0x00000000,0x00000000,0x00010000,0x00000000,0x00010000,0x01010100,0x00010101,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,0x01010100,0x00010101,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00000101,0x00000001,0x00010000,
0x01010101,0x00010101,0x00000001,0x00000000,0x00000001,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x00000000,0x00000101,0x01000000,0x00000000,0x01000000,0x00000000,
0x01010101,0x00010101,0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00010101,0x00000001,0x00010000,
0x00000001,0x00010000,0x01010100,0x00010101,0x00000000,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,
0x01010101,0x00000101,0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000000,0x00000000,0x01000000,0x00000000,0x00000000,0x00000000,0x01000000,0x00000000,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000100,0x00000000,0x00000000,0x00000000,0x00000100,
0x00000000,0x00000100,0x00000001,0x00000100,0x00000001,0x00000100,0x01010100,0x00000001,
0x00000000,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00010100,
0x01000001,0x00000001,0x00010101,0x00000000,0x01000001,0x00000001,0x00000001,0x00010100,
0x00000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00010101,0x00000101,0x01000001,0x00010000,
0x01000001,0x00010000,0x01000001,0x00010000,0x01000001,0x00010000,0x01000001,0x00010000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010101,0x00000101,0x00000001,0x00010000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000001,0x00000100,0x00000100,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000100,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010001,0x00000101,0x00000101,0x00010000,
0x00000001,0x00010000,0x00000101,0x00010000,0x01010001,0x00000101,0x00000001,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00010001,0x00000001,0x00010100,
0x00000001,0x00010000,0x00000001,0x00010100,0x01010100,0x00010001,0x00000000,0x00010000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000001,0x00000101,0x01010001,0x00000000,
0x00000101,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00000101,0x00000001,0x00010000,
0x01010100,0x00000000,0x00000000,0x00000101,0x00000001,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x01010101,0x00010101,
0x00010000,0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x01000000,0x00010101,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,0x01010100,0x00010101,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000100,0x00000100,0x00000100,0x00000100,0x00010000,0x00000001,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000001,0x00010000,0x00000001,0x00010000,
0x01000001,0x00010000,0x01000100,0x00000100,0x01000100,0x00000100,0x00010000,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000001,0x00000100,0x00000100,0x00000001,
0x01010000,0x00000000,0x01010000,0x00000000,0x00000100,0x00000001,0x00000001,0x00000100,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000100,0x00000100,0x01010000,0x00000001,0x01000000,0x00000000,0x00010100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010101,0x00000101,0x00000000,0x00000001,
0x01000000,0x00000000,0x00010000,0x00000000,0x00000100,0x00000000,0x01010101,0x00000101,
0x00000000,0x00000000,0x01000000,0x00000000,0x01010100,0x00000001,0x00010000,0x00010100,
0x01000000,0x00000001,0x00010000,0x00000100,0x00010000,0x00000000,0x01000000,0x00010101,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00000001,0x00010000,0x00000000,
0x01010100,0x00000001,0x00010001,0x00000101,0x01010001,0x00000100,0x00000100,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000001,0x00000001,
0x00000001,0x00000100,0x00000001,0x00000100,0x00000001,0x00000000,0x00000100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000001,0x00000000,0x00000000,
0x01010100,0x00000001,0x00000000,0x00000100,0x00000000,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000001,0x00000000,0x00000000,
0x01010100,0x00000101,0x00000000,0x00000001,0x01010000,0x00000000,0x00000100,0x00000101,
0x00000000,0x00000000,0x00000000,0x00000000,0x00010000,0x00000000,0x01010101,0x00000100,
0x00010000,0x00010000,0x01010100,0x00000001,0x00010001,0x00000100,0x00010100,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000000,0x01000100,0x00000000,0x01010100,0x00000001,
0x01000101,0x00000100,0x00000100,0x00000100,0x00010000,0x00000001,0x00010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01000000,0x00000000,0x01010001,0x00000001,
0x01000101,0x00000100,0x01000001,0x00000100,0x01000001,0x00000001,0x00010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000101,
0x01000000,0x00000000,0x01010100,0x00000001,0x01000001,0x00000100,0x00010100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000001,
0x00000101,0x00000100,0x00000000,0x00000100,0x00000000,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00010100,0x00000000,0x01000001,0x00010000,0x00000000,0x00000101,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00010000,0x00000000,0x01010101,0x00000101,0x00010000,0x00000000,
0x01010100,0x00000101,0x00010001,0x00010001,0x01010001,0x00010000,0x00010100,0x00000100,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000001,0x00000100,0x00000001,0x00010000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00000000,0x00000100,0x00000000,
0x00000000,0x00000000,0x01010000,0x00000101,0x00000000,0x00000000,0x01010100,0x00000101,
0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x01010000,0x00000001,0x00000000,0x00000000,0x01010100,0x00000101,
0x00000000,0x00000001,0x01000000,0x00000000,0x00010000,0x00000001,0x00000100,0x00010100,
0x00000000,0x00000000,0x00010000,0x00000100,0x01010101,0x00010001,0x00010000,0x00000000,
0x01010100,0x00000101,0x00010001,0x00010000,0x00010001,0x00010000,0x00000100,0x00000100,
0x00000000,0x00000000,0x00000100,0x00000100,0x01010101,0x00010000,0x00000100,0x00010001,
0x00000100,0x00010001,0x00000100,0x00000001,0x00000100,0x00000001,0x01000001,0x00000000,
0x00000000,0x00000000,0x00010000,0x00000000,0x01010100,0x00000101,0x01000000,0x00000000,
0x01010100,0x00000101,0x00000000,0x00000001,0x00000100,0x00000000,0x01010000,0x00000101,
0x00000000,0x00000000,0x00000000,0x00000100,0x01000000,0x00000001,0x00010100,0x00000000,
0x00000001,0x00000000,0x00010100,0x00000000,0x01000000,0x00000001,0x00000000,0x00000100,
0x00000000,0x00000000,0x00000000,0x00000100,0x01010001,0x00010101,0x00000001,0x00000100,
0x00000001,0x00000100,0x00000001,0x00000100,0x00000001,0x00000100,0x00000100,0x00000001,
0x00000000,0x00000000,0x01010100,0x00000001,0x00000000,0x00000100,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x01010100,0x00000101,
0x00000000,0x00000000,0x01000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00000001,
0x00000000,0x00000100,0x00000100,0x00000000,0x00000100,0x00000000,0x01010000,0x00000101,
0x00000000,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000100,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000001,0x01010101,0x00010101,0x01000000,0x00000001,
0x00010000,0x00000001,0x00010000,0x00000001,0x01000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000100,0x00000100,0x01010101,0x00010101,0x00000100,0x00000100,
0x00000100,0x00000100,0x00000100,0x00000000,0x00000100,0x00000000,0x01010000,0x00010101,
0x00000000,0x00000000,0x01010000,0x00000101,0x00000000,0x00000001,0x01010000,0x00000000,
0x01010101,0x00010101,0x01000000,0x00000000,0x01000000,0x00000000,0x00000000,0x00000101,
0x00000000,0x00000000,0x00010000,0x00000000,0x01010101,0x00000001,0x00010000,0x00000000,
0x00010000,0x00010101,0x00000100,0x00000000,0x01000100,0x00000000,0x00000100,0x00010101,
0x00000000,0x00000000,0x01000000,0x00000000,0x01010101,0x00010101,0x00010000,0x00000000,
0x01010000,0x00000101,0x00000100,0x00010000,0x00000000,0x00010000,0x01010000,0x00000101,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000001,0x00000101,0x00000100,
0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00000001,0x01000000,0x00000000,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x00000000,0x00000101,
0x00000000,0x00000000,0x00000100,0x00000000,0x00000100,0x00000101,0x01010000,0x00000000,
0x00000100,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x01010100,0x00000101,
0x00000000,0x00000000,0x00010000,0x00000100,0x01010101,0x00010000,0x00000100,0x00010000,
0x00000001,0x00000001,0x01010000,0x00000101,0x00000100,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000100,0x00000000,0x01000100,0x00010101,0x00000100,0x00010000,
0x00000100,0x00000000,0x00000100,0x00000000,0x01000100,0x00000000,0x00000100,0x00010101,
0x00000000,0x00000000,0x00000100,0x00000100,0x01010100,0x00000101,0x00000100,0x00010001,
0x01000101,0x00010000,0x01010001,0x00010100,0x00010001,0x00010001,0x00000100,0x00000101,
0x00000000,0x00000000,0x00000100,0x00000101,0x01000101,0x00010000,0x00010100,0x00010000,
0x00010100,0x00010000,0x00000100,0x00010101,0x01000101,0x00010000,0x00000100,0x00000101,
0x00000000,0x00000000,0x01010000,0x00000001,0x01000100,0x00000100,0x01000001,0x00010000,
0x01000001,0x00010000,0x00010001,0x00010000,0x00010001,0x00010000,0x00000100,0x00000101,
0x00000000,0x00000000,0x00000001,0x00000100,0x01010001,0x00010101,0x00000001,0x00000100,
0x00000001,0x00000100,0x01000001,0x00000101,0x00010001,0x00010100,0x01000001,0x00000001,
0x00000000,0x00000000,0x00010000,0x00000000,0x00000101,0x00000100,0x00000100,0x00010100,
0x00000001,0x00000100,0x00000001,0x00000100,0x00000100,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00010000,0x00000000,0x01000100,0x00000000,0x00010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010101,0x00000000,0x00000001,0x00000000,0x00000001,
0x00000000,0x00000001,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01010100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000100,0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x01000000,0x00000001,
0x01000000,0x00000001,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00010000,0x01010101,0x00010101,
0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010101,0x00000101,0x00000000,0x00000100,
0x00010000,0x00000001,0x01010000,0x00000000,0x00010000,0x00000000,0x00000100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000100,0x00000000,0x00000100,
0x00000000,0x00000001,0x01010101,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00010000,0x00000000,0x01010101,0x00000101,
0x00000001,0x00000100,0x00000000,0x00000100,0x00000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00000101,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01010101,0x00010101,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000001,0x01010101,0x00000101,
0x01000000,0x00000001,0x00010000,0x00000001,0x00000100,0x00000001,0x01000001,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000100,0x00000000,0x01010101,0x00000101,
0x00000100,0x00000100,0x00000100,0x00000001,0x00010000,0x00000000,0x00010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00000101,
0x00000000,0x00000100,0x00000000,0x00000100,0x00000000,0x00000100,0x01010101,0x00010101,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00000101,0x00000000,0x00000100,
0x01010100,0x00000101,0x00000000,0x00000100,0x00000000,0x00000100,0x01010100,0x00000101,
0x00000000,0x00000000,0x00000000,0x00000000,0x00010001,0x00000100,0x01000100,0x00000100,
0x01000100,0x00000100,0x00000000,0x00000100,0x00000000,0x00000001,0x01010100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x01010101,0x00010101,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00010000,0x01000000,0x00000100,
0x01000000,0x00000001,0x01000000,0x00000000,0x01000000,0x00000000,0x00010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010000,0x00000000,0x00000100,0x01000000,0x00000001,
0x00010101,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,
0x00000000,0x00000000,0x01000000,0x00000000,0x01010101,0x00010101,0x00000001,0x00010000,
0x00000001,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x01000000,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00000101,0x01000000,0x00000000,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01010101,0x00010101,
0x00000000,0x00000000,0x00000000,0x00000100,0x01010101,0x00010101,0x00000000,0x00000101,
0x01000000,0x00000100,0x00010000,0x00000100,0x00000100,0x00000100,0x00000001,0x00000101,
0x00000000,0x00000000,0x00010000,0x00000000,0x01010101,0x00010101,0x00010000,0x00010000,
0x00010000,0x00010000,0x00010000,0x00010000,0x00000100,0x00010000,0x00000001,0x00000100,
0x00000000,0x00000000,0x00010000,0x00000000,0x01010101,0x00000101,0x01000000,0x00000000,
0x01010101,0x00010101,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,
0x00000000,0x00000000,0x01010000,0x00010101,0x00010000,0x00010000,0x00010000,0x00010000,
0x00000100,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x01000000,0x00000001,
0x00000000,0x00000000,0x00000100,0x00000000,0x01010100,0x00010101,0x00000100,0x00000100,
0x00000001,0x00000100,0x00000000,0x00000100,0x00000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x01010100,0x00010101,0x00000000,0x00010000,0x00000000,0x00010000,
0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x00010000,0x01010100,0x00010101,
0x00000000,0x00000000,0x00000100,0x00000100,0x01010101,0x00010101,0x00000100,0x00000100,
0x00000100,0x00000100,0x00000000,0x00000100,0x00000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000101,0x00000000,0x00010000,0x00000000,0x00000101,0x00010000,
0x00010000,0x00010000,0x00000000,0x00000100,0x01000000,0x00000001,0x00010101,0x00000000,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00010000,0x00000000,0x00000100,
0x00000000,0x00000001,0x01000000,0x00000001,0x00010000,0x00000100,0x00000101,0x00010000,
0x00000000,0x00000000,0x00000100,0x00000000,0x01010101,0x00010101,0x00000100,0x00010000,
0x00000100,0x00000100,0x00000100,0x00000000,0x00000100,0x00000000,0x01010000,0x00010101,
0x00000000,0x00000000,0x00000001,0x00010000,0x00000100,0x00010000,0x00000000,0x00010000,
0x00000000,0x00000100,0x00000000,0x00000100,0x01000000,0x00000001,0x00010100,0x00000000,
0x00000000,0x00000000,0x01010100,0x00010101,0x00000100,0x00010000,0x01010100,0x00010000,
0x00000001,0x00010101,0x00000000,0x00010000,0x00000000,0x00000100,0x01000000,0x00000001,
0x00000000,0x00000000,0x00000000,0x00010100,0x01010100,0x00000001,0x00000000,0x00000001,
0x01010101,0x00010101,0x00000000,0x00000001,0x00000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00010001,0x00010000,0x01000100,0x00010000,0x01000100,0x00010000,
0x00000000,0x00010000,0x00000000,0x00000100,0x00000000,0x00000001,0x01010100,0x00000000,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000000,0x00000000,0x01010101,0x00010101,
0x00000000,0x00000001,0x00000000,0x00000001,0x01000000,0x00000000,0x00010100,0x00000000,
0x00000000,0x00000000,0x00000100,0x00000000,0x00000100,0x00000000,0x00010100,0x00000000,
0x01000100,0x00000001,0x00000100,0x00010100,0x00000100,0x00000000,0x00000100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x00000001,0x01010101,0x00010101,
0x00000000,0x00000001,0x00000000,0x00000001,0x01000000,0x00000000,0x00010100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00000101,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x01010101,0x00010101,
0x00000000,0x00000000,0x01010100,0x00010101,0x00000000,0x00010000,0x00010000,0x00010000,
0x01000000,0x00000100,0x00000000,0x00000001,0x01000000,0x00000100,0x00010100,0x00010000,
0x00000000,0x00000000,0x01000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00000100,
0x00000000,0x00000001,0x01010000,0x00000001,0x01000101,0x00010100,0x01000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x00010000,
0x00000000,0x00000100,0x00000000,0x00000100,0x01000000,0x00000001,0x00010101,0x00000000,
0x00000000,0x00000000,0x00000100,0x00000001,0x00000100,0x00000100,0x00000100,0x00000100,
0x00000100,0x00010000,0x00000100,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000000,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x01010101,0x00010101,
0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x00000000,0x01010100,0x00010101,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00010000,0x00000000,0x00010000,
0x00000000,0x00010000,0x00000000,0x00000100,0x00000000,0x00000001,0x01010100,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00010000,0x00000000,0x01000100,0x00000000,
0x00000001,0x00000001,0x00000001,0x00000100,0x00000000,0x00010000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x01010101,0x00010101,
0x01000000,0x00000000,0x01000100,0x00000100,0x01000100,0x00010000,0x01000001,0x00010000,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000000,0x00010000,0x00000000,0x00010000,
0x00000100,0x00000100,0x00010000,0x00000001,0x01000000,0x00000000,0x00000000,0x00000001,
0x00000000,0x00000000,0x01010100,0x00000000,0x00000000,0x00010101,0x01010100,0x00000000,
0x00000000,0x00010101,0x00010100,0x00000000,0x01000000,0x00000001,0x00000000,0x00010100,
0x00000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x00010000,0x00000000,
0x00010000,0x00000000,0x00000100,0x00000100,0x00000100,0x00010000,0x01010101,0x00010101,
0x00000000,0x00000000,0x00000000,0x00010000,0x00000000,0x00010000,0x00010000,0x00000100,
0x01000000,0x00000100,0x00000000,0x00000001,0x01010000,0x00000100,0x00000101,0x00010000,
0x00000000,0x00000000,0x01010101,0x00010101,0x00010000,0x00000000,0x01010101,0x00010101,
0x00010000,0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x01000000,0x00010101,
0x00000000,0x00000000,0x00000100,0x00000000,0x01010101,0x00010101,0x00000100,0x00010000,
0x00000100,0x00000100,0x00010000,0x00000001,0x00010000,0x00000000,0x00010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010100,0x00000101,0x00000000,0x00000100,
0x00000000,0x00000100,0x00000000,0x00000100,0x00000000,0x00000100,0x01010101,0x00010101,
0x00000000,0x00000000,0x01010100,0x00010101,0x00000000,0x00010000,0x00000000,0x00010000,
0x01010100,0x00010101,0x00000000,0x00010000,0x00000000,0x00010000,0x01010100,0x00010101,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000000,0x00000000,0x01010101,0x00010101,
0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00000100,0x00010000,0x00000100,0x00010000,0x00000100,0x00010000,
0x00000100,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x01000000,0x00000001,
0x00000000,0x00000000,0x01000100,0x00000000,0x01000100,0x00000000,0x01000100,0x00000000,
0x01000100,0x00010000,0x01000100,0x00010000,0x01000100,0x00000100,0x01000001,0x00000001,
0x00000000,0x00000000,0x00000100,0x00000000,0x00000100,0x00000000,0x00000100,0x00010000,
0x00000100,0x00010000,0x00000100,0x00000100,0x00000100,0x00000001,0x01010100,0x00000000,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000001,0x00010000,0x00000001,0x00010000,0x00000001,0x00010000,0x01010101,0x00010101,
0x00000000,0x00000000,0x01010101,0x00010101,0x00000001,0x00010000,0x00000001,0x00010000,
0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x01010000,0x00000001,
0x00000000,0x00000000,0x00000101,0x00010000,0x00010000,0x00010000,0x00000000,0x00010000,
0x00000000,0x00010000,0x00000000,0x00000100,0x00000000,0x00000001,0x01010101,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01010100,0x00000001,0x01000000,0x00000000,0x00010000,0x00000000,
0x01000001,0x00000100,0x00000001,0x00010001,0x00000001,0x00010001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x01010000,0x00000000,0x00000100,0x00000001,
0x00000100,0x00000001,0x00000001,0x00000100,0x00000000,0x00010000,0x00000000,0x00000000,
0x00000000,0x00000000,0x01010001,0x00010101,0x00000001,0x00000100,0x01010001,0x00010101,
0x00000001,0x00000100,0x01000001,0x00000101,0x00010001,0x00010100,0x01000001,0x00000001,
0x00000000,0x00000000,0x01010000,0x00000101,0x00000000,0x00000001,0x01010000,0x00000101,
0x00000000,0x00000001,0x01010000,0x00000001,0x00000100,0x00000101,0x01010000,0x00000000,
0x00000000,0x00000000,0x01010100,0x00000000,0x01000000,0x00000100,0x01000000,0x00000100,
0x01010100,0x00000101,0x00010001,0x00010100,0x00010001,0x00000100,0x00000100,0x00000001,
0x00000000,0x00000000,0x00010000,0x00000000,0x01010101,0x00000100,0x00010000,0x00010000,
0x00010100,0x00000000,0x00010001,0x00010000,0x00010001,0x00010000,0x01010100,0x00000101,
0x00000000,0x00000000,0x00000100,0x00000100,0x00000100,0x00000100,0x01010100,0x00000101,
0x00000100,0x00010001,0x00010001,0x00010001,0x01010001,0x00010000,0x00010100,0x00000100,
0x00000000,0x00000000,0x00010000,0x00000000,0x01010101,0x00000001,0x00000100,0x00000000,
0x01010101,0x00000001,0x00000100,0x00010000,0x00000100,0x00010000,0x01010000,0x00000101,
0x00000000,0x00000000,0x00000100,0x00000001,0x01010100,0x00000101,0x00000101,0x00010001,
0x00000100,0x00010000,0x00010000,0x00000100,0x00010000,0x00000000,0x00010000,0x00000000,
0x00000000,0x00000000,0x01000000,0x00000000,0x01010001,0x00000101,0x01000101,0x00010000,
0x01000001,0x00010000,0x01000001,0x00010000,0x01000000,0x00000101,0x00010000,0x00000000,
0x00000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000101,0x01000000,0x00000000,
0x01000000,0x00000000,0x01010100,0x00000001,0x01000001,0x00000100,0x00010100,0x00000000,
0x00000000,0x00000000,0x01000000,0x00000001,0x00000000,0x00000100,0x00010000,0x00000000,
0x01000100,0x00000101,0x00010100,0x00010000,0x00000000,0x00010000,0x01000000,0x00000101,
0x00000000,0x00000000,0x00000100,0x00010000,0x00000100,0x00010000,0x00000100,0x00010000,
0x00010100,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x01000000,0x00000001,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000000,0x00000001,0x01010000,0x00000101,
0x00000101,0x00010000,0x01010000,0x00010000,0x00000100,0x00010001,0x01010000,0x00000101,
0x00000000,0x00000000,0x00000100,0x00000100,0x00000101,0x00000101,0x01000100,0x00000100,
0x00010100,0x00000100,0x00000100,0x00000100,0x00000101,0x00000100,0x00000100,0x00010000,
0x00000000,0x00000000,0x01010100,0x00000101,0x00000000,0x00000001,0x01010000,0x00000101,
0x00000101,0x00010000,0x00000000,0x00010000,0x00000100,0x00010000,0x01010000,0x00000101,
0x00000000,0x00000000,0x00000100,0x00000000,0x01000101,0x00000101,0x00010100,0x00010000,
0x00000100,0x00010000,0x00000101,0x00010000,0x00000100,0x00010000,0x00000100,0x00000101,
0x00000000,0x00000000,0x00010000,0x00000000,0x00010000,0x00000000,0x00000100,0x00000000,
0x00010100,0x00010000,0x00010001,0x00010000,0x00010001,0x00010000,0x01000001,0x00000101,
0x00000000,0x00000000,0x00010000,0x00010001,0x01010101,0x00010101,0x00010000,0x00000100,
0x00010000,0x00000100,0x00010000,0x00000100,0x00000100,0x00000100,0x00000001,0x00000001,
0x00000000,0x00000000,0x00010000,0x00010001,0x01010101,0x00010001,0x00010000,0x00000000,
0x01010101,0x00000101,0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,
0x00000000,0x00000000,0x01010100,0x00010001,0x00000100,0x00010100,0x00000100,0x00000100,
0x00000001,0x00000100,0x00000000,0x00000100,0x00000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000100,0x00010001,0x01010100,0x00010101,0x00000100,0x00000100,
0x00000001,0x00000100,0x00000000,0x00000100,0x00000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010001,0x01010101,0x00010101,0x00000000,0x00000100,
0x00000000,0x00000100,0x00000000,0x00000100,0x00000000,0x00000100,0x01010101,0x00000101,
0x00000000,0x00000000,0x00000100,0x00010001,0x00000100,0x00010001,0x01010101,0x00000101,
0x00000100,0x00000001,0x00000000,0x00000001,0x00000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000101,0x00010001,0x00010000,0x00010001,0x00000101,0x00000100,
0x00010000,0x00000100,0x00000000,0x00000001,0x01000000,0x00000000,0x00010101,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010001,0x01010101,0x00010001,0x00000000,0x00000001,
0x01000000,0x00000000,0x01010000,0x00000000,0x00000100,0x00000001,0x00000001,0x00000100,
0x00000000,0x00000000,0x00000100,0x00010001,0x01010101,0x00010101,0x00000100,0x00000100,
0x00000100,0x00000001,0x00000100,0x00000000,0x00000100,0x00000000,0x01010000,0x00000101,
0x00000000,0x00000000,0x00000001,0x00010001,0x00000100,0x00010001,0x00000000,0x00000100,
0x00000000,0x00000100,0x00000000,0x00000001,0x01000000,0x00000000,0x00010100,0x00000000,
0x00000000,0x00000000,0x01010100,0x00010001,0x00000100,0x00010001,0x00010100,0x00000100,
0x01000001,0x00000101,0x00000000,0x00000100,0x00000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00010001,0x01010100,0x00010001,0x00000000,0x00000001,
0x01010101,0x00010101,0x00000000,0x00000001,0x00000000,0x00000001,0x01010000,0x00000000,
0x00000000,0x00000000,0x00010001,0x00000100,0x01000100,0x00010000,0x01000100,0x00000100,
0x00000000,0x00000100,0x00000000,0x00000001,0x01000000,0x00000000,0x00010101,0x00000000,
0x00000000,0x00000000,0x01010100,0x00010001,0x00000000,0x00010001,0x01010101,0x00000101,
0x01000000,0x00000000,0x01000000,0x00000000,0x01000000,0x00000000,0x00010100,0x00000000,
};

View File

@ -0,0 +1,459 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_G2dDemoLib
File: loader.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "g2d_demolib.h"
#include <nnsys/g2d/g2d_Softsprite.h>
#include <nnsys/g2d/g2d_Load.h>
/*---------------------------------------------------------------------------*
Name: LoadFileToMainMem_
Description:
Arguments: pFname:
Returns:
G2DDemo_Free
NULL
*---------------------------------------------------------------------------*/
static void* LoadFileToMainMem_( const char* pFname )
{
FSFile file;
void* pFile = NULL;
BOOL bSuccess;
SDK_NULL_ASSERT( pFname );
FS_InitFile( &file );
bSuccess = FS_OpenFile( &file, pFname );
if( bSuccess )
{
const u32 szFile = FS_GetLength( &file );
pFile = G2DDemo_Alloc( szFile );
SDK_NULL_ASSERT( pFile );
if( szFile != (u32)FS_ReadFile( &file, pFile, (s32)szFile ) )
{
G2DDemo_Free( pFile );
pFile = NULL;
}
bSuccess = FS_CloseFile( &file );
SDK_ASSERT( bSuccess );
}else{
OS_Warning(" Can't find the file : %s ", pFname );
}
return pFile;
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_LoadNCER
Description: NCER
G2DDemo_Free( )
Arguments: ppCellBank:
pFname: NCERファイル名
Returns:
NULL
*---------------------------------------------------------------------------*/
void* G2DDemo_LoadNCER( NNSG2dCellDataBank** ppCellBank, const char* pFname )
{
void* pFile = NULL;
SDK_NULL_ASSERT( ppCellBank );
SDK_NULL_ASSERT( pFname );
pFile = LoadFileToMainMem_( pFname );
if( pFile != NULL )
{
if( NNS_G2dGetUnpackedCellBank( pFile, ppCellBank ) )
{
NNS_G2dPrintCellBank( *ppCellBank );
return pFile;
}
G2DDemo_Free( pFile );
}
return NULL;
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_LoadNANR
Description: NANR
G2DDemo_Free( )
Arguments: ppAnimBank:
pFname:
NANR
Returns:
NULL
*---------------------------------------------------------------------------*/
void* G2DDemo_LoadNANR( NNSG2dAnimBankData** ppAnimBank, const char* pFname )
{
void* pFile = NULL;
SDK_NULL_ASSERT( ppAnimBank );
SDK_NULL_ASSERT( pFname );
pFile = LoadFileToMainMem_( pFname );
if( pFile != NULL )
{
if( NNS_G2dGetUnpackedAnimBank( pFile, ppAnimBank ) )
{
NNS_G2dPrintAnimBank( *ppAnimBank );
return pFile;
}
G2DDemo_Free( pFile );
}
return NULL;
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_LoadNMCR
Description: NMCR
G2DDemo_Free( )
Arguments: ppMCBank:
pFname:
NMCR
Returns:
NULL
*---------------------------------------------------------------------------*/
void* G2DDemo_LoadNMCR( NNSG2dMultiCellDataBank** ppMCBank, const char* pFname )
{
void* pFile = NULL;
SDK_NULL_ASSERT( ppMCBank );
SDK_NULL_ASSERT( pFname );
pFile = LoadFileToMainMem_( pFname );
if( pFile != NULL )
{
if( NNS_G2dGetUnpackedMultiCellBank( pFile, ppMCBank ) )
{
NNS_G2dPrintMultiCellBank ( *ppMCBank );
return pFile;
}
G2DDemo_Free( pFile );
}
return NULL;
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_LoadNMAR
Description: NMAR
G2DDemo_Free( )
Arguments: ppMCABank:
pFname:
NMAR
Returns:
NULL
*---------------------------------------------------------------------------*/
void* G2DDemo_LoadNMAR( NNSG2dMultiCellAnimBankData** ppMCABank, const char* pFname )
{
void* pFile = NULL;
SDK_NULL_ASSERT( ppMCABank );
SDK_NULL_ASSERT( pFname );
pFile = LoadFileToMainMem_( pFname );
if( pFile != NULL )
{
if( NNS_G2dGetUnpackedMCAnimBank( pFile, ppMCABank ) )
{
NNS_G2dPrintAnimBank( *ppMCABank );
return pFile;
}
G2DDemo_Free( pFile );
}
return NULL;
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_LoadNCGR
Description: NCGR
G2DDemo_Free( )
Arguments: ppCharData:
pFname: NCGRファイル名
Returns:
NULL
*---------------------------------------------------------------------------*/
void* G2DDemo_LoadNCGR( NNSG2dCharacterData** ppCharData, const char* pFname )
{
void* pFile = NULL;
SDK_NULL_ASSERT( ppCharData );
SDK_NULL_ASSERT( pFname );
pFile = LoadFileToMainMem_( pFname );
if( pFile != NULL )
{
if( NNS_G2dGetUnpackedCharacterData( pFile, ppCharData ) )
{
NNS_G2dPrintCharacterData( *ppCharData );
return pFile;
}
G2DDemo_Free( pFile );
}
return NULL;
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_LoadNCGR
Description: NCGR
G2DDemo_Free( )
Arguments: ppCharData:
ppCharPosInfo:
pFname: NCGRファイル名
Returns:
NULL
*---------------------------------------------------------------------------*/
void* G2DDemo_LoadNCGREx
(
NNSG2dCharacterData** ppCharData,
NNSG2dCharacterPosInfo** ppCharPosInfo,
const char* pFname
)
{
void* pFile = NULL;
SDK_NULL_ASSERT( ppCharData );
SDK_NULL_ASSERT( pFname );
pFile = LoadFileToMainMem_( pFname );
if( pFile != NULL )
{
if( NNS_G2dGetUnpackedCharacterData( pFile, ppCharData ) )
{
NNS_G2dPrintCharacterData( *ppCharData );
if( NNS_G2dGetUnpackedCharacterPosInfo( pFile, ppCharPosInfo ) )
{
NNS_G2dPrintCharacterPosInfo( *ppCharPosInfo );
return pFile;
}
}
}
G2DDemo_Free( pFile );
return NULL;
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_LoadNCLR
Description: NCLR
G2DDemo_Free( )
Arguments: ppPltData:
pFname: NCLRファイル名
Returns:
NULL
*---------------------------------------------------------------------------*/
void* G2DDemo_LoadNCLR( NNSG2dPaletteData** ppPltData, const char* pFname )
{
void* pFile = NULL;
SDK_NULL_ASSERT( ppPltData );
SDK_NULL_ASSERT( pFname );
pFile = LoadFileToMainMem_( pFname );
if( pFile != NULL )
{
if( NNS_G2dGetUnpackedPaletteData( pFile, ppPltData ) )
{
NNS_G2dPrintPaletteData( *ppPltData );
return pFile;
}
G2DDemo_Free( pFile );
}
return NULL;
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_LoadNENR
Description: NENR
G2DDemo_Free( )
Arguments: ppEntityBank:
pFname:
NENR
Returns:
NULL
*---------------------------------------------------------------------------*/
void* G2DDemo_LoadNENR( NNSG2dEntityDataBank** ppEntityBank, const char* pFname )
{
void* pFile = NULL;
SDK_NULL_ASSERT( ppEntityBank );
SDK_NULL_ASSERT( pFname );
pFile = LoadFileToMainMem_( pFname );
if( pFile != NULL )
{
if( NNS_G2dGetUnpackedEntityBank( pFile, ppEntityBank ) )
{
NNS_G2dPrintEntityDataBank( *ppEntityBank );
return pFile;
}
G2DDemo_Free( pFile );
}
return NULL;
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_LoadNCBR
Description: NCBR
G2DDemo_Free( )
Arguments: ppCharData:
pFname: NCBRファイル名
Returns:
NULL
*---------------------------------------------------------------------------*/
void* G2DDemo_LoadNCBR( NNSG2dCharacterData** ppCharData, const char* pFname )
{
void* pFile = NULL;
SDK_NULL_ASSERT( ppCharData );
SDK_NULL_ASSERT( pFname );
pFile = LoadFileToMainMem_( pFname );
if( pFile != NULL )
{
if( NNS_G2dGetUnpackedCharacterData( pFile, ppCharData ) )
{
NNS_G2dPrintCharacterData( *ppCharData );
return pFile;
}
G2DDemo_Free( pFile );
}
return NULL;
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_LoadNSCR
Description: NCBR
G2DDemo_Free( )
Arguments: ppCharData:
pFname: NCBRファイル名
Returns:
NULL
*---------------------------------------------------------------------------*/
void* G2DDemo_LoadNSCR( NNSG2dScreenData** ppScreenData, const char* pFname )
{
void* pFile = NULL;
SDK_NULL_ASSERT( ppScreenData );
SDK_NULL_ASSERT( pFname );
pFile = LoadFileToMainMem_( pFname );
if( pFile != NULL )
{
if( NNS_G2dGetUnpackedScreenData( pFile, ppScreenData ) )
{
NNS_G2dPrintScreenData( *ppScreenData );
return pFile;
}
G2DDemo_Free( pFile );
}
return NULL;
}

View File

@ -0,0 +1,156 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_G2dDemoLib
File: print.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "g2d_demolib.h"
#include "g2d_demolib/print.h"
#include "g2d_demolib/fontData.h"
#define SCREEN_HEIGHT 192 // 画面高さ
#define SCREEN_WIDTH 256 // 画面幅
#define SCREEN_CHARA_SIZE 8 // BGキャラクタサイズ
#define SCR_PLTT_SHIFT 12 // スクリーンデータ内のパレットNo用シフト幅
#define FONT_COLOR 3 // 文字色=青
// キャラクタ単位の画面サイズ
#define SCREEN_HEIGHT_CHARA (SCREEN_HEIGHT / SCREEN_CHARA_SIZE)
#define SCREEN_WIDTH_CHARA (SCREEN_WIDTH / SCREEN_CHARA_SIZE)
// スクリーンバッファ
static u16 sScreenBuf[SCREEN_HEIGHT_CHARA][SCREEN_WIDTH_CHARA];
/*---------------------------------------------------------------------------*
Name: G2DDemo_PrintInit
Description: BG1を文字表示用にセットアップします
system.c Init3DStuff_
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void G2DDemo_PrintInit(void)
{
// BG1 のセットアップ
GX_SetBankForBGExtPltt(GX_VRAM_BGEXTPLTT_01_F);
GX_SetVisiblePlane( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ );
G2_SetBG1Control(
GX_BG_SCRSIZE_TEXT_256x256,
GX_BG_COLORMODE_256,
GX_BG_SCRBASE_0x0000,
GX_BG_CHARBASE_0x04000,
GX_BG_EXTPLTT_01);
G2_SetBG1Priority(3);
// リソースのロード
GX_LoadBG1Char(fontCharData, 0, sizeof(fontCharData));
GX_BeginLoadBGExtPltt();
GX_LoadBGExtPltt(fontPlttData, 0x2000, sizeof(fontPlttData));
GX_EndLoadBGExtPltt();
// 内部バッファのクリア
G2DDemo_PrintClear();
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_PrintClear
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void G2DDemo_PrintClear(void)
{
MI_CpuClearFast( sScreenBuf, sizeof(sScreenBuf) );
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_PrintOut
Description: BG1を利用して文字列を表示します
132 24
Arguments: x: 10
y: 0
string:
Returns:
*---------------------------------------------------------------------------*/
void G2DDemo_PrintOut(int x, int y, const char* string)
{
const char* pos;
SDK_NULL_ASSERT( string );
SDK_ASSERT( 0 <= x && x < SCREEN_WIDTH_CHARA );
SDK_ASSERT( 0 <= y && y < SCREEN_HEIGHT_CHARA );
for( pos = string; *pos != '\0'; ++pos )
{
sScreenBuf[y][x] = (u16)((u16)(FONT_COLOR << SCR_PLTT_SHIFT) | (u16)(*pos));
x++;
if( x >= SCREEN_WIDTH )
{
break;
}
}
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_PrintOutf
Description: BG1を利用して文字列を表示します
132 24
Arguments: x: 10
y: 0
format: printf形式のフォーマット文字列です
...:
Returns:
*---------------------------------------------------------------------------*/
void G2DDemo_PrintOutf(int x, int y, const char* format, ...)
{
va_list vlist;
char buf[SCREEN_WIDTH_CHARA + 1];
SDK_NULL_ASSERT( format );
va_start( vlist, format );
(void)vsnprintf( buf, sizeof(buf), format, vlist );
va_end( vlist );
G2DDemo_PrintOut(x, y, buf);
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_PrintApplyToHW
Description:
V
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void G2DDemo_PrintApplyToHW(void)
{
DC_FlushRange( sScreenBuf, sizeof(sScreenBuf) );
GX_LoadBG1Scr( sScreenBuf, 0, sizeof(sScreenBuf) );
}

View File

@ -0,0 +1,423 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_G2dDemoLib
File: system.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "g2d_demolib.h"
#include <nnsys/g2d/g2d_Softsprite.h>
#include <nnsys/g2d/g2d_Load.h>
// リソースプールのサイズ
#define SIZE_OF_RES_POOL 1000
// アライメントにあわせて切り上げ
#define ROUND_UP(value, alignment) \
(((u32)(value) + (alignment-1)) & ~(alignment-1))
// アライメントにあわせて切り下げ
#define ROUND_DOWN(value, alignment) \
((u32)(value) & ~(alignment-1))
G2DDemoGamePad gGamePad; // ゲームパッド
NNSFndHeapHandle gHeapHandle; // ヒープハンドル
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name: Init3DStuff_
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void Init3DStuff_(void)
{
G3X_Init(); // initialize the 3D graphics states
G3X_InitMtxStack(); // initialize the matrix stack
// メイン画面
{
GX_SetBankForTex(GX_VRAM_TEX_0_A); // VRAM-A for texture images
GX_SetBankForOBJ(GX_VRAM_OBJ_128_B); // VRAM-B for OBJ
GX_SetBankForBG(GX_VRAM_BG_128_C); // VRAM-C for BGs
GX_SetBankForTexPltt(GX_VRAM_TEXPLTT_0123_E); // VRAM-E for texture palettes
GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, // graphics mode
GX_BGMODE_4, // BGMODE is 4
GX_BG0_AS_3D); // BG #0 is for 3D
GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D ); // 2D mapping mode
GX_SetVisiblePlane( GX_PLANEMASK_BG0 | GX_PLANEMASK_OBJ ); // display BG0 & OBJ
}
// サブ画面
{
GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D); // VRAM-D for OBJ
GXS_SetGraphicsMode(GX_BGMODE_0); // BGMODE is 0
GXS_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D); // 2D mapping mode
GXS_SetVisiblePlane(GX_PLANEMASK_OBJ); // display only OBJ
}
G2_SetBG0Priority(1);
G3X_SetShading(GX_SHADING_TOON);
G3X_AntiAlias(TRUE);
G3X_AlphaBlend(TRUE);
// 3D 面は特殊効果OFFでも他のBG面とαブレンディングが行われますが、
// そのためにはαブレンディング対象面の指定を行う必要があります。
// SDK には対象面のみを設定する API が存在しないので、代わりに G2_SetBlendAlpha を使います。
// この場合 G2_SetBlendAlpha の後ろ2つの引数は無視されます。
G2_SetBlendAlpha(GX_BLEND_PLANEMASK_BG0, GX_BLEND_PLANEMASK_BD, 0, 0);
// clear color
G3X_SetClearColor(GX_RGB(0, 0, 0), 0, 0x7fff, 0, FALSE );
G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z);
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_CommonInit
Description: OS
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void G2DDemo_CommonInit(void)
{
// Common initialization.
{
OS_Init();
FX_Init();
GX_Init();
GX_DispOff();
GXS_DispOff();
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
(void)OS_EnableIrqMask( OS_IE_V_BLANK );
(void)OS_EnableIrq();
(void)GX_VBlankIntr(TRUE);
}
// Clear VRAM
{
//---------------------------------------------------------------------------
// All VRAM banks to LCDC
//---------------------------------------------------------------------------
GX_SetBankForLCDC(GX_VRAM_LCDC_ALL);
//---------------------------------------------------------------------------
// Clear all LCDC space
//---------------------------------------------------------------------------
MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE);
//---------------------------------------------------------------------------
// Disable the banks on LCDC
//---------------------------------------------------------------------------
(void)GX_DisableBankForLCDC();
MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); // clear OAM
MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); // clear the standard palette
MI_CpuFillFast((void*)HW_DB_OAM, 192, HW_DB_OAM_SIZE); // clear OAM
MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); // clear the standard palette
}
//------------------------------------------------------------------------------
// Initializing the 3D Sprite Engine.
//------------------------------------------------------------------------------
Init3DStuff_();
NNS_G2dSetupSoftwareSpriteCamera();
//------------------------------------------------------------------------------
// misc.
{
*(GXRgb*)(HW_BG_PLTT) = GX_RGB(15, 15, 15);
*(GXRgb*)(HW_DB_BG_PLTT) = GX_RGB(15, 15, 15);
OS_InitTick();
}
//------------------------------------------------------------------------------
// Heap 確保
{
u32 arenaLow = ROUND_UP (OS_GetMainArenaLo(), 16);
u32 arenaHigh = ROUND_DOWN(OS_GetMainArenaHi(), 16);
u32 heapSize = arenaHigh - arenaLow;
void* heapMemory = OS_AllocFromMainArenaLo(heapSize, 16);
gHeapHandle = NNS_FndCreateExpHeap(heapMemory, heapSize);
SDK_ASSERT( gHeapHandle != NNS_FND_HEAP_INVALID_HANDLE );
}
//------------------------------------------------------------------------------
// File System
{
(void)OS_EnableIrqMask(OS_IE_FIFO_RECV);
/* initialize file-system */
FS_Init( FS_DMA_NOT_USE );
/* always preload FS table for faster directory access. */
{
const u32 need_size = FS_GetTableSize();
void *p_table = G2DDemo_Alloc(need_size);
SDK_ASSERT(p_table != NULL);
(void)FS_LoadTable(p_table, need_size);
}
}
// ゲームパッドを空読みします。
G2DDemo_ReadGamePad();
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_CameraSetup
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void G2DDemo_CameraSetup(void)
{
{
// 単位行列と等価
VecFx32 Eye = { 0, 0, 0 }; // Eye position
VecFx32 vUp = { 0, FX32_ONE, 0 }; // Up
VecFx32 at = { 0, 0, -FX32_ONE }; // Viewpoint
// Matrix mode is changed to GX_MTXMODE_POSITION_VECTOR internally,
// and the camera matrix is loaded to the current matrix.
G3_LookAt(&Eye, &vUp, &at, NULL);
}
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_MaterialSetup
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void G2DDemo_MaterialSetup(void)
{
// for software sprite-setting
{
G3_MaterialColorDiffAmb(GX_RGB(31, 31, 31), // diffuse
GX_RGB(16, 16, 16), // ambient
TRUE // use diffuse as vtx color if TRUE
);
G3_MaterialColorSpecEmi(GX_RGB(16, 16, 16), // specular
GX_RGB(0, 0, 0), // emission
FALSE // use shininess table if TRUE
);
G3_PolygonAttr(GX_LIGHTMASK_NONE, // no lights
GX_POLYGONMODE_MODULATE, // modulation mode
GX_CULL_NONE, // cull back
0, // polygon ID(0 - 63)
31, // alpha(0 - 31)
0 // OR of GXPolygonAttrMisc's value
);
}
}
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name: G2DDemo_GetNewCellAnimation
Description: NNSG2dCellAnimation
Arguments: num: NNSG2dCellAnimation
Returns: NNSG2dCellAnimation
*---------------------------------------------------------------------------*/
NNSG2dCellAnimation* G2DDemo_GetNewCellAnimation( u16 num )
{
static NNSG2dCellAnimation sPoolAnimatedObj[SIZE_OF_RES_POOL];
static u16 sNumAnimatedObj = 0;
const u16 retIdx = sNumAnimatedObj;
sNumAnimatedObj += num;
SDK_ASSERT( sNumAnimatedObj <= SIZE_OF_RES_POOL );
return &sPoolAnimatedObj[ retIdx ];
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_GetNewNode
Description: NNSG2dNode
Arguments: num: NNSG2dNode
Returns: NNSG2dNode
*---------------------------------------------------------------------------*/
NNSG2dNode* G2DDemo_GetNewNode( u16 num )
{
static NNSG2dNode sPoolObjNode[SIZE_OF_RES_POOL];
static u16 sNumUsedPoolObjNode = 0;
const u16 retIdx = sNumUsedPoolObjNode;
sNumUsedPoolObjNode += num;
SDK_ASSERT( sNumUsedPoolObjNode <= SIZE_OF_RES_POOL );
return &sPoolObjNode[ retIdx ];
}
/*---------------------------------------------------------------------------*
Name: getNewMultiCellAnim_
Description: NNSG2dMultiCellAnimation
Arguments: num: NNSG2dMultiCellAnimation
Returns: NNSG2dMultiCellAnimation
*---------------------------------------------------------------------------*/
static NNSG2dMultiCellAnimation* GetNewMultiCellAnim_( u16 num )
{
static NNSG2dMultiCellAnimation sMcAnimPool_[SIZE_OF_RES_POOL];
static u16 sNumUsedMcAnimPool = 0;
const u16 retIdx = sNumUsedMcAnimPool;
sNumUsedMcAnimPool += num;
SDK_ASSERT( sNumUsedMcAnimPool <= SIZE_OF_RES_POOL );
return &sMcAnimPool_[retIdx];
}
/*---------------------------------------------------------------------------*
Name: G2DDemo_GetNewMultiCellAnimation
Description: NNSG2dMultiCellAnimation
Arguments: numNode:
pAnimBank:
pCellDataBank:
pMultiCellDataBank:
Returns: NNSG2dMultiCellAnimation
*---------------------------------------------------------------------------*/
/* 古いAPIを使用する以前のバージョン
NNSG2dMultiCellAnimation* G2DDemo_GetNewMultiCellAnimation
(
u16 numNode,
const NNSG2dCellAnimBankData* pAnimBank,
const NNSG2dCellDataBank* pCellDataBank ,
const NNSG2dMultiCellDataBank* pMultiCellDataBank
)
{
// プールから NNSG2dMultiCellAnimation を取得
NNSG2dMultiCellAnimation* pMCAnim = GetNewMultiCellAnim_( 1 );
// プールから numNode ぶんの NNSG2dNode と NNSG2dCellAnimation を取得
NNSG2dNode* pNodeArray = G2DDemo_GetNewNode( numNode );
NNSG2dCellAnimation* pCellAnimArray = G2DDemo_GetNewCellAnimation( numNode );
NNS_G2dInitMCAnimation( pMCAnim, // マルチセルアニメーション
pNodeArray, // ノード配列
pCellAnimArray, // セルアニメーション配列
numNode, // ノード数
pAnimBank, // アニメーションデータバンク
pCellDataBank, // セルデータバンク
pMultiCellDataBank ); // マルチセルデータバンク
return pMCAnim;
}
*/
/*---------------------------------------------------------------------------*
Name: G2DDemo_GetNewMultiCellAnimation
Description: NNSG2dMultiCellAnimation
Arguments: pAnimBank:
pCellDataBank:
pMultiCellDataBank:
mcType:
Returns: NNSG2dMultiCellAnimation
*---------------------------------------------------------------------------*/
NNSG2dMultiCellAnimation* G2DDemo_GetNewMultiCellAnimation
(
const NNSG2dCellAnimBankData* pAnimBank,
const NNSG2dCellDataBank* pCellDataBank ,
const NNSG2dMultiCellDataBank* pMultiCellDataBank,
NNSG2dMCType mcType
)
{
const u32 szWork = NNS_G2dGetMCWorkAreaSize( pMultiCellDataBank, mcType );
void* pWorkMem = NNS_FndAllocFromExpHeap( gHeapHandle, szWork );
// プールから NNSG2dMultiCellAnimation を取得
NNSG2dMultiCellAnimation* pMCAnim = GetNewMultiCellAnim_( 1 );
// 初期化
NNS_G2dInitMCAnimationInstance( pMCAnim,
pWorkMem,
pAnimBank,
pCellDataBank,
pMultiCellDataBank,
mcType );
return pMCAnim;
}
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name: G2DDemo_ReadGamePad
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void G2DDemo_ReadGamePad(void)
{
u16 status = PAD_Read();
gGamePad.trigger = (u16)(status & (status ^ gGamePad.button));
gGamePad.release = (u16)(gGamePad.button & (status ^ gGamePad.button));
gGamePad.button = status;
}

View File

@ -0,0 +1,395 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - IDE - IDE_MultiCellAnimation
# File: Nitro.lcf
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
MEMORY
{
main (RWX) : ORIGIN = 0x02000000, LENGTH = 0x0 > main.sbin
ITCM (RWX) : ORIGIN = 0x01ff8000, LENGTH = 0x0 >> main.sbin
DTCM (RWX) : ORIGIN = 0x027e0000, LENGTH = 0x0 >> main.sbin
binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin
binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin
main_defs (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_defs.sbin
main_table (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_table.sbin
dummy.MAIN_EX (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0
arena.MAIN (RW) : ORIGIN = AFTER(main), LENGTH = 0x0
arena.MAIN_EX (RW) : ORIGIN = AFTER(dummy.MAIN_EX), LENGTH = 0x0
arena.ITCM (RW) : ORIGIN = AFTER(ITCM), LENGTH = 0x0
arena.DTCM (RW) : ORIGIN = AFTER(DTCM), LENGTH = 0x0
binary.MODULE_FILES (RW) : ORIGIN = 0x0, LENGTH = 0x0 > component.files
check.ITCM (RWX) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check
check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check
}
FORCE_ACTIVE
{
SVC_SoftReset
}
KEEP_SECTION
{
.sinit
}
SECTIONS
{
############################ STATIC #################################
.main:
{
ALIGNALL(4); . = ALIGN(32); # Fit to cache line
#
# TEXT BLOCK: READ ONLY
#
SDK_STATIC_START =.;
SDK_STATIC_TEXT_START =.;
#:::::::::: text/rodata
libsyscall.a (.text)
crt0.o (.text)
crt0.o (.rodata)
#
# .version セクションを追加しています。
# このセクションに含まれる情報はロットチェックの際に
# 必要となりますので、必ずこの位置に残すようにして下さい。
#
* (.version)
OBJECT(NitroMain,*)
GROUP(ROOT) (.text)
. = ALIGN(4);
* (.exception)
. = ALIGN(4);
SDK_STATIC_ETABLE_START =.;
EXCEPTION
SDK_STATIC_ETABLE_END =.;
. = ALIGN(4);
GROUP(ROOT) (.init)
. = ALIGN(4);
GROUP(ROOT) (.rodata)
. = ALIGN(4);
SDK_STATIC_SINIT_START =.;
#:::::::::: ctor
GROUP(ROOT) (.ctor)
GROUP(ROOT) (.sinit)
WRITEW 0;
#:::::::::: ctor
SDK_STATIC_SINIT_END =.;
#:::::::::: text/rodata
. = ALIGN(32);
SDK_STATIC_TEXT_END =.;
#
# DATA BLOCK: READ WRITE
#
SDK_STATIC_DATA_START =.;
#:::::::::: data
GROUP(ROOT) (.sdata)
. = ALIGN(4);
GROUP(ROOT) (.data)
. = ALIGN(4);
SDK_OVERLAY_DIGEST =.;
# NO DIGEST
SDK_OVERLAY_DIGEST_END =.;
#:::::::::: data
. = ALIGN(32);
SDK_STATIC_DATA_END =.;
SDK_STATIC_END =.;
SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START;
SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START;
SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START;
__sinit__ = SDK_STATIC_SINIT_START; # for static initializer
__exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table
__exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table
} > main
.main.bss:
{
ALIGNALL(4); . = ALIGN(32);
#
# BSS BLOCK
#
SDK_STATIC_BSS_START =.;
#:::::::::: bss
GROUP(ROOT) (.sbss)
. = ALIGN(4);
GROUP(ROOT) (.bss)
. = ALIGN(4);
#:::::::::: bss
. = ALIGN(32);
SDK_STATIC_BSS_END = .;
SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START;
} >> main
############################ AUTOLOADS ##############################
SDK_AUTOLOAD.ITCM.START = 0x01ff8000;
SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START;
SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START;
SDK_AUTOLOAD.ITCM.SIZE = 0;
SDK_AUTOLOAD.ITCM.BSS_SIZE = 0;
SDK_AUTOLOAD.DTCM.START = 0x027e0000;
SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START;
SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START;
SDK_AUTOLOAD.DTCM.SIZE = 0;
SDK_AUTOLOAD.DTCM.BSS_SIZE = 0;
SDK_AUTOLOAD_START = SDK_STATIC_END;
SDK_AUTOLOAD_SIZE = 0;
SDK_AUTOLOAD_NUMBER = 2;
.ITCM:
{
ALIGNALL(4); . = ALIGN(32);
#
# TEXT BLOCK: READ ONLY
#
SDK_AUTOLOAD_ITCM_ID =0;
SDK_AUTOLOAD.ITCM.ID =0;
SDK_AUTOLOAD.ITCM.START =.;
SDK_AUTOLOAD.ITCM.TEXT_START =.;
#:::::::::: text/rodata
. = ALIGN(4);
* (.itcm)
. = ALIGN(4);
. = ALIGN(4);
#:::::::::: text/rodata
SDK_AUTOLOAD.ITCM.TEXT_END =.;
#
# DATA BLOCK: READ WRITE BLOCK
#
SDK_AUTOLOAD.ITCM.DATA_START =.;
#:::::::::: data
. = ALIGN(4);
. = ALIGN(4);
. = ALIGN(4);
#:::::::::: data
. = ALIGN(32);
SDK_AUTOLOAD.ITCM.DATA_END =.;
SDK_AUTOLOAD.ITCM.END =.;
SDK_AUTOLOAD.ITCM.TEXT_SIZE = SDK_AUTOLOAD.ITCM.TEXT_END - SDK_AUTOLOAD.ITCM.TEXT_START;
SDK_AUTOLOAD.ITCM.DATA_SIZE = SDK_AUTOLOAD.ITCM.DATA_END - SDK_AUTOLOAD.ITCM.DATA_START;
SDK_AUTOLOAD.ITCM.SIZE = SDK_AUTOLOAD.ITCM.END - SDK_AUTOLOAD.ITCM.START;
SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.ITCM.SIZE;
} > ITCM
.ITCM.bss:
{
ALIGNALL(4); . = ALIGN(32);
#
# BSS BLOCK
#
SDK_AUTOLOAD.ITCM.BSS_START = .;
#:::::::::: bss
. = ALIGN(4);
. = ALIGN(4);
. = ALIGN(4);
* (.itcm.bss)
. = ALIGN(4);
#:::::::::: bss
. = ALIGN(32);
SDK_AUTOLOAD.ITCM.BSS_END = .;
SDK_AUTOLOAD.ITCM.BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_END - SDK_AUTOLOAD.ITCM.BSS_START;
} >> ITCM
.DTCM:
{
ALIGNALL(4); . = ALIGN(32);
#
# TEXT BLOCK: READ ONLY
#
SDK_AUTOLOAD_DTCM_ID =1;
SDK_AUTOLOAD.DTCM.ID =1;
SDK_AUTOLOAD.DTCM.START =.;
SDK_AUTOLOAD.DTCM.TEXT_START =.;
#:::::::::: text/rodata
. = ALIGN(4);
. = ALIGN(4);
. = ALIGN(4);
#:::::::::: text/rodata
SDK_AUTOLOAD.DTCM.TEXT_END =.;
#
# DATA BLOCK: READ WRITE BLOCK
#
SDK_AUTOLOAD.DTCM.DATA_START =.;
#:::::::::: data
. = ALIGN(4);
. = ALIGN(4);
* (.dtcm)
. = ALIGN(4);
#:::::::::: data
. = ALIGN(32);
SDK_AUTOLOAD.DTCM.DATA_END =.;
SDK_AUTOLOAD.DTCM.END =.;
SDK_AUTOLOAD.DTCM.TEXT_SIZE = SDK_AUTOLOAD.DTCM.TEXT_END - SDK_AUTOLOAD.DTCM.TEXT_START;
SDK_AUTOLOAD.DTCM.DATA_SIZE = SDK_AUTOLOAD.DTCM.DATA_END - SDK_AUTOLOAD.DTCM.DATA_START;
SDK_AUTOLOAD.DTCM.SIZE = SDK_AUTOLOAD.DTCM.END - SDK_AUTOLOAD.DTCM.START;
SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.DTCM.SIZE;
} > DTCM
.DTCM.bss:
{
ALIGNALL(4); . = ALIGN(32);
#
# BSS BLOCK
#
SDK_AUTOLOAD.DTCM.BSS_START = .;
#:::::::::: bss
. = ALIGN(4);
. = ALIGN(4);
* (.dtcm.bss)
. = ALIGN(4);
. = ALIGN(4);
#:::::::::: bss
. = ALIGN(32);
SDK_AUTOLOAD.DTCM.BSS_END = .;
SDK_AUTOLOAD.DTCM.BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_END - SDK_AUTOLOAD.DTCM.BSS_START;
} >> DTCM
SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START;
SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END;
SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END;
SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE;
SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE;
SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START;
SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END;
SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END;
SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE;
SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE;
############################ AUTOLOAD_INFO ##########################
.binary.AUTOLOAD_INFO:
{
WRITEW ADDR(.ITCM);
WRITEW SDK_AUTOLOAD.ITCM.SIZE;
WRITEW SDK_AUTOLOAD.ITCM.BSS_SIZE;
WRITEW ADDR(.DTCM);
WRITEW SDK_AUTOLOAD.DTCM.SIZE;
WRITEW SDK_AUTOLOAD.DTCM.BSS_SIZE;
} > binary.AUTOLOAD_INFO
SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE;
SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO);
SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO);
############################ STATIC_FOOTER ##########################
.binary.STATIC_FOOTER:
{
WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE
WRITEW _start_ModuleParams - ADDR(.main);
WRITEW 0; # NO DIGEST
} > binary.STATIC_FOOTER
############################ OVERLAYS ###############################
SDK_OVERLAY_NUMBER = 0;
############################ MAIN EX ##################################
# MAIN EX Area
.dummy.MAIN_EX:
{
. = ALIGN(32);
} > dummy.MAIN_EX
############################ ARENA ##################################
.arena.MAIN:
{
. = ALIGN(32);
SDK_SECTION_ARENA_START =.;
} > arena.MAIN
.arena.MAIN_EX:
{
. = ALIGN(32);
SDK_SECTION_ARENA_EX_START =.;
} > arena.MAIN_EX
.arena.ITCM:
{
. = ALIGN(32);
SDK_SECTION_ARENA_ITCM_START =.;
} > arena.ITCM
.arena.DTCM:
{
. = ALIGN(32);
SDK_SECTION_ARENA_DTCM_START =.;
} > arena.DTCM
############################ OVERLAYDEFS ############################
.main_defs:
{
### main module information
WRITEW ADDR(.main); # load address
WRITEW _start; # entry address
WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module
WRITEW _start_AutoloadDoneCallback; # callback autoload done
### overlay filename
} > main_defs
############################ OVERLAYTABLE ###########################
.main_table:
{
} > main_table
############################ OTHERS #################################
SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START;
SDK_IRQ_STACKSIZE = 1024; # allocated in DTCM
SDK_SYS_STACKSIZE = 0; # when 0 means all remains of DTCM
# Module filelist
.binary.MODULE_FILES:
{
WRITES ("main.sbin");
WRITES ("main_defs.sbin");
WRITES ("main_table.sbin");
} > binary.MODULE_FILES
# ITCM/DTCM size checker => check AUTOLOAD_ITCM/DTCM
.check.ITCM:
{
. = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE;
} > check.ITCM
SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1;
.check.DTCM:
{
. = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE;
. = . + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN;
} > check.DTCM
}

View File

@ -0,0 +1,45 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_MultiCellAnimation
File: Nitro_TS.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
/*
header file to include NITRO precompile header file
*/
#if !__option (precompile)
#ifdef __cplusplus
/* include precompiled header for C++ source */
#ifdef SDK_DEBUG
#include "Nitro_TS_Debug.mch++" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch++" */
#elif SDK_RELEASE
#include "Nitro_TS_Release.mch++" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch++" */
#elif SDK_FINALROM
#include "Nitro_TS_ROM.mch++" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch++" */
#else
#error("no SDK_ define")
#endif
#else
/* include precompiled header for C source */
#ifdef SDK_DEBUG
#include "Nitro_TS_Debug.mch" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch" */
#elif SDK_RELEASE
#include "Nitro_TS_Release.mch" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch" */
#elif SDK_FINALROM
#include "Nitro_TS_ROM.mch" /* If a compile error occurs in this line, please precompile "Nitro_TS.pch" */
#else
#error("no SDK_ define")
#endif
#endif
#endif

View File

@ -0,0 +1,22 @@
/*
precompiled header for NITRO C target
*/
/* include precompiled header for C source */
#ifdef SDK_DEBUG
#pragma precompile_target "Nitro_TS_Debug.mch"
#elif SDK_RELEASE
#pragma precompile_target "Nitro_TS_Release.mch"
#elif SDK_FINALROM
#pragma precompile_target "Nitro_TS_ROM.mch"
#else
#error("no SDK_ define")
#endif
/* include header for NITRO */
#include <nitro_TS_prefix.h>
#include <nitro.h>
/* include header for NITRO-System */
#include <nnsys_prefix.h>
#include <nnsys.h>

View File

@ -0,0 +1,21 @@
/*
precompiled header for NITRO C++ target
*/
/* include precompiled header for C++ source */
#ifdef SDK_DEBUG
#pragma precompile_target "Nitro_TS_Debug.mch++"
#elif SDK_RELEASE
#pragma precompile_target "Nitro_TS_Release.mch++"
#elif SDK_FINALROM
#pragma precompile_target "Nitro_TS_ROM.mch++"
#else
#error("no SDK_ define")
#endif
/* include header for NITRO */
#include <nitro_TS_prefix.h>
#include <nitro.h>
/* include header for NITRO-System */
#include <nnsys_prefix.h>
#include <nnsys.h>

View File

@ -0,0 +1,98 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - IDE - IDE_MultiCellAnimation
# File: ROM-TS.rsf
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
#
# Nitro ROM SPEC FILE
#
Arm9
{
Static "$(MAKEROM_ARM9:r).sbin$(COMPSUFFIX9)"
OverlayDefs "$(MAKEROM_ARM9:r)_defs.sbin$(COMPSUFFIX9)"
OverlayTable "$(MAKEROM_ARM9:r)_table.sbin$(COMPSUFFIX9)"
Elf "$(MAKEROM_ARM9:r).nef"
}
Arm7
{
Static "$(MAKEROM_ARM7:r).sbin$(COMPSUFFIX7)"
OverlayDefs "$(MAKEROM_ARM7:r)_defs.sbin$(COMPSUFFIX7)"
OverlayTable "$(MAKEROM_ARM7:r)_table.sbin$(COMPSUFFIX7)"
Elf "$(MAKEROM_ARM7:r).nef"
}
Property
{
###
### Settings for FinalROM
###
#### BEGIN
#
# TITLE NAME: Your product name within 12bytes
#
#TitleName "YourAppName"
#
# MAKER CODE: Your company ID# in 2 ascii words
# issued by NINTENDO
#
#MakerCode "00"
#
# REMASTER VERSION: Mastering version
#
#RomVersion 0
#
# ROM SPEED TYPE: [MROM/1TROM/UNDEFINED]
#
RomSpeedType $(MAKEROM_ROMSPEED)
#
# ROM SIZE: in bit [64M/128M/256M/512M/1G/2G]
#
#RomSize 128M
#RomSize 256M
#
# ROM PADDING: TRUE if finalrom
#
#RomFootPadding TRUE
#
# ROM HEADER TEMPLATE: Provided to every product by NINTENDO
#
#RomHeaderTemplate ./etc/rom_header.template.sbin
#
# BANNER FILE: generated from Banner Spec File
#
#BannerFile ./etc/myGameBanner.bnr
BannerFile $(NITROSDK_ROOT)/include/nitro/specfiles/default.bnr
###
###
###
#### END
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot $(MAKEROM_ROMROOT)
Root /
File $(MAKEROM_ROMFILES)
}

View File

@ -0,0 +1,145 @@
===========================================================================
Stationery for Nitro SDK 3.0
Japanese description is available at the second half of this file.
===========================================================================
This stationery uses precompiled headers.
1. The files and settings relating to the use of the precompiled header.
- Nitro_TS.pch
This is the pch file to generate a mch file which is used by the C source.
The actual mch file name depends on the build target you chose.
"nitro_TS_prefix.h" and "nitro.h" are included in the precompiled header.
If you want to include other header files in the precompiled header, please
add the files to the bottom of this pch file.
- Nitro_TS.pch++
This is the pch file to generate a mch file which is used by the C++ source.
The actual mch file name depends on the build target you chose.
"nitro_TS_prefix.h" and "nitro.h" are included in the precompiled header.
If you want to include other header files in the precompiled header, please
add the files to the bottom of this pch file.
- Nitro_TS.h
This is the header file for each C and C++ source file to include
the proper precompiled header.
This header file is included from the Prefix Text field in the C/C++
Preprocessor panel thus making it automatically included in each
C/C++ source file.
- The settings in the C/C++ Preprocessor panel
The settings in the C/C++ Preprocessor panel ("Target Settings"
-> "Language Settings" -> "C/C++ Preprocessor") is the following.
1) "Nitro_TS.h" is included by the Prefix Text.
2) "nitro_TS_prefix.h" is not included by the Prefix Text.
3) "Use prefix text in precompiled header" is checked.
2. The behavior when building is as follows.
1) Nitro_TS.pch (or Nitro_TS.pch++) is precompiled.
The mch file with the proper file name is generated.
2) Each C source and each C++ source is compiled.
Nitro_TS.h is included by the Prefix Text in the C/C++
Preprocessor panel.
The proper mch file is included.
3. If you don't want to use precompiled headers, please follow the steps below.
1) Remove Nitro_TS.pch from Project.
2) Remove Nitro_TS.pch++ from Project.
3) Remove Nitro_TS.h from Project.
4) Change the contents of Prefix Text field on C/C++ Preprocessor panel.
- Remove the line " #include "Nitro_TS.h" ".
- Remove the comment out of the line "#include <nitro_TS_prefix.h>" to
make this #include effective.
4. You may be able to remove Nitro_TS.pch or Nitro_TS.pch++.
Both of Nitro_TS.pch and Nitro_TS.pch++ are used in both the stationery
for C and C++ Project because both C and C++ source may be used
in one Project.
- If the precompiled header for C++ is unnecessary in your C Project,
you can remove the Nitro_TS.pch++ from your Project.
- If the precompiled header for C is unnecessary in your C++ Project,
you can remove the Nitro_TS.pch from your Project.
/*--- The lines below are written in Japanese character set ---*/
===========================================================================
Nitro SDK 3.0 用ステーショナリ
プリコンパイルヘッダの使用について
===========================================================================
このステーショナリではプリコンパイルヘッダを使用しています。
1.プリコンパイルヘッダの使用に関連した設定、ファイル
・ Nitro_TS.pch
Cソースが使うmchファイルを生成する為のpchファイルです。
生成されるmchファイルのファイル名はビルドターゲットによって異なります。
プリコンパイルヘッダには nitro_TS_prefix.h と nitro.h を含めています。
ユーザーが用意したヘッダファイルも含める場合は、このファイルの末尾に
追記して下さい。
・ Nitro_TS.pch++
C++ソースが使うmchファイルを生成する為のpchファイルです。
生成されるmchファイルのファイル名はビルドターゲットによって異なります。
プリコンパイルヘッダには nitro_TS_prefix.h と nitro.h を含めています。
ユーザーが用意したヘッダファイルも含める場合は、このファイルの末尾に
追記して下さい。
・ Nitro_TS.h
各Cソース又はC++ソースが適切なプリコンパイルヘッダをインクルードする
為のヘッダファイルです。
各Cソース又はC++ソースのコンパイル時に必ずこのヘッダファイルが使用
されるように、ターゲット設定パネル 言語設定 C/C++ Preprocessor の
Prefix Text でインクルードされています。
・ C/C++ Preprocessor パネル内の設定
ターゲット設定パネル 言語設定 C/C++ Preprocessor において次の設定
がされています。
1) Nitro_TS.h を Prefix Text でインクルードする
2) nitro_TS_prefix.h は Prefix Text ではインクルードしない
3) Use prefix text in precompiled header チェックボックスがオン
2.ビルド時の動きは下記のようになります。
1) Nitro_TS.pch またはNitro_TS.pch++)がプリコンパイルされ、ビルド
ターゲットに応じた適切なファイル名のmchファイルが生成される。
2) 各Cソース又はC++ソースがコンパイルされる。
この時、C/C++ Preprocessorパネルの Prefix Textの指定により、Nitro_TS.h
が暗黙的にインクルードされ、適切なファイル名のmchファイルがインクルード
される。
3.プリコンパイルヘッダを使用しない構成に変更するには、下記の手順を行って
下さい。
1) プロジェクトから Nitro_TS.pch を削除する
2) プロジェクトから Nitro_TS.pch++ を削除する
3) プロジェクトから Nitro_TS.h を削除する
4) ターゲット設定パネル 言語設定 C/C++ Preprocessor の Prefix Text の
内容について、下記の変更を行う
・「#include "Nitro_TS.h"」の行を削除する。
・「#include <nitro_TS_prefix.h>」の行のコメントアウトを解除し、
このインクルードを有効にする。
4.不要な Nitro_TS.pch 又は Nitro_TS.pch++ について。
Cのプロジェクト用のステーショナリ及びC++プロジェクト用のステーショナリ
の両方において、Cソース及びC++ソースが混在可能とする為に、Nitro_TS.pch と
Nitro_TS.pch++ の両方が組み込まれています。
もし、CのプロジェクトでC++用のプリコンパイルヘッダが全く不要であるな
らば、プロジェクトから Nitro_TS.pch++ を削除して頂いてかまいません。
同様に、C++のプロジェクトでC用のプリコンパイルヘッダが全く不要である
ならば、プロジェクトから Nitro_TS.pch を削除して頂いてかまいません。

View File

@ -0,0 +1,484 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - IDE - IDE_MultiCellAnimation
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// マルチセルアニメーションを描画、更新するサンプル
// 異なる方式で実体を初期化し、パフォーマンスを比較することができます。
//
// 操作方法
// 十字キー上下 再生速度変更
// A 再生<=>停止切り替え
// B 順方向<=>逆方向再生切り替え
// X マルチセルアニメーションの実体の種類を変更する
// Y マルチセルアニメーションのリセット
// ============================================================================
// プリコンパイルヘッダを使用する。
// #include <nitro.h>
// #include <nnsys/g2d.h>
#include "g2d_demolib.h"
#define NUM_OF_OAM 128 // OAMマネージャ管理対象のOAM数
#define NUM_OF_AFFINE (NUM_OF_OAM/4) // OAMマネージャ管理対象のAffineパラメータ数
#define ANIM_SPEED_UNIT (FX32_ONE >> 3) // アニメーション速度の変化差分
//
// マルチセル実体の種類
// pMCAnim_ 配列にアクセスする際に使用されます
//
typedef enum
{
MCANIM_SHARE_CELLANIM = 0x0,
MCANIM_DONOT_SHARE_CELLANIM = 0x1
}MyMCAnimType;
static const char* mcAnimTypeStr [] =
{
" ShareCellAnim",
"DoNotShareCellAnim"
};
static const int CvtTblToNNSG2dMCType [] =
{
NNS_G2D_MCTYPE_SHARE_CELLANIM,
NNS_G2D_MCTYPE_DONOT_SHARE_CELLANIM
};
// Cell 表示位置
static const NNSG2dFVec2 CELL_POSITION = {120 << FX32_SHIFT, 150 << FX32_SHIFT};
//
// MultiCellAnimation 実体
// 異なる2つの方式で実体を初期化します。
//
static NNSG2dMultiCellAnimation mcAnim[2];
// OAMアトリビュート一時バッファ
static GXOamAttr tempOamBuffer[NUM_OF_OAM];
//
// マルチセルバンク
//
static NNSG2dMultiCellDataBank* pMCBank = NULL; // マルチセルデータ
//------------------------------------------------------------------------------
// プロトタイプ宣言
static void InitOamManager(NNSG2dOamManagerInstance* pOamManager);
static void LoadResources();
static void ProcessInput(fx32* pAnimSpeed, NNSG2dAnimController* pAnimCtrl);
void VBlankIntr(void);
/*---------------------------------------------------------------------------*
Name: InitOamManager
Description: OAMマネージャシステムとOAMマネージャの初期化を行います
Arguments: pOamManager: OAMマネージャへのポインタ
Returns:
*---------------------------------------------------------------------------*/
static void InitOamManager(NNSG2dOamManagerInstance* pOamManager)
{
BOOL result;
// Oam Manager システムの初期化
NNS_G2dInitOamManagerModule();
result = NNS_G2dGetNewManagerInstance(
pOamManager,
0,
NUM_OF_OAM - 1,
NNS_G2D_OAMTYPE_MAIN );
SDK_ASSERT( result );
result = NNS_G2dInitManagerInstanceAffine( pOamManager, 0, NUM_OF_AFFINE - 1 );
SDK_ASSERT( result );
}
/*---------------------------------------------------------------------------*
Name: InitMultiCellInstance_
Description:
Returns:
*---------------------------------------------------------------------------*/
static void InitMultiCellInstance_
(
NNSG2dMultiCellAnimation* pMCAnim,
NNSG2dCellAnimBankData* pAnimBank,
NNSG2dCellDataBank* pCellBank,
NNSG2dMultiCellDataBank* pMCBank,
NNSG2dMultiCellAnimBankData* pMCABank,
NNSG2dMCType mcType
)
{
// 初期化に必要なワークメモリのサイズを取得します
const u32 szWork = NNS_G2dGetMCWorkAreaSize( pMCBank, mcType );
void* pWorkMem = G2DDemo_Alloc( szWork );
// 初期化
NNS_G2dInitMCAnimationInstance( pMCAnim,
pWorkMem,
pAnimBank,
pCellBank,
pMCBank,
mcType );
SDK_NULL_ASSERT( pMCAnim );
// マルチセルアニメーションに再生するシーケンスをセット
{
const NNSG2dMultiCellAnimSequence* pSequence = NULL;
// 再生するシーケンスを取得
pSequence = NNS_G2dGetAnimSequenceByIdx( pMCABank, 0 );
SDK_ASSERT( pSequence );
NNS_G2dSetAnimSequenceToMCAnimation( pMCAnim, pSequence);
}
}
/*---------------------------------------------------------------------------*
Name: LoadResources
Description:
Arguments: ppMCAnim:
Returns:
*---------------------------------------------------------------------------*/
static void LoadResources()
{
void* pBuf;
//
// MultiCell 関連初期化
//
{
NNSG2dCellDataBank* pCellBank = NULL; // セルデータ
NNSG2dCellAnimBankData* pAnimBank = NULL; // セルアニメーション
NNSG2dMultiCellAnimBankData* pMCABank = NULL; // マルチセルアニメーション
// セルデータ、セルアニメーション、マルチセルデータ、
// マルチセルアニメーションをロード。
// これらは最後までメインメモリ上で使用するので pBuf を解放しません。
pBuf = G2DDemo_LoadNCER( &pCellBank, "data/MultiCellAnimation.NCER" );
SDK_NULL_ASSERT( pBuf );
pBuf = G2DDemo_LoadNANR( &pAnimBank, "data/MultiCellAnimation.NANR" );
SDK_NULL_ASSERT( pBuf );
pBuf = G2DDemo_LoadNMCR( &pMCBank, "data/MultiCellAnimation.NMCR" );
SDK_NULL_ASSERT( pBuf );
pBuf = G2DDemo_LoadNMAR( &pMCABank, "data/MultiCellAnimation.NMAR" );
SDK_NULL_ASSERT( pBuf );
//
// マルチセルアニメーションの実体を初期化します
// 異なる方式で2つの実体を初期化します。
//
InitMultiCellInstance_( &mcAnim[MCANIM_SHARE_CELLANIM],
pAnimBank,
pCellBank,
pMCBank,
pMCABank,
NNS_G2D_MCTYPE_SHARE_CELLANIM );
InitMultiCellInstance_( &mcAnim[MCANIM_DONOT_SHARE_CELLANIM],
pAnimBank,
pCellBank,
pMCBank,
pMCABank,
NNS_G2D_MCTYPE_DONOT_SHARE_CELLANIM );
}
//
// VRAM 関連の初期化
//
{
// Loading NCG (Character Data)
{
NNSG2dCharacterData* pCharData = NULL;
pBuf = G2DDemo_LoadNCGR( &pCharData, "data/MultiCellAnimation.NCGR" );
SDK_NULL_ASSERT( pBuf );
// Loading For 2D Graphics Engine.
DC_FlushRange( pCharData->pRawData, pCharData->szByte );
GX_LoadOBJ( (void*)pCharData->pRawData, 0, pCharData->szByte );
// キャラクタデータを VRAM にコピーしたので
// この pBuf は開放します。以下同じ。
G2DDemo_Free( pBuf );
}
// Loading NCL (Palette Data)
{
NNSG2dPaletteData* pPltData = NULL;
pBuf = G2DDemo_LoadNCLR( &pPltData, "data/MultiCellAnimation.NCLR" );
SDK_NULL_ASSERT( pBuf );
// Loading For 2D Graphics Engine.
DC_FlushRange( pPltData->pRawData, pPltData->szByte );
GX_LoadOBJPltt( (void*)pPltData->pRawData, 0, pPltData->szByte );
G2DDemo_Free( pBuf );
}
}
}
/*---------------------------------------------------------------------------*
Name: ProcessInput
Description:
Arguments: pAnimSpeed:
pAnimCtrl:
A / B /
Returns:
*---------------------------------------------------------------------------*/
static void ProcessInput(fx32* pAnimSpeed, NNSG2dAnimController* pAnimCtrl)
{
G2DDemo_ReadGamePad();
// change animation speed.
{
if (G2DDEMO_IS_TRIGGER(PAD_KEY_UP))
{
*pAnimSpeed +=ANIM_SPEED_UNIT;
}
if (G2DDEMO_IS_TRIGGER(PAD_KEY_DOWN))
{
*pAnimSpeed -= ANIM_SPEED_UNIT;
if( *pAnimSpeed < 0 )
{
*pAnimSpeed = 0;
}
}
}
// 再生制御
{
if (G2DDEMO_IS_TRIGGER(PAD_BUTTON_B ))
{
pAnimCtrl->bReverse = ! pAnimCtrl->bReverse;
}
if (G2DDEMO_IS_TRIGGER(PAD_BUTTON_A ))
{
pAnimCtrl->bActive = ! pAnimCtrl->bActive;
}
}
}
//--------------------------------------------------------------------------------------------------------
//マルチセルの描画
static void AppDraw
(
const NNSG2dMultiCellAnimation* pMcAnim,
NNSG2dOamManagerInstance* pOamMgr
)
{
// 描画
//
// 低レベルな描画方法で MultiCell を描画します。
// 上位モジュールの G2dRenderer を 利用する描画方法もあります。
//
//
{
u16 numOamDrawn = 0; // 残り OAM 数
const NNSG2dMultiCellInstance* pMultiCell = &(pMcAnim->multiCellInstance); // 表示する MultiCell
SDK_NULL_ASSERT( pMultiCell );
//
// MultiCell と等価な OBJリストをテンポラリに書き出します
//
numOamDrawn = NNS_G2dMakeSimpleMultiCellToOams(
tempOamBuffer, // 出力先Oamバッファ
NUM_OF_OAM, // 出力先バッファ長
pMultiCell, // 出力対象 MultiCell
NULL, // Affine 変換
&CELL_POSITION, // オフセット位置
NULL, // Affine Index
FALSE ); // 倍角Affineか
SDK_ASSERT( numOamDrawn < NUM_OF_OAM );
// OAMマネージャへOBJリストを登録します
(void)NNS_G2dEntryOamManagerOam( pOamMgr, tempOamBuffer, numOamDrawn );
}
}
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain()
{
NNSG2dOamManagerInstance oamManager; // Oam マネージャ実体
MyMCAnimType mcAnimType = MCANIM_SHARE_CELLANIM;
// Initialize App.
{
G2DDemo_CommonInit();
G2DDemo_PrintInit();
InitOamManager( &oamManager );
LoadResources();
// start display
{
SVC_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
}
//----------------------------------------------------
// Main loop
while( TRUE )
{
static fx32 animSpeed = FX32_ONE; // アニメーションスピード
static OSTick time = 0;
NNSG2dMultiCellAnimation* pMcAnim = &mcAnim[mcAnimType];
//
// ------ Pad handling.
//
{
ProcessInput(&animSpeed, NNS_G2dGetMCAnimAnimCtrl(pMcAnim));
// ---- マルチセルアニメーション実体の種類を切り替えます。
if (G2DDEMO_IS_TRIGGER(PAD_BUTTON_X ))
{
if( mcAnimType == MCANIM_SHARE_CELLANIM )
{
mcAnimType = MCANIM_DONOT_SHARE_CELLANIM;
}else{
mcAnimType = MCANIM_SHARE_CELLANIM;
}
}
// ---- リセット
if (G2DDEMO_IS_PRESS(PAD_BUTTON_Y ))
{
NNS_G2dRestartMCAnimation( pMcAnim );
}
}
// ------ 描画
//
// 下位レベルの描画APIを利用して MultiCell を描画します。
// 上位モジュールの G2dRenderer を 利用する描画方法もあります。
//
//
AppDraw( pMcAnim, &oamManager );
// ------ アニメーションの更新
// 描画されている方の更新にかかった時間を計測します
{
u32 i;
for( i = 0; i < 2; i++ )
{
if( i == mcAnimType )
{
time = OS_GetTick();
NNS_G2dTickMCAnimation( &mcAnim[i], animSpeed );
time = OS_GetTick()- time;
}else{
NNS_G2dTickMCAnimation( &mcAnim[i], animSpeed );
}
}
}
// ------ デバック文字列を描画します
{
const NNSG2dAnimController* pAnimCtrl = NNS_G2dGetMCAnimAnimCtrl(pMcAnim);
G2DDemo_PrintOutf(0, 0, "speed: %7.3f", (float)animSpeed / FX32_ONE );
G2DDemo_PrintOutf(0, 1, "frame: %3d / %3d",
pAnimCtrl->pCurrent - pAnimCtrl->pAnimSequence->pAnmFrameArray,
pAnimCtrl->pAnimSequence->numFrames );
G2DDemo_PrintOutf( 0, 2, "TIMEForUpdate :%06ld usec", OS_TicksToMicroSeconds(time) );
// 現在の実体の初期化に必要なワークメモリのサイズ
G2DDemo_PrintOutf( 0, 3, "szWorkMem:%06ld byte",
NNS_G2dGetMCWorkAreaSize( pMCBank,
(NNSG2dMCType)CvtTblToNNSG2dMCType[ mcAnimType ] ) );
// 現在の実体の種類
G2DDemo_PrintOutf( 0, 4, "Type :%s", mcAnimTypeStr[mcAnimType] );
G2DDemo_PrintOut(19, 0, "Active:");
G2DDemo_PrintOut(28, 0, NNS_G2dIsAnimCtrlActive(pAnimCtrl) ? "yes": " no");
G2DDemo_PrintOut(19, 1, "Reverse:");
G2DDemo_PrintOut(28, 1, pAnimCtrl->bReverse ? "yes": " no");
}
// ------ V Blank 待ち
SVC_WaitVBlankIntr();
G2DDemo_PrintApplyToHW(); // アニメーション情報をHWに書き出します
// ------ マネージャの内容をHWに書き出します
{
NNS_G2dApplyOamManagerToHW ( &oamManager );
NNS_G2dResetOamManagerBuffer ( &oamManager );
}
}
}
/*---------------------------------------------------------------------------*
Name: VBlankIntr
Description: Vブランク割り込みを処理します
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void VBlankIntr(void)
{
OS_SetIrqCheckFlag( OS_IE_V_BLANK ); // checking VBlank interrupt
}

View File

@ -0,0 +1,60 @@
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
 CodeWarrior IDE プロジェクトサンプル
                               [ 2007.08.01 ]
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
目次
==============================================================================
  1. はじめに
  2. プロジェクトサンプルについて
  3. プロジェクトの注意事項
1. はじめに
==============================================================================
  このディレクトリには、CodeWarrior IDE のプロジェクトのサンプルが格納されて
  います。これらのサンプルは、NITRO-System/docs/IDE_BuildGuide.pdfで説明して
  いますIDE プロジェクトの作成手順に従って作成したものとなります。(若干、プ
  ロジェクト内容を整理しています。)
2. プロジェクトサンプルについて
==============================================================================
  IDE プロジェクトサンプルの内容は、下記の通りです。
  ・IDE_Archive
    fnd ライブラリのArchive サンプルをCodeWarrior IDE を使ってビルドを行う
    ためのプロジェクトです。プリコンパイルヘッダを利用する設定になっていま
    す。
  ・IDE_MultiCellAnimation
    g2d ライブラリのMultiCellAnimationサンプルをCodeWarrior IDE を使ってビ
    ルドを行うためのプロジェクトです。
    プライベートなライブラリg2d デモライブラリ)を使用する場合のプロジェ
    クトの例となっています。プリコンパイルヘッダを利用する設定になっていま
    す。
  ・IDE_G2dDemoLib
    g2d サンプル専用のプライベートなデモライブラリをCodeWarrior IDE を使っ
    てビルドするためのプロジェクトです。プリコンパイルヘッダを利用しない設
    定になっています。
3. プロジェクトの注意事項
==============================================================================
  デモライブラリ(libg2d_demo.a) が格納されるディレクトリが存在しない状態で、
  IDE_MultiCellAnimationプロジェクトを開きますと、プロジェクトウィンドウ内に
  新しくlibg2d_demo.aが追加されてしまうようです。
  これを防ぐために、IDE_G2dDemoLibプロジェクトには予めデモライブラリを格納す
  るためのディレクトリを作成しています。

View File

@ -0,0 +1,28 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 344 $
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBMAKES := $(wildcard $(addsuffix /Makefile,$(NNS_ALLLIBS)))
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,33 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - fnd
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = \
heap \
archive \
archive2
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,40 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - fnd - archive
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = fnd
SUBDIRS =
#----------------------------------------------------------------------------
SRCS = main.c sdk_init.c nns_util.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ./
MAKEROM_ROMFILES = data/*.*
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

Binary file not shown.

View File

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - archive
File: nns_util.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef NNS_UTIL_H_
#define NNS_UTIL_H_
#include <nitro.h>
#include <nnsys/fnd.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
u16 trigger;
u16 release;
u16 button;
}
GamePad;
extern GamePad gGamePad;
extern NNSFndHeapHandle gSysHeap; // システムヒープ
extern NNSFndHeapHandle gAppHeap; // アプリケーションヒープ
#define IS_TRIGGER(key) (gGamePad.trigger & key)
#define IS_RELEASE(key) (gGamePad.release & key)
#define IS_PRESS(key) (gGamePad.button & key)
#define ROUND_UP(value, alignment) \
(((u32)(value) + (alignment-1)) & ~(alignment-1))
#define ROUND_DOWN(value, alignment) \
((u32)(value) & ~(alignment-1))
void ReadGamePad(void);
void InitMemory(void);
NNSFndArchive* LoadArchive(const char* name, const char* path);
void RemoveArchive(NNSFndArchive* archive);
#ifdef __cplusplus
}/* extern "C" */
#endif
// NNS_UTIL_H_
#endif

View File

@ -0,0 +1,20 @@
/*****************************************************************************
Archive file index definition.
File: picture.naix
This file was created by NINTENDO NITRO-System Archiver.
Update:2004-05-26T17:45:19
*****************************************************************************/
#ifndef NARC_PICTURE_NAIX_
#define NARC_PICTURE_NAIX_
enum {
NARC_picture_dog256_chr = 0,
NARC_picture_dog256_pal = 1,
NARC_picture_dog256_scn = 2
};
/* NARC_PICTURE_NAIX_ */
#endif

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - archive
File: sdk_init.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef SDK_INIT_H_
#define SDK_INIT_H_
#include <nitro.h>
#ifdef __cplusplus
extern "C" {
#endif
void VBlankIntr(void);
void InitSystem(void);
void InitVRAM(void);
void InitDisplay(void);
#ifdef __cplusplus
}/* extern "C" */
#endif
// SDK_INIT_H_
#endif

View File

@ -0,0 +1,92 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - archive
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "sdk_init.h"
#include "nns_util.h"
// アーカイブのインデックス定義ファイル
#include "picture.naix"
static void LoadPicture(void);
/* -------------------------------------------------------------------------
Name: NitroMain
Description:
Arguments:
Returns:
------------------------------------------------------------------------- */
void
NitroMain(void)
{
InitSystem();
InitMemory();
InitVRAM();
InitDisplay();
LoadPicture();
G2_SetBG0Offset(0,20);
for(;;)
{
SVC_WaitVBlankIntr();
ReadGamePad();
}
}
/*---------------------------------------------------------------------------*
Name: LoadPicture
Description:
VRAMに転送します
VRAMに転送した後
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void
LoadPicture(void)
{
NNSFndArchive* archive;
// アーカイブをメインメモリに読み込み、ファイルシステムにマウントします。
// LoadArchive()内でDC_FlushRange()の呼び出しが行われています。
// LoadArchive()は、nns_util.c内にあります。
if ((archive = LoadArchive("PCT", "/data/picture.narc")) != NULL)
{
// パス名を指定してデータを取得。
void* chrData = NNS_FndGetArchiveFileByName("PCT:/picture/dog/dog256.chr");
void* scnData = NNS_FndGetArchiveFileByName("PCT:/picture/dog/dog256.scn");
// インデックスを指定してデータを取得。
void* palData = NNS_FndGetArchiveFileByIndex(archive, NARC_picture_dog256_pal);
// データをVRAMのロード。
GX_LoadBG0Char(chrData, 0, 0x10000);
GX_LoadBG0Scr (scnData, 0, 0x00800);
GX_LoadBGPltt (palData, 0, 0x00200);
// VRAMにデータをロードした後は、メインメモリ上のデータは不要な為、
// アーカイブを削除します。
// RemoveArchive()は、nns_util.c内にあります。
RemoveArchive(archive);
}
}

View File

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - archive
File: nns_util.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "nns_util.h"
#define SYSTEM_HEAP_SIZE 64*1024
GamePad gGamePad; // ゲームパッド
NNSFndHeapHandle gSysHeap; // システムヒープ    (拡張ヒープを使用)
NNSFndHeapHandle gAppHeap; // アプリケーションヒープ(拡張ヒープを使用)
/*---------------------------------------------------------------------------*
Name: InitMemory
Description:
NITRO-Systemの拡張ヒープを使用しています
SYSTEM_HEAP_SIZE分をメインア
使
使使
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitMemory(void)
{
void* sysHeapMemory = OS_AllocFromMainArenaLo(SYSTEM_HEAP_SIZE, 16);
u32 arenaLow = ROUND_UP (OS_GetMainArenaLo(), 16);
u32 arenaHigh = ROUND_DOWN(OS_GetMainArenaHi(), 16);
u32 appHeapSize = arenaHigh - arenaLow;
void* appHeapMemory = OS_AllocFromMainArenaLo(appHeapSize, 16);
gSysHeap = NNS_FndCreateExpHeap(sysHeapMemory, SYSTEM_HEAP_SIZE);
gAppHeap = NNS_FndCreateExpHeap(appHeapMemory, appHeapSize );
}
/*---------------------------------------------------------------------------*
Name: LoadArchive
Description:
DC_FlushRange
NNSFndArchive
Arguments: name:
path:
Returns: NNSFndArchive
NULLを返します
*---------------------------------------------------------------------------*/
NNSFndArchive*
LoadArchive(const char* name, const char* path)
{
FSFile file;
NNSFndArchive* archive = NULL;
FS_InitFile(&file);
if (FS_OpenFile(&file, path))
{
u32 binarySize = FS_GetLength(&file);
u32 memorySize = ROUND_UP(sizeof(NNSFndArchive), 16) + ROUND_UP(binarySize, 16);
u8* memory = (u8*)NNS_FndAllocFromExpHeapEx(gAppHeap, memorySize, 16);
if (memory != NULL)
{
u8* binary = memory + ROUND_UP(sizeof(NNSFndArchive), 16);
if (FS_ReadFile(&file, binary, (s32)binarySize) == binarySize)
{
DC_FlushRange(binary, binarySize);
if (NNS_FndMountArchive((NNSFndArchive*)memory, name, binary))
{
archive = (NNSFndArchive*)memory;
}
else
{
NNS_FndFreeToExpHeap(gAppHeap, memory);
}
}
}
(void)FS_CloseFile(&file);
}
return archive;
}
/*---------------------------------------------------------------------------*
Name: RemoveArchive
Description:
Arguments: archive: NNSアーカイブ構造体へのポインタ
Returns:
*---------------------------------------------------------------------------*/
void
RemoveArchive(NNSFndArchive* archive)
{
(void)NNS_FndUnmountArchive(archive);
NNS_FndFreeToExpHeap(gAppHeap, archive);
}
/*---------------------------------------------------------------------------*
Name: ReadGamePad
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void ReadGamePad(void)
{
u16 status = PAD_Read();
gGamePad.trigger = (u16)(status & (status ^ gGamePad.button));
gGamePad.release = (u16)(gGamePad.button & (status ^ gGamePad.button));
gGamePad.button = status;
}

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - archive
File: sdk_init.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "sdk_init.h"
#define DEFAULT_DMA_NUMBER MI_DMA_MAX_NUM
/* -------------------------------------------------------------------------
V-blank callback
------------------------------------------------------------------------- */
void
VBlankIntr(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK);
}
/*---------------------------------------------------------------------------*
Name: InitSystem
Description: NITROの初期化を行います
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitSystem(void)
{
OS_Init();
FX_Init();
GX_SetPower(GX_POWER_ALL);
GX_Init();
GX_DispOff();
GXS_DispOff();
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)OS_EnableIrqMask(OS_IE_FIFO_RECV);
(void)OS_EnableIrq();
FS_Init(DEFAULT_DMA_NUMBER);
(void)GX_VBlankIntr(TRUE); // to generate VBlank interrupt request
}
/*---------------------------------------------------------------------------*
Name: InitVRAM
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitVRAM(void)
{
// 全てのバンクをLCDCに割り当てる
GX_SetBankForLCDC(GX_VRAM_LCDC_ALL);
// LCDC空間全てをクリア
MI_CpuClearFast( (void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE );
// LCDCに割り当てられたバンクをDisable
(void)GX_DisableBankForLCDC();
MI_CpuFillFast ((void*)HW_OAM , 192, HW_OAM_SIZE ); // OAM クリア
MI_CpuFillFast ((void*)HW_DB_OAM , 192, HW_DB_OAM_SIZE); // clear OAM
MI_CpuClearFast((void*)HW_PLTT , HW_PLTT_SIZE ); // パレット クリア
MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); // clear the standard palette
}
/*---------------------------------------------------------------------------*
Name: InitDisplay
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitDisplay(void)
{
GX_SetBankForBG (GX_VRAM_BG_128_A ); // バンクAをBGに割り当てる
GX_SetBGCharOffset(GX_BGCHAROFFSET_0x00000);
GX_SetBGScrOffset ( GX_BGSCROFFSET_0x10000);
GX_SetGraphicsMode(
GX_DISPMODE_GRAPHICS, // グラフィックス表示モードにする
GX_BGMODE_0, // BGMODEを0に設定
GX_BG0_AS_2D); // BG0を2D表示に設定
GX_SetVisiblePlane(
GX_PLANEMASK_BG0 // BG0を表示。
);
G2_SetBG0Control(
GX_BG_SCRSIZE_TEXT_256x256, // 256×256ドット
GX_BG_COLORMODE_256, // 256色モード。
GX_BG_SCRBASE_0x0000, // スクリーンベース。
GX_BG_CHARBASE_0x00000, // キャラクタベース。
GX_BG_EXTPLTT_01 // BGExtPlttスロット。
);
GX_DispOn();
}

View File

@ -0,0 +1,40 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - fnd - archive2
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = fnd
SUBDIRS =
#----------------------------------------------------------------------------
SRCS = main.c sdk_init.c nns_util.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ./
MAKEROM_ROMFILES = data/*.*
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - archive2
File: nns_util.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef NNS_UTIL_H_
#define NNS_UTIL_H_
#include <nitro.h>
#include <nnsys/fnd.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
u16 trigger;
u16 release;
u16 button;
}
GamePad;
extern GamePad gGamePad;
extern NNSFndHeapHandle gSysHeap; // システムヒープ
extern NNSFndHeapHandle gAppHeap; // アプリケーションヒープ
#define IS_TRIGGER(key) (gGamePad.trigger & key)
#define IS_RELEASE(key) (gGamePad.release & key)
#define IS_PRESS(key) (gGamePad.button & key)
#define ROUND_UP(value, alignment) \
(((u32)(value) + (alignment-1)) & ~(alignment-1))
#define ROUND_DOWN(value, alignment) \
((u32)(value) & ~(alignment-1))
void ReadGamePad(void);
void InitMemory(void);
NNSFndArchive* LoadCompressedArchive(const char* name, const char* path);
void RemoveArchive(NNSFndArchive* archive);
#ifdef __cplusplus
}/* extern "C" */
#endif
// NNS_UTIL_H_
#endif

View File

@ -0,0 +1,20 @@
/*****************************************************************************
Archive file index definition.
File: picture.naix
This file was created by NINTENDO NITRO-System Archiver.
Update:2004-07-23T13:33:46
*****************************************************************************/
#ifndef NARC_PICTURE_NAIX_
#define NARC_PICTURE_NAIX_
enum {
NARC_picture_flower256_chr = 0,
NARC_picture_flower256_pal = 1,
NARC_picture_flower256_scn = 2
};
/* NARC_PICTURE_NAIX_ */
#endif

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - archive2
File: sdk_init.h
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#ifndef SDK_INIT_H_
#define SDK_INIT_H_
#include <nitro.h>
#ifdef __cplusplus
extern "C" {
#endif
void VBlankIntr(void);
void InitSystem(void);
void InitVRAM(void);
void InitDisplay(void);
#ifdef __cplusplus
}/* extern "C" */
#endif
// SDK_INIT_H_
#endif

View File

@ -0,0 +1,93 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - archive2
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "sdk_init.h"
#include "nns_util.h"
// アーカイブのインデックス定義ファイル
#include "picture.naix"
static void LoadPicture(void);
/* -------------------------------------------------------------------------
Name: NitroMain
Description:
Arguments:
Returns:
------------------------------------------------------------------------- */
void
NitroMain(void)
{
InitSystem();
InitMemory();
InitVRAM();
InitDisplay();
LoadPicture();
G2_SetBG0Offset(0,20);
for(;;)
{
SVC_WaitVBlankIntr();
ReadGamePad();
}
}
/*---------------------------------------------------------------------------*
Name: LoadPicture
Description:
VRAMに転送
VRAMに転送した後
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void
LoadPicture(void)
{
NNSFndArchive* archive;
// 圧縮されたアーカイブをメインメモリに展開し、ファイルシステムにマウントします。
// LoadCompressedArchive()内でDC_FlushRange()の呼び出しが行われています。
// LoadCompressedArchive()は、nns_util.c内にあります。
if ((archive = LoadCompressedArchive("PCT", "/data/picture_LZ.bin")) != NULL)
{
// ファイル名を指定してデータを取得。
void* chrData = NNS_FndGetArchiveFileByName("PCT:/picture/flower/flower256.chr");
void* scnData = NNS_FndGetArchiveFileByName("PCT:/picture/flower/flower256.scn");
// インデックスを指定してデータを取得。
void* palData = NNS_FndGetArchiveFileByIndex(archive, NARC_picture_flower256_pal);
// データをVRAMのロード。
GX_LoadBG0Char(chrData, 0, 0x10000);
GX_LoadBG0Scr (scnData, 0, 0x00800);
GX_LoadBGPltt (palData, 0, 0x00200);
// VRAMにデータをロードした後は、メインメモリ上のデータは不要な為、
// アーカイブを削除します。
// RemoveArchive()は、nns_util.c内にあります。
RemoveArchive(archive);
}
}

View File

@ -0,0 +1,182 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - archive2
File: nns_util.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "nns_util.h"
#define SYSTEM_HEAP_SIZE 64*1024
GamePad gGamePad; // ゲームパッド
NNSFndHeapHandle gSysHeap; // システムヒープ    (拡張ヒープを使用)
NNSFndHeapHandle gAppHeap; // アプリケーションヒープ(拡張ヒープを使用)
/*---------------------------------------------------------------------------*
Name: InitMemory
Description:
NITRO-Systemの拡張ヒープを使用しています
SYSTEM_HEAP_SIZE分をメインア
使
使使
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitMemory(void)
{
void* sysHeapMemory = OS_AllocFromMainArenaLo(SYSTEM_HEAP_SIZE, 16);
u32 arenaLow = ROUND_UP (OS_GetMainArenaLo(), 16);
u32 arenaHigh = ROUND_DOWN(OS_GetMainArenaHi(), 16);
u32 appHeapSize = arenaHigh - arenaLow;
void* appHeapMemory = OS_AllocFromMainArenaLo(appHeapSize, 16);
gSysHeap = NNS_FndCreateExpHeap(sysHeapMemory, SYSTEM_HEAP_SIZE);
gAppHeap = NNS_FndCreateExpHeap(appHeapMemory, appHeapSize );
}
/*---------------------------------------------------------------------------*
Name: LoadCompressedArchive
Description:
ntrcomp.exeを
使
NNSFndArchive
Arguments: name:
path:
Returns: NNSFndArchive
NULLを返します
*---------------------------------------------------------------------------*/
NNSFndArchive*
LoadCompressedArchive(const char* name, const char* path)
{
FSFile file;
u8* compData;
NNSFndArchive* archive = NULL;
FS_InitFile(&file);
if (FS_OpenFile(&file, path))
{
u32 fileSize = FS_GetLength(&file);
// 圧縮データを格納する為のメモリは、拡張ヒープの後ろから確保します。
// (アライメントに負数を指定すると、後ろから確保します。)
compData = NNS_FndAllocFromExpHeapEx(gAppHeap, fileSize, -16);
if (compData == NULL)
{
(void)FS_CloseFile(&file);
return NULL;
}
if (FS_ReadFile(&file, compData, (s32)fileSize) != fileSize)
{
NNS_FndFreeToExpHeap(gAppHeap, compData);
(void)FS_CloseFile(&file);
return NULL;
}
(void)FS_CloseFile(&file);
}
{
// NNSFndArchive構造体とアーカイブデータを、一つのメモリブロックに格納します。
u32 memorySize = ROUND_UP(sizeof(NNSFndArchive), 16) + ROUND_UP(MI_GetUncompressedSize(compData), 16);
// 展開後のアーカイブデータは、ヒープの前から確保します。
u8* memory = NNS_FndAllocFromExpHeapEx(gAppHeap, memorySize, 16);
if (memory != NULL)
{
u8* binary = memory + ROUND_UP(sizeof(NNSFndArchive), 16);
// アーカイブを展開します
switch (MI_GetCompressionType(compData))
{
case MI_COMPRESSION_LZ : MI_UncompressLZ16 (compData, binary); break;
case MI_COMPRESSION_HUFFMAN : MI_UncompressHuffman(compData, binary); break;
case MI_COMPRESSION_RL : MI_UncompressRL16 (compData, binary); break;
default : SDK_ASSERT(FALSE); break;
}
DC_FlushRange(binary, MI_GetUncompressedSize(compData));
if (NNS_FndMountArchive((NNSFndArchive*)memory, name, binary))
{
archive = (NNSFndArchive*)memory;
}
else
{
NNS_FndFreeToExpHeap(gAppHeap, memory);
}
}
// 圧縮データを解放します。
NNS_FndFreeToExpHeap(gAppHeap, compData);
}
return archive;
}
/*---------------------------------------------------------------------------*
Name: RemoveArchive
Description:
Arguments: archive: NNSアーカイブ構造体へのポインタ
Returns:
*---------------------------------------------------------------------------*/
void
RemoveArchive(NNSFndArchive* archive)
{
(void)NNS_FndUnmountArchive(archive);
NNS_FndFreeToExpHeap(gAppHeap, archive);
}
/*---------------------------------------------------------------------------*
Name: ReadGamePad
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void ReadGamePad(void)
{
u16 status = PAD_Read();
gGamePad.trigger = (u16)(status & (status ^ gGamePad.button));
gGamePad.release = (u16)(gGamePad.button & (status ^ gGamePad.button));
gGamePad.button = status;
}

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - archive2
File: sdk_init.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include "sdk_init.h"
#define DEFAULT_DMA_NUMBER MI_DMA_MAX_NUM
/* -------------------------------------------------------------------------
V-blank callback
------------------------------------------------------------------------- */
void
VBlankIntr(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK);
}
/*---------------------------------------------------------------------------*
Name: InitSystem
Description: NITROの初期化を行います
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitSystem(void)
{
OS_Init();
FX_Init();
GX_SetPower(GX_POWER_ALL);
GX_Init();
GX_DispOff();
GXS_DispOff();
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)OS_EnableIrqMask(OS_IE_FIFO_RECV);
(void)OS_EnableIrq();
FS_Init(DEFAULT_DMA_NUMBER);
(void)GX_VBlankIntr(TRUE); // to generate VBlank interrupt request
}
/*---------------------------------------------------------------------------*
Name: InitVRAM
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitVRAM(void)
{
// 全てのバンクをLCDCに割り当てる
GX_SetBankForLCDC(GX_VRAM_LCDC_ALL);
// LCDC空間全てをクリア
MI_CpuClearFast( (void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE );
// LCDCに割り当てられたバンクをDisable
(void)GX_DisableBankForLCDC();
MI_CpuFillFast ((void*)HW_OAM , 192, HW_OAM_SIZE ); // OAM クリア
MI_CpuFillFast ((void*)HW_DB_OAM , 192, HW_DB_OAM_SIZE); // clear OAM
MI_CpuClearFast((void*)HW_PLTT , HW_PLTT_SIZE ); // パレット クリア
MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); // clear the standard palette
}
/*---------------------------------------------------------------------------*
Name: InitDisplay
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void
InitDisplay(void)
{
GX_SetBankForBG (GX_VRAM_BG_128_A ); // バンクAをBGに割り当てる
GX_SetBGCharOffset(GX_BGCHAROFFSET_0x00000);
GX_SetBGScrOffset ( GX_BGSCROFFSET_0x10000);
GX_SetGraphicsMode(
GX_DISPMODE_GRAPHICS, // グラフィックス表示モードにする
GX_BGMODE_0, // BGMODEを0に設定
GX_BG0_AS_2D); // BG0を2D表示に設定
GX_SetVisiblePlane(
GX_PLANEMASK_BG0 // BG0を表示。
);
G2_SetBG0Control(
GX_BG_SCRSIZE_TEXT_256x256, // 256×256ドット
GX_BG_COLORMODE_256, // 256色モード。
GX_BG_SCRBASE_0x0000, // スクリーンベース。
GX_BG_CHARBASE_0x00000, // キャラクタベース。
GX_BG_EXTPLTT_01 // BGExtPlttスロット。
);
GX_DispOn();
}

View File

@ -0,0 +1,42 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - fnd - heap
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = fnd
SUBDIRS =
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
#SRCDIR = # using default
#LCFILE = # using default
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,371 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - fnd - heap
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
#include <nitro.h>
#include <nnsys/fnd.h>
#define HeapBufElementNum (4096/sizeof(u32))
static u32 sHeapBuf[HeapBufElementNum];
/*
IDとサイズの合計を保持する構造体
CalcGroupSizeForExpHeap()IDのメモリブロックのサイズを
使
*/
typedef struct TGroupSize TGroupSize;
struct TGroupSize
{
u16 groupID;
u16 padding;
u32 size;
};
/*---------------------------------------------------------------------------*
Name: CalcGroupSizeForMBlockExpHeap
Description: NNS_FndVisitAllocatedForExpHeap()
IDが指定されたものと一致する場合
Arguments: memBlock:
heap:
userParam: IDと合計値を持つ構造体へのポインタ
Returns:
*---------------------------------------------------------------------------*/
static void
CalcGroupSizeForMBlockExpHeap(
void* memBlock,
NNSFndHeapHandle heap,
u32 userParam
)
{
#pragma unused(heap)
TGroupSize* pGrSize = (TGroupSize*)userParam;
if (NNS_FndGetGroupIDForMBlockExpHeap(memBlock) == pGrSize->groupID)
{
pGrSize->size += NNS_FndGetSizeForMBlockExpHeap(memBlock);
}
}
/*---------------------------------------------------------------------------*
Name: CalcGroupSizeForExpHeap
Description: IDを持つ
Arguments: heap:
Returns: IDを持つメモリブロックのサイズの合計値が返ります
*---------------------------------------------------------------------------*/
static u32
CalcGroupSizeForExpHeap(
NNSFndHeapHandle heap,
u16 groupID
)
{
TGroupSize groupSize;
groupSize.groupID = groupID;
groupSize.size = 0;
NNS_FndVisitAllocatedForExpHeap(
heap,
CalcGroupSizeForMBlockExpHeap,
(u32)&groupSize);
return groupSize.size;
}
/*---------------------------------------------------------------------------*
Name: FreeDirForMBlockExpHeap
Description: NNS_FndVisitAllocatedForExpHeap()
userParamで指定した値と同じなら
Arguments: memBlock:
heap:
userParam:
Returns:
*---------------------------------------------------------------------------*/
static void
FreeDirForMBlockExpHeap(
void* memBlock,
NNSFndHeapHandle heap,
u32 userParam
)
{
if (NNS_FndGetAllocDirForMBlockExpHeap(memBlock) == userParam)
{
NNS_FndFreeToExpHeap(heap, memBlock);
}
}
/*---------------------------------------------------------------------------*
Name: FreeTailForExpHeap
Description:
Arguments: heap:
Returns:
*---------------------------------------------------------------------------*/
static void
FreeTailForExpHeap(NNSFndHeapHandle heap)
{
NNS_FndVisitAllocatedForExpHeap(
heap,
FreeDirForMBlockExpHeap,
NNS_FND_EXPHEAP_ALLOC_DIR_REAR);
}
/*---------------------------------------------------------------------------*
Name: SampleExpHeap
Description:
Arguments: heapAddress:
heapSize:
Returns:
*---------------------------------------------------------------------------*/
static void
SampleExpHeap(
void* heapAddress,
u32 heapSize)
{
void* pMBlocks[4];
// 拡張ヒープの作成
NNSFndHeapHandle hExpHeap = NNS_FndCreateExpHeap(heapAddress, heapSize);
// 通常のメモリブロック確保
pMBlocks[0] = NNS_FndAllocFromExpHeap(hExpHeap, 100);
// ヒープ領域の後方から確保。アライメントはデフォルト値 4。
pMBlocks[2] = NNS_FndAllocFromExpHeapEx(hExpHeap, 100, -NNS_FND_HEAP_DEFAULT_ALIGNMENT);
// グループID を 1 に変更
(void)NNS_FndSetGroupIDForExpHeap(hExpHeap, 1);
// メモリブロック確保。アライメントは 16。
pMBlocks[1] = NNS_FndAllocFromExpHeapEx(hExpHeap, 200, 16);
// ヒープ領域の後方から確保。アライメントは 16。
pMBlocks[3] = NNS_FndAllocFromExpHeapEx(hExpHeap, 200, -16);
NNS_FndDumpHeap(hExpHeap);
// グループ 0 のメモリブロックのサイズの合計値を求める。
OS_Printf("[demo exp heap] group 0 size %d\n", CalcGroupSizeForExpHeap(hExpHeap, 0));
// グループ 1 のメモリブロックのサイズの合計値を求める。
OS_Printf("[demo exp heap] group 1 size %d\n", CalcGroupSizeForExpHeap(hExpHeap, 1));
OS_Printf("\n");
// メモリブロックの拡張 100 -> 300
(void)NNS_FndResizeForMBlockExpHeap(hExpHeap, pMBlocks[1], 300);
// ヒープ領域の後方から確保したメモリブロックを解放
FreeTailForExpHeap(hExpHeap);
NNS_FndDumpHeap(hExpHeap);
// 拡張ヒープの破棄
NNS_FndDestroyExpHeap(hExpHeap);
}
/*---------------------------------------------------------------------------*
Name: SampleFrameHeap
Description:
Arguments: heapAddress:
heapSize:
Returns:
*---------------------------------------------------------------------------*/
static void
SampleFrameHeap(
void* heapAddress,
u32 heapSize)
{
void* pExpMBlock;
void* pMBlocks[8];
NNSFndHeapHandle hExpHeap;
NNSFndHeapHandle hFrmHeap;
u32 frmHeapSize;
/*
*/
// 拡張ヒープの作成
hExpHeap = NNS_FndCreateExpHeap(heapAddress, heapSize);
// 確保可能サイズ全てを占有するメモリブロックを作る
pExpMBlock = NNS_FndAllocFromExpHeap(
hExpHeap,
NNS_FndGetAllocatableSizeForExpHeap(hExpHeap));
// フレームヒープの作成
hFrmHeap = NNS_FndCreateFrmHeap(
pExpMBlock,
NNS_FndGetSizeForMBlockExpHeap(pExpMBlock));
/*
*/
// 通常のメモリブロック確保
pMBlocks[0] = NNS_FndAllocFromFrmHeap(hFrmHeap, 100);
// ヒープ領域の後方から確保。アライメントはデフォルト値 4。
pMBlocks[1] = NNS_FndAllocFromFrmHeapEx(hFrmHeap, 100, -NNS_FND_HEAP_DEFAULT_ALIGNMENT);
// メモリブロック確保状態の保存。タグは'FRST'。
(void)NNS_FndRecordStateForFrmHeap(hFrmHeap, 'FRST');
// メモリブロックを前方と後方から確保。アライメントは 8。
pMBlocks[2] = NNS_FndAllocFromFrmHeapEx(hFrmHeap, 200, 8);
pMBlocks[3] = NNS_FndAllocFromFrmHeapEx(hFrmHeap, 200, -8);
// メモリブロック確保状態の保存。タグは'SCND'。
(void)NNS_FndRecordStateForFrmHeap(hFrmHeap, 'SCND');
// メモリブロックを前方と後方から確保。アライメントは 16。
pMBlocks[4] = NNS_FndAllocFromFrmHeapEx(hFrmHeap, 300, 16);
pMBlocks[5] = NNS_FndAllocFromFrmHeapEx(hFrmHeap, 300, -16);
// メモリブロック確保状態の保存。タグは'THRD'。
(void)NNS_FndRecordStateForFrmHeap(hFrmHeap, 'THRD');
// メモリブロックを前方と後方から確保。アライメントは 32。
pMBlocks[6] = NNS_FndAllocFromFrmHeapEx(hFrmHeap, 300, 32);
pMBlocks[7] = NNS_FndAllocFromFrmHeapEx(hFrmHeap, 300, -32);
NNS_FndDumpHeap(hFrmHeap);
// タグを指定して、状態復帰
(void)NNS_FndFreeByStateToFrmHeap(hFrmHeap, 'SCND');
NNS_FndDumpHeap(hFrmHeap);
// タグを指定しないで、状態復帰('FRST'の状態へ復帰)
(void)NNS_FndFreeByStateToFrmHeap(hFrmHeap, 0);
NNS_FndDumpHeap(hFrmHeap);
/*
*/
// ヒープの後方から確保したメモリブロックを解放
(void)NNS_FndFreeToFrmHeap(hFrmHeap, NNS_FND_FRMHEAP_FREE_TAIL);
// フレームヒープを縮小
frmHeapSize = NNS_FndAdjustFrmHeap(hFrmHeap);
// フレームヒープの縮小にあわせて、拡張ヒープのメモリブロックを縮小します。
(void)NNS_FndResizeForMBlockExpHeap(hExpHeap, pExpMBlock, frmHeapSize);
// メモリブロックを保持するヒープを取得し、dumpします。
// (フレームヒープ:hFrmHeapの内容が表示されます。)
NNS_FndDumpHeap(NNS_FndFindContainHeap(pMBlocks[0]));
// 拡張ヒープをDumpします。
NNS_FndDumpHeap(hExpHeap);
/*
*/
// フレームヒープの破棄
NNS_FndDestroyFrmHeap(hFrmHeap);
// 拡張ヒープの破棄
NNS_FndDestroyExpHeap(hExpHeap);
}
/*---------------------------------------------------------------------------*
Name: SampleUnitHeap
Description:
Arguments: heapAddress:
heapSize:
Returns:
*---------------------------------------------------------------------------*/
static void
SampleUnitHeap(
void* heapAddress,
u32 heapSize)
{
void* pMBlocks[4];
// ユニットヒープの作成
NNSFndHeapHandle hUnitHeap = NNS_FndCreateUnitHeapEx(
heapAddress,
heapSize,
64, // メモリブロックのサイズ
16, // アライメント
0); // オプション
// 確保可能なメモリブロックの個数を表示
OS_Printf("[demo unit heap] free block num %d.\n", NNS_FndCountFreeBlockForUnitHeap(hUnitHeap));
// メモリブロック確保
pMBlocks[0] = NNS_FndAllocFromUnitHeap(hUnitHeap);
pMBlocks[1] = NNS_FndAllocFromUnitHeap(hUnitHeap);
pMBlocks[2] = NNS_FndAllocFromUnitHeap(hUnitHeap);
pMBlocks[3] = NNS_FndAllocFromUnitHeap(hUnitHeap);
// 3番目のメモリブロックを解放
NNS_FndFreeToUnitHeap(hUnitHeap, pMBlocks[2]);
// 確保可能なメモリブロックの個数を表示
OS_Printf("[demo unit heap] free block num %d.\n", NNS_FndCountFreeBlockForUnitHeap(hUnitHeap));
NNS_FndDumpHeap(hUnitHeap);
// ユニットヒープの破棄
NNS_FndDestroyUnitHeap(hUnitHeap);
}
/*---------------------------------------------------------------------------*
Name: NitroMain
*---------------------------------------------------------------------------*/
void
NitroMain(void)
{
OS_Init();
SampleExpHeap(sHeapBuf, sizeof sHeapBuf);
SampleFrameHeap(sHeapBuf, sizeof sHeapBuf);
SampleUnitHeap(sHeapBuf, sizeof sHeapBuf);
while(1) {}
}

View File

@ -0,0 +1,34 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = \
demolib \
samples \
bg \
Text \
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,44 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - BGAffine
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,318 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - BGAffine
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// Affine BG での文字列表示サンプル256色モード
// Affine BG では256キャラクタしか使用できないので、
// このデモでは全ての文字を表示するのに十分なサイズの CharCanvas を
// 作成できていません。
//
// 操作方法
// 操作なし。
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include "g2d_textdemolib.h"
// Affine BG では256キャラクタしか使えない事に注意しなければなりません
// これは CANVAS*_WIDTH * CANVAS*_HEIGHT の和が 256以下でなければならない事を意味します。
#define CANVAS0_WIDTH 10 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS0_HEIGHT 5 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS0_LEFT 1 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS0_TOP 1 // 文字描画域の位置Y (キャラクタ単位)
#define CANVAS1_WIDTH 20 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS1_HEIGHT 6 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS1_LEFT 3 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS1_TOP 15 // 文字描画域の位置Y (キャラクタ単位)
#define CANVAS2_WIDTH 10 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS2_HEIGHT 6 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS2_LEFT 15 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS2_TOP 3 // 文字描画域の位置Y (キャラクタ単位)
#define TEXT_HSPACE0 4 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE0 4 // 文字列描画時の行間 (ピクセル単位)
#define TEXT_HSPACE1 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE1 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
//------------------------------------------------------------------------------
// グローバル変数
NNSG2dFont gFont; // フォント
NNSG2dCharCanvas gCanvas[3]; // CharCanvas x3
NNSG2dTextCanvas gTextCanvas[3]; // TextCanvas x3
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: InitScreen
Description: BG
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitScreen(void)
{
// BG 2 を設定
G2_SetBG2ControlAffine(
GX_BG_SCRSIZE_AFFINE_256x256, // スクリーンサイズ 256x256
GX_BG_AREAOVER_XLU, // 外領域 透明
GX_BG_SCRBASE_0x0000, // スクリーンベース
GX_BG_CHARBASE_0x00000 // キャラクタベース
);
// BG2 を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_BG2 );
// カラーパレットを設定
GX_LoadBGPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
}
/*---------------------------------------------------------------------------*
Name: InitCanvas
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitCanvas(void)
{
// BGキャラクタベースへのポインタ
GXCharFmt256* pCharBase = (GXCharFmt256*)G2_GetBG2CharPtr();
// BGスクリーンベースへのポインタ
GXScrAffine32x32* pScr = (GXScrAffine32x32*)G2_GetBG1ScrPtr();
int cOffset = CHARACTER_OFFSET;
// フォントを読み込みます
TXT_LoadFont( &gFont, TXT_FONTRESOURCE_NAME );
// CharCanvas の初期化と BG スクリーンの設定
// CharCanvas 0
NNS_G2dCharCanvasInitForBG(
&gCanvas[0], // CharCanvasへのポインタ
pCharBase + cOffset, // 使用するキャラクタ列先頭へのポインタ
CANVAS0_WIDTH, // CharCanvas幅
CANVAS0_HEIGHT, // CharCanvas高さ
NNS_G2D_CHARA_COLORMODE_256 // カラーモード
);
NNS_G2dMapScrToCharAffine(
&( pScr->scr[CANVAS0_TOP][CANVAS0_LEFT] ), // CharCanvas表示位置のスクリーンへのポインタ
CANVAS0_WIDTH, // CharCanvas幅
CANVAS0_HEIGHT, // CharCanvas高さ
NNS_G2D_AFFINE_BG_WIDTH_256, // スクリーン幅
cOffset // 使用するキャラクタ列先頭のキャラクタ番号
);
// CharCanvas 0 が使う分のキャラクタ数をオフセットに加算
cOffset += CANVAS0_WIDTH * CANVAS0_HEIGHT;
NNS_G2dCharCanvasInitForBG(
&gCanvas[1],
pCharBase + cOffset,
CANVAS1_WIDTH,
CANVAS1_HEIGHT,
NNS_G2D_CHARA_COLORMODE_256
);
NNS_G2dMapScrToCharAffine(
&( pScr->scr[CANVAS1_TOP][CANVAS1_LEFT] ),
CANVAS1_WIDTH,
CANVAS1_HEIGHT,
NNS_G2D_AFFINE_BG_WIDTH_256,
cOffset
);
// CharCanvas 1 が使う分のキャラクタ数をオフセットに加算
cOffset += CANVAS1_WIDTH * CANVAS1_HEIGHT;
NNS_G2dCharCanvasInitForBG(
&gCanvas[2],
pCharBase + cOffset,
CANVAS2_WIDTH,
CANVAS2_HEIGHT,
NNS_G2D_CHARA_COLORMODE_256
);
NNS_G2dMapScrToCharAffine(
&( pScr->scr[CANVAS2_TOP][CANVAS2_LEFT] ),
CANVAS2_WIDTH,
CANVAS2_HEIGHT,
NNS_G2D_AFFINE_BG_WIDTH_256,
cOffset
);
// TextCanvas の初期化
// CharCanvas 毎に TextCanvas を用意することもできますし、
// 複数の TextCanvas で1つの CharCanvas を共有する事もできます。
// 複数の CharCanvas を1つの TextCanvas で使う場合は
// TextCanvas の CharCanvas を置き換えながら使う事になります。
// 1) 複数の TextCanvas で1つの CharCanvas を共有
// CharCanvas 1 を TextCanvas 0, 1 で共有
{
NNS_G2dTextCanvasInit(
&gTextCanvas[0], // TextCanvasへのポインタ
&gCanvas[1], // 描画先のCharCanvasへのポインタ
&gFont, // 描画に用いるフォントへのポインタ
TEXT_HSPACE0, // 文字間
TEXT_VSPACE0 // 行間
);
NNS_G2dTextCanvasInit(
&gTextCanvas[1],
&gCanvas[1],
&gFont,
TEXT_HSPACE1,
TEXT_VSPACE1
);
}
// 2) CharCanvas 毎に TextCanvas を用意
// CharCanvas 2 を TextCanvas 2 単独で使用
{
NNS_G2dTextCanvasInit(
&gTextCanvas[2],
&gCanvas[2],
&gFont,
TEXT_HSPACE0,
TEXT_VSPACE0
);
}
}
/*---------------------------------------------------------------------------*
Name: SampleMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleMain(void)
{
InitScreen();
InitCanvas();
// それぞれの CharCanvas を TXT_COLOR_WHITE で塗りつぶし
NNS_G2dCharCanvasClear(&gCanvas[0], TXT_COLOR_WHITE);
NNS_G2dCharCanvasClear(&gCanvas[1], TXT_COLOR_WHITE);
NNS_G2dCharCanvasClear(&gCanvas[2], TXT_COLOR_WHITE);
// 文字列描画
// TextCanvas 0 (->CharCanvas 1) に描画
NNS_G2dTextCanvasDrawText(&gTextCanvas[0], 0, 0, TXT_COLOR_CYAN, TXT_DRAWTEXT_FLAG_DEFAULT,
"TextCanvas0 CharCanvas1\n"
"abcdefg"
);
// TextCanvas 1 (->CharCanvas 1) に描画
NNS_G2dTextCanvasDrawText(&gTextCanvas[1], 0, 30, TXT_COLOR_MAGENTA, TXT_DRAWTEXT_FLAG_DEFAULT,
"TextCanvas1 CharCanvas1\n"
"hijklmn"
);
// TextCanvas 2 (->CharCanvas 2) に描画
NNS_G2dTextCanvasDrawText(&gTextCanvas[2], 0, 0, TXT_COLOR_GREEN, TXT_DRAWTEXT_FLAG_DEFAULT,
"TextCanvas2\n"
"CharCanvas2\n"
"opqrstu"
);
// 3) 複数の CharCanvas を1つの TextCanvas で使う
{
// TextCanvas 1 の CharCanvas を入れ替え
NNS_G2dTextCanvasSetCharCanvas(&gTextCanvas[1], &gCanvas[0]);
// TextCanvas 1 (->CharCanvas 0) に描画
NNS_G2dTextCanvasDrawText(&gTextCanvas[1], 0, 0, TXT_COLOR_BLUE, TXT_DRAWTEXT_FLAG_DEFAULT,
"TextCanvas1\n"
"CharCanvas0\n"
"vwxyz"
);
}
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// サンプルのメイン処理
SampleMain();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
CMN_WaitVBlankIntr();
// 情報出力の表示
DTX_Reflect();
}
}

View File

@ -0,0 +1,43 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - BGText
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,325 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - BGText
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// TEXT BG での文字列表示サンプル16色モード
// アフィン拡張BGも TEXT BG と同様にして表示する事が出来ます。
//
// 操作方法
// 操作なし。
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include "g2d_textdemolib.h"
// TEXT BG 及びアフィン拡張BGでは 1024 キャラクタまで使用できます。
#define CANVAS0_WIDTH 10 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS0_HEIGHT 5 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS0_LEFT 1 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS0_TOP 1 // 文字描画域の位置Y (キャラクタ単位)
#define CANVAS1_WIDTH 25 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS1_HEIGHT 8 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS1_LEFT 3 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS1_TOP 15 // 文字描画域の位置Y (キャラクタ単位)
#define CANVAS2_WIDTH 15 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS2_HEIGHT 10 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS2_LEFT 15 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS2_TOP 3 // 文字描画域の位置Y (キャラクタ単位)
#define TEXT_HSPACE0 4 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE0 4 // 文字列描画時の行間 (ピクセル単位)
#define TEXT_HSPACE1 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE1 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
//------------------------------------------------------------------------------
// グローバル変数
static NNSG2dFont gFont; // フォント
static NNSG2dCharCanvas gCanvas[3]; // CharCanvas x3
static NNSG2dTextCanvas gTextCanvas[3]; // TextCanvas x3
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: InitScreen
Description: BG
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitScreen(void)
{
// BG 1 を設定
G2_SetBG1Control(
GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256
GX_BG_COLORMODE_16, // カラーモード 16色
GX_BG_SCRBASE_0x0000, // スクリーンベース
GX_BG_CHARBASE_0x00000, // キャラクタベース
GX_BG_EXTPLTT_01 // 拡張パレットスロット
);
// BG1 を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_BG1 );
// カラーパレットを設定
GX_LoadBGPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
}
/*---------------------------------------------------------------------------*
Name: InitCanvas
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitCanvas(void)
{
// BGキャラクタベースへのポインタ
GXCharFmt16* const pCharBase = (GXCharFmt16*)G2_GetBG1CharPtr();
int cOffset = CHARACTER_OFFSET;
// フォントを読み込みます
TXT_LoadFont( &gFont, TXT_FONTRESOURCE_NAME );
// CharCanvas の初期化と BG スクリーンの設定
// CharCanvas 0
NNS_G2dCharCanvasInitForBG(
&gCanvas[0], // CharCanvasへのポインタ
pCharBase + cOffset, // 使用するキャラクタ列先頭へのポインタ
CANVAS0_WIDTH, // CharCanvas幅
CANVAS0_HEIGHT, // CharCanvas高さ
NNS_G2D_CHARA_COLORMODE_16 // カラーモード
);
NNS_G2dMapScrToCharText(
G2_GetBG1ScrPtr(), // スクリーンベースへのポインタ
CANVAS0_WIDTH, // CharCanvas幅
CANVAS0_HEIGHT, // CharCanvas高さ
CANVAS0_LEFT, // CharCanvas表示位置
CANVAS0_TOP, // CharCanvas表示位置
NNS_G2D_TEXT_BG_WIDTH_256, // スクリーン幅
cOffset, // 使用するキャラクタ列先頭のキャラクタ番号
TXT_CPALETTE_MAIN // カラーパレット番号
);
// CharCanvas 0 が使う分のキャラクタ数をオフセットに加算
cOffset += CANVAS0_WIDTH * CANVAS0_HEIGHT;
// CharCanvas 1
NNS_G2dCharCanvasInitForBG(
&gCanvas[1],
pCharBase + cOffset,
CANVAS1_WIDTH,
CANVAS1_HEIGHT,
NNS_G2D_CHARA_COLORMODE_16
);
NNS_G2dMapScrToCharText(
G2_GetBG1ScrPtr(),
CANVAS1_WIDTH,
CANVAS1_HEIGHT,
CANVAS1_LEFT,
CANVAS1_TOP,
NNS_G2D_TEXT_BG_WIDTH_256,
cOffset,
TXT_CPALETTE_MAIN
);
// CharCanvas 1 が使う分のキャラクタ数をオフセットに加算
cOffset += CANVAS1_WIDTH * CANVAS1_HEIGHT;
// CharCanvas 2
NNS_G2dCharCanvasInitForBG(
&gCanvas[2],
pCharBase + cOffset,
CANVAS2_WIDTH,
CANVAS2_HEIGHT,
NNS_G2D_CHARA_COLORMODE_16
);
NNS_G2dMapScrToCharText(
G2_GetBG1ScrPtr(),
CANVAS2_WIDTH,
CANVAS2_HEIGHT,
CANVAS2_LEFT,
CANVAS2_TOP,
NNS_G2D_TEXT_BG_WIDTH_256,
cOffset,
TXT_CPALETTE_MAIN
);
// TextCanvas の初期化
// CharCanvas 毎に TextCanvas を用意することもできますし、
// 複数の TextCanvas で1つの CharCanvas を共有する事もできます。
// 複数の CharCanvas を1つの TextCanvas で使う場合は
// TextCanvas の CharCanvas を置き換えながら使う事になります。
// 1) 複数の TextCanvas で1つの CharCanvas を共有
// CharCanvas 1 を TextCanvas 0, 1 で共有
{
NNS_G2dTextCanvasInit(
&gTextCanvas[0], // TextCanvasへのポインタ
&gCanvas[1], // 描画先のCharCanvasへのポインタ
&gFont, // 描画に用いるフォントへのポインタ
TEXT_HSPACE0, // 文字間
TEXT_VSPACE0 // 行間
);
NNS_G2dTextCanvasInit(
&gTextCanvas[1],
&gCanvas[1],
&gFont,
TEXT_HSPACE1,
TEXT_VSPACE1
);
}
// 2) CharCanvas 毎に TextCanvas を用意
// CharCanvas 2 を TextCanvas 2 単独で使用
{
NNS_G2dTextCanvasInit(
&gTextCanvas[2],
&gCanvas[2],
&gFont,
TEXT_HSPACE0,
TEXT_VSPACE0
);
}
}
/*---------------------------------------------------------------------------*
Name: SampleMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleMain(void)
{
InitScreen();
InitCanvas();
// それぞれの CharCanvas を TXT_COLOR_WHITE で塗りつぶし
NNS_G2dCharCanvasClear(&gCanvas[0], TXT_COLOR_WHITE);
NNS_G2dCharCanvasClear(&gCanvas[1], TXT_COLOR_WHITE);
NNS_G2dCharCanvasClear(&gCanvas[2], TXT_COLOR_WHITE);
// 文字列描画
// TextCanvas 0 (->CharCanvas 1) に描画
NNS_G2dTextCanvasDrawText(&gTextCanvas[0], 0, 0, TXT_COLOR_CYAN, TXT_DRAWTEXT_FLAG_DEFAULT,
"TextCanvas0 CharCanvas1\n"
"abcdefg"
);
// TextCanvas 1 (->CharCanvas 1) に描画
NNS_G2dTextCanvasDrawText(&gTextCanvas[1], 0, 30, TXT_COLOR_MAGENTA, TXT_DRAWTEXT_FLAG_DEFAULT,
"TextCanvas1 CharCanvas1\n"
"hijklmn"
);
// TextCanvas 2 (->CharCanvas 2) に描画
NNS_G2dTextCanvasDrawText(&gTextCanvas[2], 0, 0, TXT_COLOR_GREEN, TXT_DRAWTEXT_FLAG_DEFAULT,
"TextCanvas2\n"
"CharCanvas2\n"
"opqrstu"
);
// 3) 複数の CharCanvas を1つの TextCanvas で使う
{
// TextCanvas 1 の CharCanvas を入れ替え
NNS_G2dTextCanvasSetCharCanvas(&gTextCanvas[1], &gCanvas[0]);
// TextCanvas 1 (->CharCanvas 0) に描画
NNS_G2dTextCanvasDrawText(&gTextCanvas[1], 0, 0, TXT_COLOR_BLUE, TXT_DRAWTEXT_FLAG_DEFAULT,
"TextCanvas1\n"
"CharCanvas0\n"
"vwxyz"
);
}
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// サンプルのメイン処理
SampleMain();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
CMN_WaitVBlankIntr();
// 情報出力の表示
DTX_Reflect();
}
}

View File

@ -0,0 +1,43 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - CP1252Text
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,219 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - CP1252Text
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// CP1252 文字列の表示方法サンプル。
//
// 操作方法
// なし。
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include "g2d_textdemolib.h"
#define CANVAS_WIDTH 22 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS_HEIGHT 16 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS_LEFT 5 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS_TOP 4 // 文字描画域の位置Y (キャラクタ単位)
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
//------------------------------------------------------------------------------
// グローバル変数
NNSG2dFont gFont; // フォント
NNSG2dCharCanvas gCanvas; // CharCanvas
NNSG2dTextCanvas gTextCanvas; // TextCanvas
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: InitScreen
Description: BG
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitScreen(void)
{
// BG 1 を設定
G2_SetBG1Control(
GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256
GX_BG_COLORMODE_16, // カラーモード 16色
GX_BG_SCRBASE_0x0000, // スクリーンベース
GX_BG_CHARBASE_0x00000, // キャラクタベース
GX_BG_EXTPLTT_01 // 拡張パレットスロット
);
// BG1 を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_BG1 );
// カラーパレットを設定
GX_LoadBGPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
}
/*---------------------------------------------------------------------------*
Name: InitCanvas
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitCanvas(void)
{
GXCharFmt16* pCharBase = (GXCharFmt16*)G2_GetBG1CharPtr();
int cOffset = CHARACTER_OFFSET;
// フォントを読み込みます
{
// 他のデモと同じように TXT_LoadFont を使ってもフォントを読み込めます。
// このデモでは NNS_G2dFontInitCP1252 を使う場合を示しています。
// TXT_LoadFont( &gFont, TXT_CP1252_FONTRESOURCE_NAME );
void* pFontFile;
u32 size;
size = TXT_LoadFile( &pFontFile, TXT_CP1252_FONTRESOURCE_NAME );
NNS_G2D_ASSERT( size > 0 );
NNS_G2dFontInitCP1252(&gFont, pFontFile);
NNS_G2dPrintFont(&gFont);
}
// CharCanvas の初期化
NNS_G2dCharCanvasInitForBG(
&gCanvas,
pCharBase + cOffset,
CANVAS_WIDTH,
CANVAS_HEIGHT,
NNS_G2D_CHARA_COLORMODE_16
);
// TextCanvasの初期化
NNS_G2dTextCanvasInit(
&gTextCanvas,
&gCanvas,
&gFont,
TEXT_HSPACE,
TEXT_VSPACE
);
// スクリーンを設定
NNS_G2dMapScrToCharText(
G2_GetBG1ScrPtr(),
CANVAS_WIDTH,
CANVAS_HEIGHT,
CANVAS_LEFT,
CANVAS_TOP,
NNS_G2D_TEXT_BG_WIDTH_256,
CHARACTER_OFFSET,
TXT_CPALETTE_MAIN
);
}
/*---------------------------------------------------------------------------*
Name: SampleMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleMain(void)
{
InitScreen();
InitCanvas();
NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_WHITE);
NNS_G2dTextCanvasDrawText(&gTextCanvas, 0, 0,
TXT_COLOR_BLACK, TXT_DRAWTEXT_FLAG_DEFAULT,
"CP1252\n"
"0123456789\n" // <- 数字
"abcdefg ABCDEFG\n" // <- アルファベット
"\xE0\xE1\xE2\xE3\xE4\xE5\n" // <- 欧州文字
);
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// サンプルのメイン処理
SampleMain();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
CMN_WaitVBlankIntr();
// 情報出力の表示
DTX_Reflect();
}
}

View File

@ -0,0 +1,43 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - CanvasCell
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,492 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - CanvasCell
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// 1DマッピングOBJ用に構築されたCharCanvasをセルとして表示します
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include <nnsys/g2d/g2d_Renderer.h>
#include "g2d_textdemolib.h"
#define SCREEN_WIDTH 256
#define SCREEN_HEIGHT 192
#define CANVAS_WIDTH 6 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS_HEIGHT 4 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS_LEFT 13 // 文字描画域の位置X (ピクセル単位)
#define CANVAS_TOP 17 // 文字描画域の位置Y (ピクセル単位)
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の先頭キャラクタネーム
//
#define MAX_OBJ_NUM 128
#define REPEAT_THRESHOLD 22
#define CHARACTER_WIDTH 8
#define CHARACTER_HEIGHT 8
#define NUM_OF_OAM 128 // OAM マネージャに割り当てる OAM の数
//------------------------------------------------------------------------------
// グローバル変数
NNSG2dFont gFont; // フォント
NNSG2dCharCanvas gCanvas; // CharCanvas
NNSG2dTextCanvas gTextCanvas; // TextCanvas
NNSG2dRendererInstance gRenderer;
NNSG2dRenderSurface gSurface;
NNSG2dImageProxy gImageProxy;
NNSG2dImagePaletteProxy gPaletteProxy;
NNSG2dOamManagerInstance gOamManager;
NNSG2dCellData* gpCanvasCell;
//****************************************************************************
// レンダラ関連の処理
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: CallBackAddOam
Description: NNS_G2dDraw* OAM
Arguments: pOam: OAM
affineIndex: OAM 使 Affine
32
Affine 使
NNS_G2D_OAM_AFFINE_IDX_NONE
bDoubleAffine: Affineモードかどうか
Returns: TRUE FALSE
*---------------------------------------------------------------------------*/
static BOOL CallBackAddOam( const GXOamAttr* pOam, u16 affineIndex, BOOL bDoubleAffine )
{
#pragma unused( bDoubleAffine )
SDK_NULL_ASSERT( pOam );
return NNS_G2dEntryOamManagerOamWithAffineIdx( &gOamManager, pOam, affineIndex );
}
/*---------------------------------------------------------------------------*
Name: CallBackAddAffine
Description: NNS_G2dDraw* Affine
Arguments: mtx: Affine
Returns: Affine AffineIndex
*---------------------------------------------------------------------------*/
static u16 CallBackAddAffine( const MtxFx22* mtx )
{
SDK_NULL_ASSERT( mtx );
return NNS_G2dEntryOamManagerAffine( &gOamManager, mtx );
}
/*---------------------------------------------------------------------------*
Name: InitOamManager
Description: OAM 1OAMマネージャ
Arguments: pOamManager: OAM
Returns:
*---------------------------------------------------------------------------*/
static void InitOamManager(NNSG2dOamManagerInstance* pOamManager)
{
BOOL result;
SDK_NULL_ASSERT( pOamManager );
NNS_G2dInitOamManagerModule();
result = NNS_G2dGetNewOamManagerInstance(
pOamManager,
0, NUM_OF_OAM,
0, NUM_OF_OAM/4,
NNS_G2D_OAMTYPE_MAIN
);
SDK_ASSERT( result );
}
/*---------------------------------------------------------------------------*
Name: InitRenderer
Description: Renderer Surface
Arguments: pRenderer: Renderer
pSurface: Surface
Returns:
*---------------------------------------------------------------------------*/
static void InitRenderer(
NNSG2dRendererInstance* pRenderer,
NNSG2dRenderSurface* pSurface,
NNSG2dImageProxy* pImageProxy,
NNSG2dImagePaletteProxy* pPaletteProxy
)
{
NNSG2dViewRect* pRect;
SDK_NULL_ASSERT( pImageProxy );
SDK_NULL_ASSERT( pPaletteProxy );
SDK_NULL_ASSERT( pRenderer );
SDK_NULL_ASSERT( pSurface );
//---- ImageProxy をダミーアドレスで初期化
NNS_G2dInitImageProxy( pImageProxy );
NNS_G2dSetImageLocation( pImageProxy, NNS_G2D_VRAM_TYPE_2DMAIN, NULL );
//---- PaletteProxy ダミーアドレスで初期化
NNS_G2dInitImagePaletteProxy( pPaletteProxy );
NNS_G2dSetImagePaletteLocation( pPaletteProxy, NNS_G2D_VRAM_TYPE_2DMAIN, NULL );
//---- サーフェスを初期化
NNS_G2dInitRenderSurface( pSurface );
pRect = &(pSurface->viewRect);
pRect->posTopLeft.x = FX32_ONE * 0;
pRect->posTopLeft.y = FX32_ONE * 0;
pRect->sizeView.x = FX32_ONE * SCREEN_WIDTH;
pRect->sizeView.y = FX32_ONE * SCREEN_HEIGHT;
pSurface->pFuncOamRegister = CallBackAddOam;
pSurface->pFuncOamAffineRegister = CallBackAddAffine;
pSurface->type = NNS_G2D_SURFACETYPE_MAIN2D;
//---- レンダラを初期化
NNS_G2dInitRenderer( pRenderer );
NNS_G2dAddRendererTargetSurface( pRenderer, pSurface );
NNS_G2dSetRendererImageProxy( pRenderer, pImageProxy, pPaletteProxy );
}
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: InitScreen
Description: OBJ表示の初期化をします
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitScreen(void)
{
// マッピングモード設定 1D 256 KB
GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_256K);
// OBJ を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_OBJ );
// カラーパレットを設定
GX_LoadOBJPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
}
/*---------------------------------------------------------------------------*
Name: InitCanvas
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitCanvas(void)
{
GXCharFmt16* const pCharBase = (GXCharFmt16*)G2_GetOBJCharPtr();
GXOamAttr* const pObjBase = (GXOamAttr*)HW_OAM;
const int cOffset = CHARACTER_OFFSET;
const NNSG2dOBJVramMode vramMode = NNS_G2D_OBJVRAMMODE_256K;
// CharCanvas の初期化
NNS_G2dCharCanvasInitForOBJ1D(
&gCanvas,
pCharBase + (cOffset << vramMode),
// VRAM参照可能サイズによってキャラクタネーム境界が異なるため補正する
CANVAS_WIDTH,
CANVAS_HEIGHT,
NNS_G2D_CHARA_COLORMODE_16
);
// TextCanvasの初期化
NNS_G2dTextCanvasInit(
&gTextCanvas,
&gCanvas,
&gFont,
TEXT_HSPACE,
TEXT_VSPACE
);
// セルを構築
{
//---- 回転中心を CharCanvas の中心にする
const int x = CANVAS_WIDTH * CHARACTER_WIDTH / 2;
const int y = CANVAS_HEIGHT * CHARACTER_HEIGHT / 2;
const int priority = 0;
const GXOamMode mode = GX_OAM_MODE_NORMAL;
const BOOL mosaic = FALSE;
const GXOamEffect effect = GX_OAM_EFFECT_AFFINE_DOUBLE;
const GXOamColorMode color = GX_OAM_COLORMODE_16;
const int cParam = TXT_CPALETTE_MAIN;
const BOOL makeBR = FALSE;
const size_t szByte = NNS_G2dCharCanvasCalcCellDataSize1D(&gCanvas, makeBR);
//---- セルデータ用メモリ確保
gpCanvasCell = (NNSG2dCellData*)TXT_Alloc(szByte);
SDK_NULL_ASSERT( gpCanvasCell );
NNS_G2dCharCanvasMakeCell1D(
gpCanvasCell,
&gCanvas,
x,
y,
priority,
mode,
mosaic,
effect,
color,
cOffset,
cParam,
vramMode,
makeBR
);
}
}
/*---------------------------------------------------------------------------*
Name: SampleDraw
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleDraw(void)
{
// Canvasクリア
NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_NULL);
// 文字描画
NNS_G2dTextCanvasDrawText(&gTextCanvas, 1, 1, TXT_COLOR_BLACK, TXT_DRAWTEXT_FLAG_DEFAULT,
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\n"
);
}
/*---------------------------------------------------------------------------*
Name: PrintSampleInfo
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void PrintSampleInfo(void)
{
DTX_PrintLine(
"1D mapping OBJ CharCanvas Cell Sample\n"
"operation\n"
" (none)\n"
);
DTX_PrintLine("canvas size character: %3d x %3d", CANVAS_WIDTH, CANVAS_HEIGHT);
DTX_PrintLine("canvas size pixel: %3d x %3d", CANVAS_WIDTH * 8, CANVAS_HEIGHT * 8);
DTX_PrintLine("bounding sphere radius: %3d", NNS_G2dGetCellBoundingSphereR(gpCanvasCell));
}
/*---------------------------------------------------------------------------*
Name: SampleInit
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleInit(void)
{
// フォントを読み込みます
TXT_LoadFont( &gFont, TXT_FONTRESOURCE_NAME );
InitOamManager( &gOamManager );
InitRenderer( &gRenderer, &gSurface, &gImageProxy, &gPaletteProxy );
InitScreen();
InitCanvas();
SampleDraw();
PrintSampleInfo();
}
/*---------------------------------------------------------------------------*
Name: SampleMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleMain(void)
{
static fx32 x = SCREEN_WIDTH /2 * FX32_ONE;
static fx32 y = SCREEN_HEIGHT/2 * FX32_ONE;
static fx32 scale = FX32_ONE;
static u16 rot = 0;
static fx32 vx = FX32_ONE;
static fx32 vy = FX32_ONE;
static fx32 vs = FX32_ONE/120;
static u16 vr = 0x10000/0xFF;
//---- セルの表示パラメータを更新します
{
const int bsr = NNS_G2dGetCellBoundingSphereR( gpCanvasCell );
x += vx;
y += vy;
// scale += vs;
rot += vr;
//---- ディスプレイ端で反射する
if( (x < bsr * scale) || (SCREEN_WIDTH * FX32_ONE - bsr * scale < x) )
{
vx *= -1;
}
if( (y < bsr * scale) || (SCREEN_HEIGHT * FX32_ONE - bsr * scale < y) )
{
vy *= -1;
}
if( (scale < FX32_ONE/2) || (FX32_ONE * 2 < scale) )
{
vs *= -1;
}
}
//---- CharCanvas セルを描画します
NNS_G2dBeginRendering( &gRenderer );
{
NNS_G2dPushMtx();
{
NNS_G2dTranslate( x, y, 0 );
NNS_G2dRotZ( FX_SinIdx(rot), FX_CosIdx(rot) );
NNS_G2dScale( scale, scale, FX32_ONE );
NNS_G2dDrawCell( gpCanvasCell );
}
NNS_G2dPopMtx();
}
NNS_G2dEndRendering();
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// サンプルの初期化処理
SampleInit();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
// サンプルのメイン処理
SampleMain();
CMN_WaitVBlankIntr();
// セルデータの書き出し
NNS_G2dApplyOamManagerToHW( &gOamManager );
NNS_G2dResetOamManagerBuffer( &gOamManager );
// 情報出力の表示
DTX_Reflect();
}
}

View File

@ -0,0 +1,43 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - DoubleBuffering
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,358 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - DoubleBuffering
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// ダブルバッファリングONまたはOFFで文字列を表示します。
// 文字列の描画には非常に時間がかかるのでダブルバッファリングを行わないと
// 表示がちらつきます。
//
// 操作方法
// A : ダブルバッファリングのON/OFFを切り替えます。
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include "g2d_textdemolib.h"
#define CANVAS_WIDTH 30 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS_HEIGHT 22 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS_LEFT 1 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS_TOP 1 // 文字描画域の位置Y (キャラクタ単位)
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
//------------------------------------------------------------------------------
// グローバル変数
// オンスクリーン表示用
NNSG2dCharCanvas gOnCanvas;
NNSG2dTextCanvas gOnTextCanvas;
// オフスクリーン表示用
#define TRANS_TASK_NUM 1
NNSG2dCharCanvas gOffCanvas;
NNSG2dTextCanvas gOffTextCanvas;
// オフスクリーンバッファ
// CharCanvasと同サイズのキャラクタ配列
GXCharFmt16 gOffBuffer[CANVAS_HEIGHT][CANVAS_WIDTH];
NNSGfdVramTransferTask gTrasTask[TRANS_TASK_NUM];
// 共通
NNSG2dFont gFont;
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: InitCanvasShare
Description: /
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitCanvasShare(void)
{
// BG 1 を設定
G2_SetBG1Control(
GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256
GX_BG_COLORMODE_16, // カラーモード 16色
GX_BG_SCRBASE_0x0000, // スクリーンベース
GX_BG_CHARBASE_0x00000, // キャラクタベース
GX_BG_EXTPLTT_01 // 拡張パレットスロット
);
// BG1 を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_BG1 );
// カラーパレットを設定
GX_LoadBGPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
// フォントをロード
TXT_LoadFont(&gFont, TXT_FONTRESOURCE_NAME);
// スクリーンを設定
NNS_G2dMapScrToCharText(
G2_GetBG1ScrPtr(),
CANVAS_WIDTH,
CANVAS_HEIGHT,
CANVAS_LEFT,
CANVAS_TOP,
NNS_G2D_TEXT_BG_WIDTH_256,
CHARACTER_OFFSET,
TXT_CPALETTE_MAIN
);
}
/*---------------------------------------------------------------------------*
Name: InitOnScreenCanvas
Description: Canvasを初期化します
Arguments:
Returns:
*---------------------------------------------------------------------------*/
// オンスクリーン表示時の初期化
static void InitOnScreenCanvas(void)
{
GXCharFmt16* const charBase = (GXCharFmt16*)G2_GetBG1CharPtr();
// CharCanvas の初期化
NNS_G2dCharCanvasInitForBG(
&gOnCanvas,
charBase + CHARACTER_OFFSET, // VRAM のアドレス
CANVAS_WIDTH,
CANVAS_HEIGHT,
NNS_G2D_CHARA_COLORMODE_16
);
// TextCanvas の初期化
NNS_G2dTextCanvasInit(
&gOnTextCanvas,
&gOnCanvas,
&gFont,
TEXT_HSPACE,
TEXT_VSPACE
);
}
/*---------------------------------------------------------------------------*
Name: InitOffScreenCanvas
Description: Canvasを初期化します
Arguments:
Returns:
*---------------------------------------------------------------------------*/
// オフスクリーン表示時の初期化
static void InitOffScreenCanvas(void)
{
// CharCanvas の初期化
NNS_G2dCharCanvasInitForBG(
&gOffCanvas,
gOffBuffer, // VRAMのアドレスではなくオフスクリーンバッファのアドレスを渡す
CANVAS_WIDTH,
CANVAS_HEIGHT,
NNS_G2D_CHARA_COLORMODE_16
);
// TextCanvas の初期化
NNS_G2dTextCanvasInit(
&gOffTextCanvas,
&gOffCanvas,
&gFont,
TEXT_HSPACE,
TEXT_VSPACE
);
// オフスクリーンバッファの転送にVRAM転送マネージャを使います
NNS_GfdInitVramTransferManager(gTrasTask, TRANS_TASK_NUM);
}
/*---------------------------------------------------------------------------*
Name: SampleInit
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleInit(void)
{
// 共有利ソースの初期化
InitCanvasShare();
// オンスクリーン表示用初期化
InitOnScreenCanvas();
// オフスクリーン表示用初期化
InitOffScreenCanvas();
}
/*---------------------------------------------------------------------------*
Name: SampleDraw
Description:
Arguments: pTextCanvas: TextCanvas
Returns:
*---------------------------------------------------------------------------*/
static void SampleDraw(NNSG2dTextCanvas *pTextCanvas)
{
static int y = 0;
// Canvas クリア
NNS_G2dCharCanvasClear(NNS_G2dTextCanvasGetCharCanvas(pTextCanvas), TXT_COLOR_NULL);
// 描画
NNS_G2dTextCanvasDrawText(
pTextCanvas,
0, y,
TXT_COLOR_BLACK,
TXT_DRAWTEXT_FLAG_DEFAULT,
"abcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyz\n"
"abcdefghijklmnopqrstuvwxyz\n"
);
// 少しずつ下へ。
y ++;
if( y > 100 )
{
y = 0;
}
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
BOOL bDoubleBuffering = FALSE;
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// サンプルの初期化処理
SampleInit();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
{
// オンオフ描画を切り替えます。
if( CMN_IsTrigger(PAD_BUTTON_A) )
{
bDoubleBuffering = ! bDoubleBuffering;
}
DTX_PrintLine(
"Double Buffering Sample\n"
"operation\n"
" A on/off double buffering\n"
);
DTX_PrintLine(bDoubleBuffering ? "DoubleBuffering: ON": "DoubleBuffering: OFF");
}
//----------------------------------
// LCD 表示期間中
if( bDoubleBuffering )
{
// オフスクリーン表示では転送中以外はいつでも描画できます。
SampleDraw( &gOffTextCanvas );
// Vブランク期間中の転送タスクを登録します。
(void)NNS_GfdRegisterNewVramTransferTask(
NNS_GFD_DST_2D_BG1_CHAR_MAIN,
sizeof(GXCharFmt16) * CHARACTER_OFFSET,
gOffBuffer,
sizeof(gOffBuffer)
);
}
else
{
// オンスクリーン表示では何もする事はありません
}
//
//----------------------------------
CMN_WaitVBlankIntr();
DTX_Reflect();
//----------------------------------
// V ブランク期間中
if( bDoubleBuffering )
{
// オフスクリーン表示ではVブランク中に描画済みイメージをVRAMへ転送します。
NNS_GfdDoVramTransfer();
}
else
{
// オンスクリーン表示ではVブランク中にVRAMに描画します。
SampleDraw( &gOnTextCanvas );
}
//
//----------------------------------
}
}

View File

@ -0,0 +1,43 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - DrawLetter
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,246 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - DrawLetter
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// 文字描画関数の使用サンプルです。
// 1文字ずつ色を変えながら階段状に文字を描画します。
//
// 操作方法
// 操作なし。
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include "g2d_textdemolib.h"
#define CANVAS_WIDTH 22 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS_HEIGHT 16 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS_LEFT 5 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS_TOP 4 // 文字描画域の位置Y (キャラクタ単位)
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
//------------------------------------------------------------------------------
// グローバル変数
NNSG2dFont gFont; // フォント
static NNSG2dCharCanvas gCanvas; // CharCanvas
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: InitScreen
Description: BG
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitScreen(void)
{
// BG 1 を設定
G2_SetBG1Control(
GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256
GX_BG_COLORMODE_16, // カラーモード 16色
GX_BG_SCRBASE_0x0000, // スクリーンベース
GX_BG_CHARBASE_0x00000, // キャラクタベース
GX_BG_EXTPLTT_01 // 拡張パレットスロット
);
// BG1 を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_BG1 );
// カラーパレットを設定
GX_LoadBGPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
}
/*---------------------------------------------------------------------------*
Name: InitCanvas
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitCanvas(void)
{
GXCharFmt16* pCharBase = (GXCharFmt16*)G2_GetBG1CharPtr();
int cOffset = CHARACTER_OFFSET;
// フォントを読み込みます
// 他のデモと違い、わかりやすいように左スペースを持つフォントを使用します
TXT_LoadFont( &gFont, DEBUG_FONTRESOURCE_NAME );
// CharCanvas の初期化
NNS_G2dCharCanvasInitForBG(
&gCanvas,
pCharBase + cOffset,
CANVAS_WIDTH,
CANVAS_HEIGHT,
NNS_G2D_CHARA_COLORMODE_16
);
// スクリーンを設定
NNS_G2dMapScrToCharText(
G2_GetBG1ScrPtr(),
CANVAS_WIDTH,
CANVAS_HEIGHT,
CANVAS_LEFT,
CANVAS_TOP,
NNS_G2D_TEXT_BG_WIDTH_256,
cOffset,
TXT_CPALETTE_USERCOLOR
);
}
/*---------------------------------------------------------------------------*
Name: SampleMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
#define NEXT_COLOR(c) ((u8)(((c) + 1) & 0xF))
static void SampleMain(void)
{
// 表示する文字列
const char* const str = "abcdefghijklmnopqrstuvwxyz";
const char* pos;
const u8 bgColor = TXT_UCOLOR_GRAY;
int x = 0;
int y = 0;
u8 clr = 0;
NNSG2dGlyph glyph;
InitScreen();
InitCanvas();
// 背景クリア
NNS_G2dCharCanvasClear(&gCanvas, bgColor);
// DrawChar で描画
for( pos = str; *pos != '\0'; pos++ )
{
int width;
// NNS_G2dCharCanvasDrawChar の返り値は文字幅(=左スペース幅 + グリフ幅 + 右スペース幅) です
width = NNS_G2dCharCanvasDrawChar(&gCanvas, &gFont, x, y, clr, *pos);
// 文字幅を加算します
x += width;
x += TEXT_HSPACE;
y += TEXT_VSPACE;
// 次のカラー
clr = NEXT_COLOR(clr);
if( clr == bgColor )
{
clr = NEXT_COLOR(clr);
}
}
// DrawGlyph で描画
x = 0;
for( pos = str; *pos != '\0'; pos++ )
{
NNS_G2dFontGetGlyph(&glyph, &gFont, *pos);
NNS_G2dCharCanvasDrawGlyph(&gCanvas, &gFont, x, y, clr, &glyph);
// グリフ幅のみを加算します。
x += glyph.pWidths->glyphWidth;
x += TEXT_HSPACE;
y += TEXT_VSPACE;
// 次のカラー
clr = NEXT_COLOR(clr);
if( clr == bgColor )
{
clr = NEXT_COLOR(clr);
}
}
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// サンプルのメイン処理
SampleMain();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
CMN_WaitVBlankIntr();
// 情報出力の表示
DTX_Reflect();
}
}

View File

@ -0,0 +1,43 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - DrawLetters
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,497 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - DrawLetters
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// 文字列描画関数の利用サンプルです。
// NNS_G2dTextCanvasDrawString
// NNS_G2dTextCanvasDrawText
// NNS_G2dTextCanvasDrawTextRect
// の 3 関数においてフラグによる描画の違いを示します。
//
// 操作方法
// デモ実行時の下画面参照
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include "g2d_textdemolib.h"
#define CHARACTER_WIDTH 8
#define CHARACTER_HEIGHT 8
#define CANVAS_WIDTH 22 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS_HEIGHT 16 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS_LEFT 5 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS_TOP 4 // 文字描画域の位置Y (キャラクタ単位)
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
#define TRANS_TASK_NUM 1
//------------------------------------------------------------------------------
// グローバル変数
NNSG2dFont gFont; // フォント
NNSG2dCharCanvas gCanvas; // CharCanvas
NNSG2dTextCanvas gTextCanvas; // TextCanvas
// オフスクリーンバッファ
GXCharFmt16 gOffBuffer[CANVAS_HEIGHT][CANVAS_WIDTH];
NNSGfdVramTransferTask gTrasTask[TRANS_TASK_NUM];
// 表示するテキスト
static const char sSampleText[] =
"short string\n"
"It's a long long long long string.\n"
"\n"
"after null line";
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: InitScreen
Description: BG
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitScreen(void)
{
// BG 1 を設定
G2_SetBG1Control(
GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256
GX_BG_COLORMODE_16, // カラーモード 16色
GX_BG_SCRBASE_0x0000, // スクリーンベース
GX_BG_CHARBASE_0x00000, // キャラクタベース
GX_BG_EXTPLTT_01 // 拡張パレットスロット
);
// BG1 を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_BG1 );
// カラーパレットを設定
GX_LoadBGPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
}
/*---------------------------------------------------------------------------*
Name: InitCanvas
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitCanvas(void)
{
// フォントを読み込みます
TXT_LoadFont( &gFont, TXT_FONTRESOURCE_NAME );
// CharCanvas の初期化
NNS_G2dCharCanvasInitForBG(
&gCanvas,
&gOffBuffer,
CANVAS_WIDTH,
CANVAS_HEIGHT,
NNS_G2D_CHARA_COLORMODE_16
);
// TextCanvasの初期化
NNS_G2dTextCanvasInit(
&gTextCanvas,
&gCanvas,
&gFont,
TEXT_HSPACE,
TEXT_VSPACE
);
// スクリーンを設定
NNS_G2dMapScrToCharText(
G2_GetBG1ScrPtr(),
CANVAS_WIDTH,
CANVAS_HEIGHT,
CANVAS_LEFT,
CANVAS_TOP,
NNS_G2D_TEXT_BG_WIDTH_256,
CHARACTER_OFFSET,
TXT_CPALETTE_MAIN
);
}
/*---------------------------------------------------------------------------*
Name: SampleInit
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleInit(void)
{
InitScreen();
InitCanvas();
// オフスクリーンバッファの転送にVRAM転送マネージャを使います
NNS_GfdInitVramTransferManager(gTrasTask, TRANS_TASK_NUM);
}
/*---------------------------------------------------------------------------*
Name: SampleString
Description: NNS_G2dTextCanvasDrawString()
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleString(void)
{
const char* str = sSampleText;
const int linefeed = NNS_G2dFontGetLineFeed(&gFont) + NNS_G2dTextCanvasGetVSpace(&gTextCanvas);
const int baselinePos = NNS_G2dFontGetBaselinePos(&gFont);
int x, y;
// 情報出力
{
DTX_PrintLine("NNS_G2dTextCanvasDrawString Sample");
DTX_PrintLine(" operation:");
DTX_PrintLine(" X: next mode");
DTX_PrintLine("");
}
// 描画位置初期値
x = 0;
y = baselinePos;
// 背景をクリア
NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_WHITE);
// 文字列描画
while( str != NULL )
{
NNS_G2dTextCanvasDrawString(
&gTextCanvas, // 描画するTextCanvasへのポインタ
x, // 描画開始座標 x
y - baselinePos, // 描画開始座標 y
TXT_COLOR_CYAN, // 文字色
str, // 描画する文字列
&str // 描画終了位置を受け取るバッファへのポインタ
);
y += linefeed;
}
}
/*---------------------------------------------------------------------------*
Name: SampleText
Description: NNS_G2dTextCanvasDrawText()
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleText(void)
{
u32 flag = 0;
// 背景をクリア
NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_WHITE);
// 基準点を通る水平/垂直線を表示
{
const int canvas_pw = CANVAS_WIDTH * CHARACTER_WIDTH;
const int canvas_ph = CANVAS_HEIGHT * CHARACTER_HEIGHT;
const int origin_x = canvas_pw / 2;
const int origin_y = canvas_ph / 2;
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_RED, 0, origin_y, canvas_pw, 1);
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_RED, origin_x, 0, 1, canvas_ph);
}
// キー入力処理と情報出力
{
DTX_PrintLine("NNS_G2dTextCanvasDrawText Sample");
DTX_PrintLine(" operation:");
DTX_PrintLine(" up: origin bottom");
DTX_PrintLine(" down: origin top");
DTX_PrintLine(" left: origin right");
DTX_PrintLine(" right: origin left");
DTX_PrintLine(" Y: left align");
DTX_PrintLine(" A: right align");
DTX_PrintLine(" X: next mode");
DTX_PrintLine("");
if( CMN_IsPress(PAD_KEY_UP) )
{
flag |= NNS_G2D_VERTICALORIGIN_BOTTOM;
DTX_PrintLine(" NNS_G2D_VERTICALORIGIN_BOTTOM");
}
else if( CMN_IsPress(PAD_KEY_DOWN) )
{
flag |= NNS_G2D_VERTICALORIGIN_TOP;
DTX_PrintLine(" NNS_G2D_VERTICALORIGIN_TOP");
}
else
{
flag |= NNS_G2D_VERTICALORIGIN_MIDDLE;
DTX_PrintLine(" NNS_G2D_VERTICALORIGIN_MIDDLE");
}
if( CMN_IsPress(PAD_KEY_LEFT) )
{
flag |= NNS_G2D_HORIZONTALORIGIN_RIGHT;
DTX_PrintLine(" NNS_G2D_HORIZONTALORIGIN_RIGHT");
}
else if( CMN_IsPress(PAD_KEY_RIGHT) )
{
flag |= NNS_G2D_HORIZONTALORIGIN_LEFT;
DTX_PrintLine(" NNS_G2D_HORIZONTALORIGIN_LEFT");
}
else
{
flag |= NNS_G2D_HORIZONTALORIGIN_CENTER;
DTX_PrintLine(" NNS_G2D_HORIZONTALORIGIN_CENTER");
}
if( CMN_IsPress(PAD_BUTTON_Y) )
{
flag |= NNS_G2D_HORIZONTALALIGN_LEFT;
DTX_PrintLine(" NNS_G2D_HORIZONTALALIGN_LEFT");
}
else if( CMN_IsPress(PAD_BUTTON_A) )
{
flag |= NNS_G2D_HORIZONTALALIGN_RIGHT;
DTX_PrintLine(" NNS_G2D_HORIZONTALALIGN_RIGHT");
}
else
{
flag |= NNS_G2D_HORIZONTALALIGN_CENTER;
DTX_PrintLine(" NNS_G2D_HORIZONTALALIGN_CENTER");
}
}
// 文字列描画
NNS_G2dTextCanvasDrawText(
&gTextCanvas, // 描画するTextCanvasへのポインタ
CANVAS_WIDTH * CHARACTER_WIDTH / 2, // 基準点座標 CharCanvas中心
CANVAS_HEIGHT * CHARACTER_HEIGHT / 2, // 基準点座標 CharCanvas中心
TXT_COLOR_MAGENTA, // 文字色
flag, // 描画位置フラグ
sSampleText // 描画する文字列
);
}
/*---------------------------------------------------------------------------*
Name: SampleTextRect
Description: NNS_G2dTextCanvasDrawTextRect()
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleTextRect(void)
{
const int canvas_pw = CANVAS_WIDTH * CHARACTER_WIDTH;
const int canvas_ph = CANVAS_HEIGHT * CHARACTER_HEIGHT;
const int rect_x = canvas_pw * 1/6;
const int rect_y = canvas_ph * 1/6;
const int rect_w = canvas_pw * 2/3;
const int rect_h = canvas_ph * 2/3;
u32 flag = 0;
// 背景をクリア
NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_WHITE);
// 基準矩形を表示
{
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_RED,
rect_x - 1, rect_y - 1, rect_w + 2, 1);
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_RED,
rect_x - 1, rect_y + rect_h, rect_w + 2, 1);
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_RED,
rect_x - 1, rect_y, 1, rect_h);
NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_RED,
rect_x + rect_w, rect_y, 1, rect_h);
}
// キー入力処理と情報出力
{
DTX_PrintLine("NNS_G2dTextCanvasDrawTextRect Sample");
DTX_PrintLine(" operation:");
DTX_PrintLine(" up: top align");
DTX_PrintLine(" down: bottom align");
DTX_PrintLine(" left: left align");
DTX_PrintLine(" right: right align");
DTX_PrintLine(" X: next mode");
DTX_PrintLine("");
if( CMN_IsPress(PAD_KEY_UP) )
{
flag |= NNS_G2D_VERTICALALIGN_TOP;
DTX_PrintLine(" NNS_G2D_VERTICALALIGN_TOP");
}
else if( CMN_IsPress(PAD_KEY_DOWN) )
{
flag |= NNS_G2D_VERTICALALIGN_BOTTOM;
DTX_PrintLine(" NNS_G2D_VERTICALALIGN_BOTTOM");
}
else
{
flag |= NNS_G2D_VERTICALALIGN_MIDDLE;
DTX_PrintLine(" NNS_G2D_VERTICALALIGN_MIDDLE");
}
if( CMN_IsPress(PAD_KEY_LEFT) )
{
flag |= NNS_G2D_HORIZONTALALIGN_LEFT;
DTX_PrintLine(" NNS_G2D_HORIZONTALALIGN_LEFT");
}
else if( CMN_IsPress(PAD_KEY_RIGHT) )
{
flag |= NNS_G2D_HORIZONTALALIGN_RIGHT;
DTX_PrintLine(" NNS_G2D_HORIZONTALALIGN_RIGHT");
}
else
{
flag |= NNS_G2D_HORIZONTALALIGN_CENTER;
DTX_PrintLine(" NNS_G2D_HORIZONTALALIGN_CENTER");
}
}
// 文字列の描画
NNS_G2dTextCanvasDrawTextRect(
&gTextCanvas, // 描画するTextCanvasへのポインタ
rect_x, // 矩形位置座標
rect_y, // 矩形位置座標
rect_w, // 基準矩形幅
rect_h, // 基準矩形高さ
TXT_COLOR_GREEN, // 文字色
flag, // 描画位置フラグ
sSampleText // 描画する文字列
);
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
// 表示モード
enum
{
MODE_STRING, // NNS_G2dTextCanvasDrawString のデモ
MODE_TEXT, // NNS_G2dTextCanvasDrawText のデモ
MODE_TEXT_RECT, // NNS_G2dTextCanvasDrawTextRectのデモ
NUM_OF_MODE
}
mode = MODE_TEXT_RECT;
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// デモ用の前処理
SampleInit();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
// Xボタンでモード変更
if( CMN_IsTrigger(PAD_BUTTON_X) )
{
mode ++;
mode %= NUM_OF_MODE;
}
// モードに応じて処理分岐
switch( mode )
{
case MODE_STRING: SampleString(); break;
case MODE_TEXT: SampleText(); break;
case MODE_TEXT_RECT: SampleTextRect(); break;
}
// 転送タスクの登録
(void)NNS_GfdRegisterNewVramTransferTask(
NNS_GFD_DST_2D_BG1_CHAR_MAIN,
sizeof(GXCharFmt16) * CHARACTER_OFFSET,
gOffBuffer,
sizeof(gOffBuffer)
);
CMN_WaitVBlankIntr();
// 情報出力の表示
DTX_Reflect();
// オフスクリーンバッファの転送
NNS_GfdDoVramTransfer();
}
}

View File

@ -0,0 +1,43 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - DrawTaggedText
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,327 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - DrawTaggedText
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// NNS_G2dTextCanvasDrawTaggedText() の使用サンプル。
//
// 操作方法
// 操作なし。
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include "g2d_textdemolib.h"
#define CANVAS_WIDTH 22 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS_HEIGHT 16 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS_LEFT 5 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS_TOP 4 // 文字描画域の位置Y (キャラクタ単位)
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
// 文字列埋め込み用色番号
#define WHITE "\x1"
#define BLACK "\x2"
#define RED "\x3"
#define GREEN "\x4"
#define BLUE "\x5"
#define CYAN "\x6"
#define MAGENTA "\x7"
#define YELLOW "\x8"
//------------------------------------------------------------------------------
// グローバル変数
NNSG2dFont gFont; // フォント
NNSG2dCharCanvas gCanvas; // CharCanvas
NNSG2dTextCanvas gTextCanvas; // TextCanvas
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: SimpleTagCallback
Description: NNSG2dTagCallback
Arguments: c:
pInfo:
Returns:
*---------------------------------------------------------------------------*/
static void SimpleTagCallback(u16 c, NNSG2dTagCallbackInfo* pInfo)
{
if( c == 0x1B )
{
const char* pos = (const char*)pInfo->str;
switch( *pos++ )
{
// 0x1B C 0xXX
case 'C': // Color
{
pInfo->clr = *(u8*)pos;
pos++;
}
break;
// 0x1B B
case 'B': // callBack
{
NNS_G2D_POINTER_ASSERT( pInfo->cbParam );
pos++; // alignment for NNS_G2D_UNICODE
pInfo->str = (const NNSG2dChar*)pos;
((NNSG2dTagCallback)pInfo->cbParam)( c, pInfo );
}
return;
// 0x1B H 0xXX
case 'H': // Horizontal
{
s8 hSpace;
hSpace = *(s8*)pos;
pos++;
NNS_G2dTextCanvasSetHSpace(&(pInfo->txn), hSpace);
}
break;
// 0x1B V 0xXX
case 'V': // Vertical
{
s8 vSpace;
vSpace = *(s8*)pos;
pos++;
NNS_G2dTextCanvasSetVSpace(&(pInfo->txn), vSpace);
}
break;
// 0x1B X 0xXX
case 'X': // X
{
pInfo->x += *(s8*)pos;
pos++;
}
break;
// 0x1B Y 0xXX
case 'Y': // Y
{
pInfo->y += *(s8*)pos;
pos++;
}
break;
default:
OS_Warning("NNS_G2dTextCanvasDrawTaggedText: Unknown Tag: %c (0x%02X)\n", *(u8*)(pos-1), *(u8*)(pos-1));
pos++; // alignment for NNS_G2D_UNICODE
break;
}
pInfo->str = (const NNSG2dChar*)pos;
}
}
/*---------------------------------------------------------------------------*
Name: InitScreen
Description: BG
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitScreen(void)
{
// BG 1 を設定
G2_SetBG1Control(
GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256
GX_BG_COLORMODE_16, // カラーモード 16色
GX_BG_SCRBASE_0x0000, // スクリーンベース
GX_BG_CHARBASE_0x00000, // キャラクタベース
GX_BG_EXTPLTT_01 // 拡張パレットスロット
);
// BG1 を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_BG1 );
// カラーパレットを設定
GX_LoadBGPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
}
/*---------------------------------------------------------------------------*
Name: InitCanvas
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitCanvas(void)
{
GXCharFmt16* pCharBase = (GXCharFmt16*)G2_GetBG1CharPtr();
int cOffset = CHARACTER_OFFSET;
// フォントを読み込みます
TXT_LoadFont( &gFont, TXT_FONTRESOURCE_NAME );
// CharCanvas の初期化
NNS_G2dCharCanvasInitForBG(
&gCanvas,
pCharBase + cOffset,
CANVAS_WIDTH,
CANVAS_HEIGHT,
NNS_G2D_CHARA_COLORMODE_16
);
// TextCanvas の初期化
NNS_G2dTextCanvasInit(
&gTextCanvas,
&gCanvas,
&gFont,
TEXT_HSPACE,
TEXT_VSPACE
);
// スクリーンを設定
NNS_G2dMapScrToCharText(
G2_GetBG1ScrPtr(),
CANVAS_WIDTH,
CANVAS_HEIGHT,
CANVAS_LEFT,
CANVAS_TOP,
NNS_G2D_TEXT_BG_WIDTH_256,
cOffset,
TXT_CPALETTE_MAIN
);
}
/*---------------------------------------------------------------------------*
Name: SampleMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
#define TAG_BEGIN "\x1B"
#define CHG_COLOR(clr) TAG_BEGIN "C" clr
#define CHG_LFEED(h) TAG_BEGIN "L" #h
#define CHG_HSP(h) TAG_BEGIN "H" #h
#define CHG_VSP(v) TAG_BEGIN "V" #v
#define ADD_X(x) TAG_BEGIN "X" #x
#define ADD_Y(y) TAG_BEGIN "Y" #y
static void SampleMain(void)
{
const static char text[] =
"change color to " CHG_COLOR(RED) "red " CHG_COLOR(GREEN) "green " CHG_COLOR(CYAN) "cyan" CHG_COLOR(BLACK) "\n"
CHG_HSP(\x5) "change hspace to 5" CHG_HSP(\x1) "\n"
ADD_X(\x32) ADD_Y(\x32) "jump x+50 y+50";
InitScreen();
InitCanvas();
// 背景クリア
NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_WHITE);
// タグつき文字列描画
NNS_G2dTextCanvasDrawTaggedText(
&gTextCanvas, // 描画する TextCanvas
0, // 描画開始座標
0, // 描画開始座標
TXT_COLOR_BLACK, // 文字色
text, // 描画する文字列
SimpleTagCallback, // タグ処理コールバック
NULL // タグ処理コールバック用パラメータ
);
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// サンプルのメイン処理
SampleMain();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
CMN_WaitVBlankIntr();
// 情報出力の表示
DTX_Reflect();
}
}

View File

@ -0,0 +1,121 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - DrawVertical
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 299 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
FCNV_DIR = $(NITROSYSTEM_TOOLSDIR)/fontcvtr
FONTCVTR = $(FCNV_DIR)/fontcvtrc.exe
FONT_SRC = ../data/src
FONT_OUT = ../data
FONT_XLOR = $(FONT_SRC)/demofont2.xlor
FONT_BPP = 4
FONT_WIN_H = " Pゴシック"
FONT_WIN_V = "@ Pゴシック"
FONT_SIZE = 12
FONT_H0 = h_0.NFTR
FONT_H90 = h_90.NFTR
FONT_H180 = h_180.NFTR
FONT_H270 = h_270.NFTR
FONT_V0 = v_0.NFTR
FONT_V90 = v_90.NFTR
FONT_V180 = v_180.NFTR
FONT_V270 = v_270.NFTR
FONT_BIN = $(FONT_H0) $(FONT_H90) $(FONT_H180) $(FONT_H270) \
$(FONT_V0) $(FONT_V90) $(FONT_V180) $(FONT_V270)
FONT_TARGET = $(addprefix $(FONT_OUT)/,$(FONT_BIN))
LDEPENDS_NEF += $(FONT_TARGET)
FONT_TTC = $(shell find `cygpath -W`/Fonts/ -iname msgothic.ttc)
ifeq ($(FONT_TTC),)
ENV_CHK = env-error
else
ENV_CHK = $(FONT_TTC)
endif
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
.PHONY: env-error
.PRECIOUS: $(FONT_OUT)/%.bmp
do-build: $(TARGETS)
$(TARGETS): $(FONT_TARGET)
env-error:
-echo Sorry. This demo requires japanese Windows environment.
false
# win -> bmp for h
$(FONT_OUT)/h.bmp: $(FONT_XLOR) $(FONTCVTR) Makefile $(ENV_CHK)
ifndef SILENT
echo $(FONT_WIN_H) -\> $@
endif
$(FONTCVTR) -i win -in $(FONT_WIN_H) -is $(FONT_SIZE) -ib $(FONT_BPP) \
-o bmp -of $@ -oo $(FONT_XLOR)
# win -> bmp for v
$(FONT_OUT)/v.bmp: $(FONT_XLOR) $(FONTCVTR) Makefile $(ENV_CHK)
ifndef SILENT
echo $(FONT_WIN_V) -\> $@
endif
$(FONTCVTR) -i win -in $(FONT_WIN_V) -is $(FONT_SIZE) -ib $(FONT_BPP) \
-o bmp -of $@ -oo $(FONT_XLOR)
# bmp -> nftr for h
$(FONT_OUT)/h_%.NFTR: $(FONT_OUT)/h.bmp $(FONT_XLOR) $(FONTCVTR) Makefile $(ENV_CHK)
ifndef SILENT
echo $< -\> $@
endif
$(FONTCVTR) -i bmp -if $< -io $(FONT_XLOR) -ib $(FONT_BPP) \
-o nitro -of $@ -oe sjis -oc $*
# bmp -> nftr for v
$(FONT_OUT)/v_%.NFTR: $(FONT_OUT)/v.bmp $(FONT_XLOR) $(FONTCVTR) Makefile $(ENV_CHK)
ifndef SILENT
echo $< -\> $@
endif
$(FONTCVTR) -i bmp -if $< -io $(FONT_XLOR) -ib $(FONT_BPP) \
-o nitro -of $@ -oe sjis -oc $*
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,439 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - DrawVertical
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// 縦書き用に変換したフォントを使用して縦書き描画を行います。
// このデモは日本語環境専用です。
//
// 操作方法
// 十字ボタンの押した方向が画面上となるように
// フォントと表示位置を切り替えます。
// A ボタンを押すと縦書き/横書きを切り替えます。
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include "g2d_textdemolib.h"
#define CHARACTER_WIDTH 8
#define CHARACTER_HEIGHT 8
#define CANVAS_WIDTH 28 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS_HEIGHT 20 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS_LEFT 2 // 文字描画域の位置X (キャラクタ単位)
#define CANVAS_TOP 2 // 文字描画域の位置Y (キャラクタ単位)
#define BG_WIDTH 32 // 文字列を描画する BG の幅 (キャラクタ単位)
#define BG_HEIGHT 32 // 文字列を描画する BG の高さ (キャラクタ単位)
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
//------------------------------------------------------------------------------
// 型
typedef enum Direction
{
DIR_H_0, // 横書き 画面の左から右へ
DIR_H_90, // 横書き 画面の上から下
DIR_H_180, // 横書き 画面の右から左へ
DIR_H_270, // 横書き 画面の下から上へ
DIR_V_0, // 縦書き 画面の上から下へ
DIR_V_90, // 縦書き 画面の右から左へ
DIR_V_180, // 縦書き 画面の下から上へ
DIR_V_270, // 縦書き 画面の左から右へ
DIR_NULL
}
Direction;
typedef struct FontInfo
{
const char* name;
Direction dir;
NNSG2dFont res;
}
FontInfo;
//------------------------------------------------------------------------------
// グローバル変数
NNSG2dCharCanvas gCanvas; // CharCanvas
NNSG2dTextCanvas gTextCanvas; // TextCanvas
FontInfo gFonts[] =
{
{"/data/h_0.NFTR", DIR_H_0 },
{"/data/h_90.NFTR", DIR_H_90 },
{"/data/h_180.NFTR", DIR_H_180 },
{"/data/h_270.NFTR", DIR_H_270 },
{"/data/v_0.NFTR", DIR_V_0 },
{"/data/v_90.NFTR", DIR_V_90 },
{"/data/v_180.NFTR", DIR_V_180 },
{"/data/v_270.NFTR", DIR_V_270 },
};
// 表示する文字列
const char* const sSampleText = "いろはにほへと ちりぬるを わかよたれそ\n"
"つねならむ うゐのおくやま けふこえて\n"
"あさきゆめみし ゑひもせす\n"
"The quick brown fox jumps over the lazy dog";
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: InitScreen
Description: BG
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitScreen(void)
{
// BG 1 を設定
G2_SetBG1Control(
GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256
GX_BG_COLORMODE_16, // カラーモード 16色
GX_BG_SCRBASE_0x0000, // スクリーンベース
GX_BG_CHARBASE_0x00000, // キャラクタベース
GX_BG_EXTPLTT_01 // 拡張パレットスロット
);
// BG1 を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_BG1 );
// カラーパレットを設定
GX_LoadBGPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
}
/*---------------------------------------------------------------------------*
Name: InitCanvas
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitCanvas(void)
{
GXCharFmt16* pChrBase = (GXCharFmt16*) G2_GetBG1CharPtr();
GXScrFmtText* pScrBase = (GXScrFmtText*)G2_GetBG1ScrPtr();
int cOffset = CHARACTER_OFFSET;
// スクリーンをクリア
MI_CpuClear16(G2_GetBG1ScrPtr(), sizeof(GXScrFmtText) * BG_WIDTH * BG_HEIGHT);
// CharCanvas の初期化
NNS_G2dCharCanvasInitForBG(
&gCanvas,
pChrBase + cOffset,
CANVAS_WIDTH,
CANVAS_HEIGHT,
NNS_G2D_CHARA_COLORMODE_16
);
// TextCanvasの初期化
NNS_G2dTextCanvasInit(
&gTextCanvas,
&gCanvas,
&gFonts[0].res,
TEXT_HSPACE,
TEXT_VSPACE
);
// スクリーンを設定
NNS_G2dMapScrToCharText(
pScrBase,
CANVAS_WIDTH,
CANVAS_HEIGHT,
CANVAS_LEFT,
CANVAS_TOP,
NNS_G2D_TEXT_BG_WIDTH_256,
cOffset,
TXT_CPALETTE_4BPP
);
}
/*---------------------------------------------------------------------------*
Name: SampleDraw
Description:
Arguments: x: x
y: y
pFont: 使
Returns:
*---------------------------------------------------------------------------*/
static void SampleDraw(int x, int y, const NNSG2dFont* pFont)
{
// 背景クリア
NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_4BPP_BG);
// フォント変更
NNS_G2dTextCanvasSetFont(&gTextCanvas, pFont);
// テキスト描画
NNS_G2dTextCanvasDrawText(&gTextCanvas, x, y, TXT_COLOR_4BPP_TEXT,
TXT_DRAWTEXT_FLAG_DEFAULT, sSampleText);
}
/*---------------------------------------------------------------------------*
Name: SampleInit
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleInit(void)
{
int i;
// フォント読み込み
for( i = 0; i < ARY_SIZEOF(gFonts); ++i )
{
TXT_LoadFont( &gFonts[i].res, gFonts[i].name );
}
// スクリーン設定
InitScreen();
// キャンバス構築
InitCanvas();
}
/*---------------------------------------------------------------------------*
Name: SearchFont
Description:
Arguments: pfis:
dir:
Returns:
*---------------------------------------------------------------------------*/
static const NNSG2dFont* SearchFont(const FontInfo* pfis, Direction dir)
{
int i;
for( i = 0; i < ARY_SIZEOF(gFonts); ++i )
{
if( pfis[i].dir == dir )
{
return &pfis[i].res;
}
}
return NULL;
}
/*---------------------------------------------------------------------------*
Name: MakeDirection
Description: /
Arguments: d:
bV: TRUE FALSE
Returns: /
*---------------------------------------------------------------------------*/
static Direction MakeDirection(Direction d, BOOL bV)
{
switch( d )
{
case DIR_H_0: return bV ? DIR_V_0: DIR_H_0;
case DIR_H_90: return bV ? DIR_V_90: DIR_H_90;
case DIR_H_180: return bV ? DIR_V_180: DIR_H_180;
case DIR_H_270: return bV ? DIR_V_270: DIR_H_270;
}
return DIR_H_0;
}
/*---------------------------------------------------------------------------*
Name: SampleMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleMain(void)
{
static Direction rotation = DIR_NULL;
static BOOL bV = FALSE;
BOOL bUpdated = FALSE;
//---- 入力に応じて表示の方向を変更します。
if( CMN_IsTrigger(PAD_KEY_UP) || rotation == DIR_NULL )
{
rotation = DIR_H_0;
bUpdated = TRUE;
}
if( CMN_IsTrigger(PAD_KEY_DOWN) )
{
rotation = DIR_H_180;
bUpdated = TRUE;
}
if( CMN_IsTrigger(PAD_KEY_LEFT) )
{
rotation = DIR_H_270;
bUpdated = TRUE;
}
if( CMN_IsTrigger(PAD_KEY_RIGHT) )
{
rotation = DIR_H_90;
bUpdated = TRUE;
}
if( CMN_IsTrigger(PAD_BUTTON_A) )
{
bV = ! bV;
bUpdated = TRUE;
}
//---- 方向が変更された場合に変更を反映します。
if( bUpdated )
{
static const int canvas_width = CANVAS_WIDTH * CHARACTER_WIDTH;
static const int canvas_height = CANVAS_HEIGHT * CHARACTER_HEIGHT;
const Direction dir = MakeDirection(rotation, bV);
const NNSG2dFont* pFont = SearchFont(gFonts, dir);
int x = 0;
int y = 0;
NNS_G2D_POINTER_ASSERT( pFont );
//---- 方向に応じて始点を調整します。
switch( dir )
{
case DIR_H_270:
case DIR_V_180: y = canvas_height; break;
case DIR_H_90:
case DIR_V_0: x = canvas_width; break;
case DIR_H_180:
case DIR_V_90: x = canvas_width;
y = canvas_height; break;
}
//---- 方向別のフォントを用いてサンプル文字列を描画します。
SampleDraw(x, y, pFont);
//---- メッセージ表示
DTX_PrintLine("DrawVertical demo");
DTX_PrintLine(" operation:");
DTX_PrintLine(" +: change direction");
DTX_PrintLine(" A: toggle horizontal/vertical writing");
DTX_PrintLine("");
DTX_PrintLine("direction:");
switch( dir )
{
case DIR_H_0:
case DIR_V_270: DTX_PrintLine(" left to right"); break;
case DIR_H_90:
case DIR_V_0: DTX_PrintLine(" top to bottom"); break;
case DIR_H_180:
case DIR_V_90: DTX_PrintLine(" right to left"); break;
case DIR_H_270:
case DIR_V_180: DTX_PrintLine(" bottom to up"); break;
}
DTX_PrintLine("");
DTX_PrintLine("writing mode:");
DTX_PrintLine(bV ? " vertical": " horizontal");
}
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// デモ用の前処理
SampleInit();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
CMN_WaitVBlankIntr();
SampleMain();
// 情報出力の表示
DTX_Reflect();
}
}

View File

@ -0,0 +1,57 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = \
textdemolib \
\
DoubleBuffering \
BGText \
BGAffine \
\
OBJ1D \
OBJ2DRect \
CanvasCell \
\
ShiftJISText \
UTF16Text \
UTF8Text \
CP1252Text \
\
DrawLetter \
DrawLetters \
DrawTaggedText \
\
MinimumCanvas \
SimpleFontView \
\
PortraitHW \
PortraitSW \
ifneq ($(shell find `cygpath -W`/Fonts/ -iname msgothic.ttc),)
SUBDIRS += DrawVertical
endif
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,43 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - MinimumCanvas
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,630 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - MinimumCanvas
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// 表示する文字列の大きさに応じて、その文字列を表示する事が出来る
// 最小の CharCanvas を構築し、描画を行います。
// NNS_G2dFontGetTextRect によって得られた文字列のサイズが
// CharCanvas のサイズとして無効である場合は、それ以上かつ最小の
// 有効サイズを計算して CharCanvas を構築します。
//
// 操作方法
// A ボタン カラーモードを変更する。
// B ボタン VRAMモードを変更する。
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include <nnsys/misc.h>
#include "g2d_textdemolib.h"
#define ROUNDUP(x, div) (((x) + (div) - 1) & ~((div) - 1))
#define CHARACTER_WIDTH 8 // キャラクタのピクセル単位での幅
#define CHARACTER_HEIGHT 8 // キャラクタのピクセル単位での高さ
#define SCREEN_WIDTH 256 // スクリーン幅
#define SCREEN_HEIGHT 192 // スクリーン高さ
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号
#define MAX_OBJ_NUM 128 // OBJ の最大数
#define MAX_CHARA_NAME 1024 // キャラクタネームの最大値
//------------------------------------------------------------------------------
// グローバル変数
NNSG2dFont gFont; // フォント
GXOamColorMode gColorMode = GX_OAM_COLORMODE_16;
NNSG2dOBJVramMode gVramMode = NNS_G2D_OBJVRAMMODE_32K;
int gUsingCharas = 0;
int gUsingOam = 0;
const static NNSG2dChar* sampleText[] =
{
NNS_G2D_TRANSCODE("This sample program make temporary minimum\n"
"CharCanvas to draw a text and draw the\n"
"text to it."),
NNS_G2D_TRANSCODE("sample text"),
NNS_G2D_TRANSCODE("this text require\n11x3 size."),
NNS_G2D_TRANSCODE("line 1\n" "line 2\n" "line 3\n" "line 4\n"),
NNS_G2D_TRANSCODE("A"),
};
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: GetMinValidCanvasSize
Description: CharCanvas
Arguments: areaWidth: CharCanvas
areaHeight: CharCanvas
colorMode: CharCanvas
vramMode: OBJ VRAM
Returns: CharCanvas
*---------------------------------------------------------------------------*/
static NNSG2dTextRect GetMinValidCanvasSize(
int areaWidth,
int areaHeight,
GXOamColorMode colorMode,
NNSG2dOBJVramMode vramMode
)
{
NNSG2dTextRect rect;
NNS_G2D_MIN_ASSERT( areaWidth, 1 );
NNS_G2D_MIN_ASSERT( areaHeight, 1 );
NNS_G2D_ASSERT( (colorMode == GX_OAM_COLORMODE_16)
|| (colorMode == GX_OAM_COLORMODE_256) );
NNS_G2D_ASSERT( (vramMode == NNS_G2D_OBJVRAMMODE_32K)
|| (vramMode == NNS_G2D_OBJVRAMMODE_64K)
|| (vramMode == NNS_G2D_OBJVRAMMODE_128K)
|| (vramMode == NNS_G2D_OBJVRAMMODE_256K) );
rect.width = areaWidth;
rect.height = areaHeight;
if( (colorMode == GX_OAM_COLORMODE_16 && vramMode == NNS_G2D_OBJVRAMMODE_128K)
|| (colorMode != GX_OAM_COLORMODE_16 && vramMode == NNS_G2D_OBJVRAMMODE_256K) )
{
// 「奇数と「4で割った余りが3の値」の組み合わせは不可」のケース。
// 条件に当てはまる場合は適切などちらか片方を +1 すればよい
if( (rect.width % 2) != 0 && (rect.height % 2) != 0 )
{
if( (rect.width % 4) != 1 )
{
// width % 4 == 3 && height % 4 == 1,3
rect.width++;
}
else if( (rect.height % 4) != 1 )
{
// width % 4 == 1 && height % 4 == 3
rect.height++;
}
}
}
else if( colorMode == GX_OAM_COLORMODE_16 && vramMode == NNS_G2D_OBJVRAMMODE_256K )
{
// 共に偶数でなければならない。
rect.width = ROUNDUP(rect.width, 2);
rect.height = ROUNDUP(rect.height, 2);
}
return rect;
}
/*---------------------------------------------------------------------------*
Name: OffsetCharName
Description: 1D OBJでキャラクタネームが指し示すアドレスを取得します
Arguments: pCharBase: OBJのキャラクタベース
charName:
vramMode: VRAM
Returns:
*---------------------------------------------------------------------------*/
static void* OffsetCharName(
void* pCharBase,
int charName,
NNSG2dOBJVramMode vramMode )
{
u32 addr = (u32)pCharBase;
addr += sizeof(GXCharFmt16) * (charName << vramMode);
return (void*)addr;
}
/*---------------------------------------------------------------------------*
Name: SDKToNNSColorMode
Description: NITRO-SDK NITRO-System
Arguments: sdk: NITRO-SDKのカラーモード列挙子
Returns: sdk NITRO-System
*---------------------------------------------------------------------------*/
static inline NNSG2dCharaColorMode SDKToNNSColorMode(GXOamColorMode sdk)
{
static const NNSG2dCharaColorMode nns[] =
{ NNS_G2D_CHARA_COLORMODE_16, NNS_G2D_CHARA_COLORMODE_256 };
NNS_MINMAX_ASSERT(sdk, 0, 1);
return nns[sdk];
}
/*---------------------------------------------------------------------------*
Name: ResetOAM
Description: OAMを全て解放しリセットします
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void ResetOAM(void)
{
MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE);
gUsingOam = 0;
}
/*---------------------------------------------------------------------------*
Name: ResetOBJChr
Description: OBJキャラクタを全て解放します
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void ResetOBJChr(void)
{
gUsingCharas = 0;
}
/*---------------------------------------------------------------------------*
Name: AllocCharacters
Description:
Arguments: num:
Returns:
-1
*---------------------------------------------------------------------------*/
static int AllocCharacters(
int num,
GXOamColorMode colorMode,
NNSG2dOBJVramMode vramMode )
{
int ret;
int realNum = ROUNDUP_DIV(num, (1 << vramMode));
if( colorMode == GX_OAM_COLORMODE_256 )
{
realNum *= 2;
}
if( gUsingCharas + realNum > MAX_CHARA_NAME )
{
return -1;
}
ret = gUsingCharas;
gUsingCharas += realNum;
return ret;
}
/*---------------------------------------------------------------------------*
Name: AllocOAM
Description: OAM
OAM OAM
Arguments: num: OAM
Returns:
NULL
*---------------------------------------------------------------------------*/
static GXOamAttr* AllocOAM(int num)
{
GXOamAttr* const pObjBase = (GXOamAttr*)HW_OAM;
GXOamAttr* ret;
if( gUsingOam + num > MAX_OBJ_NUM )
{
return NULL;
}
ret = pObjBase + gUsingOam;
gUsingOam += num;
return ret;
}
/*---------------------------------------------------------------------------*
Name: HandleInput
Description:
Arguments:
Returns: TRUE
*---------------------------------------------------------------------------*/
static BOOL HandleInput(void)
{
BOOL bChanged = FALSE;
if( CMN_IsTrigger(PAD_BUTTON_A) )
{
gColorMode = (gColorMode != GX_OAM_COLORMODE_16) ?
GX_OAM_COLORMODE_16:
GX_OAM_COLORMODE_256;
bChanged = TRUE;
}
if( CMN_IsTrigger(PAD_BUTTON_B) )
{
gVramMode++;
if( gVramMode > NNS_G2D_OBJVRAMMODE_256K )
{
gVramMode = NNS_G2D_OBJVRAMMODE_32K;
}
bChanged = TRUE;
}
return bChanged;
}
/*---------------------------------------------------------------------------*
Name: InitScreen
Description: OBJ表示の初期化をします
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitScreen(void)
{
// OBJ を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_OBJ );
// カラーパレットを設定
GX_LoadOBJPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
}
/*---------------------------------------------------------------------------*
Name: PutText
Description:
Arguments: x:
y:
pFont:
colorMode: OBJのカラーモードを指定します
vramMode: OBJのVRAMモードを指定します
color:
txt:
Returns:
*---------------------------------------------------------------------------*/
static void PutText(
int x,
int y,
const NNSG2dFont* pFont,
GXOamColorMode colorMode,
NNSG2dOBJVramMode vramMode,
u8 color,
const NNSG2dChar* txt
)
{
void* const pCharBase = G2_GetOBJCharPtr();
NNSG2dCharCanvas cc;
NNSG2dTextCanvas tc;
NNSG2dTextRect textRect;
NNSG2dTextRect canvasSize;
int areaWidth, areaHeight;
GXOamAttr* pOam;
int numOBJ;
int charNo;
// テキスト領域サイズを求めます
textRect = NNS_G2dFontGetTextRect(pFont, TEXT_HSPACE, TEXT_VSPACE, txt);
areaWidth = ROUNDUP_DIV(textRect.width, CHARACTER_WIDTH);
areaHeight = ROUNDUP_DIV(textRect.height, CHARACTER_HEIGHT);
canvasSize = GetMinValidCanvasSize(areaWidth, areaHeight, colorMode, vramMode);
// OAM と キャラクタを確保します
numOBJ = NNS_G2dCalcRequiredOBJ1D( canvasSize.width, canvasSize.height );
charNo = AllocCharacters( canvasSize.width * canvasSize.height, colorMode, vramMode );
pOam = AllocOAM( numOBJ );
NNS_G2D_ASSERT( charNo >= 0 );
NNS_G2D_POINTER_ASSERT( pOam );
// CharCanvas を 1D OBJ 用に テキスト領域サイズで初期化
NNS_G2dCharCanvasInitForOBJ1D(
&cc,
OffsetCharName(pCharBase, charNo, vramMode),
canvasSize.width,
canvasSize.height,
SDKToNNSColorMode(colorMode)
);
// CharCanvas 用に OBJ を配置
(void)NNS_G2dArrangeOBJ1D(
pOam,
canvasSize.width,
canvasSize.height,
x, y,
colorMode,
charNo,
vramMode
);
// OBJを設定
TXT_SetCharCanvasOBJAttrs(
pOam, // OAM配列へのポインタ
numOBJ, // 対象とするOAMの数
0, // priority
GX_OAM_MODE_NORMAL, // OBJモード
FALSE, // モザイク
GX_OAM_EFFECT_NONE, // OBJ効果
TXT_CPALETTE_MAIN, // パレット番号
0 // アフィンパラメータインデックス
);
// TextCanvas を構築
NNS_G2dTextCanvasInit(
&tc,
&cc,
pFont,
TEXT_HSPACE,
TEXT_VSPACE
);
// Canvas をクリアして文字列描画
NNS_G2dCharCanvasClear(
&cc,
TXT_COLOR_WHITE
);
NNS_G2dTextCanvasDrawText(
&tc,
0, 0,
color,
TXT_DRAWTEXT_FLAG_DEFAULT,
txt
);
DTX_PrintLine("%3dx%3d %2dx%2d %2dx%2d %4d %3d",
textRect.width, textRect.height,
areaWidth, areaHeight,
canvasSize.width, canvasSize.height,
canvasSize.width * canvasSize.height, numOBJ
);
}
/*---------------------------------------------------------------------------*
Name: PrintSampleInfo
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void PrintSampleInfo(void)
{
static const char* colorModeString[] =
{
"GX_OAM_COLORMODE_16",
"GX_OAM_COLORMODE_256"
};
static const char* vramModeString[] =
{
"NNS_G2D_OBJVRAMMODE_32K",
"NNS_G2D_OBJVRAMMODE_64K",
"NNS_G2D_OBJVRAMMODE_128K",
"NNS_G2D_OBJVRAMMODE_256K"
};
DTX_PrintLine(
"Text size dependents Canvas Sample\n"
"operation\n"
" A change color mode\n"
" B change vram mode\n"
);
DTX_PrintLine("color mode: %s", colorModeString[gColorMode]);
DTX_PrintLine("vram mode: %s", vramModeString[gVramMode]);
DTX_PrintLine(
"\n"
"Size Using\n"
"text canvas adjust char OBJ"
);
}
/*---------------------------------------------------------------------------*
Name: SampleDraw
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleDraw(void)
{
int i;
PrintSampleInfo();
switch( gVramMode )
{
case NNS_G2D_OBJVRAMMODE_32K: GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); break;
case NNS_G2D_OBJVRAMMODE_64K: GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_64K); break;
case NNS_G2D_OBJVRAMMODE_128K: GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_128K); break;
case NNS_G2D_OBJVRAMMODE_256K: GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_256K); break;
default: GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); break;
}
ResetOAM();
ResetOBJChr();
for( i = 0; i < ARY_SIZEOF(sampleText); ++i )
{
int x = (int)(SCREEN_WIDTH / ARY_SIZEOF(sampleText)) * i;
int y = (int)(SCREEN_HEIGHT / ARY_SIZEOF(sampleText)) * i;
u8 color = (u8)(TXT_COLOR_RED + i);
PutText(x, y, &gFont, gColorMode, gVramMode, color, sampleText[i]);
}
}
/*---------------------------------------------------------------------------*
Name: SampleInit
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleInit(void)
{
// フォントを読み込みます
TXT_LoadFont( &gFont, TXT_FONTRESOURCE_NAME );
InitScreen();
SampleDraw();
}
/*---------------------------------------------------------------------------*
Name: SampleMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleMain(void)
{
if( HandleInput() )
{
SampleDraw();
DC_StoreAll();
}
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// サンプルの初期化処理
SampleInit();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
// サンプルのメイン処理
SampleMain();
CMN_WaitVBlankIntr();
// 情報出力の表示
DTX_Reflect();
}
}

View File

@ -0,0 +1,43 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - OBJ1D
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,576 @@
/*---------------------------------------------------------------------------*
Project: NITRO-System - demos - g2d - Text - OBJ1D
File: main.c
Copyright 2004-2008 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Revision: 172 $
*---------------------------------------------------------------------------*/
// ============================================================================
// デモの内容
// 1DマッピングOBJ上での文字描画サンプル。
// CharCanvasのサイズに応じて必要なOBJ数を表示します。
// OBJ1D ではカラーモード、VRAMモードとキャンバスの辺の長さの
// 組み合わせによっては正しく文字が表示されないことに注意してください。
// 参照NNS_G2dCharCanvasInitForOBJ1D() APIリファレンス
//
// 操作方法
// A ボタン カラーモードを変更する。
// B ボタン VRAMモードを変更する。
// 十字ボタン CharCanvasのサイズを変更する。
// ============================================================================
#include <nnsys/g2d/g2d_TextCanvas.h>
#include <nnsys/g2d/g2d_CharCanvas.h>
#include <nnsys/misc.h>
#include "g2d_textdemolib.h"
#define CANVAS_WIDTH 28 // 文字描画域の幅 (キャラクタ単位)
#define CANVAS_HEIGHT 10 // 文字描画域の高さ (キャラクタ単位)
#define CANVAS_LEFT 13 // 文字描画域の位置X (ピクセル単位)
#define CANVAS_TOP 17 // 文字描画域の位置Y (ピクセル単位)
#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位)
#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位)
#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の先頭キャラクタネーム
#define MAX_OBJ_NUM 128
#define REPEAT_THRESHOLD 22
//------------------------------------------------------------------------------
// グローバル変数
NNSG2dFont gFont; // フォント
NNSG2dCharCanvas gCanvas; // CharCanvas
NNSG2dTextCanvas gTextCanvas; // TextCanvas
const char* gErrMsg = NULL;
int gCanvasWidth = CANVAS_WIDTH;
int gCanvasHeight = CANVAS_HEIGHT;
GXOamColorMode gColorMode = GX_OAM_COLORMODE_16;
NNSG2dOBJVramMode gVramMode = NNS_G2D_OBJVRAMMODE_32K;
//****************************************************************************
// Initialize etc.
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: IsValidCharCanvasSize
Description: CharCanvas
Arguments: areaWidth: CharCanvas
areaHeight: CharCanvas
colorMode: CharCanvas
vramMode: OBJ VRAM
Returns: TRUE
*---------------------------------------------------------------------------*/
static BOOL IsValidCharCanvasSize(
int areaWidth,
int areaHeight,
GXOamColorMode colorMode,
NNSG2dOBJVramMode vramMode
)
{
NNS_G2D_ASSERT( (colorMode == GX_OAM_COLORMODE_16)
|| (colorMode == GX_OAM_COLORMODE_256) );
NNS_G2D_ASSERT( (vramMode == NNS_G2D_OBJVRAMMODE_32K)
|| (vramMode == NNS_G2D_OBJVRAMMODE_64K)
|| (vramMode == NNS_G2D_OBJVRAMMODE_128K)
|| (vramMode == NNS_G2D_OBJVRAMMODE_256K) );
// サイズは正でなければならない
if( areaWidth <= 0 || areaHeight <= 0 )
{
return FALSE;
}
if( (colorMode == GX_OAM_COLORMODE_16 && vramMode == NNS_G2D_OBJVRAMMODE_128K)
|| (colorMode != GX_OAM_COLORMODE_16 && vramMode == NNS_G2D_OBJVRAMMODE_256K) )
{
// 「奇数と「4で割った余りが3の値」の組み合わせは不可」のケース。
// これは「どちらかが偶数または共に4で割ったあまりが3でないなら可」と同値なので
// これで判定する。
return ((areaWidth % 2) == 0)
|| ((areaHeight % 2) == 0)
|| ((areaWidth % 4) != 3 && (areaHeight % 4) != 3);
}
else if( colorMode == GX_OAM_COLORMODE_16 && vramMode == NNS_G2D_OBJVRAMMODE_256K )
{
// 共に偶数でなければならない。
return (areaWidth % 2) == 0 && (areaHeight % 2) == 0;
}
else
{
return TRUE;
}
}
/*---------------------------------------------------------------------------*
Name: OffsetCharName
Description: 1D OBJでキャラクタネームが指し示すアドレスを取得します
Arguments: pCharBase: OBJのキャラクタベース
charName:
vramMode: VRAM
Returns:
*---------------------------------------------------------------------------*/
static void* OffsetCharName(
void* pCharBase,
int charName,
NNSG2dOBJVramMode vramMode )
{
u32 addr = (u32)pCharBase;
addr += sizeof(GXCharFmt16) * (charName << vramMode);
return (void*)addr;
}
/*---------------------------------------------------------------------------*
Name: SDKToNNSColorMode
Description: NITRO-SDK NITRO-System
Arguments: sdk: NITRO-SDKのカラーモード列挙子
Returns: sdk NITRO-System
*---------------------------------------------------------------------------*/
static inline NNSG2dCharaColorMode SDKToNNSColorMode(GXOamColorMode sdk)
{
static const NNSG2dCharaColorMode nns[] =
{ NNS_G2D_CHARA_COLORMODE_16, NNS_G2D_CHARA_COLORMODE_256 };
NNS_MINMAX_ASSERT(sdk, 0, 1);
return nns[sdk];
}
/*---------------------------------------------------------------------------*
Name: ResetOAM
Description: OAMをリセットします
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void ResetOAM(void)
{
MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE);
}
/*---------------------------------------------------------------------------*
Name: HandleInput
Description:
Arguments:
Returns: TRUE
*---------------------------------------------------------------------------*/
static BOOL HandleInput(void)
{
BOOL bChanged = FALSE;
#define REPEAT(key) ((repeat_count >= REPEAT_THRESHOLD) ? CMN_IsPress(key): CMN_IsTrigger(key))
{
static int repeat_count = 0;
int old_cw = gCanvasWidth;
int old_ch = gCanvasHeight;
if( CMN_IsTrigger(PAD_BUTTON_A) )
{
gColorMode = (gColorMode != GX_OAM_COLORMODE_16) ?
GX_OAM_COLORMODE_16:
GX_OAM_COLORMODE_256;
bChanged = TRUE;
}
if( CMN_IsTrigger(PAD_BUTTON_B) )
{
gVramMode++;
if( gVramMode > NNS_G2D_OBJVRAMMODE_256K )
{
gVramMode = NNS_G2D_OBJVRAMMODE_32K;
}
bChanged = TRUE;
}
if( REPEAT(PAD_KEY_UP) )
{
gCanvasHeight--;
}
if( REPEAT(PAD_KEY_DOWN) )
{
gCanvasHeight++;
}
if( REPEAT(PAD_KEY_LEFT) )
{
gCanvasWidth--;
}
if( REPEAT(PAD_KEY_RIGHT) )
{
gCanvasWidth++;
}
if( gCanvasWidth < 1 )
{
gCanvasWidth = 1;
}
if( gCanvasHeight < 1 )
{
gCanvasHeight = 1;
}
if( MAX_OBJ_NUM < NNS_G2dCalcRequiredOBJ1D(gCanvasWidth, gCanvasHeight) )
{
// 使える OBJ の最大数を超えた
gCanvasWidth = old_cw;
gCanvasHeight = old_ch;
gErrMsg = "OBJ OVERFLOW";
bChanged = TRUE;
}
{
const int maxChr = ((1024 << gVramMode) >> gColorMode) - CHARACTER_OFFSET;
//
if( maxChr < (gCanvasWidth + 1) * (gCanvasHeight + 1) )
{
// 使えるキャラクタの最大数を超えた
gCanvasWidth = old_cw;
gCanvasHeight = old_ch;
gErrMsg = "Character OVERFLOW";
bChanged = TRUE;
}
}
if( gCanvasWidth != old_cw || gCanvasHeight != old_ch )
{
bChanged = TRUE;
}
if( CMN_IsPress(PAD_PLUS_KEY_MASK) )
{
repeat_count++;
}
else
{
repeat_count = 0;
}
}
return bChanged;
}
/*---------------------------------------------------------------------------*
Name: InitScreen
Description: OBJ表示の初期化をします
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitScreen(void)
{
// OBJ を可視に
CMN_SetPlaneVisible( GX_PLANEMASK_OBJ );
// カラーパレットを設定
GX_LoadOBJPltt(TXTColorPalette, 0, sizeof(TXTColorPalette));
}
/*---------------------------------------------------------------------------*
Name: InitCanvas
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void InitCanvas(void)
{
void* const pCharBase = G2_GetOBJCharPtr();
GXOamAttr* const pObjBase = (GXOamAttr*)HW_OAM;
const int cOffset = CHARACTER_OFFSET;
int nObjs;
// マッピングモード設定
switch( gVramMode )
{
case NNS_G2D_OBJVRAMMODE_32K: GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); break;
case NNS_G2D_OBJVRAMMODE_64K: GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_64K); break;
case NNS_G2D_OBJVRAMMODE_128K: GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_128K); break;
case NNS_G2D_OBJVRAMMODE_256K: GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_256K); break;
default: GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); break;
}
// CharCanvas の初期化
NNS_G2dCharCanvasInitForOBJ1D(
&gCanvas,
OffsetCharName(pCharBase, cOffset, gVramMode),
// VRAM参照可能サイズによってキャラクタネーム境界が異なるため補正する
gCanvasWidth,
gCanvasHeight,
SDKToNNSColorMode(gColorMode)
);
// Canvasクリア
NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_WHITE);
// OBJを配置
nObjs = NNS_G2dArrangeOBJ1D(
pObjBase,
gCanvasWidth,
gCanvasHeight,
CANVAS_LEFT,
CANVAS_WIDTH,
gColorMode,
cOffset,
gVramMode
);
// OBJを設定
TXT_SetCharCanvasOBJAttrs(
pObjBase, // OAM配列へのポインタ
nObjs, // 対象とするOAMの数
0, // priority
GX_OAM_MODE_NORMAL, // OBJモード
FALSE, // モザイク
GX_OAM_EFFECT_NONE, // OBJ効果
TXT_CPALETTE_MAIN, // パレット番号
0 // アフィンパラメータインデックス
);
// TextCanvasの初期化
NNS_G2dTextCanvasInit(
&gTextCanvas,
&gCanvas,
&gFont,
TEXT_HSPACE,
TEXT_VSPACE
);
// 使用中のOBJ数
DTX_PrintLine("using OBJ: %3d", nObjs);
if( ! IsValidCharCanvasSize(gCanvasWidth, gCanvasHeight, gColorMode, gVramMode) )
{
gErrMsg = "INVALID CharCanvas size";
}
}
/*---------------------------------------------------------------------------*
Name: SampleDraw
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleDraw(void)
{
// 文字描画
NNS_G2dTextCanvasDrawText(&gTextCanvas, 1, 1, TXT_COLOR_BLACK, TXT_DRAWTEXT_FLAG_DEFAULT,
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\n"
"bcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789a\n"
"cdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ab\n"
"defghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abc\n"
"efghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcd\n"
"fghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcde\n"
"ghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdef\n"
"hijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefg\n"
"ijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefgh\n"
"jklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghi\n"
"klmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghij\n"
"lmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijk\n"
"mnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijkl\n"
"nopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklm\n"
"opqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmn\n"
"pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmno\n"
"qrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnop\n"
"rstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopq\n"
"stuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqr\n"
"tuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrs\n"
"uvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrst\n"
"vwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstu\n"
"wxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuv\n"
"xyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvw\n"
"yzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwx\n"
);
}
/*---------------------------------------------------------------------------*
Name: PrintSampleInfo
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void PrintSampleInfo(void)
{
static const char* colorModeString[] =
{
"GX_OAM_COLORMODE_16",
"GX_OAM_COLORMODE_256"
};
static const char* vramModeString[] =
{
"NNS_G2D_OBJVRAMMODE_32K",
"NNS_G2D_OBJVRAMMODE_64K",
"NNS_G2D_OBJVRAMMODE_128K",
"NNS_G2D_OBJVRAMMODE_256K"
};
DTX_PrintLine(
"1D mapping OBJ CharCanvas Sample\n"
"operation\n"
" A change color mode\n"
" B change vram mode\n"
" + change canvas size\n"
);
DTX_PrintLine("color mode: %s", colorModeString[gColorMode]);
DTX_PrintLine("vram mode: %s", vramModeString[gVramMode]);
DTX_PrintLine("canvas size: %2d x %2d", gCanvasWidth, gCanvasHeight);
}
/*---------------------------------------------------------------------------*
Name: SampleInit
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleInit(void)
{
// フォントを読み込みます
TXT_LoadFont( &gFont, TXT_FONTRESOURCE_NAME );
PrintSampleInfo();
InitScreen();
InitCanvas();
SampleDraw();
}
/*---------------------------------------------------------------------------*
Name: SampleMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
static void SampleMain(void)
{
gErrMsg = NULL;
if( HandleInput() )
{
PrintSampleInfo();
ResetOAM();
InitCanvas();
SampleDraw();
DC_StoreAll();
if( gErrMsg != NULL )
{
DTX_PrintLine("\n\n\n\n !!! %s !!!", gErrMsg);
}
}
}
//****************************************************************************
// Main
//****************************************************************************
/*---------------------------------------------------------------------------*
Name: NitroMain
Description:
Arguments:
Returns:
*---------------------------------------------------------------------------*/
void NitroMain(void)
{
// Initilizing App.
{
// SDK とデモライブラリを初期化
OS_Init();
TXT_Init();
// 背景を設定
TXT_SetupBackground();
// サンプルの初期化処理
SampleInit();
}
// start display
{
CMN_WaitVBlankIntr();
GX_DispOn();
GXS_DispOn();
}
// Main loop
while( TRUE )
{
CMN_ReadGamePad();
// サンプルのメイン処理
SampleMain();
CMN_WaitVBlankIntr();
// 情報出力の表示
DTX_Reflect();
}
}

View File

@ -0,0 +1,43 @@
#! make -f
#----------------------------------------------------------------------------
# Project: NITRO-System - demos - g2d - Text - OBJ2DRect
# File: Makefile
#
# Copyright 2004-2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Revision: 172 $
#----------------------------------------------------------------------------
NNS_USELIBS = g2d gfd fnd
G2D_TEXTDEMOLIB = ../textdemolib
LINCLUDES = $(G2D_TEXTDEMOLIB)/include
LLIBRARY_DIRS = $(G2D_TEXTDEMOLIB)/lib/$(NITRO_BUILDTYPE)
LLIBRARIES = libg2d_textdemo.a
#----------------------------------------------------------------------------
SRCS = main.c
TARGET_BIN = main.srl
MAKEROM_ROMROOT = ../
MAKEROM_ROMFILES = ./data/*.*
#----------------------------------------------------------------------------
include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs
do-build: $(TARGETS)
include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

Some files were not shown because too many files have changed in this diff Show More