From 59700b44dea6abf35922e9ab1bdb0a63279df289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ni=C3=B1o=20D=C3=ADaz?= Date: Mon, 6 Jan 2025 22:43:23 +0000 Subject: [PATCH] chore: Use UNIX line endings --- changelog.txt | 3392 ++++++++--------- docs/ReadMe.txt | 68 +- docs/dev/Doxyfile_English | 3060 +++++++-------- docs/dev/Doxyfile_French | 3060 +++++++-------- .../16c/16cSprites/16cSpriteAnim/Makefile | 2 +- .../16cSprites/16cSpriteAnim/gfx/all_gfx.h | 34 +- .../16cSprites/16cSpriteAnim/gfx/bin/ropes.c | 36 +- .../16cSpriteAnim/gfx/bin/ropes.pal.c | 8 +- .../16cSprites/16cSpriteAnim/source/main.c | 76 +- examples/16c/16cSprites/16cSprites/Makefile | 2 +- .../16c/16cSprites/16cSprites/gfx/all_gfx.h | 38 +- .../16c/16cSprites/16cSprites/source/main.c | 144 +- examples/16c/16cText/16cText/Makefile | 2 +- examples/16c/16cText/16cText/source/main.c | 82 +- examples/16c/16cText/16cText2/Makefile | 2 +- examples/16c/16cText/16cText2/source/main.c | 70 +- examples/16c/16cText/16cTextAlign/Makefile | 2 +- .../16c/16cText/16cTextAlign/source/main.c | 66 +- examples/16c/16cText/16cTextFont/Makefile | 2 +- .../16c/16cText/16cTextFont/gfx/all_gfx.h | 38 +- .../16c/16cText/16cTextFont/gfx/bin/bigfont.c | 34 +- .../16cText/16cTextFont/gfx/bin/smallfont.c | 34 +- .../16c/16cText/16cTextFont/source/main.c | 60 +- examples/3DSprites/3D1024Sprites/Makefile | 2 +- .../3DSprites/3D1024Sprites/gfx/all_gfx.h | 40 +- .../3DSprites/3D1024Sprites/source/main.c | 156 +- .../3DSprites/3DCreateSprite/16bit/Makefile | 2 +- .../3DCreateSprite/16bit/gfx/all_gfx.h | 40 +- .../3DCreateSprite/16bit/source/main.c | 112 +- .../3DCreateSprite/16colors/Makefile | 2 +- .../3DCreateSprite/16colors/gfx/all_gfx.h | 46 +- .../3DCreateSprite/16colors/source/main.c | 124 +- .../3DCreateSprite/256colors/Makefile | 2 +- .../3DCreateSprite/256colors/gfx/all_gfx.h | 46 +- .../3DCreateSprite/256colors/source/main.c | 122 +- .../3DSprites/3DCreateSprite/4colors/Makefile | 2 +- .../3DCreateSprite/4colors/gfx/all_gfx.h | 46 +- .../3DCreateSprite/4colors/source/main.c | 122 +- .../3DCreateSprite/Rectangle/Makefile | 2 +- .../3DCreateSprite/Rectangle/gfx/all_gfx.h | 38 +- .../3DCreateSprite/Rectangle/source/main.c | 102 +- examples/3DSprites/3DMoveSprite/Makefile | 2 +- examples/3DSprites/3DMoveSprite/gfx/all_gfx.h | 36 +- examples/3DSprites/3DMoveSprite/source/main.c | 98 +- examples/3DSprites/3DPriorities/Makefile | 2 +- examples/3DSprites/3DPriorities/gfx/all_gfx.h | 46 +- examples/3DSprites/3DPriorities/source/main.c | 126 +- examples/3DSprites/3DSetSpriteTex/Makefile | 2 +- .../3DSprites/3DSetSpriteTex/gfx/all_gfx.h | 46 +- .../3DSprites/3DSetSpriteTex/source/main.c | 142 +- examples/3DSprites/3DSpriteTouched/Makefile | 2 +- .../3DSprites/3DSpriteTouched/gfx/all_gfx.h | 46 +- .../3DSprites/3DSpriteTouched/source/main.c | 140 +- examples/3DSprites/Animations/Frames/Makefile | 2 +- .../3DSprites/Animations/Frames/gfx/all_gfx.h | 38 +- .../3DSprites/Animations/Frames/source/main.c | 104 +- .../3DSprites/Animations/PaperMario/Makefile | 2 +- .../Animations/PaperMario/gfx/all_gfx.h | 44 +- .../Animations/PaperMario/gfx/bin/mariobg.c | 34 +- .../Animations/PaperMario/source/main.c | 170 +- .../3DSprites/Animations/SpriteAnim/Makefile | 2 +- .../Animations/SpriteAnim/gfx/all_gfx.h | 38 +- .../Animations/SpriteAnim/source/main.c | 112 +- .../3DSprites/Animations/SpriteAnim2/Makefile | 2 +- .../Animations/SpriteAnim2/gfx/all_gfx.h | 38 +- .../Animations/SpriteAnim2/source/main.c | 120 +- .../3DSprites/Animations/SpriteAnim3/Makefile | 2 +- .../Animations/SpriteAnim3/gfx/all_gfx.h | 38 +- .../Animations/SpriteAnim3/source/main.c | 116 +- examples/3DSprites/Effects/3DAlpha/Makefile | 2 +- .../3DSprites/Effects/3DAlpha/gfx/all_gfx.h | 50 +- .../3DSprites/Effects/3DAlpha/source/main.c | 144 +- examples/3DSprites/Effects/3DDeform/Makefile | 2 +- .../3DSprites/Effects/3DDeform/gfx/all_gfx.h | 36 +- .../3DSprites/Effects/3DDeform/source/main.c | 106 +- examples/3DSprites/Effects/3DDeform2/Makefile | 2 +- .../3DSprites/Effects/3DDeform2/gfx/all_gfx.h | 42 +- .../3DSprites/Effects/3DDeform2/source/main.c | 104 +- examples/3DSprites/Effects/3DFlips/Makefile | 2 +- .../3DSprites/Effects/3DFlips/gfx/all_gfx.h | 36 +- .../3DSprites/Effects/3DFlips/source/main.c | 106 +- .../3DRotAndZoom/3DSpriteResize/Makefile | 2 +- .../3DRotAndZoom/3DSpriteResize/gfx/all_gfx.h | 36 +- .../3DRotAndZoom/3DSpriteResize/source/main.c | 110 +- .../3DRotAndZoom/3DSpriteRotate/Makefile | 2 +- .../3DRotAndZoom/3DSpriteRotate/gfx/all_gfx.h | 40 +- .../3DRotAndZoom/3DSpriteRotate/source/main.c | 126 +- .../3DRotAndZoom/3DSpriteRotateXY/Makefile | 2 +- .../3DSpriteRotateXY/gfx/all_gfx.h | 40 +- .../3DSpriteRotateXY/source/main.c | 126 +- examples/3DSprites/KeybAnd3D/Makefile | 2 +- examples/3DSprites/KeybAnd3D/gfx/all_gfx.h | 40 +- examples/3DSprites/KeybAnd3D/source/main.c | 178 +- .../Backgrounds/Advanced/GetBgPixel/Makefile | 2 +- .../Advanced/GetBgPixel/gfx/all_gfx.h | 36 +- .../Advanced/GetBgPixel/gfx/bin/bg0.c | 34 +- .../Advanced/GetBgPixel/source/main.c | 52 +- .../Backgrounds/Advanced/GetBgPixel2/Makefile | 2 +- .../Advanced/GetBgPixel2/gfx/all_gfx.h | 36 +- .../Advanced/GetBgPixel2/gfx/bin/zelda.c | 34 +- .../Advanced/GetBgPixel2/source/main.c | 78 +- .../Backgrounds/Advanced/GetBgPixel3/Makefile | 2 +- .../Advanced/GetBgPixel3/gfx/all_gfx.h | 36 +- .../Advanced/GetBgPixel3/gfx/bin/Town.c | 34 +- .../Advanced/GetBgPixel3/source/main.c | 66 +- .../Backgrounds/Advanced/Parallax/Makefile | 2 +- .../Advanced/Parallax/gfx/all_gfx.h | 40 +- .../Advanced/Parallax/gfx/bin/BG1.c | 34 +- .../Advanced/Parallax/gfx/bin/BG2.c | 34 +- .../Advanced/Parallax/gfx/bin/BG3.c | 34 +- .../Advanced/Parallax/source/main.c | 68 +- .../Backgrounds/Advanced/RotBgTiles/Makefile | 2 +- .../Advanced/RotBgTiles/gfx/all_gfx.h | 36 +- .../Advanced/RotBgTiles/gfx/bin/Rot.c | 34 +- .../Advanced/RotBgTiles/source/main.c | 78 +- examples/Backgrounds/Basics/LargeBgs/Makefile | 2 +- .../Backgrounds/Basics/LargeBgs/gfx/all_gfx.h | 36 +- .../Basics/LargeBgs/gfx/bin/zelda.c | 34 +- .../Backgrounds/Basics/LargeBgs/source/main.c | 76 +- .../Backgrounds/Basics/NormalBgs/Makefile | 2 +- .../Basics/NormalBgs/gfx/all_gfx.h | 42 +- .../Basics/NormalBgs/gfx/bin/bg0.c | 34 +- .../Basics/NormalBgs/gfx/bin/bg1.c | 34 +- .../Basics/NormalBgs/gfx/bin/bg2.c | 34 +- .../Basics/NormalBgs/gfx/bin/bg3.c | 34 +- .../Basics/NormalBgs/source/main.c | 42 +- examples/Backgrounds/Basics/RotBgs/Makefile | 2 +- .../Backgrounds/Basics/RotBgs/gfx/all_gfx.h | 36 +- .../Backgrounds/Basics/RotBgs/gfx/bin/Rot.c | 34 +- .../Backgrounds/Basics/RotBgs/source/main.c | 96 +- .../Backgrounds/Basics/UnlimitedBgs/Makefile | 2 +- .../Basics/UnlimitedBgs/gfx/all_gfx.h | 36 +- .../Basics/UnlimitedBgs/gfx/bin/Town.c | 34 +- .../Basics/UnlimitedBgs/source/main.c | 62 +- .../Backgrounds/DualBgs/Parallax/Makefile | 2 +- .../DualBgs/Parallax/gfx/all_gfx.h | 40 +- .../DualBgs/Parallax/gfx/bin/BG1.c | 34 +- .../DualBgs/Parallax/gfx/bin/BG2.c | 34 +- .../DualBgs/Parallax/gfx/bin/BG3.c | 34 +- .../DualBgs/Parallax/source/main.c | 64 +- .../Backgrounds/DualBgs/ScrollBg/Makefile | 2 +- .../DualBgs/ScrollBg/gfx/all_gfx.h | 36 +- .../DualBgs/ScrollBg/gfx/bin/BG3.c | 34 +- .../DualBgs/ScrollBg/source/main.c | 64 +- .../Backgrounds/DualBgs/UnlimitedBg/Makefile | 2 +- .../DualBgs/UnlimitedBg/gfx/all_gfx.h | 36 +- .../DualBgs/UnlimitedBg/gfx/bin/Town.c | 34 +- .../DualBgs/UnlimitedBg/source/main.c | 60 +- examples/Backgrounds/Effects/BgAlpha/Makefile | 2 +- .../Backgrounds/Effects/BgAlpha/gfx/all_gfx.h | 38 +- .../Backgrounds/Effects/BgAlpha/gfx/bin/bg0.c | 34 +- .../Backgrounds/Effects/BgAlpha/gfx/bin/bg1.c | 34 +- .../Backgrounds/Effects/BgAlpha/source/main.c | 90 +- examples/Backgrounds/Effects/Mode7/Makefile | 2 +- .../Backgrounds/Effects/Mode7/gfx/all_gfx.h | 36 +- .../Backgrounds/Effects/Mode7/gfx/bin/Rot.c | 34 +- .../Backgrounds/Effects/Mode7/source/main.c | 102 +- examples/Backgrounds/Effects/SineBg/Makefile | 2 +- .../Backgrounds/Effects/SineBg/gfx/all_gfx.h | 36 +- .../Effects/SineBg/gfx/bin/zelda.c | 34 +- .../Backgrounds/Effects/SineBg/source/main.c | 124 +- .../Transitions/BgTransCenter/Makefile | 2 +- .../Transitions/BgTransCenter/gfx/all_gfx.h | 36 +- .../BgTransCenter/gfx/bin/pasplash.c | 34 +- .../Transitions/BgTransCenter/source/main.c | 134 +- .../Transitions/BgTransDiag/Makefile | 2 +- .../Transitions/BgTransDiag/gfx/all_gfx.h | 36 +- .../BgTransDiag/gfx/bin/pasplash.c | 34 +- .../Transitions/BgTransDiag/source/main.c | 140 +- .../Transitions/BgTransLeftRight/Makefile | 2 +- .../BgTransLeftRight/gfx/all_gfx.h | 36 +- .../BgTransLeftRight/gfx/bin/pasplash.c | 34 +- .../BgTransLeftRight/source/main.c | 138 +- .../Transitions/BgTransUpDown/Makefile | 2 +- .../Transitions/BgTransUpDown/gfx/all_gfx.h | 36 +- .../BgTransUpDown/gfx/bin/pasplash.c | 34 +- .../Transitions/BgTransUpDown/source/main.c | 140 +- .../Transitions/BrightnessFade/Makefile | 2 +- .../Transitions/BrightnessFade/gfx/all_gfx.h | 36 +- .../BrightnessFade/gfx/bin/pasplash.c | 34 +- .../Transitions/BrightnessFade/source/main.c | 146 +- .../Transitions/BrightnessFade2/Makefile | 2 +- .../Transitions/BrightnessFade2/source/main.c | 130 +- .../Transitions/WindowFade/Makefile | 2 +- .../Transitions/WindowFade/gfx/all_gfx.h | 36 +- .../Transitions/WindowFade/gfx/bin/pasplash.c | 34 +- .../Transitions/WindowFade/source/main.c | 124 +- examples/Bitmap/16bitDoubleBuffer/Makefile | 2 +- .../Bitmap/16bitDoubleBuffer/source/main.c | 66 +- examples/Bitmap/16bitDraw/Makefile | 2 +- examples/Bitmap/16bitDraw/source/main.c | 72 +- examples/Bitmap/8bitDoubleBuffer/Makefile | 2 +- .../Bitmap/8bitDoubleBuffer/source/main.c | 90 +- examples/Bitmap/8bitDraw/Makefile | 2 +- examples/Bitmap/8bitDraw/source/main.c | 86 +- examples/Bitmap/8bitText/Makefile | 2 +- examples/Bitmap/8bitText/source/main.c | 134 +- examples/Bitmap/8bitText2/Makefile | 2 +- examples/Bitmap/8bitText2/source/main.c | 74 +- examples/Bitmap/8bitTextFont/Makefile | 2 +- examples/Bitmap/8bitTextFont/gfx/all_gfx.h | 38 +- .../Bitmap/8bitTextFont/gfx/bin/bigfont.c | 34 +- .../Bitmap/8bitTextFont/gfx/bin/smallfont.c | 34 +- examples/Bitmap/8bitTextFont/source/main.c | 94 +- examples/Bitmap/Fake16bit/Makefile | 6 +- examples/Bitmap/Fake16bit/gfx/all_gfx.h | 38 +- examples/Bitmap/Fake16bit/source/main.c | 148 +- examples/Bitmap/Load16bitBitmap/Makefile | 2 +- examples/Bitmap/Load16bitBitmap/gfx/all_gfx.h | 38 +- examples/Bitmap/Load16bitBitmap/source/main.c | 68 +- examples/Bitmap/Load8bitBitmap/Makefile | 2 +- examples/Bitmap/Load8bitBitmap/gfx/all_gfx.h | 40 +- examples/Bitmap/Load8bitBitmap/source/main.c | 70 +- examples/Bitmap/LoadJpeg/Makefile | 6 +- examples/Bitmap/LoadJpeg/source/main.c | 64 +- examples/Bitmap/TextRot/Makefile | 2 +- examples/Bitmap/TextRot/source/main.c | 150 +- examples/C++/Gravity/Makefile | 2 +- examples/C++/Gravity/gfx/all_gfx.h | 38 +- examples/C++/Gravity/source/main.cpp | 104 +- examples/C++/HandleProvider/Makefile | 2 +- examples/C++/HandleProvider/gfx/all_gfx.h | 38 +- examples/C++/HandleProvider/source/MyApp.cpp | 114 +- examples/C++/HandleProvider/source/MyApp.h | 70 +- examples/C++/HandleProvider/source/main.cpp | 40 +- examples/Demos/Bunny/Makefile | 2 +- examples/Demos/Bunny/gfx/all_gfx.h | 40 +- examples/Demos/Bunny/source/main.c | 76 +- examples/Demos/CarreRouge/Makefile | 2 +- examples/Demos/CarreRouge/gfx/all_gfx.h | 40 +- examples/Demos/CarreRouge/source/main.c | 254 +- examples/Demos/DSMotion/MotionDraw/Makefile | 2 +- .../Demos/DSMotion/MotionDraw/source/main.c | 148 +- examples/Demos/DSMotion/MotionDraw2/Makefile | 2 +- .../Demos/DSMotion/MotionDraw2/source/main.c | 162 +- examples/Demos/DSMotion/MotionTurn/Makefile | 2 +- .../Demos/DSMotion/MotionTurn/gfx/all_gfx.h | 40 +- .../Demos/DSMotion/MotionTurn/source/main.c | 142 +- examples/Demos/Fireworks/Makefile | 2 +- examples/Demos/Fireworks/gfx/all_gfx.h | 50 +- examples/Demos/Fireworks/source/main.c | 320 +- examples/Demos/FollowStylus/Makefile | 2 +- examples/Demos/FollowStylus/gfx/all_gfx.h | 38 +- examples/Demos/FollowStylus/source/main.c | 82 +- examples/Demos/Frisbee/Frisbee/Makefile | 2 +- examples/Demos/Frisbee/Frisbee/Readme.txt | 26 +- examples/Demos/Frisbee/Frisbee/gfx/all_gfx.h | 38 +- examples/Demos/Frisbee/Frisbee/source/main.c | 162 +- examples/Demos/Frisbee/Frisbee2/Makefile | 2 +- examples/Demos/Frisbee/Frisbee2/Readme.txt | 26 +- examples/Demos/Frisbee/Frisbee2/gfx/all_gfx.h | 38 +- examples/Demos/Frisbee/Frisbee2/source/main.c | 176 +- examples/Demos/Frisbee/Frisbee3/Makefile | 2 +- examples/Demos/Frisbee/Frisbee3/Readme.txt | 26 +- examples/Demos/Frisbee/Frisbee3/gfx/all_gfx.h | 38 +- examples/Demos/Frisbee/Frisbee3/source/main.c | 200 +- examples/Demos/MultipleFiles/Makefile | 6 +- examples/Demos/MultipleFiles/gfx/all_gfx.h | 38 +- examples/Demos/MultipleFiles/include/header.h | 70 +- examples/Demos/MultipleFiles/source/game.c | 196 +- examples/Demos/MultipleFiles/source/main.c | 44 +- examples/Demos/PassingBy/Makefile | 2 +- examples/Demos/PassingBy/source/main.c | 128 +- .../Demos/PlatformGame/PlatformGame/Makefile | 2 +- .../PlatformGame/PlatformGame/gfx/all_gfx.h | 38 +- .../PlatformGame/PlatformGame/source/main.c | 144 +- .../Demos/PlatformGame/PlatformGame2/Makefile | 2 +- .../PlatformGame/PlatformGame2/gfx/all_gfx.h | 46 +- .../PlatformGame/PlatformGame2/gfx/bin/back.c | 34 +- .../PlatformGame2/gfx/bin/mario_world.c | 34 +- .../PlatformGame/PlatformGame2/source/main.c | 264 +- .../Demos/PlatformGame/PlatformGame3/Makefile | 2 +- .../PlatformGame/PlatformGame3/gfx/all_gfx.h | 48 +- .../PlatformGame/PlatformGame3/gfx/bin/back.c | 34 +- .../PlatformGame3/gfx/bin/hills.c | 34 +- .../PlatformGame3/gfx/bin/mario_world.c | 34 +- .../PlatformGame/PlatformGame3/source/main.c | 292 +- .../PlatformGame/PlatformGame3bis/Makefile | 2 +- .../PlatformGame3bis/gfx/all_gfx.h | 48 +- .../PlatformGame3bis/gfx/bin/back.c | 34 +- .../PlatformGame3bis/gfx/bin/hills.c | 34 +- .../PlatformGame3bis/gfx/bin/mario_world.c | 34 +- .../PlatformGame3bis/source/main.c | 284 +- .../Demos/PlatformGame/PlatformGame4/Makefile | 2 +- .../PlatformGame/PlatformGame4/gfx/all_gfx.h | 52 +- .../PlatformGame/PlatformGame4/gfx/bin/back.c | 34 +- .../PlatformGame4/gfx/bin/hills.c | 34 +- .../PlatformGame4/gfx/bin/mario_world.c | 34 +- .../gfx/bin/platformcollisionmap2.c | 34 +- .../PlatformGame/PlatformGame4/source/main.c | 476 +-- .../Demos/PlatformGame/PlatformGame5/Makefile | 2 +- .../PlatformGame/PlatformGame5/gfx/all_gfx.h | 52 +- .../PlatformGame/PlatformGame5/gfx/bin/back.c | 34 +- .../PlatformGame5/gfx/bin/hills.c | 34 +- .../PlatformGame5/gfx/bin/mario_world.c | 34 +- .../gfx/bin/platformcollisionmap3.c | 34 +- .../PlatformGame/PlatformGame5/source/main.c | 630 +-- examples/Demos/PuckHit/Makefile | 2 +- examples/Demos/PuckHit/gfx/all_gfx.h | 38 +- examples/Demos/PuckHit/source/main.c | 134 +- examples/Demos/TypeWriter/Makefile | 2 +- examples/Demos/TypeWriter/gfx/all_gfx.h | 38 +- examples/Demos/TypeWriter/source/main.c | 186 +- examples/Filesystem/FATListDirectory/Makefile | 2 +- .../Filesystem/FATListDirectory/source/main.c | 128 +- examples/Filesystem/FATReadWrite/Makefile | 2 +- .../Filesystem/FATReadWrite/source/main.c | 126 +- examples/Filesystem/Filesystem/Makefile | 2 +- examples/Filesystem/Filesystem/source/main.c | 166 +- examples/Gif/GifAnim/Makefile | 2 +- examples/Gif/GifAnim/source/main.c | 126 +- examples/Gif/GifAnim2/Makefile | 2 +- examples/Gif/GifAnim2/source/main.c | 164 +- examples/Gif/LoadGif/Makefile | 2 +- examples/Gif/LoadGif/source/main.c | 60 +- examples/Input/DSMotion/Motion/Makefile | 2 +- examples/Input/DSMotion/Motion/source/main.c | 148 +- examples/Input/DSMotion/MotionToPad/Makefile | 2 +- .../Input/DSMotion/MotionToPad/gfx/all_gfx.h | 38 +- .../Input/DSMotion/MotionToPad/source/main.c | 168 +- examples/Input/GHController/Makefile | 2 +- examples/Input/GHController/source/main.c | 82 +- examples/Input/Keyboard/Keyboard/Makefile | 2 +- .../Input/Keyboard/Keyboard/source/main.c | 130 +- .../Input/Keyboard/KeyboardCustom/Makefile | 2 +- .../Keyboard/KeyboardCustom/gfx/all_gfx.h | 36 +- .../KeyboardCustom/gfx/bin/keyboardcustom.c | 34 +- .../Keyboard/KeyboardCustom/source/main.c | 136 +- examples/Input/Pad/Makefile | 2 +- examples/Input/Pad/source/main.c | 98 +- examples/Input/Stylus/RecoAddShape/Makefile | 2 +- .../Input/Stylus/RecoAddShape/source/main.c | 108 +- examples/Input/Stylus/RecoGraffiti/Makefile | 2 +- .../Input/Stylus/RecoGraffiti/source/main.c | 118 +- examples/Input/Stylus/RecoShapeInfo/Makefile | 2 +- .../Input/Stylus/RecoShapeInfo/source/main.c | 140 +- examples/Input/Stylus/Stylus/Makefile | 2 +- examples/Input/Stylus/Stylus/source/main.c | 56 +- examples/Input/Stylus/StylusExtra/Makefile | 2 +- .../Input/Stylus/StylusExtra/source/main.c | 64 +- examples/Input/TaitoPaddle/Makefile | 2 +- examples/Input/TaitoPaddle/gfx/all_gfx.h | 38 +- examples/Input/TaitoPaddle/source/main.c | 90 +- examples/Makefile_example | 726 ++-- examples/Math/AngleSinCos/Makefile | 2 +- examples/Math/AngleSinCos/gfx/all_gfx.h | 38 +- examples/Math/AngleSinCos/source/main.c | 90 +- examples/Math/CollisionRect/Makefile | 2 +- examples/Math/CollisionRect/gfx/all_gfx.h | 38 +- examples/Math/CollisionRect/source/main.c | 76 +- examples/Math/CollisionRound/Makefile | 2 +- examples/Math/CollisionRound/gfx/all_gfx.h | 38 +- examples/Math/CollisionRound/source/main.c | 70 +- examples/Math/FixedPoint/Makefile | 2 +- examples/Math/FixedPoint/gfx/all_gfx.h | 38 +- examples/Math/FixedPoint/source/main.c | 88 +- examples/Math/GetAngle/Makefile | 2 +- examples/Math/GetAngle/gfx/bin/master.pal.c | 70 +- examples/Math/GetAngle/gfx/bin/vaisseau.raw.c | 140 +- examples/Math/GetAngle/source/main.c | 54 +- examples/Math/Gravity/Makefile | 2 +- examples/Math/Gravity/gfx/all_gfx.h | 38 +- examples/Math/Gravity/source/main.c | 138 +- examples/Math/Gravity2/Makefile | 2 +- examples/Math/Gravity2/gfx/all_gfx.h | 38 +- examples/Math/Gravity2/source/main.c | 142 +- examples/Math/PathFinding2/Makefile | 2 +- examples/Math/PathFinding2/source/main.c | 170 +- examples/Math/Pathfinding/Makefile | 2 +- .../Math/Pathfinding/gfx/bin/master.pal.c | 70 +- .../Math/Pathfinding/gfx/bin/vaisseau.raw.c | 140 +- examples/Math/Pathfinding/source/main.c | 160 +- examples/Math/Pathfinding1/Makefile | 2 +- examples/Math/Pathfinding1/gfx/bin/Readme.txt | 8 +- .../Math/Pathfinding1/gfx/bin/master.pal.c | 70 +- .../Math/Pathfinding1/gfx/bin/vaisseau.raw.c | 140 +- examples/Math/Pathfinding1/source/main.c | 160 +- examples/Other/CloseLidSound/Makefile | 2 +- examples/Other/CloseLidSound/source/main.c | 62 +- examples/Other/Counters/Makefile | 2 +- examples/Other/Counters/source/main.c | 76 +- examples/Other/GetAngle/Makefile | 2 +- examples/Other/GetAngle/gfx/bin/master.pal.c | 70 +- .../Other/GetAngle/gfx/bin/vaisseau.raw.c | 140 +- examples/Other/GetAngle/source/main.c | 70 +- examples/Other/Pathfinding/Makefile | 2 +- .../Other/Pathfinding/gfx/bin/master.pal.c | 70 +- .../Other/Pathfinding/gfx/bin/vaisseau.raw.c | 140 +- examples/Other/Pathfinding/source/main.c | 160 +- examples/Other/Pathfinding1/Makefile | 2 +- .../Other/Pathfinding1/gfx/bin/master.pal.c | 70 +- .../Other/Pathfinding1/gfx/bin/vaisseau.raw.c | 140 +- examples/Other/Pathfinding1/source/main.c | 160 +- examples/Other/Pathfinding2/Makefile | 2 +- examples/Other/Pathfinding2/source/main.c | 184 +- examples/Other/RTC/Makefile | 2 +- examples/Other/RTC/source/main.c | 68 +- examples/Other/ScreenLight/Makefile | 2 +- examples/Other/ScreenLight/source/main.c | 56 +- examples/Other/UserInfo/Makefile | 2 +- examples/Other/UserInfo/source/main.c | 82 +- examples/Other/VBLFunction/Makefile | 2 +- examples/Other/VBLFunction/source/main.c | 78 +- examples/Other/WaitFor/Makefile | 2 +- examples/Other/WaitFor/source/main.c | 66 +- examples/Sound/ASlib/ASlib_General/Makefile | 12 +- .../Sound/ASlib/ASlib_General/source/main.c | 392 +- .../ASlib/ASlib_with_filesystem/Makefile | 18 +- .../ASlib/ASlib_with_filesystem/source/main.c | 396 +- examples/Sound/ASlib/PSG/Makefile | 10 +- examples/Sound/ASlib/PSG/source/main.c | 110 +- examples/Sound/ASlib/SoundChanBusy/Makefile | 12 +- .../Sound/ASlib/SoundChanBusy/source/main.c | 72 +- examples/Sound/ASlib/SoundPlayback/Makefile | 12 +- .../Sound/ASlib/SoundPlayback/source/main.c | 72 +- .../Sound/Maxmod/BasicModPlayback/Makefile | 6 +- .../Maxmod/BasicModPlayback/source/main.c | 82 +- examples/Sound/Maxmod/ModAndSounds/Makefile | 6 +- .../Sound/Maxmod/ModAndSounds/source/main.c | 96 +- examples/Sound/Maxmod/Reverb/Makefile | 6 +- examples/Sound/Maxmod/Reverb/source/main.c | 228 +- examples/Sound/Microphone/Makefile | 2 +- examples/Sound/Microphone/source/main.c | 102 +- examples/Sprites/Animations/Frames/Makefile | 2 +- .../Sprites/Animations/Frames/gfx/all_gfx.h | 38 +- .../Sprites/Animations/Frames/source/main.c | 78 +- .../Sprites/Animations/SpriteAnim/Makefile | 2 +- .../Animations/SpriteAnim/gfx/all_gfx.h | 38 +- .../Animations/SpriteAnim/source/main.c | 112 +- .../Sprites/Animations/SpriteAnim2/Makefile | 2 +- .../Animations/SpriteAnim2/gfx/all_gfx.h | 38 +- .../Animations/SpriteAnim2/source/main.c | 106 +- .../Sprites/Animations/SpriteAnim3/Makefile | 2 +- .../Animations/SpriteAnim3/gfx/all_gfx.h | 38 +- .../Animations/SpriteAnim3/source/main.c | 112 +- .../Sprites/Animations/SpriteFrame/Makefile | 2 +- .../Animations/SpriteFrame/source/main.c | 82 +- examples/Sprites/Basics/16bitSprite/Makefile | 2 +- .../Sprites/Basics/16bitSprite/gfx/all_gfx.h | 36 +- .../Sprites/Basics/16bitSprite/source/main.c | 52 +- .../Sprites/Basics/16colorSprite/Makefile | 2 +- .../Basics/16colorSprite/gfx/all_gfx.h | 38 +- .../Basics/16colorSprite/source/main.c | 56 +- examples/Sprites/Basics/CreateSprite/Makefile | 2 +- .../Sprites/Basics/CreateSprite/gfx/all_gfx.h | 38 +- .../Sprites/Basics/CreateSprite/source/main.c | 54 +- examples/Sprites/Basics/DualSprite/Makefile | 2 +- .../Sprites/Basics/DualSprite/gfx/all_gfx.h | 38 +- .../Sprites/Basics/DualSprite/source/main.c | 76 +- .../Sprites/Basics/GetSpritePixel/Makefile | 2 +- .../Basics/GetSpritePixel/gfx/all_gfx.h | 42 +- .../Basics/GetSpritePixel/source/main.c | 102 +- .../Sprites/Basics/MultiplePalettes/Makefile | 2 +- .../Basics/MultiplePalettes/gfx/all_gfx.h | 50 +- .../Basics/MultiplePalettes/source/main.c | 80 +- .../Sprites/Basics/SpriteTouched/Makefile | 2 +- .../Basics/SpriteTouched/gfx/bin/Readme.txt | 8 +- .../Basics/SpriteTouched/gfx/bin/master.pal.c | 70 +- .../SpriteTouched/gfx/bin/vaisseau.raw.c | 140 +- .../Basics/SpriteTouched/source/main.c | 66 +- .../Sprites/Basics/SpriteTouchedPix/Makefile | 2 +- .../Basics/SpriteTouchedPix/gfx/all_gfx.h | 38 +- .../Basics/SpriteTouchedPix/source/main.c | 54 +- .../Sprites/Effects/16bitSpriteAlpha/Makefile | 2 +- .../Effects/16bitSpriteAlpha/gfx/all_gfx.h | 36 +- .../Effects/16bitSpriteAlpha/source/main.c | 88 +- .../Sprites/Effects/AlphaBlending/Makefile | 2 +- .../Effects/AlphaBlending/gfx/all_gfx.h | 38 +- .../Effects/AlphaBlending/source/main.c | 80 +- .../Sprites/Effects/DrawOnDblsize/Makefile | 2 +- .../Effects/DrawOnDblsize/gfx/all_gfx.h | 38 +- .../Effects/DrawOnDblsize/source/main.c | 88 +- .../Sprites/Effects/DrawOnSprite/Makefile | 2 +- .../Effects/DrawOnSprite/gfx/all_gfx.h | 38 +- .../Effects/DrawOnSprite/source/main.c | 104 +- examples/Sprites/Effects/Flips/Makefile | 2 +- examples/Sprites/Effects/Flips/gfx/all_gfx.h | 38 +- examples/Sprites/Effects/Flips/source/main.c | 58 +- examples/Sprites/Effects/Mosaic/Makefile | 2 +- examples/Sprites/Effects/Mosaic/gfx/all_gfx.h | 38 +- examples/Sprites/Effects/Mosaic/source/main.c | 68 +- .../Sprites/Movement/MoveSpritePix/Makefile | 2 +- .../Movement/MoveSpritePix/gfx/all_gfx.h | 38 +- .../Movement/MoveSpritePix/source/main.c | 52 +- .../Sprites/Movement/MoveSprites/Makefile | 2 +- .../Movement/MoveSprites/gfx/all_gfx.h | 38 +- .../Movement/MoveSprites/source/main.c | 66 +- .../Movement/MoveSpritewithKeys/Makefile | 2 +- .../Movement/MoveSpritewithKeys/gfx/all_gfx.h | 38 +- .../Movement/MoveSpritewithKeys/source/main.c | 76 +- .../Movement/MoveSpritewithStylus/Makefile | 2 +- .../MoveSpritewithStylus/gfx/all_gfx.h | 38 +- .../MoveSpritewithStylus/source/main.c | 52 +- examples/Sprites/Others/CreateGfx/Makefile | 2 +- .../Sprites/Others/CreateGfx/gfx/all_gfx.h | 38 +- .../Sprites/Others/CreateGfx/source/main.c | 136 +- .../Sprites/Priorities/Priorities/Makefile | 2 +- .../Priorities/Priorities/source/main.c | 80 +- .../Sprites/Priorities/Priorities2/Makefile | 2 +- .../Priorities/Priorities2/source/main.c | 82 +- .../RotationZoom/Sprite_RotZoom/Makefile | 2 +- .../RotationZoom/Sprite_RotZoom/gfx/all_gfx.h | 38 +- .../RotationZoom/Sprite_RotZoom/source/main.c | 110 +- .../RotationZoom/Sprite_Rotation/Makefile | 2 +- .../Sprite_Rotation/gfx/all_gfx.h | 38 +- .../Sprite_Rotation/source/main.c | 82 +- .../Sprites/RotationZoom/Sprite_Zoom/Makefile | 2 +- .../RotationZoom/Sprite_Zoom/gfx/all_gfx.h | 38 +- .../RotationZoom/Sprite_Zoom/source/main.c | 92 +- examples/Text/16c/16cText/Makefile | 2 +- examples/Text/16c/16cText/source/main.c | 76 +- examples/Text/16c/16cText2/Makefile | 2 +- examples/Text/16c/16cText2/source/main.c | 70 +- examples/Text/16c/16cTextFont/Makefile | 2 +- examples/Text/16c/16cTextFont/gfx/all_gfx.h | 38 +- .../Text/16c/16cTextFont/gfx/bin/bigfont.c | 34 +- .../Text/16c/16cTextFont/gfx/bin/smallfont.c | 34 +- examples/Text/16c/16cTextFont/source/main.c | 84 +- examples/Text/8bit/8bitText/Makefile | 2 +- examples/Text/8bit/8bitText/source/main.c | 134 +- examples/Text/8bit/8bitText2/Makefile | 2 +- examples/Text/8bit/8bitText2/source/main.c | 74 +- examples/Text/8bit/8bitTextFont/Makefile | 2 +- examples/Text/8bit/8bitTextFont/gfx/all_gfx.h | 38 +- .../Text/8bit/8bitTextFont/gfx/bin/bigfont.c | 34 +- .../8bit/8bitTextFont/gfx/bin/smallfont.c | 34 +- examples/Text/8bit/8bitTextFont/source/main.c | 116 +- examples/Text/8bit/StarWarsText/Makefile | 2 +- examples/Text/8bit/StarWarsText/source/main.c | 146 +- examples/Text/Normal/BoxText/Makefile | 2 +- examples/Text/Normal/BoxText/source/main.c | 90 +- examples/Text/Normal/CustomFont/Makefile | 2 +- examples/Text/Normal/CustomFont/gfx/all_gfx.h | 36 +- .../Text/Normal/CustomFont/gfx/bin/newfont.c | 34 +- examples/Text/Normal/CustomFont/source/main.c | 104 +- .../Text/Normal/CustomFontBorder/Makefile | 2 +- .../Normal/CustomFontBorder/gfx/all_gfx.h | 36 +- .../Normal/CustomFontBorder/gfx/bin/newfont.c | 34 +- .../Normal/CustomFontBorder/source/main.c | 194 +- examples/Text/Normal/HelloWorld/Makefile | 2 +- examples/Text/Normal/HelloWorld/source/main.c | 62 +- examples/Text/Normal/Hex/Makefile | 2 +- examples/Text/Normal/Hex/source/main.c | 70 +- examples/Text/Normal/Newline/Makefile | 2 +- examples/Text/Normal/Newline/source/main.c | 58 +- examples/Text/Normal/Print/Makefile | 2 +- examples/Text/Normal/Print/source/main.c | 68 +- examples/Text/Normal/SpecialText/Makefile | 2 +- .../Text/Normal/SpecialText/source/main.c | 46 +- examples/Text/Normal/Text/Makefile | 2 +- examples/Text/Normal/Text/source/main.c | 128 +- examples/Text/Normal/TextColors/Makefile | 2 +- examples/Text/Normal/TextColors/source/main.c | 90 +- examples/Text/Normal/Text_BoxType/Makefile | 2 +- .../Text/Normal/Text_BoxType/source/main.c | 98 +- examples/Wifi/dswifi/Connect/Makefile | 2 +- examples/Wifi/dswifi/Connect/source/main.c | 64 +- examples/Wifi/dswifi/DownloadFile/Makefile | 2 +- examples/Wifi/dswifi/DownloadFile/ReadMe.txt | 16 +- .../Wifi/dswifi/DownloadFile/source/main.c | 82 +- examples/Wifi/dswifi/LeaderBoard/Makefile | 2 +- .../Wifi/dswifi/LeaderBoard/source/main.c | 184 +- include/PA7.h | 58 +- include/PA9.h | 240 +- include/PA_BgStruct.h | 134 +- include/PA_FifoMessages.h | 246 +- include/PA_IPC.h | 72 +- include/PA_Transfer.h | 84 +- include/arm7/as_lib7.h | 404 +- include/arm9/PA_16c.h | 1024 ++--- include/arm9/PA_3DSprites.h | 882 ++--- include/arm9/PA_Assert.h | 74 +- include/arm9/PA_BgLargeMap.h | 564 +-- include/arm9/PA_BgRot.h | 372 +- include/arm9/PA_BgTiles.h | 2220 +++++------ include/arm9/PA_BgTrans.h | 274 +- include/arm9/PA_Debug.h | 144 +- include/arm9/PA_Draw.h | 1202 +++--- include/arm9/PA_Fake16bit.h | 470 +-- include/arm9/PA_General.h | 796 ++-- include/arm9/PA_Gif.h | 406 +- include/arm9/PA_IA.h | 52 +- include/arm9/PA_Interrupt.h | 222 +- include/arm9/PA_Keyboard.h | 474 +-- include/arm9/PA_Keys.h | 494 +-- include/arm9/PA_KeysSpecial.h | 234 +- include/arm9/PA_Math.h | 576 +-- include/arm9/PA_Micro.h | 148 +- include/arm9/PA_Mode7.h | 410 +- include/arm9/PA_Motion.h | 90 +- include/arm9/PA_Palette.h | 696 ++-- include/arm9/PA_PaletteDual.h | 310 +- include/arm9/PA_Reco.h | 230 +- include/arm9/PA_Sound.h | 92 +- include/arm9/PA_SpecialFx.h | 274 +- include/arm9/PA_Sprite.h | 2946 +++++++------- include/arm9/PA_SpriteDual.h | 1666 ++++---- include/arm9/PA_Text.h | 1040 ++--- include/arm9/PA_TextBits.h | 114 +- include/arm9/PA_TileDual.h | 1292 +++---- include/arm9/PA_Timer.h | 72 +- include/arm9/PA_Wifi.h | 50 +- include/arm9/PA_Window.h | 400 +- include/arm9/as_lib9.h | 948 ++--- include/arm9/cpp/PA_Application.h | 92 +- include/arm9/cpp/PA_CppHeader.h | 36 +- include/arm9/cpp/PA_FixedPointClass.h | 548 +-- include/arm9/cpp/PA_SpriteClass.h | 278 +- include/arm9/cpp/PA_Wrappers.h | 126 +- include/arm9/jpeg.h | 964 ++--- source/arm7/PA.c | 96 +- source/arm7/PA_Fifo.c | 76 +- source/arm7/PA_Input.c | 76 +- source/arm7/PA_Internal.h | 62 +- source/arm7/PA_Legacy.c | 206 +- source/arm7/PA_Mic.c | 46 +- source/arm7/PA_PSG.c | 16 +- source/arm7/as_lib7.c | 1086 +++--- source/arm7/helix/license.txt | 60 +- source/arm7/helix/rcsl.txt | 1896 ++++----- source/arm7/helix/real/hufftabs.c | 1510 ++++---- source/arm7/helix/real/license.txt | 60 +- source/arm7/helix/real/rcsl.txt | 1896 ++++----- source/arm7/helix/real/rpsl.txt | 1036 ++--- source/arm7/helix/rpsl.txt | 1036 ++--- source/arm9/BitmapFont/PAGfx.ini | 26 +- source/arm9/BitmapFont/PAGfx.log | 34 +- source/arm9/BitmapFont/all_gfx.h | 48 +- source/arm9/BitmapFont/bin/PA_BmpFont0.c | 34 +- source/arm9/BitmapFont/bin/PA_BmpFont1.c | 34 +- source/arm9/BitmapFont/bin/PA_BmpFont2.c | 34 +- source/arm9/BitmapFont/bin/PA_BmpFont3.c | 34 +- source/arm9/BitmapFont/bin/PA_BmpFont4.c | 34 +- source/arm9/PA.c | 168 +- source/arm9/PA_16c.c | 268 +- source/arm9/PA_16cTextRot.c | 170 +- source/arm9/PA_3D.c | 92 +- source/arm9/PA_3DSprites.c | 1034 ++--- source/arm9/PA_ASM.s | 56 +- source/arm9/PA_BgEasy.c | 106 +- source/arm9/PA_BgGetPixel.c | 144 +- source/arm9/PA_BgLargeMap.c | 544 +-- source/arm9/PA_BgRot.c | 68 +- source/arm9/PA_BgTiles.c | 412 +- source/arm9/PA_BgTrans.c | 284 +- source/arm9/PA_Debug.c | 72 +- source/arm9/PA_Draw.c | 192 +- source/arm9/PA_Draw16bit.c | 106 +- source/arm9/PA_Draw16bitEx.c | 390 +- source/arm9/PA_Draw8bit.c | 126 +- source/arm9/PA_Draw8bitEx.c | 322 +- source/arm9/PA_Error.c | 36 +- source/arm9/PA_Fake16bitBg.c | 188 +- source/arm9/PA_Fifo.c | 46 +- source/arm9/PA_Gif.c | 432 +-- source/arm9/PA_IA.c | 158 +- source/arm9/PA_Inits.c | 302 +- source/arm9/PA_Interrupt.c | 108 +- source/arm9/PA_Keyboard.c | 356 +- source/arm9/PA_Keys.c | 142 +- source/arm9/PA_KeysSpecial.c | 162 +- source/arm9/PA_Math.c | 138 +- source/arm9/PA_Mode7.c | 312 +- source/arm9/PA_Motion.c | 178 +- source/arm9/PA_MulDivSqrt.s | 322 +- source/arm9/PA_NewBg.c | 264 +- source/arm9/PA_Palette.c | 122 +- source/arm9/PA_PaletteEx.c | 132 +- source/arm9/PA_RTC.c | 74 +- source/arm9/PA_Reco.c | 466 +-- source/arm9/PA_Sound.c | 74 +- source/arm9/PA_Sprite.c | 644 ++-- source/arm9/PA_SpriteAnim.c | 154 +- source/arm9/PA_SpriteStylus.c | 158 +- source/arm9/PA_Stuff.c | 120 +- source/arm9/PA_Text.c | 504 +-- source/arm9/PA_Text16bit.c | 352 +- source/arm9/PA_Text8bit.c | 406 +- source/arm9/PA_TextBits.c | 324 +- source/arm9/PA_TextPrint.c | 320 +- source/arm9/PA_TextSpecial.c | 486 +-- source/arm9/PA_Timer.c | 156 +- source/arm9/PA_Wifi.c | 476 +-- source/arm9/TiledFont/all_gfx.h | 40 +- source/arm9/TiledFont/bin/PA_TiledFont.c | 34 +- source/arm9/TransBg/all_gfx.h | 40 +- source/arm9/TransBg/bin/PA_TransBg.c | 34 +- source/arm9/as_lib9.c | 938 ++--- source/arm9/cpp/PA_Wrappers.cpp | 2 +- source/arm9/jpeg.c | 2210 +++++------ source/arm9/keyboard.map.c | 1036 ++--- source/arm9/keyboard.pal.c | 10 +- source/arm9/keyboard.raw.c | 1312 +++---- sys/arm7_maxmod_dswifi/source/main.c | 96 +- sys/arm7_mp3/source/main.c | 92 +- sys/arm7_mp3_dswifi/source/main.c | 104 +- template/Makefile | 726 ++-- template/ReadMe.txt | 152 +- template/source/main.c | 52 +- 699 files changed, 46881 insertions(+), 46881 deletions(-) diff --git a/changelog.txt b/changelog.txt index 58f82b6..237dd4f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,1697 +1,1697 @@ -------------------------------------------------- -| PAlib 100707 QuickFix: The last PAlib release | fincs -------------------------------------------------- - -[General] Removed the ASlib IPC clear code, it was doing more harm than good. - -[3DSprites] PA_3DCreateSprite now returns the GFX number. - -[Linux] Fixed a backslash (\) path to use forward slash (/). - -[Examples] The updating script screwed up some sound examples, it's now fixed. - -[EFS] EFS support was dropped in favor of libfilesystem. - -[Editors] PN support is now dropped. - -[Fix] PAlib now works with devkitARM r31. - -[Sprite] Fixed PA_DeleteSprite bug (thanks BassAceGold). - --------------------------------------------------- -| PAlib 0912XX STABLE beta: PAlib.evilness -= 99 | fincs --------------------------------------------------- - -Note: PAlib was a mess in the ARM7 side before this release. - -[Bugfix] Fixed the crackling bug on some cards by clearing the ASlib IPC (hopefully). - -[libnds] Enabled the libnds functions that use the system FIFO channel. - -[Pad/Stylus/RTC/Screen lights/LED blink] Now using stable (and fast/efficent) FIFO-based libnds code instead of the old (and slow/inefficent) IPC-based code. - -[Cleanup] Removed the supporting hitchhikr mod player code that made it to former releases (!). - -[Fifo] Added a new PAlib Fifo system (i.e. Fifo channel) for some commands that aren't present in libnds. - -[DS Lite Brightness/Microphone] Now using Fifo instead of the old IPC system (and extra improvements). Warning! The DS lite code is untested as fincs doesn't own a DS lite :P - -[Microphone] Recorded sounds are no longer ugly due to the change above. - -[Microphone volume] This area has been improved with an algorithm made by fincs. 0-75 = background noise, 75-150 = regular talking, 150-255 = blowing. - -[Microphone] Added a microphone stop function. - -[Lid code] Now using FIFO to tell the ARM7 to sleep. Caution: MP3 will glitch if you don't pause it before closing the lid so be careful! - -[ARM7] The base code in all ARM7 cores (input/output, etc) was split into a separate ARM7 library. - -[IPC] PA_IPC_compat was renamed to PA_Transfer as it's now used as a storing place like libnds does. - -[PA_IPC] Deprecated, initialization of it is now optional (via PA_LegacyIPCInit()). - +------------------------------------------------- +| PAlib 100707 QuickFix: The last PAlib release | fincs +------------------------------------------------- -[VBlank] Now only flushing the compatibility IPC structure instead of flushing everything, programs should run a bit faster now ^^ - -[ASlib] The ASlib ARM7 code was moved to the shared ARM7 library so each core that uses it doesn't have its own copy. - -[16c] Corrected bug that only erased half of the screen (thanks Soulanger). - -[PSG] Now using Fifo, it should be faster at playing new tones/noises now. - -[Const correctness] Added const-correctness to the AS_MP3StreamPlay() function. - -[ASlib] The default SFX rate was changed to 11025 to better suit PAlib. AS_SetDefaultSettings() is no longer needed for 11025 Hz sound effects (though you can use it to improve the quality of your sound effects via exporting them in a higher frequency and using this function). - -[PA_Locate] Fixed by using standard directory functions. - -[ASlib] Reorganized the members of the IPC structure for better word-alignment, saved 128 bytes of memory :D - -[Directory structure, again] Removed the lib subfolder. The folders include, lib and source are back at the root PAlib directory. - -[PA_Makefile] Severe cleanup. Please update your Makefile with the one from the template. - -[PA_Makefile] Removed .ds.gba output support as .nds files created by ndstool already include a loader for GBA flashcarts. - -[PA_Makefile] The logo.bmp file is now optional. If it doesn't exist it grabs the default one (PAlib/lib/defaultlogo.bmp). - -[Core] PA_InitVBL() was disabled as VBlank initialization is now automatically done in PA_Init(). - -[Functions] Renamed PA_InitText to PA_LoadDefaultText and PA_InitKeyboard to PA_LoadDefaultKeyboard. You can still use the old function names though... - -[Backgrounds] Deprecated the old token-pasting macros for backgrounds/fonts and introduced new functions that take a struct pointer instead. - -[Examples] Changed examples to use the new background/font functions. - -[Documentation] Many Doxygen warnings were fixed and the documentation was cleaned. - -[Documentation] Now comes with separate CHM and PDF files. - -[Documentation] Added instructions/tools/scripts to generate the documentation. - -[Tiled system] Fixed PA_DeleteMap(), it was glitching the tiles instead. - -[GIF] GifToTiles() and GifToTex() have been removed as converting graphics at runtime is bad practice. - -PAGfx changes (v0.10 by fincs) -============================== - -PAGfx ------ - -[Output] The outputted header is now even cleaner. - -[Custom transparent color] Fixed :s - -[Backgrounds] Now outputting a background structure instead of pointers to the files. - -[Backgrounds] Renamed InfiniteMap to UnlimitedBg. - -[Backgrounds] The TiledBg and LargeMap modes were finally obsoleted by EasyBg. - -[Backgrounds] EasyBg is now the default. - -PAGfx Frontend --------------- - -[Custom transparent color] Fixed :s - -[INI load] Marking TiledBg and LargeMap as obsoleted -> EasyBg. - -[UI] The UI was made less noisy (no more annoying msgboxes!). - -C++ wrapper library (experimental) -=================== - -[C++] A new experimental PAlib module that wraps PAlib functionality was added for those C++ users there :) - -[C++ template] A template for C++ programs that uses the wrapper classes was added. - -[C++ examples] Some C++ examples were added (PAlib/examples/C++) - -[PA::Application] Added an application class. - -[PA::Fixed] Added a fixed point number wrapper. - -[PA::Sprite] Added a simple sprite class. - -[PA::HandleProvider] Added a HandleProvider class. Use it to easily manage sprite numbers and such. - --------------------------------------------- -| PAlib 090801 beta: We're almost there... | (You Want It?) | fincs --------------------------------------------- - -[PAlib] Compiled with libnds 1.3.7. - -[DMA_Copy] Now checks if the source is NULL and fills with zeros instead, fixes some no$gba warning-related problems. - -[Many #defines] All defines that used the format #define PA_Function() { blah } has been changed to #define PA_Function() do{ blah }while(0). This makes every #define "safe". - -[inline functions] Changed all extern inlines to static inline. - -[3D Sprites] Rotation was fixed. - -[no$gba] Reverted back to the latest free version (2.6) now that a FIFO-related problem that was causing this version to not function properly was fixed in libnds. - -[Debugging] Added some debugging functions including iDeaS debugging console output and emulator detecting. - -[Text system] Updated the default font with the full character set: http://forum.palib.info/index.php?topic=6413.0 - -[C Standard Library] Now disabling UTF-8 support in the C standard library on startup. It was causing problems with the string functions and extended ASCII characters. - -[Environment variables] The PAPATH variable is no longer needed. - -[PAGfx and graphics including system] #include "gfx/all_gfx.c" is gone, and new versions of PAGfx and PAGfx Frontend were rolled out. - -[Examples] The examples have been updated with the new PAGfx and including system. - -[Errors] The PAlib error screens have been improved. - -[Speed test] The speed test routines were removed due to uselessness. - -[Text functions] Added const-correctness to them. - -PAGfx changes (v0.9 by fincs) -============================= - -General -------- - -[Build system] Now maintaining two versions: the .NET version for Windows and the Mono version for Linux/Mac OS X/others. - -PAGfx ------ - -[Export] Exporting support for .c files has been removed as the #include "gfx/all_gfx.c" method has been deprecated. - -[Transparent colors] Now supporting Hex colors as transparent colors. - -[Command line] When specifying another PAGfx.ini it outputs to the folder where the file is in. - -[all_gfx.h] The output file is now more clear and uses #pragma once instead of an #include guard. - -[Palettes] Now PAGfx doesn't truncate the palette when it has less than 256 colors. - -[Invalid C identifiers] PAGfx now replaces all invalid characters in the C identifiers with an underscore ("_"). - -PAGfx Frontend --------------- - -[Color/Background Modes] Now supporting the whole color and background modes. - -[Textures] Texture loading from PAGfx.ini was fixed, it now works. - -[Transparent color] Now supports specifying a custom transparent color. - -[Color mode warnings] Replaced the annoying color mode warning msgboxes by a status "bar". - -[Toolbar] The "Update Row" button has been removed as it only crashed PAGfx. - -[INI exporting] Graphic files that are on the same folder as PAGfx.exe or in a subfolder are exported without the full path. - -[Mono-version] The PAGfx Frontend was ported to Mono, albeit with some GUI glitches. - -[Mono-version] Colormode warnings have been disabled under Mono due to lack of support. - --------------------------------------------- -| PAlib 090621 beta: Some small changes :) | n00bey --------------------------------------------- - -[Makefiles] Two makefiles were added in the PAlib source so now 'make' works again (only concerns Linux users, Windows users can just continue to use the .bat file). - -[PA_Locate()] PA_Locate() was put back into PA_Stuff.c - -[PA_16cPutPixel] It now 'sets' the pixel instread of just making a logical-or (|) (may be slightly slower, please report back about it, so we can decide about changing it back). - -[UserInfo] Fixed personal message and name. - -[Keyboard] PA_InitCustomKeyboard fixed (it still used the old PAlib-Keyboard structure name). - -[PAlib] Removed the Blank array and replaced every DMA_Copy it was used by with a NULL (what a memory waste, 260000 bytes just for zeros...). - -[Examples] PAlib/examples/Bitmap8-16bit/Fake16bit: replaced '\' with '/' in the #include to gain compatiblity with Linux... - -[Examples] PAlib/examples/Sprites/Effects/DrawOnDblsize & DrawOnSprite: replaced Blank with NULL - ------------------------------------------------------ -| PAlib 090613 beta: THIS BETA VERSION CONTAINS WIN | fincs ------------------------------------------------------ - -[PAlib] Compiled with devkitARM r26 and libnds 1.3.5 - -[3D Sprites] The infamous viewport bug has been fixed. - -[no$gba] no$gba has been updated to 2.6a as this is the only version that emulates correctly the inner workings of libnds (FIFO). - -[iDeaS] iDeaS has been updated to 1.0.3.1. - -[Directory structure] The whole directory structure that the library part of PAlib uses has been changed so that it follows the standards. - -[PA_Makefile] A new user-friendly pre-compilation warning & error system has been added that checks for common mistakes. - -[Template] The template has been made more newbie-friendly. - -[HelloWorld] This example has been rewritten with the same newbie-friendly code that the template uses. - -[EFSlib] This library has been made compatible with devkitARM r26. - -[PA_IO.c] This file was removed due to uselessness. - -[PA_Locate()] This function was removed. There are better solutions. - -[Wifi] An example on how to download files with ky_GetURL() has been added (Wifi\dswifi\DownloadFile). All credit goes to Kumyco who let me use his code. - -[PA_GetHTTP()] As this function was broken, it was removed from PAlib. Use ky_GetURL() instead (look at the Wifi\dswifi\DownloadFile example) - -SVN changes that were applied to this release ---------------------------------------------- - -[Keyboard] The keyboard now supports the whole US-ASCII character set. The four characters "{", "}", "|" and "~" were added, the first three replacing "[", "]", "\" in capslock mode. The visual representant for the apostroph looks no longer like an acute accent. - -[Keyboard] Added key repeat functionality for uppercase letters and symbols. - -------------------------------------------------- -| PAlib 090601 beta: Keep this project alive... | n00bey -------------------------------------------------- - -[PAlib] Compiled with devkitARM r26 and libnds 1.3.4 - -[RTC] This section has been fixed. time() and gmtime() is used now - -[RTC] Instead of printing out the years that passed since 2000 i.e. 09 for this year, PA_RTC.year now is set to the absolute year 2009 - -[RTC] PA_RTC.FPS also works now that RTC is fixed - -[3D Sprites] Added some fixes for 3D Sprites; Deleting 16bit sprites should work now (Thanks to Rodrigo Roman) - -[Examples] Removed the PAFS examples. - -[Rotational Bitmap Text] Some fixes were applied. - ---------------------------------------- -| PAlib 090509 beta: Yet another beta | n00bey ---------------------------------------- - -[PAlib] Compiled with devkitARM r26 and libnds 1.3.3 - -[PAlib] Fixed some #include paths: PAlib now can be compiled on Linux again without errors... - -[ARM7_MP3_dswifi] As we all know that inlining is disabled with -Os I removed -Winline... - -[Sound] as_lib.c:159: changed IPC_Sound->chan[i] to IPC_Sound->chan[minp_ch] - why noone else saw the warning that it accessed a element out of the arrays size -_- ? - -[PA_IO] Fixed PA_ReadTextFile ... It now returns a pointer that has to be free'd afterwards - -[General] Yay! No warnings when compiling :P - - --------------------------------------------------------------------------------------- -| PAlib beta 090408: "Finally working with the latest version of devkitPro" Edition! | fincs --------------------------------------------------------------------------------------- - -[PAlib] Now PAlib is compatible with devkitARM r25 and libnds 1.3.3 thanks to n00bey and fincs!! Enjoy! - -[Sound] MikMod and hitchhikr's mod player have been removed in favor of the new MaxMod library that comes with devkitPro (/examples/Sound/MaxMod/) - -[Wifi] LibLobby support has been temporarily removed. - -[ARM7 cores] The set of ARM7 cores has been modified: ARM7_MP3, ARM7_MP3_DSWIFI and ARM7_MAXMOD_DSWIFI. - -[FAT loading] NightFox's FAT loading functions have been removed because they were buggy. Use the latest version of the functions instead. - -[Video] This whole section has been removed (legacy stuff that is useless) - -[Splash screens] The splash screen functions have been removed because they were useless. Code your own instead. - -[Workspace] VisualHAM has been removed in favor of Programmers' Notepad that comes with devkitPro. - -[Tools] viDeoconverterS has been removed. - -[PAFS] PAFS has been removed. - ------------------------------- -| PAlib 080823 : Tighten Up! | ------------------------------- - - -New Stuff ---------- - -[Input] Added functions for using the Guitar Hero grip controller. See the example code in /examples/input/GHController for how to use them. These functions were contributed by BassAceGold. - -[Input] Added functions for using the Taito Paddle controller. See the example code in /examples/input/TaitoPaddle for how to use these functions. Thanks to Yasu for figuring out how it works. - -[FAT Loading] A whole new library for loading graphics and sound assets from FAT (EFS or regular FAT with DLDI) is introduced to PAlib thanks to NightFox! You can now easily load backgrounds, sprites with their palettes, textures, sound effects and other files from FAT. See the examples in /examples/FAT/FATLoading and the PAlib documentation (English only, sorry) for how to use these great new functions. - -[8/16bit] A new "fake" 16-bit bitmap drawing mode by fincs. This simulates a 16-bit background using an 8-bit background by changing palettes every HBlank, and thereby frees up the large chunk of VRAM needed for a true 16-bit mode. See the included example in /examples/Bitmap8-16bit/Fake16bit or the PAlib documentation for usage. - -[3DSprites] MaaS wrote a new function, PA_3DSetSpritePalCol, for changing 3D sprite palette colors on the fly. - -[ARM7] Added a new arm7 core with only aslib and no wireless stuff, so it SHOULD work on M3/G6 Real. For increaed compatibility, this is now the default ARM7 binary, so be sure to select a different one in your Makefile if you need DSWifi or other ARM7 features. (See the readme file in the template folder for information on how to edit the Makefile to select a different ARM7 binary.) - - -Updated Oldies --------------- - -[Installer] Updated the PAlib installer. All items are now optional and the root path is user-selectable. - -[AS_Lib/Sound] Noda provided a new AS_Lib version and defines for EFS were removed. Using ASlib with EFSlib v2 now only requires including the efs_lib.c/.h files in your project. - -[Sound] PA_InitASLibForSounds, PA_InitASLibForMP3 and PA_InitSound have been removed. You should now use the following methods to initialize AS_Lib in the mode you desire: - -/* Init AS_Lib for mp3s */ -PA_VBLFunctionInit(AS_SoundVBL); // easy way to make sure that AS_SoundVBL() is called every frame -AS_Init(AS_MODE_MP3 | AS_MODE_SURROUND | AS_MODE_16CH); // initializes AS_Lib -AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); // or your preferred default sound settings - -or - -/* Init AS_Lib for sounds only */ -AS_Init(AS_MODE_SURROUND | AS_MODE_16CH); // initializes AS_Lib -AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); // or your preferred default sound settings - -[Random] OlliPolli has improved PAlib's Random functions. They are now faster, better and bigger (bigger random numbers, that is) and PA_InitRand is no longer needed. - -[Text] ThemePark has made a very useful change to PA_OutputText and PA_OutputSimpleText. They now support newlines (\n) in the body of the text. - -[Backgrounds] Maple identified a problem with PA_DeleteBg and improved the function so that it now fully resets the background instead of just deleteing the tiles and hiding it. This should solve problems when switching between large map backgrounds and regular backgrounds on the same layer. - -[Makefile] Removed --gc-sections from the Makefile. Thanks to Noda. - -[Makefile] The Makefile in your project directory now only contains lines that will commonly change from project to project with the bulk of the Makefile being moved to /palib/lib/PA_Makefile. This should solve some updating issues and make editing the Makefile easier. Thanks to crash for this change. - -[Examples/3DSprites] All 3DSprites examples have been updated so that PA_3DProcess comes after the vblank. This is the prefered method for rendering the 3D sprites and can solve a problem with flickering or tearing textures if a lot of 3D sprites are on screen. - -[Examples/EFS_Lib] The EFS_Lib examples in /examples/FAT/EFS_Lib and /examples/Sound/ASLib_with_EFSlib have been updated to use EFS_Lib v2.0. Huge thanks to Noda for creating this wonderful library! - -[Emulators] Updated all emulators (iDeaS, DeSmuME, No$GBA, NeonDS) and provided Linux versions where available (iDeaS, DeSmuME). - - -Things Fixed ------------- - -[Mic/Sound] Fixed PA_MicReplay by returning the old PA_PlaySoundEx2 to the PAlib source. This also provides a rudimentary alternative sound engine when ASlib cannot be used. - -[8/16bit Drawing] Fixed bug in PA_8bitDraw and PA_16bitDraw that caused unwanted lines to appear when turning drawing on and off while the stylus was held down. Thanks to Maple for the solution. - -[BMP Loading] Fixed declaration in PA_GetBmpWidth and PA_GetBmpHeight that caused compiler errors for C++ users. Thanks to Frosty Chaotix and others for this. - -[Video] dmig has fixed the long time error in PA_LoadVid, which should now be working. - -[3DSprites] Fixed misdefinition in PA_3DUpdateSpriteAnims. This fix may help problems with flickering and tearing of textures. Thanks to SevenString for the catch. - -[Sprites] Sylus101 fixed an issue in PA_ResetSpriteSysScreen that stopped sprite animations from working after the function was called. - -[Sprites] Fixed PA_GetSpriteNCycles returning wrong type and inconsistent definition for spriteanims.ncycles. Thanks to Salz` for catching this. - -[Input] Fixed bug preventing Pad.xxx.Anykey from recognizing the Y button. Thanks to ant512 for uncovering this bug ages ago and now it's finally been fixed in the source. - -[GIF Loading] ThemePark fixed a bug in PA_3DCreateFromGif and many transparency related problems in PA_GifToTex/GifToTiles. These functions are optimized and should be working properly now. See the exmaples for new usage. - -[Pathfinding] AntonioND updated the PA_Astar path-finding function. It's more efficient, returns an error value (-1) if there is no solution and a possible infinite loop bug has been fixed. - -[Window] Schyzophrenic fixed an error in PA_EnableWin that prevented full declaration of layer priorities against the windows. - -[Palettes] MaaS fixed bug in PA_SetSpritePalCol that caused corruption of sprites. - -[General] Fixed PA_CloseLidSound. Thanks to unkwar. - -[General] Finally fixed PA_PowerOff. - - ------------------------------------ -| PAlib 080313 : Community Update | ------------------------------------ - - -New Stuff ---------- - -[PAlib-arm7] There is now the possibility to choose from several arm7 cores by using different makefile options. See the PAlib template project folder ReadMe.txt for the details. - -[Music/Sound] Added Noda's AS_Lib, removed the old modplayer. If you want to play mp3's with AS_Lib, you have to select an arm7 core which supports it. PAlib's old sound functions are thus deprecated and no longer supported, but there are some macros to provide a better compatibility to old code. There is one important difference, however: PA_PlaySimpleSound(sound) and PA_PlaySoundRepeat(sound) now return the sound channel the sound is played on, which is allocated automatically! - -[Wifi] Added support for liblobby for direct DS<->DS connections. To use it, you have to download liblobby (see install.txt) and select an arm7 core which supports it. Example is at PAlibExamples/Wifi/libLobby. - -[Music] Added the modplayer by hitchhikr ( http://forum.gbadev.org/viewtopic.php?t=14628&highlight= ). To use it, select a proper arm7 core. Example is at PAlibExamples\Sound\ModPlayback. - -[Music] Added support for libmikmod by Stonebone ( http://forum.gbadev.org/viewtopic.php?t=14710 ). To use it, download mikmod (see install.txt) and select a proper arm7 core. Example is at PAlibExamples\Sound\MikMod. - -[FAT] Added Lick's Locator() as PA_Locate(). Use it to locate the data folder or file of your game on the flash card, so you don't have to force the players to store it in the root of their card or in another specific place. - -[Examples] Added example for PA_Locate() in PAlibExamples/FAT/Locate - -[Examples] Added converted example for AS_Lib in PAlibExamples/Sound/ASLib_General and ASLib_using_EFSLib to show how to stream mp3's from EFS - -[Examples] Added a simple sound playback example for AS_Lib in PAlibExamples/Sound/SoundPlayback - -[16cText] Complete rewrite, cleaner code, now allows Rotations. Thanks to Michoko for additional fixes - -[8bitText] Complete rewrite, now uses the same base as the 16cText. Easier to maintain code, lighter when using both, allows all the alignements (PA_TextAlign(align)). PA_CenterSmartText and PA_SmartText left for backwards compatibility... Correction function is now PA_8bitText - -[dsFont] Added the dsFont tool which generates custom fonts from fonts installed on your PC in PAlib/Tools/dsFont - -[EFS_Lib] Added an example for Noda's EFS_Lib in PAlibExamples/FAT/EFS_Lib. See the ReadMe.txt for instructions - -[3DSprites] Added PA_3DSetSpritePalCol() to modify the 3D sprite palettes - - -Updated Oldies --------------- - -[Documentation] Updated the documentation using the latest Doxygen (a \~ had to be added before every \param to solve an issue with the languages) - -[Examples] All use the new makefile (see "Things Fixed") - -[Cleanup] Deleted unneccesary thumbs.db, log.txt, svn files - -[3DSprites] Added PA_3DGetSpriteX and PA_3DGetSpriteY (thanks to Pitt) - -[3DSprites] Added PA_3DSetSpriteVisible - -[Emulators] Updated all emulators to the latest version, added additional emulators - -[PA_API] Code was outdated and is now deleted. Try the woopsi window system as a more complete alternative - - -Things Fixed ------------- - -[devkitARM] Compiles with devkitARM r21 (fixes in PA_3D.c and PA_3DSprites.c) -> Vista compatibility! - -[Makefiles] No longer include a WIFI icon (which is never shown). This allows for example normal .nds files to run in no$gba and, for example, on Supercard SD's - you should no longer need the .sc.nds file, so it is no longer generated. - -[Misc] New function PA_PowerOff() to shut down the DS; it was there on the arm7 side but unable to be used - -[Wifi] Changed the deprecated close() in the Leaderboard code to the correct closesocket() - -[BgTiles] PA_ReLoadBgTiles should work in all cases (thanks to Retrohead) - -[PA_SetSpriteAnimFrame] Now sprites changes frame correctly (thanks to Lotti) - -[Draw] PA_LoadBmpToBuffer() now works properly (thanks to Chris Lu) - -[SpriteAnims] PA_GetSpriteNCycles fixed (thanks to jabba) - -[16cText] Left 1 extra pixel letter spacing in the previous release, now fixed - -[Jpeg] Potential Jpeg fix, seems fixed but occured very rarely - -[Linux] Ubuntu/Debian packages created! - -[Linux] Changed all makefiles to Makefile for correct compilation - -[Linux] Added #!/bin/sh in PAlib/lib/arm7/clean.sh and PAlib/Tools/PAGfx/PAGfx.sh - - ------------------------------ -| PAlib 070717 : Misc Stuff | ------------------------------ - - -New Stuff ---------- - -[16bit] Double Buffering added - -[Image] ImageSplitter added, an app to split up big images with frames into several smaller sprites. See example to use the app. It's basic and doesn't manage any 'error' ^^ - - -Updated Oldies --------------- - -[Text] Now supports %x for Hex output - -[16cText] Added PA_16cTextLineSpacing(u8 spacing) and PA_16cTextLetterSpacing(u8 spacing) - -[iDeaS] Updated to 1.0.1.7 - -[Size] Optimised a bit more how PAlib code is organized, saves a few kB everywhere for some projects :) - -[Reco] Added PA_RecoInfo.Difference and PA_RecoInfo.Shape for the shape found and the amount of difference (test to find the values you like ^^) to that shape - -[Wifi] Updated to latest version - - -Things Fixed ------------- - -[RTC] Reverted back to older code, now works - -[Linux] PAlib compilation fixed - -[3DSprites] Fixed bug of 3D not showing after using scrollable backgrounds. Big thanks to Sumiguchi ^^ - -[Timers] Chris Liu fixed the Timers ! - -[Sprites] Fixed PA_GetSpriteAnim (thanks to Doud !) - - ------------------------------------ -| PAlib 070615 : Sumiguchi's Work | ------------------------------------ - - -New Stuff ---------- - -[Keyboard] Added PA_SetKeyboardScreen(screen) to select the screen to use for the keyboard prior to loading it... Added a 3DSprite examples (on the top screen) using the keyboard. Optimized the code slightly - -[Fatlib] Ashai Rey's LoadGif example added, using FAT - -[Examples] Sumiguchi's Fireworks demo, using 3DSprite, is now in Demos/Fireworks :) - -[Vham+iDeaS] Thanks to Lino, iDeaS (my new best friend ^^) now comes bundled with PAlib, and is included in Vham. Press F8 to compile+load in iDeaS :). Runs at a much more accurate speed for 3DSprites than no$gba - -[BgAlpha] Added Sumiguchi's example - -[DblBuffer] Added PA_8bitSwapBuffer(u8 screen) and PA_Init8bitDblBuffer(u8 screen, u8 bg_priority) - -[8bit] Double-Buffering made it in... - -[Wifi] Sumiguchi's LeaderBoard code got added ! bool PA_SubmitScore(char *response, char *gamekey, char *playername, int score, char *level, u8 responsetype) - - -Updated Oldies --------------- - -[libnds] Updated to latest release - -[Sprites] Added Error message when overloading Sprite VRAM - - -Things Fixed ------------- - -[PAFSSound] Fixed compilation errors in CPP - -[Microphone] Should sound better - -[VHam IDE] NdsLauncher updated, now looks for no$gba in devkitPro/No$GBA and PAlib/Emulators/ - -[16cText] Word Wrap is better now - -[Tiles] Fixed Hflip, Vflip, and Pal functions, thanks to Pouer - -[TextPrint] Quick fix in PA_Print, nothing major - -[WindowFade] Fixed 1 pixel showing incorrectly in some fades - -[16bi] Minor fix - - - - ----------------------------------- -| PAlib 070323 : Texts revisited | ----------------------------------- - - -New Stuff ---------- - -[16cText] Added PA_16cTextAlign(u8 align), taking as arguments ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, or ALIGN_JUSTIFY. - - -Updated Oldies --------------- - -[16cText] Saves 10 to 20kB on the default font sizes : their stores as 1bit fonts instead of 4bit, and only converted to 4bit if used. So unused font sizes won't take up that much space anymore :) - - -Things Fixed ------------- - -[TextColors] Fixed them, thanks to Tom :) - -[Gif] PA_LoadGifXY fixed, thanks to Ashai Rey - -[Sound] PA_PlaySoundRepeat is back, looks like I forgot to save PAlib when I added it :s - -[PAFS] Sound is fixed - -[PSG] ClrFog fixed the example :s - - - ----------------------------------- -| PAlib 070316 : Community Build | ----------------------------------- - -New Stuff ---------- - -[3DSprites] Added PA_Init3D2Banks(void) and PA_Reset3DSprites2Banks(void) to use 2 banks instead of 1, but it removes the backgrounds from screen 0... - -[3DSprites] Added functions to load from gif files. Check the example to see how it works. This is much slower than the normal texture functions :) - -[3DSprites] Added PA_3DSetSpriteAlpha(sprite, alpha) and PA_3DSetSpritePolyID(sprite, polyID (0-64)) and the example... Sprites must have different polyIDs to alphablend. You might want to set the sprites to different priorities too ;) - -[FATlib] Added Sumiguchi's FAT example :) (http://palib.info/forum/modules/newbb/viewtopic.php?topic_id=2556&post_id=16028#forumpost16028) - -[Sound] PSG support added, check example for more info - -[BgWrap] PA_SetBgWrap(u8 screen, u8 bg, u8 wrap) added, for RotBg, 8bit, and 16bit backgrounds. Usefull if you need to scroll around 8bit/16bit backgrounds. Thanks to mastertop for the tip :) - -[BgTrans] Added PA_BgTransCenter(u8 screen, u16 type, u8 invert, s16 state); and the example... - -[Transitions] Added BrightnessFade2 and the example - -[ModPlayer] Added PA_SetModVolume(0-127) and PA_GetModVolume(), plus a nice example :) - -[ModPlayer] Added PA_SetModChanPan(u8 channel, u8 pan) and PA_SetModPan(u8 pan), with the example, as always ^^ - -[Hardware] Now auto-turns off the DS on lid close by default. You can change that by using PA_SetAutoCheckLid (if you want to have it always on, or have your custom CheckLid). - - -Updated Oldies --------------- - -[PAGfx] Now returns an error message if you give it wrong filenames (typo or name starting with a number) - -[ModPlayer] Abrexxes updated the modplayer, should with more mods now :)(http://palib.info/forum/modules/newbb/viewtopic.php?post_id=16043#forumpost16043) - -[Sound] Repeat is back. Also added PA_PlaySoundRepeat(PA_Channel, sound) and an example using it. - - - -Things Fixed ------------- - -[Sprite] PA_SpriteTouched now works in all corners, sorry - -[DSMotion] Fixed - -[GifToTile] Cedric fixed a memory leak, thanks :) - -[3DSprites] Textures were overlapping when using very large sizes, fixed :) - -[3DSprites] Textures were overlapping when using very large sizes, fixed :) - -[3DSprites] Fixed width/height, now supports non-square textures/sprites. Added rectangle example with 256x32 sprite - -[3DSprites] Fixed Priorities on DS - -[16bit] PA_Draw16bitRect should be fixed - - - ----------------------------------- -| PAlib 070222 : Not doing 3D... | ----------------------------------- - -New Stuff ---------- - -[3DSprites] Animations made it in this release ! Check the 3DSprites Animation examples ;) Works 100% like the normal sprite animations, shouldn't be too hard - -[3DSprites] You can now change the corner positions in textures. Check out Deform examples - - -Updated Oldies --------------- - -[3DSprites] Added PA_3DCreateSprite, and DeleteTex now works :) - -[Examples] Updates for the whole 3D examples - - -Things Fixed ------------- - -[BinFiles] Fixed Bin examples, was a all_gfx.h problem in PAlib - -[16cExample] Fixed 16cText2 example, forgot to erase text :s - - - --------------------------------- -| PAlib 070220 : 3DSprites WIP | --------------------------------- - -New Stuff ---------- - -[3DSprites] Completely new 3D Sprite system, only for one screen though... Check out the examples, there's too much stuff to post here :/ You can all flood DAVIDO with thanks, because he really helped me alot ^^ - -[Examples] Added Demos/MultipleFiles example to show how to use header and .c files correctly - -[PAGfx] Updated to convert textures, still limited right now (check 3DSprite examples). Supported modes : 4colors, 16colors, 256colors, 16bit, A3I5, and A5I3 - - -Updated Oldies --------------- - -[Makefile] Makefile updated, thanks to DAVIDO ! Please take the on in the template or any example... - -[PAGfxLinux] Updated to match Windows PAGfx... - -[Examples] Reorganized examples into subfolders, should make looking for a specific example easier. Please erase your exemple folder before reinstalling... - -[TextFont] Updated the Tiled Text Font to Liquid Kidz : http://www.dafont.com/liquid-kidz.font. Hope it pleases more people than the old one ^^ - - -Things Fixed ------------- - -[PAGfx] 16bit sprite transparency and occasionnal bg compilation error - -[Fonts] 16c and 8bit now have the dot at the right height... - - ------------------------------------- -| PAlib 070216 : Transitions Rule | ------------------------------------- - -New Stuff ---------- - -[BgTrans] Completely new Background Transition effects, check them out in the Transition examples ! - -[8bitText] Added a StarWars Text example, in the Text folder. Useless ? Yeah, I know ^^ - - -Things Fixed ------------- - -[PAFS] Fixed on DS (to be confirmed :/) - - - - -------------------------------- -| PAlib 070214 : Love Edition | -------------------------------- - -New Stuff ---------- - -[EasyBg] Added PA_EasyBgLoadPtr(screen, bg_number, bg), which can take the new background pointers ! Requires to convert with the new PAGfx... Added LoadBgPtr example to show how to use an array with it. - - -Things Fixed ------------- - -[RotBg] Fixed a bug in PA_Set/GetRotBgTile - -[APIButtons] Fixed API Button example, the text wasn't set correctly - -[16c] Was using twice as much memory as needed :s - -[DSMotion] I had forgotten to update some of the DS Motion examples... - - - - - ------------------------------------- -PAlib 070206 : devkitPro r20 version ------------------------------------- - -New Stuff ---------- - -[Sound] Added PA_SetSoundChannelVol(channel, volume) to change the sound's playing volume... Added SoundChannelVolume as an example to show how it works - -[Sound] Added PA_SetSoundVol(Volume) to change the global volume level, and the example to go with it... - -[SpriteTouch] Added PA_SpriteStylusOver, similar to SpriteTouched, but which doesn't check if the stylus is held or not... Can therefore be used with Stylus.Released :) - -[DualBg] Added DualEasyBg functions, and an example to go with it : DualBackgrounds/EasyBg - -[8bit] Added PA_InitBig8bitBg(u8 screen, u8 bg_priority) : Same as PA_Init8bitBg, but with an available size of 256x256. Takes up a little more space but allows correct vertical scrolling... - -[SpriteSys] PA_ResetSpriteSysScreen(screen) added, to reset the sprite system only for a given screen. Highly untested, might give unwanted results, especially for running animations, please report any bug :) - -[PAFS_Bg] Added void PA_FSBgNameLoad(u8 screen, u8 bg_number, char* bg_name) to load a background by inputting it's name (should be easier :) ), and the example to go with it... - -[BgPixel] Added PA_EasyBgGetPixel(screen, bg_number, x, y) (to get the palette color number) and PA_EasyBgGetPixelCol (same thing but returns the u16 color). Added 3 examples to go with it (tested with normal backgrounds, largemaps and infinite tile backgrounds...). Scrolling is of course taken into account ;) - -[Platform] Added Platform4 example, which changes the collision system to use PA_EasyBgGetPixel, and can now manage diagonal collisions :) - -[DSLite] Added PA_SetDSLBrightness(u8 level) to change the DS Lite light level (0-3) - -[SoundPan] Added PA_SetSoundChannelPan(channel, pan) to set the pan level (left-right, from 0 to 127) of a sound channel. It is reset to 64 after each sound played. Added an example to test it, works well :) - -[16cText] Added PA_16cLetterPos (.Letter[n].X/Y and .NLetters), which allows you to get the position of each letter outputted by the LAST 16cText... - -[Demos] Added a TypeWritter demo. It has a nice little cursor to add text anywhere in your string (not just at the end like the plain Keyboard example), and supports different text sizes, all this being done using the 16c Text system and the new PA_16cLetterPos structure - -[16c] Added PA_16cClearZone(u8 screen, s16 x1, s16 y1, s16 x2, s16 y2) to erase part of the screen - -[16c] Added 16cSprites example to show how to use the system to display 400 shots all over the screens ^^ - -[16c] Egon added a really nice 16c example on how to use sprite animations on a 16c background ! - -[16c] Egon added PA_16c8Xi(u8 screen, s16 x, s16 y, u32 *image,u8 i) :) - -[Text] The 'u' letter in 16c and 8bit texts, size 2, had an added pixel... I saw that the 'v' following it was missplaced by 1 pixel, it is now fixed :) - -[Gif2Frames] Added an app I made to decompose an animated gif into all the frames (in a single gif file) - -[Fat] Added latest snapshot of libfat and PA_IO.c/h - -[Fat] Added PA_InitFat() to initialise any disk devices found, returns true if found. - -[Fat] Added PA_GetFileSize(FILE* pFile) to return a long of the file size - -[Fat] Added PA_ReadTextFile(char* pathname) to return the contents of a file to a char*. Added PA_WriteTextFile(char* pathname, char* text) to Write the contents of "text" to "pathname" returns the Number of bytes Written - -[Palettes] Added PA_LoadSprite16cPal(screen, n_palette, palette) and a 16colors sprite example - -[Demo] Platform examples 4 and 5 added to the examples/demo section, code updated to match the latest version :) - -[RotMaps] Added PA_SetRotMapTile(u8 screen, u8 bg_select, s16 x, s16 y, u8 tile_number) and PA_GetRotMapTile(u8 screen, u8 bg_select, s16 x, s16 y), using gmiller's code... - -[CustomFonts] Added PA_16cCustomFont(slot, fontname) and PA_8bitCustomFont(slot, fontname) and the examples to go with it... Wiki will be updated soon with the instructions. Requires the latest PAGfx version... PAGfx has been updated too, to do the conversion... - -[DSMotion] Official DSMotion code added !!! Check the Input examples to see how it works (init/getting the data). Has 2 different ways of playing with it : either get the raw values and use that, or transform the data into Pad.Held.Up/etc data :) - -[DSMotion] Added MotionDraw, a simple demo... - -[Keyboard] Added PA_InitCustomKeyboard(bg_number, keyb_custom) to load custom keyboards (use instead of PA_InitKeyboard), and the example to go with it... Custom keyboards are 256 colors and should be converted as EasyBg... - -[DSMotion] Added MotionDraw2... - -[DSMotion] Added Angle and Force variables. Made a quick MotionTurn example to see how to use them - -[Compo] Added CompoSplash demo to show the DS Dev Compo Splash screen... Also contains a custom logo for the DS Compo, if you feel like it - -[SpriteTouch] Added PA_Sprite16cTouchedPix - -[16bitSprites] Added PA_Set16bitSpriteAlpha and the example to go with it - - -Updated Stuff -------------- - -[PAFS] Added PA_FSGetFolder(char *name), to get a folder number from its name... Returns -1 if not found - -[Sound] SoundBusy doesn't flush the cache all the time anymore - -[PAGfx] Better total time output (useless, but I don't care ^^). Removed the Palette generation purcentage, it always takes less than a second now :p - -[PAGfx] Completely new tile detection code, should be MUCH faster when converting very big/complex backgrounds... - -[PAGfx] Found on the net a different method to read images, which is 10 times faster, I'm pretty sure you'll be amazed by how fast it converts backgrounds now ^^. Works for very large sprites too - -[Video] Video system moved to use PAFS. GBFS code removed. Example modified... - -[Sprites] Updated all the outdated sprite examples - -[PAFS] Name length passed to 64 characters. You'll need to use the latest PAFS.exe with the latest PAlib... (PAlib/Tools/PAFS) - -[PAGfx] Much better purcentage output (took into account the fact that it slowed down over time) and shows expected time left. - -[Arm7] Code cleaning... and again, and again ^^ - -[Fat] Updated Fat Example to use new driver/code - -[Sound] Automatically calls PA_InitSteamSound() when a streaming sound is played - -[PAFS] Paco updated PAFS, should work better with FAT32 partitions :) - -[Gif] Gif files up to 2048 pixels wide will work now - -[MAKEFILE] MAJOR Makefile update, now pads the data files to 32bit, BIG THANKS TO GANDRAN !!! Should solve all the multiple sound inclusion problems/corruption... Please update your project makefile with any PAlibExample or PAlibTemplate makefile... - -[Sound] Sound code rewritten, you can now play several sounds per frame. The old sound system is present, it switches automatically to use if you call the Stream commands... You can also, in the same frame, stop a sound channel and launch a sound on that channel :) - -[Gif] Added PA_LoadGifXY, to load gifs to a specific part of the screen :). Updated the gif examples to work with it... - -[GetSpritePixel] Added PA_GetSprite16cPixel, for 16 color sprites, and an example to go with it... - -[Makefile] Makefiles updated, please copy one of the example/template makefiles and paste in your project. Includes the sound padding correction and includes the libwifi - -[DSMotion] Now uses an average, jitters less - -[Text] PAlib text output c files changed, saves up to 10KB/rom :) - -[Stylus] Updated code to the newer more reliable code :) - -[16bitSprites] Changed display settings, now uses less memory, requires latest PAGfx to work - -[3D] DEPRICATED - -[Vham] Added Compile + Launch in No$GBA, with F6. No$GBA isn't installed with PAlib, you must have a copy in c:\devkitPro\no$gba - -[Logo] Updated PAlib logo and wifi logo - - -Things Fixed ------------- - -[PAGfx] 256 pixel wide backgrounds were rounded up to 512, this is fixed - -[Video] Fixed the video system - -[EasyBg] Fixed Tile flip bug when loading an EasyBg with more than 1008 tiles, not sure why it was still there :) - -[Sound] Sound no longer stops when turning screens off or setting the led to blink mode... - -[Microphone] Recoded the whole microphone, now works, though it's ugly...PA_MicGetVol(), PA_MicStartRecording(u8 *Buffer, s32 Length), PA_MicReplay(u8 PA_Channel, u8 *Buffer, s32 Length). See the new example ;) - -[DualSprites] Should work better with big sprites. Added a DualSprite example - -[MoveSpritePix] Fixed the bug where the sprite couldn't be moved if partly off-screen... Might not work well with 64x64 sprites that are too much offscreen though, sorry, but that reaches the DS's X/Y corrdinate limits ^^ - -[GifToTiles] Had a huge typo, width instead of height :s - -[PAFS] Paco found a bug that prevented from using other directories than Files... - -[SpritePrio] There was a typo : PA_SetSPriteExtPrio instead of PA_SetSpriteExtPrio... - -[PAGfx] No longer hangs when loading non-8pixel-padded backgrounds - -[Warnings] Fixed the FD_SETSIZE warnings - -[TextColors] TEXT_BLUE and TEXT_GREEN were inverted - -[Reco] Fixed upper screen mess-up when using the recognition system - -[SpriteAnims] Fixed first frame not showing when starting a new animation... - -[PAFSBg] Fixed PAFS Bg loading - -[PAGfx] No longer hangs if you have non-8 pixel multiple sprites. Automatically resizes it - -[Error] Fixed compilation error on projects with multiple cpp files - -[8bitText] Fixed 3 8bit text bugs - - - - -PAlib 060917 : Biggest update ever ^^ - -New Stuff ---------- - -[Tiles] New infinite tile system. Both PAlib and PAGfx have been updated to achieve this. PAGfx now has an InfiniteMap command to convert backgrounds with more than 1008 tiles... Check out the Backgrounds/InfiniteTiles example to see how it works. Example used has 1790 tiles... - -[Gif] Added new gif animation commands : PA_GifSetStartFrame(StartFrame), PA_GifSetEndFrame(EndFrame) and PA_GifGetFrame(). Also moved the examples to a separate Gif example folder. GifAnim2 uses these new commands :) - -[Gif Sprite] Added a function to convert gif files into tiles... This can be used to create sprites from a gif file ! PA_GifToTiles(gif, palette). Check the Gif/GifSprite example to see how to correctly use it... Good points : takes much less memory, no need for conversions ! Bad points : takes more RAM if you do not free your pointer after use... And is way much slower... - -[BG Prio] Added PA_SetBgPrioSeq(u8 screen, u8 priority0, u8 priority1, u8 priority2, u8 priority3), to set the backgrounds in a certain order. 100% not my code, not my idea, I just copy/pasted it ^^ Thanks to sumiguchi for that one - -[SpeedTest] Added a series of macros to test the speed of several functions and see which one is the best speed-wise... Check Math/SpeedTest example to see how it works, it's not very intuitive :/ - -[PAGfx] New exports .bin files in the /bin folder ! To use .bin files instead of .c, simply copy the .bin files into the 'data' directory (create it in the main folder if not there), and include all_gfx.h, but NOT all_gfx.c... This will include the .bin instead of the .c files... Changes have been made both in PAGfx and PAlib to allow further evolution... Because of this, backgrounds converted with this version of PAGfx CANNOT work with older PAlib versions, and files converted with older PAGfx version CANNOT work with this version of PAlib... Sorry :/ - -[PAGfx/PAlib] Added a new mode in PAGfx : EasyBg... This will automatically select the best mode for the background (between TiledBg, LargeMap, and InifiniteMap). A new set of commands has been created in PAlib to avoid thinking about it : PA_EasyBgLoad(screen, bg_number, bg_name), PA_EasyBgScrollXY(screen, bg_number, xscroll, yscroll)... (ScrollX and ScrollY also available). Editted the examples (not all) to reflect this new stuff. The wiki will be simplified soon as you don't have to think about what type of background you want now (the seperate explanations will be left in an 'advanced tutorial'). - -[PAFS Backgrounds] Added PAFS/PAFS_Bg to see how to load backgrounds from PAFS ! You have to give it the number of the first background file (name_Info), and put all the .bin files in PAFS... => PA_FSBgLoad(screen, bg_number, filenumber) - -[PAFS Sprites] Added PAFS/PAFS_Sprite to see how to load sprites from PAFS... - -[3d+Sprites] Sprites will now work on the 3d screen :D. Just run PA_Init(), and then PA_Init3D(); Added 3d+Sprites example to go with this... Untested on real DS :/ - -[3d+Backgrounds] Backgrounds can now be used instead of sprites on the same screen as the 3d ! Just run PA_Init, and then PA_Init3DAndBg()... You cannot have both Backgrounds and Sprites when using 3d, sorry ! Important note : Background 0 is NOT AVAILABLE when using 3d, trying to use it will result in wrong display... Added 3d+Bg example to go with this... Untested on real DS :/ - -[FPS Counter] Added an FPS counter : PA_RTC.FPS... Yup, that simple, nothing more to do ^^ Check out the Other/FPSCounter example to see it running. It has a simple stress code to be sure the DS won't work at 60FPS, and you can actually change the amount of stress to see the FPS change... - -[SoundBusy] Added 2 functions : PA_SoundChannelIsBusy(channel) returns 1 if busy, 0 if free. PA_GetFreeSoundChannel() returns the first available sound channel, -1 if none free. - -[StopSound] Checked, it worked... Added an example using it :) - -[LidSounds] Added PA_CloseLidSound(channel, close_sound) and PA_CloseLidSound2(channel, close_sound, open_sound), allowing you to play goodbye and welcome sounds when the lid is closed/opened ! Go see the Other/CloseLidSound example, sounds great :p Big thanks to Timonator for the idea... - -[PAGfx] Added JustPal command for sprites, to extract the palette - - -Updated Stuff -------------- - -[Examples] Started cleaning up the examples, especially the images, should save a few Mb... - -[Examples] Added 16cText2 and 8bitText2, using stdio to output the date and time :) - -[Examples] Cleaned the examples... Please delete your PAlib and PAlibExamples folder before updating... Should save some size in the zip and installer, (500-1000kB) - -[Examples] Added BinFiles in Background and Sprites to see how it works - -[Sound] On by default - -[Sound] El Hobito added PA_StopSound(u8 PA_Channel); - -[8/16bit Modes] Saved up to 50ko/file when using these modes (Giflib was included by default :s), saved 3ko/file for other .nds files - -[PAGfx] Now displays % progression when converting big backgrounds, and total conversion time at the end - -[PAGfx] Quick fix, background could be corrupted on some small background sizes - -[Palettes] Added PA_Load8bitBgPal(u8 screen, void *Pal) to load palettes for the 8bit backgrounds :) - -[GBFS Sound] Removed the main GBFS sound function, should win a few kB in the rom - -[GBFS] Removed the GBFS examples - -[Installer] Added German language - -[Wifilib] Now uses libnds's wifilib - - -Things Fixed ------------- - -[Linux] Corrected a typo in the makefile which prevented it from working on Linux - -[PAFS] Found and fixed a major bug in PAFS. Now should work correctly (it screwed up the file positions when a file was had a size of 4*n - 1 ^^ - -[PAFS] No longuer includes the files from the hidden .svn directory, sorry for that one ^^ - -[InfiniteTiles] Fixed all the errors you could have when compiling - -[Doc] Fixed a few minor errors, thanks for reporting them :) - -[RotBg] Mastertop found a compilation error, thanks :) - -[Compilation] Rockard found yet another bug, thanks ^^ - - - - -PAlib 060905 Fixes :) - -New Stuff ---------- - -[Compilation] No longer requires install.bat :) - -[VBL] Added a custom function code in the VBL : PA_VBLFunctionInit(your function) will execute, each and every frame, a given function... This can be used to make counters or have critical codes run at full speed when you're low on CPU time. Be aware that too CPU-expensive functions might slow down your program or hang the DS if run from the VBL !!! PA_VBLFunctionReset() can be used to stop the custom function. An example was added (Other/VBLFunction) - -[2D/3D] Seperated the 2D init (still done by default in PA_Init). You can now use PA_Init2D to return to 2D mode after using 3D functions :) - -[Gif] Gif speed now works, only tested on emu for now. Thanks to Shaun for the solution :D Removed PA_SetGifSpeed :p - -[Gif] New commands available to change the gif speed while playing and pause it ! PA_GifAnimSpeed(float speed), PA_GifAnimStop, PA_GifAnimPause, and PA_GifAnimPlay. Check out the GifAnim example :) - -[Demos] Added the Bunny demo to the demo folder. It shows how to use sprite frames and pixel-perfect stylus collision to create stupid minigames ^^ - - -Updated Stuff -------------- - -[Stylus] Now includes Stylus.Downtime and Uptime, to know how long the stylus was held on the screen or off of it (check Input/Stylus2 example to see that in action) - -[Stylus] Added Stylus.DblClick, may need more testing though, also in Stylus2 example - -[DeSmuME] Reverted back to the old version, this one had 'Hickups' :s - -[Giflib] Changed its compilation, saves 4kb ^^ - -[Doc] Updated the doc - - -Things Fixed ------------- - -[Compilation] Fixed the 5 last warnings :) - -[Examples] FAT example back, thanks Creebo ^^ - -[PAGfx] Better declarations in all_gfx.h and .c, with #ifndef and CPP compatible stuff :) - -[PAGfx] Now works correctly when you don't precise the Sprite/Bg mode (256colors, etc...) Will take the most common mode by default :) (fixes PAGfx.exe errors and PAGfx Frontend import function - -[Draw] Draw functions fixed, thanks to PadrinatoR :) - - - - - - - - -PAlib 060902 Small features update - -New stuff ---------- - -[Gif] Just couldn't seem to find the option that determines the gif's speed in giflib :/ I added a counter for animation speed, you can set it manually : PA_SetGifSpeed(number of VBLs to wait). 60 VBLs = 1 second between 2 frames. Example available in Bitmap/GifSpeed - -[Counters] Added 16 possible VBL Counters : PA_VBLCounterStart(ncounter) to reset and start one, PA_VBLCounter[ncounter] to get its current value. Added an example (Other/Counters) to show it works and to extract seconds from that. Also available : Pause and Unpause :) - -[RotBg] Added PA_SetRotMapTile(u8 screen, u8 bg_select, s16 x, s16 y, u8 tile_number), thanks to spinal and gmiller ! Modified the code to work with all background sizes, and added an example (Backgrounds/RotBgTile). Only tested on emulator, will need more tests :) - -[Splash] Added PA_SplashEyes() to load the PAlib splash screen with eyes following you ! More splash screens to come when available. Example found in Splash/SplashEyes - -[Splash] Added PA_SplashBlue() to load up a Splash Screen based on the forum's logo ! More splash screens to come when available. Example found in Splash/SplashBlue - -[PAFS] Added PA_LoadFSImage(u8 screen, s16 FSImage) to load Images (jpeg, gif, or bmp format) from PAFS just by giving the file's PAFS number (no need to know which image format it is !). Added PAFS/PAFS_Image as example to go with it :) - -[Pad] Added Pad.Newpress.Anykey, (Held and Released too). Modified the basic Pad example to include that in. Seems to work, please confirm if you have any bug/error (should report any key, but not the stylus) - - -Things Fixed ------------- - -[PAGfx] Benualdo correct a bug when exporting 8bit backgrounds, thanks :) - -[Examples] Removed some examples that were there twice :s - -[Example Fix] Fixed the 3d texture compilation error, not sure if it works though, couldn't test - -[Examples] Removed GBFS Gif and Bmp examples (GBFS will be depricated soon), added PAFS examples instead - - - -PAlib 060831 Official Revival Update - -[Text] Added TEXT_WHITE, TEXT_RED, etc... macros, thanks to Penjuin. Also updated the TextColors example to show that (using yellow) - -[Bugfix] Fixed PA_SetBgColor, thanks to franck569 :) - -[Bugfix] PA_ResetBgSys should now leave all screens black, untested though :) - -[Bugfix] You can now get the user's name even if he hasn't entered a message ^^ Thanks to PadrinatoR for that one ! - -[Bugfix ?] A typo, seen by PadrinatoR (again !) was found in the stylus arm7 code. I corrected it, and have no idea what it will change ! If you have any problem with the stylus on this version, please report so that we can revert back to a functionnal stylus code. - -[Bugfix] Corrected GBFSInit and migrated to solid function instead of extern inline. Untested, report if problem found... (should we just remove GBFS support and turn towards PAFS, or is everyone still using GBFS or neither one of them ?) - -[Bugfix] Corrected a bug in PA_WaitFor ^^ - - - -PAlib 060830 Revival Update - -[General] Updated my computer to latest devkitPro :) - -[Warnings] Fixed most warnings, 5 more left - -[C++] Warnings fixed - -[Vham] Updated to 2.6, "New Project" now works correctly, thanks for the help ;) - -[16c] Put the 16colors text example back in - -[Feature] Added PA_WaitFor(something), check the example (Examples/Other) to see how it work : PA_WaitFor(Pad.Newpress.A), etc... - -[PAGfx] Updated to version 0.8, which was on my hard drive since... March ! I have no idea how good/bad it works actually, can't remember if it was fully functionnal or not :/ - - - -PAlib 060304 MAJOR UPDATE - -[PAlib] Changed the compilation to do some real stuff... Now only includes what you use ! A simple demo can be as small as 60kB ! - -[TextBox] Removed the "1" that was drawn on the bottom screen - -[Examples] Tested all of them to check that they compiled and worked with the latest version. Made a general cleanup, so please delete PAlibExamples directory before reinstalling... - Broken : 16cText, 3D examples using PAlogo (??), Video - - - -PAlib 060304 MAJOR BUGFIX - -[Interrupts] Switched to libnds's interrupt handler. Seems to correct some bugs. Superstar's demo seems to work fine with the new system, so I hope this solves lots of C++ problems :S. Corrected 2 other big projects, so it seems like this could be the most stable release up to now ! It probably broke (very temporarily jialing' streaming system (uses TIMERS), we'll just have to switch the code to libnds's timer system, which shouldn't be long, but I ran out of time today :/ - -[Arm7] Some unwanted test code slipped in the previous version, could cause some major bugs - -[16 color Bg] Added a fake 'bitmap' 16 color background system. It's very usefull to draw SHMUP bullets on it (>600 8x8 bullets from what I tested) - -[Text Sizes] Added a new text system for 16color backgrounds. Works like the 8bit text (5 different sizes) but is much much faster, and takes much less memory (both in VRAM and in ROM) -> 45k in rom, and around 30k in VRAM (compared to <200k in rom and 49 in vram for 8bit text). Added an example to go with it - -[BoxText] Fixed an evil bug that prevented the boxtext from stopping, thanks too Scognito ! - -[Sprite Priorities] Fixed - -[FAT Driver] Chishm updated his FAT driver : -2006-03-03 - * Improved NMMC (MK2 / MK3) driver - * Optimised LFNs into loops, thanks to dwedit - * Optimised SuperCard SD CFC7, thanks to Cory1492 - * Added file attribute support - * Added read only M3 SD support, thanks to SaTa and Moonlight. Disabled by default due to incompleteness - * Fixed SuperCard SD reading, thanks to Loopy - * Added EFA2 support, thanks to CyteX - -[Version number] Changed the version numbers, I didn't feel like getting to a 1.0 milestone ^^ - - - -PAlib 0.998d - -[Sound] Fixed :S - -[PAGfx] Updated to add 'const' where it was missing... (thanks Jandujar !) - -[PAGfx] Removed the #ifndef from all_gfx.h, you can now include it correclty in multiple files - -[PAGfx] Shorter lines on error messages - -[PAGfx] 2 bug corrections preventing from working if a file wasn't found - -[PAGC Frontend] Corrected error when first moving from sprites to backgrounds view - -[Sprite Ext Prio] Fixed order when 2 sprites had the same priority level - -[Text] Fixed the '-' not showing for values from 0 to -1 - -[Text] Fixed the decimal values with negative numbers (thanks to Jandujar !) - - - -PAlib 0.998c - -[Examples] Fixed the keyboard example, had SimpleText instead of Text function, so the line break didn't work :S - -[Examples] Added Sprite/Priorities2, which shows how the priority system could be used to create a card game, or an isometric 3D system... - -[Screen Lights] Rewrote the code, shouldn't break the sound anymore - -[Arm7] Switched to libnds's IRQ system, now works better on MK2/3 - -[PA3D] Compiles again, sorry ! - -[Backgrounds] Optimised the Background memory error messages - -[Palettes] Added PA_SetSpritePalCol - -[C++] Fixed the Pad/Stylus problem (replacing bool by u8, I don't like that...) - - - -PAlib 0.998b - -[Sprites] Fixed sprites on hardware :/ - -[Vham IDE] Updated to remove the ofile bug when adding files :) Thanks to Kleevah ! - - -PAlib 0.998a - -[PAGfx] Updated 16colors sprites not working - -[PAGfx] Updated broken 512x512 TiledBg, now works correctly - -[16bit Sprite] Added a Create16bitSpriteFromGfx function - -[SpriteAnims] Added PA_SetSpriteNCycles(bool screen, u8 sprite, s16 NCycles) and PA_GetSpriteNCycles(bool screen, u8 sprite) - -[Doc] Updated some missing function infos - -[Palettes] PA_CreatePalBright added, to create new palette with different brightness level. ChecK Sprite/PalBrightness to see how to use it (can be used on backgrounds too) - -[Sprite Priorities] Added advanced sprite priorities, with 256 possible levels ! Check the Sprite/Priorities example to see how it works (requires an init). Beware, this is much slower than the normal priority system, as it requires sorting the sprites... - -[LargeMaps] Fixed scrolling bug when background was larger than 256 pixels, but smaller than 512 (thanks Mtom !), and a nice speed increase (up to twice as fast) on large maps (>512) - -[Sprite Animations] Fixed a little bug in the frame number when using UPDOWN, thanks to Costello - -[FAT Driver] Included Chishm's FAT Driver, with M3, SC, and MK2/3 support ! I take NO credit whatsoever for this. ALL the credit goes to Chishm and the people who helped him make this driver better... If you have any questions/bugs, please report them on palib.com, and do not bug Chishm... The driver takes around 25k, and can be removed by editing PA_Config.h. Please take the time to read the gba_nds_fat.txt file included with the driver... I haven't played with it too much yet, just tested listing the files on my MK3... (FAT/FAT example). I also update the Vham Init to take into account the FAT_ functions. - -[DeSmuME] Updated - -[Makefile] Updated with jandujar's bin2o fix. Does this make the sound work better for anyone ?? - - -PAlib 0.997a - -[Doc] Updated - -[DeSmuME] Updated, perfect backgrounds and nice sprites !! Forget about dualis ;) - -[PAGfx] Sprite optimisation and 16bit fixes - -[SpecialFx] Fixed a rare compilation error - -[Vham IDE] Removed Dualis support... I tested the latest version and it still doesn't work with my Bg+Sprite tester it seems... - -[Linux] NDS/nds fixes... again... thanks Gooler... /me hangs himself - -[Linux] Added Gooler's compilation script - -[Supercard] Added Akuma's makefile to compile a .sc.nds for supercard users, thanks ! - -[DualSprites] Added all the animation functions - -[SpriteTouched] Speed optimisation - -[SpriteTouchedPix] New function, similar to SpriteTouched, but with pixel precision ! Require InitSpriteDraw prior to usage, and is MUCH slower than the normal SpriteTouched function (as you could guess) - -[MoveSpritePix] New MoveSprite function, which requires InitSpriteDraw (like TouchedPix), but has pixel-perfect detection, and does not center the sprite on the stylus - -[Stylus] Slightly better coordinates (I hope, tried to remove eronous values), and added Stylus.Vx and Stylus.Vy ! - - - -PAlib 0.996a - -[Backgrounds] Added PA_ClearBg(screen, bg) and extern inline void PA_ClearTextBg(screen) to clear a given background map - -[ResetBgSys] Now resets the video mode, fixes some rare issues - -[Mode7] Added PA_DeInitMode7, when your finished using it, lol - -[Examples] Updated the Mode7 examples to upgrade to PAGfx functions - -[LargeMap] Fixed bug when loading not-so-large maps, lol - -[SpriteTouched] Added the Stylus.Held check in it because everyone seems to want it, lol - -[Linux] Some compilation errors fixed, thanks to Gooler... I hope it works now ! - -[Animations] Extended the sprite animation system, check out SpriteAnim3 and the wiki ! - - - -PAlib 0.995b - -[C++] Fixed a compilation error - -[RotBg] Fixed the rotating backgrounds not showing, was a palette bug (they don't use extended palettes like the others...) - -[Reco] Added infos to the shape reco : PA_RecoInfo;.Length, minX, minY, maxX, maxY, startX, startY, endX, endY, Angle and an example to go with it. Updated the wiki... - - -PAlib 0.995a - -[Shape Recognition] Beta testing a shape recognition system ! Added 2 examples in the input folder and updated the wiki... - -[Random] New Random Init function, should give better results - -[PAGfx] Corrected the Green color bug - -[Doc] Added text and recognition stuff - - -PAlib 0.99b - -[MoveSprite] Vx and Vy values fixed on DS (worked on emulator but not on DS for some reason) - -[LargeMap] Fixed a palette bug on background 1 - -[SpriteAnim] Fixed a nasty bug in the sprite gfx updating if you had too many sprites, it would update the wrong one - -[DeleteSprite] Fixed a bug in DeleteSprite, should work better now - -[SpriteDraw] Completely rewrote the draw routines and init. You can init all onscreen sprites with PA_InitAllSpriteDraw(), and you can draw with PA_SetSpritePixel(bool screen, u8 sprite, u8 x, u8 y, u8 color). Only supports 256 colors for now. Check the example given for more details - -[Emus] Added DeSmuME, by Yopyop :p - -[Vham IDE] Added Launch (+/- Build) in Dualis or DeSmuME (which will soon work better than Dualis... :p) - -[Jialing Sound] Updated to work with PAFS - -[Libnds] Updated stylus code, please update libnds to the latest version to avoid false values - - -PAlib 0.99a - -[Vham] New IDE included, still in beta test ! Now using Vham ! I take NO credit for this, all the credit goes to Peter from http://console-dev.de/ for doing this nive IDE - -[Sound] New sound system, by JiaLing ! - -[Linux] Forgot one of the changes, corrected thanks to Morian - -[C++] Corrected the compilation errors - -[PAGfx] Updated to correct errors in PAGfx and the frontend - -[Gif] Gif repaired, not sure why it didn't work though :/ - -[TextColors] Added a black color (number 9) - -[TextBox] Fixed the "\n " bug and and colors, everything works now - -[TextBox] New simplified textbox functions with borders and all ! Check out the 2 new examples - -[Text] Added a custom font loading example - -[8bit] Fixed an 8bit pixel plotting bug, not sure when it actually got there - -[Video] Corrected C++ compilation errors - - -PAlib 0.78b - -[Video] Works again... - - -PAlib 0.78a - -[Gif] Fixed a few bugs with 8bit gifs - -[Bug] Fixed a few stuff for linux compatibility, not sure I got everything though - -[Examples] Added a simple gif example, as well as a 2048x2048 map in the largemap example - -[Examples] Added a Sin and Cos Trajectory example - -[Text Colors] Added %cn as text color trigger in functions OutputText and BoxText... n is the color number (0-7)... Check out the textcolors example to see how to use it... (I just updated it) - -[MoveSprite] Optimized PA_MoveSprite code (1 function instead of 2 ! :p) and now works even if isprite is partly out of screen - -[Sound] Corrected sound (player too fast depending on the function used to play it !) - -[Demos] Added tons of new demos (and removed the original Frisbee one, replaced by a new one) with their comments on the wiki (day 12 and day 13). These demos show how to use the stylus at best, and treat about collisions... - -[PAFS] Corrected the bug when the filename wasn't PAFS.ds.gba and you still wanted to use the /silence command... Added the possibility to put /silent instead - -[PAGfx] Kleevah updated PAGfx and the Frontend, to solve some issues, add an icon, and have a better about box... - -[Doc] Updated - - -PAlib 0.77a : Christmas Release - -[Bugfix] MAJOR bugfix for the text, appeared screwed up on the top screen sometimes on DS (not on emulator), now fixed - -[PA_Config] Added a 3Ddefinition to PA_COnfig.h, saves 60k when you remove it ! I might turn the 3d off by default for now on... - -[PA_Config] Added a keyboard definition to PA_COnfig.h, saves 20k when you remove it, but it will stay on by default in PAlib - -[Bugfix] A stylus bug had slipped in when getting at the bottom of the screen ! now fixed thanks to Morian (DS only bug) - -[PAFS] Major Bugfix, now should work both in Ram AND Rom... (it used to work only depending on the number of files for some reason) - -[PAFS] Removed the press key to exit if you add a '/silence' after the path, puts a log instead, and replaced the old buggy PAFS.exe in all examples but the ram one, had forgotten those ! - -[PAGfx] Corrected the frontend, which had TiledBg instead of TileBg... minor bugfixes to both the converter and the frontend - -[Text] Added #define TEXT_ALLCHARACTERS to the config file : Replaces the normal default text by a similar one which has pretty much all the special characters... thanks to Morian for that one ! But it takes twice as much memory in video ram, so you can choose which one to include... Will be on by default in PAlib updates... Also updated the small font with a few more characters (like € and others) - -[Palettes] Added PA_SetBgPalNCol(bool screen, u8 bg_number, u8 pal_number, u8 color_number, u16 color); (usefull for the 8bit backgrounds... haven't updated the examples yet though) - -[Malloc] Added PA_Malloc(void **pointeur, u32 size) for safe malloc... (checks if exists, and if it does, frees before doing the malloc. Thanks Brunni ! - - -PAlib 0.76a : - -[PAFS Feature] Started to test some PAFS in ram... this should make it work in emulators and WMB, but is still a work in progress... it works well on one example, but seems to fail on another one, not sure why... Check out the PAFS_Ram example to see how to use it... - -[Text Feature] PA_SetTextTileCol(screen, color) is out ! What is it ? It changes the color of the next texts to come... this means you can start writing in white, tell that the rest will be in blue, and have both colors on the screen !!! For now, there are only predefined colors, and color is a number form 0 to 6... Check the TextColors example... - -[Minor Fix] Fixed a C++ compilation warning - - -PAlib 0.75a : - -[Bugfix] Text colors now work (emulator+DS) - -[Feature fix] Added PA_InitCustomText(screen, bg_select, text) to replace the custom text functions... Text must be converted using PAGfx as TileBg... (the loading function works like LoadTiledBg) - -[Feature] Much Lighter roms (lost like 100k) by removing the neoflash and palib splash screens... Moreover, they were added by default (they shouldn't have been). I'll replace them later on with jpegs, which will be way lighter... - -[PAFS] Updated PAFS to add 32bit padding to files, should solve some problems. Added mod and sound playing functions and the corresponding example... Will use all that to do the filesystem tutorial on the wiki... - -[Examples] Added the gravity example - - - -PAlib 0.74d : - -[Bugfix] Fixed the background rotations ! - -[Feature] Updated the rotating backgrounds to work easily with PAGfx -> PA_LoadPAGfxRotBg(screen, background number, bg name, wraparound (0-1)) - - -PAlib 0.74c : - -[Animations] Added PA_SetSpriteAnimFrame(screen, sprite, frame) and Added PA_SetSpriteAnimSpeed(screen, sprite, speed) - -[Bugfix] Fixed the stylus position error... - -[MODIFICATION] Changed PA_PlaySimpleSound(channel, sound), doesn't require '(void*)' and the size anymore ! Changed the example to reflect this... - - -PAlib 0.74b : - -[libnds] Updated to work on the latest libnds update - -[Bugfix] Better Sprite Animation code when rapidly changing animation sets - -[Examples] Added a nice SpriteAnim2 (using animations, sprite movement, and sprite flipping), and an AlphaBlending example for 1 sprite... - -[Doc] Updated the doc - - -PAlib 0.74a : - -[Feature] Added the new sprite animation code ! Check out the example to see how to use -PA_StartSpriteAnim(bool screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed (in fps)), PA_StopSpriteAnim(bool screen, u8 sprite), PA_GetSpriteAnimFrame(bool screen, u8 sprite), PA_SpriteAnimPause(bool screen, u8 sprite, bool pause) - -[Bugfix] The Text was still broken on hardware, in fact !!! Now it works better... andThis is a temporary fix, which removes custom fonts - -[Bugfix] Added the semicolon to PA_Save16bit (yes !) - -[Examples] Reworte part of some examples to remove french text and organize them better, added a few examples to go with the wiki... - - -PAlib 0.73b : - -[Bugfix] I think I broke the text functions in .73a, with the extended palettes... this is now fixed - - -PAlib 0.73a : - -[Change] Extended Palettes now used by default for backgrounds (load them with PA_LoadBgPal(screen, bg_number, pal)). The old PA_LoadPal is left for backwards compatibility but should not be used anymore - -[PAGfx Update] Integrates better with PAlib Background functions - -[Feature] MAJOR update for the background system, has been greatly simplified with PAGfx ! I recommend everyone to go check the simple LoadBgs example to see how it now works. In order to have correct palette names, please do not input palette names for the backgrounds... PA_LoadTiledBg and PA_LoadPAGfxLargeBg(screen, bg_number, bg_name)... - -[Feature] Added 2 random functions (PA_RandMax and PA_RandMinMax), thanks to SuperStar - - - -PAlib 0.72a : - -[Feature] Delfare updated the 3d code with some call list functions ! Check the examples :) - -[Bugfix] Compilation errors for linux users... again... And added a install.sh for them, too - -[Change] Now sets the extended sprites on by default, as it's just better... adapted PA_LoadPal to work with that, and renamed PA_LoadSpriteExtPal to PA_LoadSpritePal (left the ExtPal function for compatibility issues). Updated the sprite examples to take that into account... - - - -PAlib 0.71a : - -[PAlibTools] Updated PAGfxConverter to version 0.5. This is a MAJOR update, as it supports backgrounds, sprites, and has Kleevah's nice frontend :) - -[Examples] Updated all the examples to use PAGfxConverter instead of gfx2gba - -[BugFix] Fixed the PA FS Search function, thanks to Seddy :) - -[BugFix] Made the changes suggested by Gooler for compiling under linux, sorry for those ! - -[Bugfix] Corrected the CPPInstall.bat, should work again, sorry ! - -[Sourceforge] Removed the PAlib minimal and PAlib examples, please use only the complete packages now... - - -PAlib 0.70a : - -[Feature] Here comes the first version of PASpriteConverter !!! Beware, it needs the .Net FrameWork to work... -What so great about it ? Nothing much yet, but great things to come... -How does it work ? Check out the SpriteConverter example, it's really simple. -Why do I think it's better to use it rather than gfx2gba ? - - Because it handles all image formats (jpeg, bmp, png, etc...), and you don't necessarily need to convert your sprite to a 256 paletted sprite... Though if you have too many colors, it'll fail... - - You can easily set which color you want as background (Black, White, Green, or Fuschia) - -[Feature] PA File System now available !!! What's so great about it ? It's easier to use than GBFS, and takes much less space in Ram (actually, 0, everything goes in the Rom :p), and it supports directories structures !! Currently, only made the PAFS plain example, I'll add the folder example soon, and then convert all the GBFS functions to it. The search functions are already available... PAFS requires the .Net framework in order to work correctly. If you don't have it, either install it, or use GBFS... -I ended up adding the folder example today, to test if it worked, and saw I had a stupid bug, now everything's perfect :p Haven't converted all the functions yet, though. I'm sort of tired of working on this, so I'll continue next week, and tweak it to have the possibility to add the file system in RAM instead of ROM, for all those WMB users :-) - -[Feature] Got extended palettes for backgrounds working !! You can all thank Benny for this, he's the one who got me motivated to do it :p It took like 5-10 minutes to change the old code I had and make it work, should have done it ages ago !!! Anyways, expect PAlib to have Extended palettes for backgrounds and sprites by default very soon, just the time for me to change the basic palette loading functions... - -[Minor Feature] Added PA_SetBgColor(bool screen, u16 color), to set the background color... (thanks to SuperStar again :p), and PA_DualSetBgColor(u16 color), to set it to both screens - -[Minor Fix] Corrected the unerased character on some stylus examples, thanks to SuperStar - - -PAlib 0.67a : - -[Feature] Now works for C++ projects !!!! Added a CPPInstall.bat, which compiles PAlib to work with C++ projects... This hasn't been fully tested yet, but seems to work :-) By default, the lib compiles to C, so if you use C++, you'll have to recompile after install... - -[Feature] Added PA_SetScreenLight(screen, light), to set on/off one of the screens lights, and the example to go with it... - -[Feature] PA_GetGifHeight and PA_GetGifWidth added, pretty self-explanatory... - -[Feature] Mode7 comes in !! Not much yet, you can check the example, but more will come soon... I'll just have to... well... rewrite tons of that code :p So it'll take more time than I thought, but you can already play with this code a little... - -[Bugfix] Fixed the Rotations Background, I hadn't seen I had messed them up by putting 32bit registers instead of 16... - -[Update] Updated the 8bit Draw function, should be less buggy. The 8bit and 16 bit Draw functions should be even faster now, when used with big drawsizes - - - -PAlib 0.66a : - -[Feature] Added tons of Dual Sprite functions, but they are completely untested... (too many functions to test, sorry), and for palettes - -[Feature] Added PA_SetScreenSpace(space) to set the desired pixel space between the screens, for the dual functions. On emulator, 0 looks the best, but on DS I like to put 48 (which is the default value). - -[Update] Updated the keyboard with a modified version of Headspin's keyboard ! It looks pretty good like that :p If you want to modify the keyboard layout, or add some keys (I left some spaces empty), you can edit the keyboard.bmp file in PAlib/lib/arm9/PA, and post it on the forum, and I'll change it if I feel it's better... I also updated the keyboard code a little... - -[Feature] Added PA_SetKeyboardColor(color1, color2), which changes the keyboard's color. 0 for blue, 1 for red, 2 for green... Basically, color1 is for the unpressed keys, color2 for the pressed keys. Blue and red by default. Updated the keyboard example to take that into account, you can change the keyboard colors with A, B, X, and Y - -[Bugfix] Delfare corrected the installer, it now creates the correct environnement variable for everyone. By the way, uninstall is not available simply because it deletes the whole devkitPro folder... which is not quite what we want ! I'll change that to uninstall just the PAlib folder some time - - - -PAlib 0.65a : - -- Great new installer ! You can chose which components to install (examples, documentation...), and it creates an environnement variable (currently only for c:\devkitPro\PAlib, because NSIS doesn't do it just like I would like, so you'll have to modify the path if you install to another directory...) It uses solid LZMA compression, providing much smaller files than the zip files... -- Added a set of Dual functions -> easy Double screen support ! It's a WIP, so don't expect too much, but I started off with the backgrounds functions... So now, you can load, scroll, and do pretty much anything to a background directly on both screens, just like if there was just one big screen... I'll add support for custom space between the screen, bug corrections, and sprites in the next version. Doing a wrapper for each function just takes too much time right now ! -- Updated the version of gfx2gba used in the examples, shouldn't return a warning about extern thingy anymore... - - -PAlib 0.64e : - -- Delfare's update, with his installer -- Delfare's new text functions !! - - -PAlib 0.64d : - -- Fixed the compilation errors with the new libnds... - - -PAlib 0.64c : - -- Pathfinding Fixes - - - -PAlib 0.64b : - -- Fixed the compilation errors on cpp files... - - -PAlib 0.64a : - -- The documentation is back !! -- Fixed the compilation error some seemed to had (well, should be fixed, I hope...) -- Faster gif decompression -- Support for animated gifs on 16bit backgrounds -- Updated the example makefiles, and added the logos for multiboot and wifime -- Added PA_LoadGBFSImage, for easy loading of Gif, Jpeg, and Bmp from GBFS -- Added support for exporting Bmp's into buffers -- Fixed the problem with PA_SetSpriteAnim not working on sprite initialized with PA_CreateSpriteFromGfx... (untested, but should work) -- Switched the stylus code to the new libnds one... hope it's better for you ! - - -PAlib 0.63a : - -- Fixed the Draw functions to work with different drawing sizes -- Added a Line function with different sizes -- Added a Rectangle function -- Some screens were switched on G6 ! (don't ask me why)... This is fixed (basicly, double-checks the screen on init, and switches if it was wrong) -- Added support for BMP files ! See the GBFS example (but can be used without GBFS). Currently, only supports 16, 24, and 32 bit bmps, on a 16bit background, but paletted bitmaps are coming... -- Added support for GIF files ! Thanks Birslip, and thanks to Libungif... Currently, only did the example to load on a 16bit background, but the functions will be updated soon to work on 8 bit backgrounds (with auto-detection of 8/16bit). This might have made the PAlib size go up some more, but some of the files will be removed later on, and optimisations are still to be done speedwise (I have some ideas I haven't had time to put in place...) -- Changed the makefile a bit : - -> To easy change author/game name/website, just open the makefile and you'll see where to change... - -> To add support for gif/bmp files in the data folder -- Lots of bug fixes/enhancements - - -PAlib 0.62a : - -- Added a search for *.extension in PA GBFS system -- Changed the WaitForVBL again, it's even better now, and speeds up the demos on emulator -- Changed all the convert.bat files (gfx2gba...) to have the -align command in them, should fix some sprite problems -- Added 16 bit sprites ! With the example to go with it... Only thing : I discovered that 16 bit sprites need to be 128 pixels large... this means that any sprite size takes up a lot more memory than it takes in 256 or 16 color modes... example : an 8x8 pixel will take as much memory as a 128x8 one ! so 16 times more... -- Adding 16 bit sprites made me change a line or 2 in the sprite gfx system, apparently it works perfectly, but if you get anything weird, could be my fault... (half-sprites, or double-sprites) +[General] Removed the ASlib IPC clear code, it was doing more harm than good. + +[3DSprites] PA_3DCreateSprite now returns the GFX number. + +[Linux] Fixed a backslash (\) path to use forward slash (/). + +[Examples] The updating script screwed up some sound examples, it's now fixed. + +[EFS] EFS support was dropped in favor of libfilesystem. + +[Editors] PN support is now dropped. + +[Fix] PAlib now works with devkitARM r31. + +[Sprite] Fixed PA_DeleteSprite bug (thanks BassAceGold). + +-------------------------------------------------- +| PAlib 0912XX STABLE beta: PAlib.evilness -= 99 | fincs +-------------------------------------------------- + +Note: PAlib was a mess in the ARM7 side before this release. + +[Bugfix] Fixed the crackling bug on some cards by clearing the ASlib IPC (hopefully). + +[libnds] Enabled the libnds functions that use the system FIFO channel. + +[Pad/Stylus/RTC/Screen lights/LED blink] Now using stable (and fast/efficent) FIFO-based libnds code instead of the old (and slow/inefficent) IPC-based code. + +[Cleanup] Removed the supporting hitchhikr mod player code that made it to former releases (!). + +[Fifo] Added a new PAlib Fifo system (i.e. Fifo channel) for some commands that aren't present in libnds. + +[DS Lite Brightness/Microphone] Now using Fifo instead of the old IPC system (and extra improvements). Warning! The DS lite code is untested as fincs doesn't own a DS lite :P + +[Microphone] Recorded sounds are no longer ugly due to the change above. + +[Microphone volume] This area has been improved with an algorithm made by fincs. 0-75 = background noise, 75-150 = regular talking, 150-255 = blowing. + +[Microphone] Added a microphone stop function. + +[Lid code] Now using FIFO to tell the ARM7 to sleep. Caution: MP3 will glitch if you don't pause it before closing the lid so be careful! + +[ARM7] The base code in all ARM7 cores (input/output, etc) was split into a separate ARM7 library. + +[IPC] PA_IPC_compat was renamed to PA_Transfer as it's now used as a storing place like libnds does. + +[PA_IPC] Deprecated, initialization of it is now optional (via PA_LegacyIPCInit()). + + +[VBlank] Now only flushing the compatibility IPC structure instead of flushing everything, programs should run a bit faster now ^^ + +[ASlib] The ASlib ARM7 code was moved to the shared ARM7 library so each core that uses it doesn't have its own copy. + +[16c] Corrected bug that only erased half of the screen (thanks Soulanger). + +[PSG] Now using Fifo, it should be faster at playing new tones/noises now. + +[Const correctness] Added const-correctness to the AS_MP3StreamPlay() function. + +[ASlib] The default SFX rate was changed to 11025 to better suit PAlib. AS_SetDefaultSettings() is no longer needed for 11025 Hz sound effects (though you can use it to improve the quality of your sound effects via exporting them in a higher frequency and using this function). + +[PA_Locate] Fixed by using standard directory functions. + +[ASlib] Reorganized the members of the IPC structure for better word-alignment, saved 128 bytes of memory :D + +[Directory structure, again] Removed the lib subfolder. The folders include, lib and source are back at the root PAlib directory. + +[PA_Makefile] Severe cleanup. Please update your Makefile with the one from the template. + +[PA_Makefile] Removed .ds.gba output support as .nds files created by ndstool already include a loader for GBA flashcarts. + +[PA_Makefile] The logo.bmp file is now optional. If it doesn't exist it grabs the default one (PAlib/lib/defaultlogo.bmp). + +[Core] PA_InitVBL() was disabled as VBlank initialization is now automatically done in PA_Init(). + +[Functions] Renamed PA_InitText to PA_LoadDefaultText and PA_InitKeyboard to PA_LoadDefaultKeyboard. You can still use the old function names though... + +[Backgrounds] Deprecated the old token-pasting macros for backgrounds/fonts and introduced new functions that take a struct pointer instead. + +[Examples] Changed examples to use the new background/font functions. + +[Documentation] Many Doxygen warnings were fixed and the documentation was cleaned. + +[Documentation] Now comes with separate CHM and PDF files. + +[Documentation] Added instructions/tools/scripts to generate the documentation. + +[Tiled system] Fixed PA_DeleteMap(), it was glitching the tiles instead. + +[GIF] GifToTiles() and GifToTex() have been removed as converting graphics at runtime is bad practice. + +PAGfx changes (v0.10 by fincs) +============================== + +PAGfx +----- + +[Output] The outputted header is now even cleaner. + +[Custom transparent color] Fixed :s + +[Backgrounds] Now outputting a background structure instead of pointers to the files. + +[Backgrounds] Renamed InfiniteMap to UnlimitedBg. + +[Backgrounds] The TiledBg and LargeMap modes were finally obsoleted by EasyBg. + +[Backgrounds] EasyBg is now the default. + +PAGfx Frontend +-------------- + +[Custom transparent color] Fixed :s + +[INI load] Marking TiledBg and LargeMap as obsoleted -> EasyBg. + +[UI] The UI was made less noisy (no more annoying msgboxes!). + +C++ wrapper library (experimental) +=================== + +[C++] A new experimental PAlib module that wraps PAlib functionality was added for those C++ users there :) + +[C++ template] A template for C++ programs that uses the wrapper classes was added. + +[C++ examples] Some C++ examples were added (PAlib/examples/C++) + +[PA::Application] Added an application class. + +[PA::Fixed] Added a fixed point number wrapper. + +[PA::Sprite] Added a simple sprite class. + +[PA::HandleProvider] Added a HandleProvider class. Use it to easily manage sprite numbers and such. + +-------------------------------------------- +| PAlib 090801 beta: We're almost there... | (You Want It?) | fincs +-------------------------------------------- + +[PAlib] Compiled with libnds 1.3.7. + +[DMA_Copy] Now checks if the source is NULL and fills with zeros instead, fixes some no$gba warning-related problems. + +[Many #defines] All defines that used the format #define PA_Function() { blah } has been changed to #define PA_Function() do{ blah }while(0). This makes every #define "safe". + +[inline functions] Changed all extern inlines to static inline. + +[3D Sprites] Rotation was fixed. + +[no$gba] Reverted back to the latest free version (2.6) now that a FIFO-related problem that was causing this version to not function properly was fixed in libnds. + +[Debugging] Added some debugging functions including iDeaS debugging console output and emulator detecting. + +[Text system] Updated the default font with the full character set: http://forum.palib.info/index.php?topic=6413.0 + +[C Standard Library] Now disabling UTF-8 support in the C standard library on startup. It was causing problems with the string functions and extended ASCII characters. + +[Environment variables] The PAPATH variable is no longer needed. + +[PAGfx and graphics including system] #include "gfx/all_gfx.c" is gone, and new versions of PAGfx and PAGfx Frontend were rolled out. + +[Examples] The examples have been updated with the new PAGfx and including system. + +[Errors] The PAlib error screens have been improved. + +[Speed test] The speed test routines were removed due to uselessness. + +[Text functions] Added const-correctness to them. + +PAGfx changes (v0.9 by fincs) +============================= + +General +------- + +[Build system] Now maintaining two versions: the .NET version for Windows and the Mono version for Linux/Mac OS X/others. + +PAGfx +----- + +[Export] Exporting support for .c files has been removed as the #include "gfx/all_gfx.c" method has been deprecated. + +[Transparent colors] Now supporting Hex colors as transparent colors. + +[Command line] When specifying another PAGfx.ini it outputs to the folder where the file is in. + +[all_gfx.h] The output file is now more clear and uses #pragma once instead of an #include guard. + +[Palettes] Now PAGfx doesn't truncate the palette when it has less than 256 colors. + +[Invalid C identifiers] PAGfx now replaces all invalid characters in the C identifiers with an underscore ("_"). + +PAGfx Frontend +-------------- + +[Color/Background Modes] Now supporting the whole color and background modes. + +[Textures] Texture loading from PAGfx.ini was fixed, it now works. + +[Transparent color] Now supports specifying a custom transparent color. + +[Color mode warnings] Replaced the annoying color mode warning msgboxes by a status "bar". + +[Toolbar] The "Update Row" button has been removed as it only crashed PAGfx. + +[INI exporting] Graphic files that are on the same folder as PAGfx.exe or in a subfolder are exported without the full path. + +[Mono-version] The PAGfx Frontend was ported to Mono, albeit with some GUI glitches. + +[Mono-version] Colormode warnings have been disabled under Mono due to lack of support. + +-------------------------------------------- +| PAlib 090621 beta: Some small changes :) | n00bey +-------------------------------------------- + +[Makefiles] Two makefiles were added in the PAlib source so now 'make' works again (only concerns Linux users, Windows users can just continue to use the .bat file). + +[PA_Locate()] PA_Locate() was put back into PA_Stuff.c + +[PA_16cPutPixel] It now 'sets' the pixel instread of just making a logical-or (|) (may be slightly slower, please report back about it, so we can decide about changing it back). + +[UserInfo] Fixed personal message and name. + +[Keyboard] PA_InitCustomKeyboard fixed (it still used the old PAlib-Keyboard structure name). + +[PAlib] Removed the Blank array and replaced every DMA_Copy it was used by with a NULL (what a memory waste, 260000 bytes just for zeros...). + +[Examples] PAlib/examples/Bitmap8-16bit/Fake16bit: replaced '\' with '/' in the #include to gain compatiblity with Linux... + +[Examples] PAlib/examples/Sprites/Effects/DrawOnDblsize & DrawOnSprite: replaced Blank with NULL + +----------------------------------------------------- +| PAlib 090613 beta: THIS BETA VERSION CONTAINS WIN | fincs +----------------------------------------------------- + +[PAlib] Compiled with devkitARM r26 and libnds 1.3.5 + +[3D Sprites] The infamous viewport bug has been fixed. + +[no$gba] no$gba has been updated to 2.6a as this is the only version that emulates correctly the inner workings of libnds (FIFO). + +[iDeaS] iDeaS has been updated to 1.0.3.1. + +[Directory structure] The whole directory structure that the library part of PAlib uses has been changed so that it follows the standards. + +[PA_Makefile] A new user-friendly pre-compilation warning & error system has been added that checks for common mistakes. + +[Template] The template has been made more newbie-friendly. + +[HelloWorld] This example has been rewritten with the same newbie-friendly code that the template uses. + +[EFSlib] This library has been made compatible with devkitARM r26. + +[PA_IO.c] This file was removed due to uselessness. + +[PA_Locate()] This function was removed. There are better solutions. + +[Wifi] An example on how to download files with ky_GetURL() has been added (Wifi\dswifi\DownloadFile). All credit goes to Kumyco who let me use his code. + +[PA_GetHTTP()] As this function was broken, it was removed from PAlib. Use ky_GetURL() instead (look at the Wifi\dswifi\DownloadFile example) + +SVN changes that were applied to this release +--------------------------------------------- + +[Keyboard] The keyboard now supports the whole US-ASCII character set. The four characters "{", "}", "|" and "~" were added, the first three replacing "[", "]", "\" in capslock mode. The visual representant for the apostroph looks no longer like an acute accent. + +[Keyboard] Added key repeat functionality for uppercase letters and symbols. + +------------------------------------------------- +| PAlib 090601 beta: Keep this project alive... | n00bey +------------------------------------------------- + +[PAlib] Compiled with devkitARM r26 and libnds 1.3.4 + +[RTC] This section has been fixed. time() and gmtime() is used now + +[RTC] Instead of printing out the years that passed since 2000 i.e. 09 for this year, PA_RTC.year now is set to the absolute year 2009 + +[RTC] PA_RTC.FPS also works now that RTC is fixed + +[3D Sprites] Added some fixes for 3D Sprites; Deleting 16bit sprites should work now (Thanks to Rodrigo Roman) + +[Examples] Removed the PAFS examples. + +[Rotational Bitmap Text] Some fixes were applied. + +--------------------------------------- +| PAlib 090509 beta: Yet another beta | n00bey +--------------------------------------- + +[PAlib] Compiled with devkitARM r26 and libnds 1.3.3 + +[PAlib] Fixed some #include paths: PAlib now can be compiled on Linux again without errors... + +[ARM7_MP3_dswifi] As we all know that inlining is disabled with -Os I removed -Winline... + +[Sound] as_lib.c:159: changed IPC_Sound->chan[i] to IPC_Sound->chan[minp_ch] - why noone else saw the warning that it accessed a element out of the arrays size -_- ? + +[PA_IO] Fixed PA_ReadTextFile ... It now returns a pointer that has to be free'd afterwards + +[General] Yay! No warnings when compiling :P + + +-------------------------------------------------------------------------------------- +| PAlib beta 090408: "Finally working with the latest version of devkitPro" Edition! | fincs +-------------------------------------------------------------------------------------- + +[PAlib] Now PAlib is compatible with devkitARM r25 and libnds 1.3.3 thanks to n00bey and fincs!! Enjoy! + +[Sound] MikMod and hitchhikr's mod player have been removed in favor of the new MaxMod library that comes with devkitPro (/examples/Sound/MaxMod/) + +[Wifi] LibLobby support has been temporarily removed. + +[ARM7 cores] The set of ARM7 cores has been modified: ARM7_MP3, ARM7_MP3_DSWIFI and ARM7_MAXMOD_DSWIFI. + +[FAT loading] NightFox's FAT loading functions have been removed because they were buggy. Use the latest version of the functions instead. + +[Video] This whole section has been removed (legacy stuff that is useless) + +[Splash screens] The splash screen functions have been removed because they were useless. Code your own instead. + +[Workspace] VisualHAM has been removed in favor of Programmers' Notepad that comes with devkitPro. + +[Tools] viDeoconverterS has been removed. + +[PAFS] PAFS has been removed. + +------------------------------ +| PAlib 080823 : Tighten Up! | +------------------------------ + + +New Stuff +--------- + +[Input] Added functions for using the Guitar Hero grip controller. See the example code in /examples/input/GHController for how to use them. These functions were contributed by BassAceGold. + +[Input] Added functions for using the Taito Paddle controller. See the example code in /examples/input/TaitoPaddle for how to use these functions. Thanks to Yasu for figuring out how it works. + +[FAT Loading] A whole new library for loading graphics and sound assets from FAT (EFS or regular FAT with DLDI) is introduced to PAlib thanks to NightFox! You can now easily load backgrounds, sprites with their palettes, textures, sound effects and other files from FAT. See the examples in /examples/FAT/FATLoading and the PAlib documentation (English only, sorry) for how to use these great new functions. + +[8/16bit] A new "fake" 16-bit bitmap drawing mode by fincs. This simulates a 16-bit background using an 8-bit background by changing palettes every HBlank, and thereby frees up the large chunk of VRAM needed for a true 16-bit mode. See the included example in /examples/Bitmap8-16bit/Fake16bit or the PAlib documentation for usage. + +[3DSprites] MaaS wrote a new function, PA_3DSetSpritePalCol, for changing 3D sprite palette colors on the fly. + +[ARM7] Added a new arm7 core with only aslib and no wireless stuff, so it SHOULD work on M3/G6 Real. For increaed compatibility, this is now the default ARM7 binary, so be sure to select a different one in your Makefile if you need DSWifi or other ARM7 features. (See the readme file in the template folder for information on how to edit the Makefile to select a different ARM7 binary.) + + +Updated Oldies +-------------- + +[Installer] Updated the PAlib installer. All items are now optional and the root path is user-selectable. + +[AS_Lib/Sound] Noda provided a new AS_Lib version and defines for EFS were removed. Using ASlib with EFSlib v2 now only requires including the efs_lib.c/.h files in your project. + +[Sound] PA_InitASLibForSounds, PA_InitASLibForMP3 and PA_InitSound have been removed. You should now use the following methods to initialize AS_Lib in the mode you desire: + +/* Init AS_Lib for mp3s */ +PA_VBLFunctionInit(AS_SoundVBL); // easy way to make sure that AS_SoundVBL() is called every frame +AS_Init(AS_MODE_MP3 | AS_MODE_SURROUND | AS_MODE_16CH); // initializes AS_Lib +AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); // or your preferred default sound settings + +or + +/* Init AS_Lib for sounds only */ +AS_Init(AS_MODE_SURROUND | AS_MODE_16CH); // initializes AS_Lib +AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); // or your preferred default sound settings + +[Random] OlliPolli has improved PAlib's Random functions. They are now faster, better and bigger (bigger random numbers, that is) and PA_InitRand is no longer needed. + +[Text] ThemePark has made a very useful change to PA_OutputText and PA_OutputSimpleText. They now support newlines (\n) in the body of the text. + +[Backgrounds] Maple identified a problem with PA_DeleteBg and improved the function so that it now fully resets the background instead of just deleteing the tiles and hiding it. This should solve problems when switching between large map backgrounds and regular backgrounds on the same layer. + +[Makefile] Removed --gc-sections from the Makefile. Thanks to Noda. + +[Makefile] The Makefile in your project directory now only contains lines that will commonly change from project to project with the bulk of the Makefile being moved to /palib/lib/PA_Makefile. This should solve some updating issues and make editing the Makefile easier. Thanks to crash for this change. + +[Examples/3DSprites] All 3DSprites examples have been updated so that PA_3DProcess comes after the vblank. This is the prefered method for rendering the 3D sprites and can solve a problem with flickering or tearing textures if a lot of 3D sprites are on screen. + +[Examples/EFS_Lib] The EFS_Lib examples in /examples/FAT/EFS_Lib and /examples/Sound/ASLib_with_EFSlib have been updated to use EFS_Lib v2.0. Huge thanks to Noda for creating this wonderful library! + +[Emulators] Updated all emulators (iDeaS, DeSmuME, No$GBA, NeonDS) and provided Linux versions where available (iDeaS, DeSmuME). + + +Things Fixed +------------ + +[Mic/Sound] Fixed PA_MicReplay by returning the old PA_PlaySoundEx2 to the PAlib source. This also provides a rudimentary alternative sound engine when ASlib cannot be used. + +[8/16bit Drawing] Fixed bug in PA_8bitDraw and PA_16bitDraw that caused unwanted lines to appear when turning drawing on and off while the stylus was held down. Thanks to Maple for the solution. + +[BMP Loading] Fixed declaration in PA_GetBmpWidth and PA_GetBmpHeight that caused compiler errors for C++ users. Thanks to Frosty Chaotix and others for this. + +[Video] dmig has fixed the long time error in PA_LoadVid, which should now be working. + +[3DSprites] Fixed misdefinition in PA_3DUpdateSpriteAnims. This fix may help problems with flickering and tearing of textures. Thanks to SevenString for the catch. + +[Sprites] Sylus101 fixed an issue in PA_ResetSpriteSysScreen that stopped sprite animations from working after the function was called. + +[Sprites] Fixed PA_GetSpriteNCycles returning wrong type and inconsistent definition for spriteanims.ncycles. Thanks to Salz` for catching this. + +[Input] Fixed bug preventing Pad.xxx.Anykey from recognizing the Y button. Thanks to ant512 for uncovering this bug ages ago and now it's finally been fixed in the source. + +[GIF Loading] ThemePark fixed a bug in PA_3DCreateFromGif and many transparency related problems in PA_GifToTex/GifToTiles. These functions are optimized and should be working properly now. See the exmaples for new usage. + +[Pathfinding] AntonioND updated the PA_Astar path-finding function. It's more efficient, returns an error value (-1) if there is no solution and a possible infinite loop bug has been fixed. + +[Window] Schyzophrenic fixed an error in PA_EnableWin that prevented full declaration of layer priorities against the windows. + +[Palettes] MaaS fixed bug in PA_SetSpritePalCol that caused corruption of sprites. + +[General] Fixed PA_CloseLidSound. Thanks to unkwar. + +[General] Finally fixed PA_PowerOff. + + +----------------------------------- +| PAlib 080313 : Community Update | +----------------------------------- + + +New Stuff +--------- + +[PAlib-arm7] There is now the possibility to choose from several arm7 cores by using different makefile options. See the PAlib template project folder ReadMe.txt for the details. + +[Music/Sound] Added Noda's AS_Lib, removed the old modplayer. If you want to play mp3's with AS_Lib, you have to select an arm7 core which supports it. PAlib's old sound functions are thus deprecated and no longer supported, but there are some macros to provide a better compatibility to old code. There is one important difference, however: PA_PlaySimpleSound(sound) and PA_PlaySoundRepeat(sound) now return the sound channel the sound is played on, which is allocated automatically! + +[Wifi] Added support for liblobby for direct DS<->DS connections. To use it, you have to download liblobby (see install.txt) and select an arm7 core which supports it. Example is at PAlibExamples/Wifi/libLobby. + +[Music] Added the modplayer by hitchhikr ( http://forum.gbadev.org/viewtopic.php?t=14628&highlight= ). To use it, select a proper arm7 core. Example is at PAlibExamples\Sound\ModPlayback. + +[Music] Added support for libmikmod by Stonebone ( http://forum.gbadev.org/viewtopic.php?t=14710 ). To use it, download mikmod (see install.txt) and select a proper arm7 core. Example is at PAlibExamples\Sound\MikMod. + +[FAT] Added Lick's Locator() as PA_Locate(). Use it to locate the data folder or file of your game on the flash card, so you don't have to force the players to store it in the root of their card or in another specific place. + +[Examples] Added example for PA_Locate() in PAlibExamples/FAT/Locate + +[Examples] Added converted example for AS_Lib in PAlibExamples/Sound/ASLib_General and ASLib_using_EFSLib to show how to stream mp3's from EFS + +[Examples] Added a simple sound playback example for AS_Lib in PAlibExamples/Sound/SoundPlayback + +[16cText] Complete rewrite, cleaner code, now allows Rotations. Thanks to Michoko for additional fixes + +[8bitText] Complete rewrite, now uses the same base as the 16cText. Easier to maintain code, lighter when using both, allows all the alignements (PA_TextAlign(align)). PA_CenterSmartText and PA_SmartText left for backwards compatibility... Correction function is now PA_8bitText + +[dsFont] Added the dsFont tool which generates custom fonts from fonts installed on your PC in PAlib/Tools/dsFont + +[EFS_Lib] Added an example for Noda's EFS_Lib in PAlibExamples/FAT/EFS_Lib. See the ReadMe.txt for instructions + +[3DSprites] Added PA_3DSetSpritePalCol() to modify the 3D sprite palettes + + +Updated Oldies +-------------- + +[Documentation] Updated the documentation using the latest Doxygen (a \~ had to be added before every \param to solve an issue with the languages) + +[Examples] All use the new makefile (see "Things Fixed") + +[Cleanup] Deleted unneccesary thumbs.db, log.txt, svn files + +[3DSprites] Added PA_3DGetSpriteX and PA_3DGetSpriteY (thanks to Pitt) + +[3DSprites] Added PA_3DSetSpriteVisible + +[Emulators] Updated all emulators to the latest version, added additional emulators + +[PA_API] Code was outdated and is now deleted. Try the woopsi window system as a more complete alternative + + +Things Fixed +------------ + +[devkitARM] Compiles with devkitARM r21 (fixes in PA_3D.c and PA_3DSprites.c) -> Vista compatibility! + +[Makefiles] No longer include a WIFI icon (which is never shown). This allows for example normal .nds files to run in no$gba and, for example, on Supercard SD's - you should no longer need the .sc.nds file, so it is no longer generated. + +[Misc] New function PA_PowerOff() to shut down the DS; it was there on the arm7 side but unable to be used + +[Wifi] Changed the deprecated close() in the Leaderboard code to the correct closesocket() + +[BgTiles] PA_ReLoadBgTiles should work in all cases (thanks to Retrohead) + +[PA_SetSpriteAnimFrame] Now sprites changes frame correctly (thanks to Lotti) + +[Draw] PA_LoadBmpToBuffer() now works properly (thanks to Chris Lu) + +[SpriteAnims] PA_GetSpriteNCycles fixed (thanks to jabba) + +[16cText] Left 1 extra pixel letter spacing in the previous release, now fixed + +[Jpeg] Potential Jpeg fix, seems fixed but occured very rarely + +[Linux] Ubuntu/Debian packages created! + +[Linux] Changed all makefiles to Makefile for correct compilation + +[Linux] Added #!/bin/sh in PAlib/lib/arm7/clean.sh and PAlib/Tools/PAGfx/PAGfx.sh + + +----------------------------- +| PAlib 070717 : Misc Stuff | +----------------------------- + + +New Stuff +--------- + +[16bit] Double Buffering added + +[Image] ImageSplitter added, an app to split up big images with frames into several smaller sprites. See example to use the app. It's basic and doesn't manage any 'error' ^^ + + +Updated Oldies +-------------- + +[Text] Now supports %x for Hex output + +[16cText] Added PA_16cTextLineSpacing(u8 spacing) and PA_16cTextLetterSpacing(u8 spacing) + +[iDeaS] Updated to 1.0.1.7 + +[Size] Optimised a bit more how PAlib code is organized, saves a few kB everywhere for some projects :) + +[Reco] Added PA_RecoInfo.Difference and PA_RecoInfo.Shape for the shape found and the amount of difference (test to find the values you like ^^) to that shape + +[Wifi] Updated to latest version + + +Things Fixed +------------ + +[RTC] Reverted back to older code, now works + +[Linux] PAlib compilation fixed + +[3DSprites] Fixed bug of 3D not showing after using scrollable backgrounds. Big thanks to Sumiguchi ^^ + +[Timers] Chris Liu fixed the Timers ! + +[Sprites] Fixed PA_GetSpriteAnim (thanks to Doud !) + + +----------------------------------- +| PAlib 070615 : Sumiguchi's Work | +----------------------------------- + + +New Stuff +--------- + +[Keyboard] Added PA_SetKeyboardScreen(screen) to select the screen to use for the keyboard prior to loading it... Added a 3DSprite examples (on the top screen) using the keyboard. Optimized the code slightly + +[Fatlib] Ashai Rey's LoadGif example added, using FAT + +[Examples] Sumiguchi's Fireworks demo, using 3DSprite, is now in Demos/Fireworks :) + +[Vham+iDeaS] Thanks to Lino, iDeaS (my new best friend ^^) now comes bundled with PAlib, and is included in Vham. Press F8 to compile+load in iDeaS :). Runs at a much more accurate speed for 3DSprites than no$gba + +[BgAlpha] Added Sumiguchi's example + +[DblBuffer] Added PA_8bitSwapBuffer(u8 screen) and PA_Init8bitDblBuffer(u8 screen, u8 bg_priority) + +[8bit] Double-Buffering made it in... + +[Wifi] Sumiguchi's LeaderBoard code got added ! bool PA_SubmitScore(char *response, char *gamekey, char *playername, int score, char *level, u8 responsetype) + + +Updated Oldies +-------------- + +[libnds] Updated to latest release + +[Sprites] Added Error message when overloading Sprite VRAM + + +Things Fixed +------------ + +[PAFSSound] Fixed compilation errors in CPP + +[Microphone] Should sound better + +[VHam IDE] NdsLauncher updated, now looks for no$gba in devkitPro/No$GBA and PAlib/Emulators/ + +[16cText] Word Wrap is better now + +[Tiles] Fixed Hflip, Vflip, and Pal functions, thanks to Pouer + +[TextPrint] Quick fix in PA_Print, nothing major + +[WindowFade] Fixed 1 pixel showing incorrectly in some fades + +[16bi] Minor fix + + + + +---------------------------------- +| PAlib 070323 : Texts revisited | +---------------------------------- + + +New Stuff +--------- + +[16cText] Added PA_16cTextAlign(u8 align), taking as arguments ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, or ALIGN_JUSTIFY. + + +Updated Oldies +-------------- + +[16cText] Saves 10 to 20kB on the default font sizes : their stores as 1bit fonts instead of 4bit, and only converted to 4bit if used. So unused font sizes won't take up that much space anymore :) + + +Things Fixed +------------ + +[TextColors] Fixed them, thanks to Tom :) + +[Gif] PA_LoadGifXY fixed, thanks to Ashai Rey + +[Sound] PA_PlaySoundRepeat is back, looks like I forgot to save PAlib when I added it :s + +[PAFS] Sound is fixed + +[PSG] ClrFog fixed the example :s + + + +---------------------------------- +| PAlib 070316 : Community Build | +---------------------------------- + +New Stuff +--------- + +[3DSprites] Added PA_Init3D2Banks(void) and PA_Reset3DSprites2Banks(void) to use 2 banks instead of 1, but it removes the backgrounds from screen 0... + +[3DSprites] Added functions to load from gif files. Check the example to see how it works. This is much slower than the normal texture functions :) + +[3DSprites] Added PA_3DSetSpriteAlpha(sprite, alpha) and PA_3DSetSpritePolyID(sprite, polyID (0-64)) and the example... Sprites must have different polyIDs to alphablend. You might want to set the sprites to different priorities too ;) + +[FATlib] Added Sumiguchi's FAT example :) (http://palib.info/forum/modules/newbb/viewtopic.php?topic_id=2556&post_id=16028#forumpost16028) + +[Sound] PSG support added, check example for more info + +[BgWrap] PA_SetBgWrap(u8 screen, u8 bg, u8 wrap) added, for RotBg, 8bit, and 16bit backgrounds. Usefull if you need to scroll around 8bit/16bit backgrounds. Thanks to mastertop for the tip :) + +[BgTrans] Added PA_BgTransCenter(u8 screen, u16 type, u8 invert, s16 state); and the example... + +[Transitions] Added BrightnessFade2 and the example + +[ModPlayer] Added PA_SetModVolume(0-127) and PA_GetModVolume(), plus a nice example :) + +[ModPlayer] Added PA_SetModChanPan(u8 channel, u8 pan) and PA_SetModPan(u8 pan), with the example, as always ^^ + +[Hardware] Now auto-turns off the DS on lid close by default. You can change that by using PA_SetAutoCheckLid (if you want to have it always on, or have your custom CheckLid). + + +Updated Oldies +-------------- + +[PAGfx] Now returns an error message if you give it wrong filenames (typo or name starting with a number) + +[ModPlayer] Abrexxes updated the modplayer, should with more mods now :)(http://palib.info/forum/modules/newbb/viewtopic.php?post_id=16043#forumpost16043) + +[Sound] Repeat is back. Also added PA_PlaySoundRepeat(PA_Channel, sound) and an example using it. + + + +Things Fixed +------------ + +[Sprite] PA_SpriteTouched now works in all corners, sorry + +[DSMotion] Fixed + +[GifToTile] Cedric fixed a memory leak, thanks :) + +[3DSprites] Textures were overlapping when using very large sizes, fixed :) + +[3DSprites] Textures were overlapping when using very large sizes, fixed :) + +[3DSprites] Fixed width/height, now supports non-square textures/sprites. Added rectangle example with 256x32 sprite + +[3DSprites] Fixed Priorities on DS + +[16bit] PA_Draw16bitRect should be fixed + + + +---------------------------------- +| PAlib 070222 : Not doing 3D... | +---------------------------------- + +New Stuff +--------- + +[3DSprites] Animations made it in this release ! Check the 3DSprites Animation examples ;) Works 100% like the normal sprite animations, shouldn't be too hard + +[3DSprites] You can now change the corner positions in textures. Check out Deform examples + + +Updated Oldies +-------------- + +[3DSprites] Added PA_3DCreateSprite, and DeleteTex now works :) + +[Examples] Updates for the whole 3D examples + + +Things Fixed +------------ + +[BinFiles] Fixed Bin examples, was a all_gfx.h problem in PAlib + +[16cExample] Fixed 16cText2 example, forgot to erase text :s + + + +-------------------------------- +| PAlib 070220 : 3DSprites WIP | +-------------------------------- + +New Stuff +--------- + +[3DSprites] Completely new 3D Sprite system, only for one screen though... Check out the examples, there's too much stuff to post here :/ You can all flood DAVIDO with thanks, because he really helped me alot ^^ + +[Examples] Added Demos/MultipleFiles example to show how to use header and .c files correctly + +[PAGfx] Updated to convert textures, still limited right now (check 3DSprite examples). Supported modes : 4colors, 16colors, 256colors, 16bit, A3I5, and A5I3 + + +Updated Oldies +-------------- + +[Makefile] Makefile updated, thanks to DAVIDO ! Please take the on in the template or any example... + +[PAGfxLinux] Updated to match Windows PAGfx... + +[Examples] Reorganized examples into subfolders, should make looking for a specific example easier. Please erase your exemple folder before reinstalling... + +[TextFont] Updated the Tiled Text Font to Liquid Kidz : http://www.dafont.com/liquid-kidz.font. Hope it pleases more people than the old one ^^ + + +Things Fixed +------------ + +[PAGfx] 16bit sprite transparency and occasionnal bg compilation error + +[Fonts] 16c and 8bit now have the dot at the right height... + + +------------------------------------ +| PAlib 070216 : Transitions Rule | +------------------------------------ + +New Stuff +--------- + +[BgTrans] Completely new Background Transition effects, check them out in the Transition examples ! + +[8bitText] Added a StarWars Text example, in the Text folder. Useless ? Yeah, I know ^^ + + +Things Fixed +------------ + +[PAFS] Fixed on DS (to be confirmed :/) + + + + +------------------------------- +| PAlib 070214 : Love Edition | +------------------------------- + +New Stuff +--------- + +[EasyBg] Added PA_EasyBgLoadPtr(screen, bg_number, bg), which can take the new background pointers ! Requires to convert with the new PAGfx... Added LoadBgPtr example to show how to use an array with it. + + +Things Fixed +------------ + +[RotBg] Fixed a bug in PA_Set/GetRotBgTile + +[APIButtons] Fixed API Button example, the text wasn't set correctly + +[16c] Was using twice as much memory as needed :s + +[DSMotion] I had forgotten to update some of the DS Motion examples... + + + + + +------------------------------------ +PAlib 070206 : devkitPro r20 version +------------------------------------ + +New Stuff +--------- + +[Sound] Added PA_SetSoundChannelVol(channel, volume) to change the sound's playing volume... Added SoundChannelVolume as an example to show how it works + +[Sound] Added PA_SetSoundVol(Volume) to change the global volume level, and the example to go with it... + +[SpriteTouch] Added PA_SpriteStylusOver, similar to SpriteTouched, but which doesn't check if the stylus is held or not... Can therefore be used with Stylus.Released :) + +[DualBg] Added DualEasyBg functions, and an example to go with it : DualBackgrounds/EasyBg + +[8bit] Added PA_InitBig8bitBg(u8 screen, u8 bg_priority) : Same as PA_Init8bitBg, but with an available size of 256x256. Takes up a little more space but allows correct vertical scrolling... + +[SpriteSys] PA_ResetSpriteSysScreen(screen) added, to reset the sprite system only for a given screen. Highly untested, might give unwanted results, especially for running animations, please report any bug :) + +[PAFS_Bg] Added void PA_FSBgNameLoad(u8 screen, u8 bg_number, char* bg_name) to load a background by inputting it's name (should be easier :) ), and the example to go with it... + +[BgPixel] Added PA_EasyBgGetPixel(screen, bg_number, x, y) (to get the palette color number) and PA_EasyBgGetPixelCol (same thing but returns the u16 color). Added 3 examples to go with it (tested with normal backgrounds, largemaps and infinite tile backgrounds...). Scrolling is of course taken into account ;) + +[Platform] Added Platform4 example, which changes the collision system to use PA_EasyBgGetPixel, and can now manage diagonal collisions :) + +[DSLite] Added PA_SetDSLBrightness(u8 level) to change the DS Lite light level (0-3) + +[SoundPan] Added PA_SetSoundChannelPan(channel, pan) to set the pan level (left-right, from 0 to 127) of a sound channel. It is reset to 64 after each sound played. Added an example to test it, works well :) + +[16cText] Added PA_16cLetterPos (.Letter[n].X/Y and .NLetters), which allows you to get the position of each letter outputted by the LAST 16cText... + +[Demos] Added a TypeWritter demo. It has a nice little cursor to add text anywhere in your string (not just at the end like the plain Keyboard example), and supports different text sizes, all this being done using the 16c Text system and the new PA_16cLetterPos structure + +[16c] Added PA_16cClearZone(u8 screen, s16 x1, s16 y1, s16 x2, s16 y2) to erase part of the screen + +[16c] Added 16cSprites example to show how to use the system to display 400 shots all over the screens ^^ + +[16c] Egon added a really nice 16c example on how to use sprite animations on a 16c background ! + +[16c] Egon added PA_16c8Xi(u8 screen, s16 x, s16 y, u32 *image,u8 i) :) + +[Text] The 'u' letter in 16c and 8bit texts, size 2, had an added pixel... I saw that the 'v' following it was missplaced by 1 pixel, it is now fixed :) + +[Gif2Frames] Added an app I made to decompose an animated gif into all the frames (in a single gif file) + +[Fat] Added latest snapshot of libfat and PA_IO.c/h + +[Fat] Added PA_InitFat() to initialise any disk devices found, returns true if found. + +[Fat] Added PA_GetFileSize(FILE* pFile) to return a long of the file size + +[Fat] Added PA_ReadTextFile(char* pathname) to return the contents of a file to a char*. Added PA_WriteTextFile(char* pathname, char* text) to Write the contents of "text" to "pathname" returns the Number of bytes Written + +[Palettes] Added PA_LoadSprite16cPal(screen, n_palette, palette) and a 16colors sprite example + +[Demo] Platform examples 4 and 5 added to the examples/demo section, code updated to match the latest version :) + +[RotMaps] Added PA_SetRotMapTile(u8 screen, u8 bg_select, s16 x, s16 y, u8 tile_number) and PA_GetRotMapTile(u8 screen, u8 bg_select, s16 x, s16 y), using gmiller's code... + +[CustomFonts] Added PA_16cCustomFont(slot, fontname) and PA_8bitCustomFont(slot, fontname) and the examples to go with it... Wiki will be updated soon with the instructions. Requires the latest PAGfx version... PAGfx has been updated too, to do the conversion... + +[DSMotion] Official DSMotion code added !!! Check the Input examples to see how it works (init/getting the data). Has 2 different ways of playing with it : either get the raw values and use that, or transform the data into Pad.Held.Up/etc data :) + +[DSMotion] Added MotionDraw, a simple demo... + +[Keyboard] Added PA_InitCustomKeyboard(bg_number, keyb_custom) to load custom keyboards (use instead of PA_InitKeyboard), and the example to go with it... Custom keyboards are 256 colors and should be converted as EasyBg... + +[DSMotion] Added MotionDraw2... + +[DSMotion] Added Angle and Force variables. Made a quick MotionTurn example to see how to use them + +[Compo] Added CompoSplash demo to show the DS Dev Compo Splash screen... Also contains a custom logo for the DS Compo, if you feel like it + +[SpriteTouch] Added PA_Sprite16cTouchedPix + +[16bitSprites] Added PA_Set16bitSpriteAlpha and the example to go with it + + +Updated Stuff +------------- + +[PAFS] Added PA_FSGetFolder(char *name), to get a folder number from its name... Returns -1 if not found + +[Sound] SoundBusy doesn't flush the cache all the time anymore + +[PAGfx] Better total time output (useless, but I don't care ^^). Removed the Palette generation purcentage, it always takes less than a second now :p + +[PAGfx] Completely new tile detection code, should be MUCH faster when converting very big/complex backgrounds... + +[PAGfx] Found on the net a different method to read images, which is 10 times faster, I'm pretty sure you'll be amazed by how fast it converts backgrounds now ^^. Works for very large sprites too + +[Video] Video system moved to use PAFS. GBFS code removed. Example modified... + +[Sprites] Updated all the outdated sprite examples + +[PAFS] Name length passed to 64 characters. You'll need to use the latest PAFS.exe with the latest PAlib... (PAlib/Tools/PAFS) + +[PAGfx] Much better purcentage output (took into account the fact that it slowed down over time) and shows expected time left. + +[Arm7] Code cleaning... and again, and again ^^ + +[Fat] Updated Fat Example to use new driver/code + +[Sound] Automatically calls PA_InitSteamSound() when a streaming sound is played + +[PAFS] Paco updated PAFS, should work better with FAT32 partitions :) + +[Gif] Gif files up to 2048 pixels wide will work now + +[MAKEFILE] MAJOR Makefile update, now pads the data files to 32bit, BIG THANKS TO GANDRAN !!! Should solve all the multiple sound inclusion problems/corruption... Please update your project makefile with any PAlibExample or PAlibTemplate makefile... + +[Sound] Sound code rewritten, you can now play several sounds per frame. The old sound system is present, it switches automatically to use if you call the Stream commands... You can also, in the same frame, stop a sound channel and launch a sound on that channel :) + +[Gif] Added PA_LoadGifXY, to load gifs to a specific part of the screen :). Updated the gif examples to work with it... + +[GetSpritePixel] Added PA_GetSprite16cPixel, for 16 color sprites, and an example to go with it... + +[Makefile] Makefiles updated, please copy one of the example/template makefiles and paste in your project. Includes the sound padding correction and includes the libwifi + +[DSMotion] Now uses an average, jitters less + +[Text] PAlib text output c files changed, saves up to 10KB/rom :) + +[Stylus] Updated code to the newer more reliable code :) + +[16bitSprites] Changed display settings, now uses less memory, requires latest PAGfx to work + +[3D] DEPRICATED + +[Vham] Added Compile + Launch in No$GBA, with F6. No$GBA isn't installed with PAlib, you must have a copy in c:\devkitPro\no$gba + +[Logo] Updated PAlib logo and wifi logo + + +Things Fixed +------------ + +[PAGfx] 256 pixel wide backgrounds were rounded up to 512, this is fixed + +[Video] Fixed the video system + +[EasyBg] Fixed Tile flip bug when loading an EasyBg with more than 1008 tiles, not sure why it was still there :) + +[Sound] Sound no longer stops when turning screens off or setting the led to blink mode... + +[Microphone] Recoded the whole microphone, now works, though it's ugly...PA_MicGetVol(), PA_MicStartRecording(u8 *Buffer, s32 Length), PA_MicReplay(u8 PA_Channel, u8 *Buffer, s32 Length). See the new example ;) + +[DualSprites] Should work better with big sprites. Added a DualSprite example + +[MoveSpritePix] Fixed the bug where the sprite couldn't be moved if partly off-screen... Might not work well with 64x64 sprites that are too much offscreen though, sorry, but that reaches the DS's X/Y corrdinate limits ^^ + +[GifToTiles] Had a huge typo, width instead of height :s + +[PAFS] Paco found a bug that prevented from using other directories than Files... + +[SpritePrio] There was a typo : PA_SetSPriteExtPrio instead of PA_SetSpriteExtPrio... + +[PAGfx] No longer hangs when loading non-8pixel-padded backgrounds + +[Warnings] Fixed the FD_SETSIZE warnings + +[TextColors] TEXT_BLUE and TEXT_GREEN were inverted + +[Reco] Fixed upper screen mess-up when using the recognition system + +[SpriteAnims] Fixed first frame not showing when starting a new animation... + +[PAFSBg] Fixed PAFS Bg loading + +[PAGfx] No longer hangs if you have non-8 pixel multiple sprites. Automatically resizes it + +[Error] Fixed compilation error on projects with multiple cpp files + +[8bitText] Fixed 3 8bit text bugs + + + + +PAlib 060917 : Biggest update ever ^^ + +New Stuff +--------- + +[Tiles] New infinite tile system. Both PAlib and PAGfx have been updated to achieve this. PAGfx now has an InfiniteMap command to convert backgrounds with more than 1008 tiles... Check out the Backgrounds/InfiniteTiles example to see how it works. Example used has 1790 tiles... + +[Gif] Added new gif animation commands : PA_GifSetStartFrame(StartFrame), PA_GifSetEndFrame(EndFrame) and PA_GifGetFrame(). Also moved the examples to a separate Gif example folder. GifAnim2 uses these new commands :) + +[Gif Sprite] Added a function to convert gif files into tiles... This can be used to create sprites from a gif file ! PA_GifToTiles(gif, palette). Check the Gif/GifSprite example to see how to correctly use it... Good points : takes much less memory, no need for conversions ! Bad points : takes more RAM if you do not free your pointer after use... And is way much slower... + +[BG Prio] Added PA_SetBgPrioSeq(u8 screen, u8 priority0, u8 priority1, u8 priority2, u8 priority3), to set the backgrounds in a certain order. 100% not my code, not my idea, I just copy/pasted it ^^ Thanks to sumiguchi for that one + +[SpeedTest] Added a series of macros to test the speed of several functions and see which one is the best speed-wise... Check Math/SpeedTest example to see how it works, it's not very intuitive :/ + +[PAGfx] New exports .bin files in the /bin folder ! To use .bin files instead of .c, simply copy the .bin files into the 'data' directory (create it in the main folder if not there), and include all_gfx.h, but NOT all_gfx.c... This will include the .bin instead of the .c files... Changes have been made both in PAGfx and PAlib to allow further evolution... Because of this, backgrounds converted with this version of PAGfx CANNOT work with older PAlib versions, and files converted with older PAGfx version CANNOT work with this version of PAlib... Sorry :/ + +[PAGfx/PAlib] Added a new mode in PAGfx : EasyBg... This will automatically select the best mode for the background (between TiledBg, LargeMap, and InifiniteMap). A new set of commands has been created in PAlib to avoid thinking about it : PA_EasyBgLoad(screen, bg_number, bg_name), PA_EasyBgScrollXY(screen, bg_number, xscroll, yscroll)... (ScrollX and ScrollY also available). Editted the examples (not all) to reflect this new stuff. The wiki will be simplified soon as you don't have to think about what type of background you want now (the seperate explanations will be left in an 'advanced tutorial'). + +[PAFS Backgrounds] Added PAFS/PAFS_Bg to see how to load backgrounds from PAFS ! You have to give it the number of the first background file (name_Info), and put all the .bin files in PAFS... => PA_FSBgLoad(screen, bg_number, filenumber) + +[PAFS Sprites] Added PAFS/PAFS_Sprite to see how to load sprites from PAFS... + +[3d+Sprites] Sprites will now work on the 3d screen :D. Just run PA_Init(), and then PA_Init3D(); Added 3d+Sprites example to go with this... Untested on real DS :/ + +[3d+Backgrounds] Backgrounds can now be used instead of sprites on the same screen as the 3d ! Just run PA_Init, and then PA_Init3DAndBg()... You cannot have both Backgrounds and Sprites when using 3d, sorry ! Important note : Background 0 is NOT AVAILABLE when using 3d, trying to use it will result in wrong display... Added 3d+Bg example to go with this... Untested on real DS :/ + +[FPS Counter] Added an FPS counter : PA_RTC.FPS... Yup, that simple, nothing more to do ^^ Check out the Other/FPSCounter example to see it running. It has a simple stress code to be sure the DS won't work at 60FPS, and you can actually change the amount of stress to see the FPS change... + +[SoundBusy] Added 2 functions : PA_SoundChannelIsBusy(channel) returns 1 if busy, 0 if free. PA_GetFreeSoundChannel() returns the first available sound channel, -1 if none free. + +[StopSound] Checked, it worked... Added an example using it :) + +[LidSounds] Added PA_CloseLidSound(channel, close_sound) and PA_CloseLidSound2(channel, close_sound, open_sound), allowing you to play goodbye and welcome sounds when the lid is closed/opened ! Go see the Other/CloseLidSound example, sounds great :p Big thanks to Timonator for the idea... + +[PAGfx] Added JustPal command for sprites, to extract the palette + + +Updated Stuff +------------- + +[Examples] Started cleaning up the examples, especially the images, should save a few Mb... + +[Examples] Added 16cText2 and 8bitText2, using stdio to output the date and time :) + +[Examples] Cleaned the examples... Please delete your PAlib and PAlibExamples folder before updating... Should save some size in the zip and installer, (500-1000kB) + +[Examples] Added BinFiles in Background and Sprites to see how it works + +[Sound] On by default + +[Sound] El Hobito added PA_StopSound(u8 PA_Channel); + +[8/16bit Modes] Saved up to 50ko/file when using these modes (Giflib was included by default :s), saved 3ko/file for other .nds files + +[PAGfx] Now displays % progression when converting big backgrounds, and total conversion time at the end + +[PAGfx] Quick fix, background could be corrupted on some small background sizes + +[Palettes] Added PA_Load8bitBgPal(u8 screen, void *Pal) to load palettes for the 8bit backgrounds :) + +[GBFS Sound] Removed the main GBFS sound function, should win a few kB in the rom + +[GBFS] Removed the GBFS examples + +[Installer] Added German language + +[Wifilib] Now uses libnds's wifilib + + +Things Fixed +------------ + +[Linux] Corrected a typo in the makefile which prevented it from working on Linux + +[PAFS] Found and fixed a major bug in PAFS. Now should work correctly (it screwed up the file positions when a file was had a size of 4*n - 1 ^^ + +[PAFS] No longuer includes the files from the hidden .svn directory, sorry for that one ^^ + +[InfiniteTiles] Fixed all the errors you could have when compiling + +[Doc] Fixed a few minor errors, thanks for reporting them :) + +[RotBg] Mastertop found a compilation error, thanks :) + +[Compilation] Rockard found yet another bug, thanks ^^ + + + + +PAlib 060905 Fixes :) + +New Stuff +--------- + +[Compilation] No longer requires install.bat :) + +[VBL] Added a custom function code in the VBL : PA_VBLFunctionInit(your function) will execute, each and every frame, a given function... This can be used to make counters or have critical codes run at full speed when you're low on CPU time. Be aware that too CPU-expensive functions might slow down your program or hang the DS if run from the VBL !!! PA_VBLFunctionReset() can be used to stop the custom function. An example was added (Other/VBLFunction) + +[2D/3D] Seperated the 2D init (still done by default in PA_Init). You can now use PA_Init2D to return to 2D mode after using 3D functions :) + +[Gif] Gif speed now works, only tested on emu for now. Thanks to Shaun for the solution :D Removed PA_SetGifSpeed :p + +[Gif] New commands available to change the gif speed while playing and pause it ! PA_GifAnimSpeed(float speed), PA_GifAnimStop, PA_GifAnimPause, and PA_GifAnimPlay. Check out the GifAnim example :) + +[Demos] Added the Bunny demo to the demo folder. It shows how to use sprite frames and pixel-perfect stylus collision to create stupid minigames ^^ + + +Updated Stuff +------------- + +[Stylus] Now includes Stylus.Downtime and Uptime, to know how long the stylus was held on the screen or off of it (check Input/Stylus2 example to see that in action) + +[Stylus] Added Stylus.DblClick, may need more testing though, also in Stylus2 example + +[DeSmuME] Reverted back to the old version, this one had 'Hickups' :s + +[Giflib] Changed its compilation, saves 4kb ^^ + +[Doc] Updated the doc + + +Things Fixed +------------ + +[Compilation] Fixed the 5 last warnings :) + +[Examples] FAT example back, thanks Creebo ^^ + +[PAGfx] Better declarations in all_gfx.h and .c, with #ifndef and CPP compatible stuff :) + +[PAGfx] Now works correctly when you don't precise the Sprite/Bg mode (256colors, etc...) Will take the most common mode by default :) (fixes PAGfx.exe errors and PAGfx Frontend import function + +[Draw] Draw functions fixed, thanks to PadrinatoR :) + + + + + + + + +PAlib 060902 Small features update + +New stuff +--------- + +[Gif] Just couldn't seem to find the option that determines the gif's speed in giflib :/ I added a counter for animation speed, you can set it manually : PA_SetGifSpeed(number of VBLs to wait). 60 VBLs = 1 second between 2 frames. Example available in Bitmap/GifSpeed + +[Counters] Added 16 possible VBL Counters : PA_VBLCounterStart(ncounter) to reset and start one, PA_VBLCounter[ncounter] to get its current value. Added an example (Other/Counters) to show it works and to extract seconds from that. Also available : Pause and Unpause :) + +[RotBg] Added PA_SetRotMapTile(u8 screen, u8 bg_select, s16 x, s16 y, u8 tile_number), thanks to spinal and gmiller ! Modified the code to work with all background sizes, and added an example (Backgrounds/RotBgTile). Only tested on emulator, will need more tests :) + +[Splash] Added PA_SplashEyes() to load the PAlib splash screen with eyes following you ! More splash screens to come when available. Example found in Splash/SplashEyes + +[Splash] Added PA_SplashBlue() to load up a Splash Screen based on the forum's logo ! More splash screens to come when available. Example found in Splash/SplashBlue + +[PAFS] Added PA_LoadFSImage(u8 screen, s16 FSImage) to load Images (jpeg, gif, or bmp format) from PAFS just by giving the file's PAFS number (no need to know which image format it is !). Added PAFS/PAFS_Image as example to go with it :) + +[Pad] Added Pad.Newpress.Anykey, (Held and Released too). Modified the basic Pad example to include that in. Seems to work, please confirm if you have any bug/error (should report any key, but not the stylus) + + +Things Fixed +------------ + +[PAGfx] Benualdo correct a bug when exporting 8bit backgrounds, thanks :) + +[Examples] Removed some examples that were there twice :s + +[Example Fix] Fixed the 3d texture compilation error, not sure if it works though, couldn't test + +[Examples] Removed GBFS Gif and Bmp examples (GBFS will be depricated soon), added PAFS examples instead + + + +PAlib 060831 Official Revival Update + +[Text] Added TEXT_WHITE, TEXT_RED, etc... macros, thanks to Penjuin. Also updated the TextColors example to show that (using yellow) + +[Bugfix] Fixed PA_SetBgColor, thanks to franck569 :) + +[Bugfix] PA_ResetBgSys should now leave all screens black, untested though :) + +[Bugfix] You can now get the user's name even if he hasn't entered a message ^^ Thanks to PadrinatoR for that one ! + +[Bugfix ?] A typo, seen by PadrinatoR (again !) was found in the stylus arm7 code. I corrected it, and have no idea what it will change ! If you have any problem with the stylus on this version, please report so that we can revert back to a functionnal stylus code. + +[Bugfix] Corrected GBFSInit and migrated to solid function instead of extern inline. Untested, report if problem found... (should we just remove GBFS support and turn towards PAFS, or is everyone still using GBFS or neither one of them ?) + +[Bugfix] Corrected a bug in PA_WaitFor ^^ + + + +PAlib 060830 Revival Update + +[General] Updated my computer to latest devkitPro :) + +[Warnings] Fixed most warnings, 5 more left + +[C++] Warnings fixed + +[Vham] Updated to 2.6, "New Project" now works correctly, thanks for the help ;) + +[16c] Put the 16colors text example back in + +[Feature] Added PA_WaitFor(something), check the example (Examples/Other) to see how it work : PA_WaitFor(Pad.Newpress.A), etc... + +[PAGfx] Updated to version 0.8, which was on my hard drive since... March ! I have no idea how good/bad it works actually, can't remember if it was fully functionnal or not :/ + + + +PAlib 060304 MAJOR UPDATE + +[PAlib] Changed the compilation to do some real stuff... Now only includes what you use ! A simple demo can be as small as 60kB ! + +[TextBox] Removed the "1" that was drawn on the bottom screen + +[Examples] Tested all of them to check that they compiled and worked with the latest version. Made a general cleanup, so please delete PAlibExamples directory before reinstalling... + Broken : 16cText, 3D examples using PAlogo (??), Video + + + +PAlib 060304 MAJOR BUGFIX + +[Interrupts] Switched to libnds's interrupt handler. Seems to correct some bugs. Superstar's demo seems to work fine with the new system, so I hope this solves lots of C++ problems :S. Corrected 2 other big projects, so it seems like this could be the most stable release up to now ! It probably broke (very temporarily jialing' streaming system (uses TIMERS), we'll just have to switch the code to libnds's timer system, which shouldn't be long, but I ran out of time today :/ + +[Arm7] Some unwanted test code slipped in the previous version, could cause some major bugs + +[16 color Bg] Added a fake 'bitmap' 16 color background system. It's very usefull to draw SHMUP bullets on it (>600 8x8 bullets from what I tested) + +[Text Sizes] Added a new text system for 16color backgrounds. Works like the 8bit text (5 different sizes) but is much much faster, and takes much less memory (both in VRAM and in ROM) -> 45k in rom, and around 30k in VRAM (compared to <200k in rom and 49 in vram for 8bit text). Added an example to go with it + +[BoxText] Fixed an evil bug that prevented the boxtext from stopping, thanks too Scognito ! + +[Sprite Priorities] Fixed + +[FAT Driver] Chishm updated his FAT driver : +2006-03-03 + * Improved NMMC (MK2 / MK3) driver + * Optimised LFNs into loops, thanks to dwedit + * Optimised SuperCard SD CFC7, thanks to Cory1492 + * Added file attribute support + * Added read only M3 SD support, thanks to SaTa and Moonlight. Disabled by default due to incompleteness + * Fixed SuperCard SD reading, thanks to Loopy + * Added EFA2 support, thanks to CyteX + +[Version number] Changed the version numbers, I didn't feel like getting to a 1.0 milestone ^^ + + + +PAlib 0.998d + +[Sound] Fixed :S + +[PAGfx] Updated to add 'const' where it was missing... (thanks Jandujar !) + +[PAGfx] Removed the #ifndef from all_gfx.h, you can now include it correclty in multiple files + +[PAGfx] Shorter lines on error messages + +[PAGfx] 2 bug corrections preventing from working if a file wasn't found + +[PAGC Frontend] Corrected error when first moving from sprites to backgrounds view + +[Sprite Ext Prio] Fixed order when 2 sprites had the same priority level + +[Text] Fixed the '-' not showing for values from 0 to -1 + +[Text] Fixed the decimal values with negative numbers (thanks to Jandujar !) + + + +PAlib 0.998c + +[Examples] Fixed the keyboard example, had SimpleText instead of Text function, so the line break didn't work :S + +[Examples] Added Sprite/Priorities2, which shows how the priority system could be used to create a card game, or an isometric 3D system... + +[Screen Lights] Rewrote the code, shouldn't break the sound anymore + +[Arm7] Switched to libnds's IRQ system, now works better on MK2/3 + +[PA3D] Compiles again, sorry ! + +[Backgrounds] Optimised the Background memory error messages + +[Palettes] Added PA_SetSpritePalCol + +[C++] Fixed the Pad/Stylus problem (replacing bool by u8, I don't like that...) + + + +PAlib 0.998b + +[Sprites] Fixed sprites on hardware :/ + +[Vham IDE] Updated to remove the ofile bug when adding files :) Thanks to Kleevah ! + + +PAlib 0.998a + +[PAGfx] Updated 16colors sprites not working + +[PAGfx] Updated broken 512x512 TiledBg, now works correctly + +[16bit Sprite] Added a Create16bitSpriteFromGfx function + +[SpriteAnims] Added PA_SetSpriteNCycles(bool screen, u8 sprite, s16 NCycles) and PA_GetSpriteNCycles(bool screen, u8 sprite) + +[Doc] Updated some missing function infos + +[Palettes] PA_CreatePalBright added, to create new palette with different brightness level. ChecK Sprite/PalBrightness to see how to use it (can be used on backgrounds too) + +[Sprite Priorities] Added advanced sprite priorities, with 256 possible levels ! Check the Sprite/Priorities example to see how it works (requires an init). Beware, this is much slower than the normal priority system, as it requires sorting the sprites... + +[LargeMaps] Fixed scrolling bug when background was larger than 256 pixels, but smaller than 512 (thanks Mtom !), and a nice speed increase (up to twice as fast) on large maps (>512) + +[Sprite Animations] Fixed a little bug in the frame number when using UPDOWN, thanks to Costello + +[FAT Driver] Included Chishm's FAT Driver, with M3, SC, and MK2/3 support ! I take NO credit whatsoever for this. ALL the credit goes to Chishm and the people who helped him make this driver better... If you have any questions/bugs, please report them on palib.com, and do not bug Chishm... The driver takes around 25k, and can be removed by editing PA_Config.h. Please take the time to read the gba_nds_fat.txt file included with the driver... I haven't played with it too much yet, just tested listing the files on my MK3... (FAT/FAT example). I also update the Vham Init to take into account the FAT_ functions. + +[DeSmuME] Updated + +[Makefile] Updated with jandujar's bin2o fix. Does this make the sound work better for anyone ?? + + +PAlib 0.997a + +[Doc] Updated + +[DeSmuME] Updated, perfect backgrounds and nice sprites !! Forget about dualis ;) + +[PAGfx] Sprite optimisation and 16bit fixes + +[SpecialFx] Fixed a rare compilation error + +[Vham IDE] Removed Dualis support... I tested the latest version and it still doesn't work with my Bg+Sprite tester it seems... + +[Linux] NDS/nds fixes... again... thanks Gooler... /me hangs himself + +[Linux] Added Gooler's compilation script + +[Supercard] Added Akuma's makefile to compile a .sc.nds for supercard users, thanks ! + +[DualSprites] Added all the animation functions + +[SpriteTouched] Speed optimisation + +[SpriteTouchedPix] New function, similar to SpriteTouched, but with pixel precision ! Require InitSpriteDraw prior to usage, and is MUCH slower than the normal SpriteTouched function (as you could guess) + +[MoveSpritePix] New MoveSprite function, which requires InitSpriteDraw (like TouchedPix), but has pixel-perfect detection, and does not center the sprite on the stylus + +[Stylus] Slightly better coordinates (I hope, tried to remove eronous values), and added Stylus.Vx and Stylus.Vy ! + + + +PAlib 0.996a + +[Backgrounds] Added PA_ClearBg(screen, bg) and extern inline void PA_ClearTextBg(screen) to clear a given background map + +[ResetBgSys] Now resets the video mode, fixes some rare issues + +[Mode7] Added PA_DeInitMode7, when your finished using it, lol + +[Examples] Updated the Mode7 examples to upgrade to PAGfx functions + +[LargeMap] Fixed bug when loading not-so-large maps, lol + +[SpriteTouched] Added the Stylus.Held check in it because everyone seems to want it, lol + +[Linux] Some compilation errors fixed, thanks to Gooler... I hope it works now ! + +[Animations] Extended the sprite animation system, check out SpriteAnim3 and the wiki ! + + + +PAlib 0.995b + +[C++] Fixed a compilation error + +[RotBg] Fixed the rotating backgrounds not showing, was a palette bug (they don't use extended palettes like the others...) + +[Reco] Added infos to the shape reco : PA_RecoInfo;.Length, minX, minY, maxX, maxY, startX, startY, endX, endY, Angle and an example to go with it. Updated the wiki... + + +PAlib 0.995a + +[Shape Recognition] Beta testing a shape recognition system ! Added 2 examples in the input folder and updated the wiki... + +[Random] New Random Init function, should give better results + +[PAGfx] Corrected the Green color bug + +[Doc] Added text and recognition stuff + + +PAlib 0.99b + +[MoveSprite] Vx and Vy values fixed on DS (worked on emulator but not on DS for some reason) + +[LargeMap] Fixed a palette bug on background 1 + +[SpriteAnim] Fixed a nasty bug in the sprite gfx updating if you had too many sprites, it would update the wrong one + +[DeleteSprite] Fixed a bug in DeleteSprite, should work better now + +[SpriteDraw] Completely rewrote the draw routines and init. You can init all onscreen sprites with PA_InitAllSpriteDraw(), and you can draw with PA_SetSpritePixel(bool screen, u8 sprite, u8 x, u8 y, u8 color). Only supports 256 colors for now. Check the example given for more details + +[Emus] Added DeSmuME, by Yopyop :p + +[Vham IDE] Added Launch (+/- Build) in Dualis or DeSmuME (which will soon work better than Dualis... :p) + +[Jialing Sound] Updated to work with PAFS + +[Libnds] Updated stylus code, please update libnds to the latest version to avoid false values + + +PAlib 0.99a + +[Vham] New IDE included, still in beta test ! Now using Vham ! I take NO credit for this, all the credit goes to Peter from http://console-dev.de/ for doing this nive IDE + +[Sound] New sound system, by JiaLing ! + +[Linux] Forgot one of the changes, corrected thanks to Morian + +[C++] Corrected the compilation errors + +[PAGfx] Updated to correct errors in PAGfx and the frontend + +[Gif] Gif repaired, not sure why it didn't work though :/ + +[TextColors] Added a black color (number 9) + +[TextBox] Fixed the "\n " bug and and colors, everything works now + +[TextBox] New simplified textbox functions with borders and all ! Check out the 2 new examples + +[Text] Added a custom font loading example + +[8bit] Fixed an 8bit pixel plotting bug, not sure when it actually got there + +[Video] Corrected C++ compilation errors + + +PAlib 0.78b + +[Video] Works again... + + +PAlib 0.78a + +[Gif] Fixed a few bugs with 8bit gifs + +[Bug] Fixed a few stuff for linux compatibility, not sure I got everything though + +[Examples] Added a simple gif example, as well as a 2048x2048 map in the largemap example + +[Examples] Added a Sin and Cos Trajectory example + +[Text Colors] Added %cn as text color trigger in functions OutputText and BoxText... n is the color number (0-7)... Check out the textcolors example to see how to use it... (I just updated it) + +[MoveSprite] Optimized PA_MoveSprite code (1 function instead of 2 ! :p) and now works even if isprite is partly out of screen + +[Sound] Corrected sound (player too fast depending on the function used to play it !) + +[Demos] Added tons of new demos (and removed the original Frisbee one, replaced by a new one) with their comments on the wiki (day 12 and day 13). These demos show how to use the stylus at best, and treat about collisions... + +[PAFS] Corrected the bug when the filename wasn't PAFS.ds.gba and you still wanted to use the /silence command... Added the possibility to put /silent instead + +[PAGfx] Kleevah updated PAGfx and the Frontend, to solve some issues, add an icon, and have a better about box... + +[Doc] Updated + + +PAlib 0.77a : Christmas Release + +[Bugfix] MAJOR bugfix for the text, appeared screwed up on the top screen sometimes on DS (not on emulator), now fixed + +[PA_Config] Added a 3Ddefinition to PA_COnfig.h, saves 60k when you remove it ! I might turn the 3d off by default for now on... + +[PA_Config] Added a keyboard definition to PA_COnfig.h, saves 20k when you remove it, but it will stay on by default in PAlib + +[Bugfix] A stylus bug had slipped in when getting at the bottom of the screen ! now fixed thanks to Morian (DS only bug) + +[PAFS] Major Bugfix, now should work both in Ram AND Rom... (it used to work only depending on the number of files for some reason) + +[PAFS] Removed the press key to exit if you add a '/silence' after the path, puts a log instead, and replaced the old buggy PAFS.exe in all examples but the ram one, had forgotten those ! + +[PAGfx] Corrected the frontend, which had TiledBg instead of TileBg... minor bugfixes to both the converter and the frontend + +[Text] Added #define TEXT_ALLCHARACTERS to the config file : Replaces the normal default text by a similar one which has pretty much all the special characters... thanks to Morian for that one ! But it takes twice as much memory in video ram, so you can choose which one to include... Will be on by default in PAlib updates... Also updated the small font with a few more characters (like € and others) + +[Palettes] Added PA_SetBgPalNCol(bool screen, u8 bg_number, u8 pal_number, u8 color_number, u16 color); (usefull for the 8bit backgrounds... haven't updated the examples yet though) + +[Malloc] Added PA_Malloc(void **pointeur, u32 size) for safe malloc... (checks if exists, and if it does, frees before doing the malloc. Thanks Brunni ! + + +PAlib 0.76a : + +[PAFS Feature] Started to test some PAFS in ram... this should make it work in emulators and WMB, but is still a work in progress... it works well on one example, but seems to fail on another one, not sure why... Check out the PAFS_Ram example to see how to use it... + +[Text Feature] PA_SetTextTileCol(screen, color) is out ! What is it ? It changes the color of the next texts to come... this means you can start writing in white, tell that the rest will be in blue, and have both colors on the screen !!! For now, there are only predefined colors, and color is a number form 0 to 6... Check the TextColors example... + +[Minor Fix] Fixed a C++ compilation warning + + +PAlib 0.75a : + +[Bugfix] Text colors now work (emulator+DS) + +[Feature fix] Added PA_InitCustomText(screen, bg_select, text) to replace the custom text functions... Text must be converted using PAGfx as TileBg... (the loading function works like LoadTiledBg) + +[Feature] Much Lighter roms (lost like 100k) by removing the neoflash and palib splash screens... Moreover, they were added by default (they shouldn't have been). I'll replace them later on with jpegs, which will be way lighter... + +[PAFS] Updated PAFS to add 32bit padding to files, should solve some problems. Added mod and sound playing functions and the corresponding example... Will use all that to do the filesystem tutorial on the wiki... + +[Examples] Added the gravity example + + + +PAlib 0.74d : + +[Bugfix] Fixed the background rotations ! + +[Feature] Updated the rotating backgrounds to work easily with PAGfx -> PA_LoadPAGfxRotBg(screen, background number, bg name, wraparound (0-1)) + + +PAlib 0.74c : + +[Animations] Added PA_SetSpriteAnimFrame(screen, sprite, frame) and Added PA_SetSpriteAnimSpeed(screen, sprite, speed) + +[Bugfix] Fixed the stylus position error... + +[MODIFICATION] Changed PA_PlaySimpleSound(channel, sound), doesn't require '(void*)' and the size anymore ! Changed the example to reflect this... + + +PAlib 0.74b : + +[libnds] Updated to work on the latest libnds update + +[Bugfix] Better Sprite Animation code when rapidly changing animation sets + +[Examples] Added a nice SpriteAnim2 (using animations, sprite movement, and sprite flipping), and an AlphaBlending example for 1 sprite... + +[Doc] Updated the doc + + +PAlib 0.74a : + +[Feature] Added the new sprite animation code ! Check out the example to see how to use +PA_StartSpriteAnim(bool screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed (in fps)), PA_StopSpriteAnim(bool screen, u8 sprite), PA_GetSpriteAnimFrame(bool screen, u8 sprite), PA_SpriteAnimPause(bool screen, u8 sprite, bool pause) + +[Bugfix] The Text was still broken on hardware, in fact !!! Now it works better... andThis is a temporary fix, which removes custom fonts + +[Bugfix] Added the semicolon to PA_Save16bit (yes !) + +[Examples] Reworte part of some examples to remove french text and organize them better, added a few examples to go with the wiki... + + +PAlib 0.73b : + +[Bugfix] I think I broke the text functions in .73a, with the extended palettes... this is now fixed + + +PAlib 0.73a : + +[Change] Extended Palettes now used by default for backgrounds (load them with PA_LoadBgPal(screen, bg_number, pal)). The old PA_LoadPal is left for backwards compatibility but should not be used anymore + +[PAGfx Update] Integrates better with PAlib Background functions + +[Feature] MAJOR update for the background system, has been greatly simplified with PAGfx ! I recommend everyone to go check the simple LoadBgs example to see how it now works. In order to have correct palette names, please do not input palette names for the backgrounds... PA_LoadTiledBg and PA_LoadPAGfxLargeBg(screen, bg_number, bg_name)... + +[Feature] Added 2 random functions (PA_RandMax and PA_RandMinMax), thanks to SuperStar + + + +PAlib 0.72a : + +[Feature] Delfare updated the 3d code with some call list functions ! Check the examples :) + +[Bugfix] Compilation errors for linux users... again... And added a install.sh for them, too + +[Change] Now sets the extended sprites on by default, as it's just better... adapted PA_LoadPal to work with that, and renamed PA_LoadSpriteExtPal to PA_LoadSpritePal (left the ExtPal function for compatibility issues). Updated the sprite examples to take that into account... + + + +PAlib 0.71a : + +[PAlibTools] Updated PAGfxConverter to version 0.5. This is a MAJOR update, as it supports backgrounds, sprites, and has Kleevah's nice frontend :) + +[Examples] Updated all the examples to use PAGfxConverter instead of gfx2gba + +[BugFix] Fixed the PA FS Search function, thanks to Seddy :) + +[BugFix] Made the changes suggested by Gooler for compiling under linux, sorry for those ! + +[Bugfix] Corrected the CPPInstall.bat, should work again, sorry ! + +[Sourceforge] Removed the PAlib minimal and PAlib examples, please use only the complete packages now... + + +PAlib 0.70a : + +[Feature] Here comes the first version of PASpriteConverter !!! Beware, it needs the .Net FrameWork to work... +What so great about it ? Nothing much yet, but great things to come... +How does it work ? Check out the SpriteConverter example, it's really simple. +Why do I think it's better to use it rather than gfx2gba ? + - Because it handles all image formats (jpeg, bmp, png, etc...), and you don't necessarily need to convert your sprite to a 256 paletted sprite... Though if you have too many colors, it'll fail... + - You can easily set which color you want as background (Black, White, Green, or Fuschia) + +[Feature] PA File System now available !!! What's so great about it ? It's easier to use than GBFS, and takes much less space in Ram (actually, 0, everything goes in the Rom :p), and it supports directories structures !! Currently, only made the PAFS plain example, I'll add the folder example soon, and then convert all the GBFS functions to it. The search functions are already available... PAFS requires the .Net framework in order to work correctly. If you don't have it, either install it, or use GBFS... +I ended up adding the folder example today, to test if it worked, and saw I had a stupid bug, now everything's perfect :p Haven't converted all the functions yet, though. I'm sort of tired of working on this, so I'll continue next week, and tweak it to have the possibility to add the file system in RAM instead of ROM, for all those WMB users :-) + +[Feature] Got extended palettes for backgrounds working !! You can all thank Benny for this, he's the one who got me motivated to do it :p It took like 5-10 minutes to change the old code I had and make it work, should have done it ages ago !!! Anyways, expect PAlib to have Extended palettes for backgrounds and sprites by default very soon, just the time for me to change the basic palette loading functions... + +[Minor Feature] Added PA_SetBgColor(bool screen, u16 color), to set the background color... (thanks to SuperStar again :p), and PA_DualSetBgColor(u16 color), to set it to both screens + +[Minor Fix] Corrected the unerased character on some stylus examples, thanks to SuperStar + + +PAlib 0.67a : + +[Feature] Now works for C++ projects !!!! Added a CPPInstall.bat, which compiles PAlib to work with C++ projects... This hasn't been fully tested yet, but seems to work :-) By default, the lib compiles to C, so if you use C++, you'll have to recompile after install... + +[Feature] Added PA_SetScreenLight(screen, light), to set on/off one of the screens lights, and the example to go with it... + +[Feature] PA_GetGifHeight and PA_GetGifWidth added, pretty self-explanatory... + +[Feature] Mode7 comes in !! Not much yet, you can check the example, but more will come soon... I'll just have to... well... rewrite tons of that code :p So it'll take more time than I thought, but you can already play with this code a little... + +[Bugfix] Fixed the Rotations Background, I hadn't seen I had messed them up by putting 32bit registers instead of 16... + +[Update] Updated the 8bit Draw function, should be less buggy. The 8bit and 16 bit Draw functions should be even faster now, when used with big drawsizes + + + +PAlib 0.66a : + +[Feature] Added tons of Dual Sprite functions, but they are completely untested... (too many functions to test, sorry), and for palettes + +[Feature] Added PA_SetScreenSpace(space) to set the desired pixel space between the screens, for the dual functions. On emulator, 0 looks the best, but on DS I like to put 48 (which is the default value). + +[Update] Updated the keyboard with a modified version of Headspin's keyboard ! It looks pretty good like that :p If you want to modify the keyboard layout, or add some keys (I left some spaces empty), you can edit the keyboard.bmp file in PAlib/lib/arm9/PA, and post it on the forum, and I'll change it if I feel it's better... I also updated the keyboard code a little... + +[Feature] Added PA_SetKeyboardColor(color1, color2), which changes the keyboard's color. 0 for blue, 1 for red, 2 for green... Basically, color1 is for the unpressed keys, color2 for the pressed keys. Blue and red by default. Updated the keyboard example to take that into account, you can change the keyboard colors with A, B, X, and Y + +[Bugfix] Delfare corrected the installer, it now creates the correct environnement variable for everyone. By the way, uninstall is not available simply because it deletes the whole devkitPro folder... which is not quite what we want ! I'll change that to uninstall just the PAlib folder some time + + + +PAlib 0.65a : + +- Great new installer ! You can chose which components to install (examples, documentation...), and it creates an environnement variable (currently only for c:\devkitPro\PAlib, because NSIS doesn't do it just like I would like, so you'll have to modify the path if you install to another directory...) It uses solid LZMA compression, providing much smaller files than the zip files... +- Added a set of Dual functions -> easy Double screen support ! It's a WIP, so don't expect too much, but I started off with the backgrounds functions... So now, you can load, scroll, and do pretty much anything to a background directly on both screens, just like if there was just one big screen... I'll add support for custom space between the screen, bug corrections, and sprites in the next version. Doing a wrapper for each function just takes too much time right now ! +- Updated the version of gfx2gba used in the examples, shouldn't return a warning about extern thingy anymore... + + +PAlib 0.64e : + +- Delfare's update, with his installer +- Delfare's new text functions !! + + +PAlib 0.64d : + +- Fixed the compilation errors with the new libnds... + + +PAlib 0.64c : + +- Pathfinding Fixes + + + +PAlib 0.64b : + +- Fixed the compilation errors on cpp files... + + +PAlib 0.64a : + +- The documentation is back !! +- Fixed the compilation error some seemed to had (well, should be fixed, I hope...) +- Faster gif decompression +- Support for animated gifs on 16bit backgrounds +- Updated the example makefiles, and added the logos for multiboot and wifime +- Added PA_LoadGBFSImage, for easy loading of Gif, Jpeg, and Bmp from GBFS +- Added support for exporting Bmp's into buffers +- Fixed the problem with PA_SetSpriteAnim not working on sprite initialized with PA_CreateSpriteFromGfx... (untested, but should work) +- Switched the stylus code to the new libnds one... hope it's better for you ! + + +PAlib 0.63a : + +- Fixed the Draw functions to work with different drawing sizes +- Added a Line function with different sizes +- Added a Rectangle function +- Some screens were switched on G6 ! (don't ask me why)... This is fixed (basicly, double-checks the screen on init, and switches if it was wrong) +- Added support for BMP files ! See the GBFS example (but can be used without GBFS). Currently, only supports 16, 24, and 32 bit bmps, on a 16bit background, but paletted bitmaps are coming... +- Added support for GIF files ! Thanks Birslip, and thanks to Libungif... Currently, only did the example to load on a 16bit background, but the functions will be updated soon to work on 8 bit backgrounds (with auto-detection of 8/16bit). This might have made the PAlib size go up some more, but some of the files will be removed later on, and optimisations are still to be done speedwise (I have some ideas I haven't had time to put in place...) +- Changed the makefile a bit : + -> To easy change author/game name/website, just open the makefile and you'll see where to change... + -> To add support for gif/bmp files in the data folder +- Lots of bug fixes/enhancements + + +PAlib 0.62a : + +- Added a search for *.extension in PA GBFS system +- Changed the WaitForVBL again, it's even better now, and speeds up the demos on emulator +- Changed all the convert.bat files (gfx2gba...) to have the -align command in them, should fix some sprite problems +- Added 16 bit sprites ! With the example to go with it... Only thing : I discovered that 16 bit sprites need to be 128 pixels large... this means that any sprite size takes up a lot more memory than it takes in 256 or 16 color modes... example : an 8x8 pixel will take as much memory as a 128x8 one ! so 16 times more... +- Adding 16 bit sprites made me change a line or 2 in the sprite gfx system, apparently it works perfectly, but if you get anything weird, could be my fault... (half-sprites, or double-sprites) diff --git a/docs/ReadMe.txt b/docs/ReadMe.txt index bd6534a..ac6f91e 100644 --- a/docs/ReadMe.txt +++ b/docs/ReadMe.txt @@ -1,34 +1,34 @@ -PAlib documentation folder -========================== - -Instructions for normal users ------------------------------ - -This directory contains the PAlib documentation in two languages, -English and French. Just go to the subfolder of your choice to -pick a language. - -Each language subfolder has three versions of the documentation: - - PAlib.chm - The CHM version for use with Windows. - - PAlib.pdf - The printable PDF version. - - /html/ subfolder - The browsable HTML version. - -Instructions for developers ---------------------------- - -The folder dev contains tools/scripts to generate the documentation. -By default it's set up for a Windows system with PAlib installed in -the folder C:\devkitPro\PAlib, but you can adapt it by: - - - Changing the STRIP_FROM_PATH and the HHC_LOCATION variable. - - Disabling the .chm creation support (GENERATE_HTMLHELP = NO) - because it depends on a Windows executable. - -To generate the documentation you need the following installed: - - Doxygen - - MikTeX on Windows or pdfTeX on other OSes - -Just run the appropiate batch file on Windows or follow these steps: - - Run "doxygen Doxyfile_[Language]" where Language is the language - you want to generate the documentation for. - - Run make on the [Language]/latex folder. +PAlib documentation folder +========================== + +Instructions for normal users +----------------------------- + +This directory contains the PAlib documentation in two languages, +English and French. Just go to the subfolder of your choice to +pick a language. + +Each language subfolder has three versions of the documentation: + - PAlib.chm - The CHM version for use with Windows. + - PAlib.pdf - The printable PDF version. + - /html/ subfolder - The browsable HTML version. + +Instructions for developers +--------------------------- + +The folder dev contains tools/scripts to generate the documentation. +By default it's set up for a Windows system with PAlib installed in +the folder C:\devkitPro\PAlib, but you can adapt it by: + + - Changing the STRIP_FROM_PATH and the HHC_LOCATION variable. + - Disabling the .chm creation support (GENERATE_HTMLHELP = NO) + because it depends on a Windows executable. + +To generate the documentation you need the following installed: + - Doxygen + - MikTeX on Windows or pdfTeX on other OSes + +Just run the appropiate batch file on Windows or follow these steps: + - Run "doxygen Doxyfile_[Language]" where Language is the language + you want to generate the documentation for. + - Run make on the [Language]/latex folder. diff --git a/docs/dev/Doxyfile_English b/docs/dev/Doxyfile_English index 0db408b..45092df 100644 --- a/docs/dev/Doxyfile_English +++ b/docs/dev/Doxyfile_English @@ -1,1530 +1,1530 @@ -# Doxyfile 1.6.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = CP1252 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = PAlib - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = ../english/ - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = C:/devkitPro/PAlib/include/nds - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = YES - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it parses. -# With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this tag. -# The format is ext=language, where ext is a file extension, and language is one of -# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, -# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), -# use: inc=Fortran f=C. Note that for custom extensions you also need to set -# FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = YES - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = YES - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 29 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = NO - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = NO - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by -# doxygen. The layout file controls the global structure of the generated output files -# in an output format independent way. The create the layout file that represents -# doxygen's defaults, run doxygen with the -l option. You can optionally specify a -# file name after the option, if omitted DoxygenLayout.xml will be used as the name -# of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = NO - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = ../../include/nds \ - ../../include/nds/arm9 \ - ../../include/nds/arm9/cpp - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = CP1252 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.h \ - *.hpp - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = ../../include/nds/arm9/jpeg.h - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = ../../examples/ - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = *.c *.cpp *.h - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = YES - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = . - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .htm - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = YES - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = ../PAlib.chm - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = c:/devkitPro/PAlib/docs/dev/hhc.exe - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = CP1252 - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = YES - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = YES - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER -# are set, an additional index file will be generated that can be used as input for -# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated -# HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. -# For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's -# filter section matches. -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = YES - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 300 - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# When the SEARCHENGINE tag is enable doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) -# there is already a search function so this one should typically -# be disabled. - -SEARCHENGINE = YES - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = YES - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4 - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = YES - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 1000 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = YES - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES +# Doxyfile 1.6.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = CP1252 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = PAlib + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ../english/ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = C:/devkitPro/PAlib/include/nds + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it parses. +# With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this tag. +# The format is ext=language, where ext is a file extension, and language is one of +# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, +# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. Note that for custom extensions you also need to set +# FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = YES + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 29 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = NO + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = NO + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = NO + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../../include/nds \ + ../../include/nds/arm9 \ + ../../include/nds/arm9/cpp + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = CP1252 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.h \ + *.hpp + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = ../../include/nds/arm9/jpeg.h + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = ../../examples/ + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = *.c *.cpp *.h + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = YES + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = . + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .htm + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = ../PAlib.chm + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = c:/devkitPro/PAlib/docs/dev/hhc.exe + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = CP1252 + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = YES + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = YES + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER +# are set, an additional index file will be generated that can be used as input for +# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated +# HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. +# For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's +# filter section matches. +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 300 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# When the SEARCHENGINE tag is enable doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) +# there is already a search function so this one should typically +# be disabled. + +SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = YES + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 1000 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = YES + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/docs/dev/Doxyfile_French b/docs/dev/Doxyfile_French index 14c7d5f..1bfcaf6 100644 --- a/docs/dev/Doxyfile_French +++ b/docs/dev/Doxyfile_French @@ -1,1530 +1,1530 @@ -# Doxyfile 1.6.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = CP1252 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = PAlib - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = ../french/ - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = French - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = C:/devkitPro/PAlib/include/nds - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = YES - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it parses. -# With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this tag. -# The format is ext=language, where ext is a file extension, and language is one of -# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, -# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), -# use: inc=Fortran f=C. Note that for custom extensions you also need to set -# FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = YES - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = YES - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 29 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = NO - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = NO - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by -# doxygen. The layout file controls the global structure of the generated output files -# in an output format independent way. The create the layout file that represents -# doxygen's defaults, run doxygen with the -l option. You can optionally specify a -# file name after the option, if omitted DoxygenLayout.xml will be used as the name -# of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = NO - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = ../../include/nds \ - ../../include/nds/arm9 \ - ../../include/nds/arm9/cpp - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = CP1252 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.h \ - *.hpp - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = ../../include/nds/arm9/jpeg.h - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = ../../examples/ - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = *.c *.cpp *.h - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = YES - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = . - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .htm - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = YES - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = ../PAlib.chm - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = c:/devkitPro/PAlib/docs/dev/hhc.exe - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = CP1252 - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = YES - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = YES - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER -# are set, an additional index file will be generated that can be used as input for -# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated -# HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. -# For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's -# filter section matches. -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = YES - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 300 - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# When the SEARCHENGINE tag is enable doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) -# there is already a search function so this one should typically -# be disabled. - -SEARCHENGINE = YES - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = YES - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4 - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = YES - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 1000 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = YES - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES +# Doxyfile 1.6.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = CP1252 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = PAlib + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ../french/ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = French + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = C:/devkitPro/PAlib/include/nds + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it parses. +# With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this tag. +# The format is ext=language, where ext is a file extension, and language is one of +# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, +# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. Note that for custom extensions you also need to set +# FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = YES + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 29 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = NO + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = NO + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = NO + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../../include/nds \ + ../../include/nds/arm9 \ + ../../include/nds/arm9/cpp + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = CP1252 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.h \ + *.hpp + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = ../../include/nds/arm9/jpeg.h + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = ../../examples/ + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = *.c *.cpp *.h + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = YES + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = . + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .htm + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = ../PAlib.chm + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = c:/devkitPro/PAlib/docs/dev/hhc.exe + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = CP1252 + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = YES + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = YES + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER +# are set, an additional index file will be generated that can be used as input for +# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated +# HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. +# For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's +# filter section matches. +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 300 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# When the SEARCHENGINE tag is enable doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) +# there is already a search function so this one should typically +# be disabled. + +SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = YES + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 1000 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = YES + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/examples/16c/16cSprites/16cSpriteAnim/Makefile b/examples/16c/16cSprites/16cSpriteAnim/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/16c/16cSprites/16cSpriteAnim/Makefile +++ b/examples/16c/16cSprites/16cSpriteAnim/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/16c/16cSprites/16cSpriteAnim/gfx/all_gfx.h b/examples/16c/16cSprites/16cSpriteAnim/gfx/all_gfx.h index 92bcbbe..22160f9 100644 --- a/examples/16c/16cSprites/16cSpriteAnim/gfx/all_gfx.h +++ b/examples/16c/16cSprites/16cSpriteAnim/gfx/all_gfx.h @@ -1,17 +1,17 @@ -//Gfx converted using Mollusk's PAGfx Converter - -//This file contains all the .h, for easier inclusion in a project - -#ifndef ALL_GFX_H -#define ALL_GFX_H - - -// Sprite files : -extern const unsigned char ropes_Sprite[192] __attribute__ ((aligned (4))) ; // Pal : ropes_Pal - -// Palette files : -extern const unsigned short ropes_Pal[7] __attribute__ ((aligned (4))) ; - - -#endif - +//Gfx converted using Mollusk's PAGfx Converter + +//This file contains all the .h, for easier inclusion in a project + +#ifndef ALL_GFX_H +#define ALL_GFX_H + + +// Sprite files : +extern const unsigned char ropes_Sprite[192] __attribute__ ((aligned (4))) ; // Pal : ropes_Pal + +// Palette files : +extern const unsigned short ropes_Pal[7] __attribute__ ((aligned (4))) ; + + +#endif + diff --git a/examples/16c/16cSprites/16cSpriteAnim/gfx/bin/ropes.c b/examples/16c/16cSprites/16cSpriteAnim/gfx/bin/ropes.c index 586c646..7fd9c4a 100644 --- a/examples/16c/16cSprites/16cSpriteAnim/gfx/bin/ropes.c +++ b/examples/16c/16cSprites/16cSpriteAnim/gfx/bin/ropes.c @@ -1,18 +1,18 @@ -//Sprite created using PAGfx -//This sprite uses ropes_Pal - -const unsigned char ropes_Sprite[192] __attribute__ ((aligned (4))) = { -0, 33, 3, 0, 0, 32, 84, 0, 0, 0, 81, 2, 0, 0, 66, 5, -0, 0, 81, 2, 0, 0, 97, 3, 0, 16, 33, 0, 0, 19, 2, 0, -48, 19, 0, 0, 53, 3, 0, 0, 35, 3, 0, 0, 85, 3, 0, 0, -35, 1, 0, 0, 101, 2, 0, 0, 48, 18, 0, 0, 0, 101, 2, 0, -0, 0, 81, 2, 0, 16, 33, 0, 0, 19, 2, 0, 48, 19, 0, 0, -80, 3, 0, 0, 35, 3, 0, 0, 85, 3, 0, 0, 35, 1, 0, 0, -101, 2, 0, 0, 48, 18, 0, 0, 0, 101, 2, 0, 0, 33, 3, 0, -0, 32, 84, 0, 0, 0, 50, 3, 0, 0, 65, 5, 0, 0, 49, 2, -50, 1, 0, 0, 53, 3, 0, 0, 35, 3, 0, 0, 66, 2, 0, 0, -32, 50, 0, 0, 32, 86, 0, 0, 0, 33, 2, 0, 0, 48, 86, 0, -0, 0, 33, 2, 0, 0, 98, 5, 0, 0, 49, 2, 0, 0, 33, 5, -0, 16, 33, 0, 0, 51, 1, 0, 48, 19, 0, 0, 50, 3, 0, 0 -}; - +//Sprite created using PAGfx +//This sprite uses ropes_Pal + +const unsigned char ropes_Sprite[192] __attribute__ ((aligned (4))) = { +0, 33, 3, 0, 0, 32, 84, 0, 0, 0, 81, 2, 0, 0, 66, 5, +0, 0, 81, 2, 0, 0, 97, 3, 0, 16, 33, 0, 0, 19, 2, 0, +48, 19, 0, 0, 53, 3, 0, 0, 35, 3, 0, 0, 85, 3, 0, 0, +35, 1, 0, 0, 101, 2, 0, 0, 48, 18, 0, 0, 0, 101, 2, 0, +0, 0, 81, 2, 0, 16, 33, 0, 0, 19, 2, 0, 48, 19, 0, 0, +80, 3, 0, 0, 35, 3, 0, 0, 85, 3, 0, 0, 35, 1, 0, 0, +101, 2, 0, 0, 48, 18, 0, 0, 0, 101, 2, 0, 0, 33, 3, 0, +0, 32, 84, 0, 0, 0, 50, 3, 0, 0, 65, 5, 0, 0, 49, 2, +50, 1, 0, 0, 53, 3, 0, 0, 35, 3, 0, 0, 66, 2, 0, 0, +32, 50, 0, 0, 32, 86, 0, 0, 0, 33, 2, 0, 0, 48, 86, 0, +0, 0, 33, 2, 0, 0, 98, 5, 0, 0, 49, 2, 0, 0, 33, 5, +0, 16, 33, 0, 0, 51, 1, 0, 48, 19, 0, 0, 50, 3, 0, 0 +}; + diff --git a/examples/16c/16cSprites/16cSpriteAnim/gfx/bin/ropes.pal.c b/examples/16c/16cSprites/16cSpriteAnim/gfx/bin/ropes.pal.c index 623e66b..d75327b 100644 --- a/examples/16c/16cSprites/16cSpriteAnim/gfx/bin/ropes.pal.c +++ b/examples/16c/16cSprites/16cSpriteAnim/gfx/bin/ropes.pal.c @@ -1,4 +1,4 @@ -//Palette created using Mollusk's PAGfxConverter - -const unsigned short ropes_Pal[7] __attribute__ ((aligned (4))) = { -000000, 52488, 58929, 54668, 65535, 63157, 65403}; +//Palette created using Mollusk's PAGfxConverter + +const unsigned short ropes_Pal[7] __attribute__ ((aligned (4))) = { +000000, 52488, 58929, 54668, 65535, 63157, 65403}; diff --git a/examples/16c/16cSprites/16cSpriteAnim/source/main.c b/examples/16c/16cSprites/16cSpriteAnim/source/main.c index 179d5b5..036855b 100644 --- a/examples/16c/16cSprites/16cSpriteAnim/source/main.c +++ b/examples/16c/16cSprites/16cSpriteAnim/source/main.c @@ -1,39 +1,39 @@ -// Includes -#include // Include for PA_Lib -#include "all_gfx.h" - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init16cBg(0, 2); //Initializes a 16 color bg - PA_LoadPal16c(PAL_BG0, ropes_Pal); //And loads its palette - PA_16cErase(0); //Clear bg before start drawing - - u8 i=0; // position of our rope, from bottom - u8 j=0; // step of our animation - u8 frames=0; //frames rendered, usefull to do animation timing - - // Infinite loop to keep the program running - while (1) - { - i+=1; //Move the rope up 1 pixels - if (i>192) i=0; //If the rope has hit the top of the screen, start again from bottom - - if (++frames==20) //If we have render 20 consecutive frames - { - j=j+64; //Change animation to next frame - // ropes_Sprite has three 8x16 pixels frames, so each frame is (8x16)/2 = 64 bytes (since each pixels is 4bits) - // so our stride on the animation image is 64. - if (j>128) j=0;//Check frame limit (only 3 frames on this animation) - frames=0; //Reset frame counter - } - - PA_WaitForVBL(); //Typical wait for vertical blank... - PA_16cErase(0); //Erase background (if there is only one row like in this example, you should erase only the space ocupped by the row). - PA_16c8Xi(0,125,192-i,(u32*)(ropes_Sprite+j),i); //Draw the row. - } - - return 0; +// Includes +#include // Include for PA_Lib +#include "all_gfx.h" + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init16cBg(0, 2); //Initializes a 16 color bg + PA_LoadPal16c(PAL_BG0, ropes_Pal); //And loads its palette + PA_16cErase(0); //Clear bg before start drawing + + u8 i=0; // position of our rope, from bottom + u8 j=0; // step of our animation + u8 frames=0; //frames rendered, usefull to do animation timing + + // Infinite loop to keep the program running + while (1) + { + i+=1; //Move the rope up 1 pixels + if (i>192) i=0; //If the rope has hit the top of the screen, start again from bottom + + if (++frames==20) //If we have render 20 consecutive frames + { + j=j+64; //Change animation to next frame + // ropes_Sprite has three 8x16 pixels frames, so each frame is (8x16)/2 = 64 bytes (since each pixels is 4bits) + // so our stride on the animation image is 64. + if (j>128) j=0;//Check frame limit (only 3 frames on this animation) + frames=0; //Reset frame counter + } + + PA_WaitForVBL(); //Typical wait for vertical blank... + PA_16cErase(0); //Erase background (if there is only one row like in this example, you should erase only the space ocupped by the row). + PA_16c8Xi(0,125,192-i,(u32*)(ropes_Sprite+j),i); //Draw the row. + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/16c/16cSprites/16cSprites/Makefile b/examples/16c/16cSprites/16cSprites/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/16c/16cSprites/16cSprites/Makefile +++ b/examples/16c/16cSprites/16cSprites/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/16c/16cSprites/16cSprites/gfx/all_gfx.h b/examples/16c/16cSprites/16cSprites/gfx/all_gfx.h index b0cd0e7..5799a05 100644 --- a/examples/16c/16cSprites/16cSprites/gfx/all_gfx.h +++ b/examples/16c/16cSprites/16cSprites/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char shot_Sprite[32] _GFX_ALIGN; // Palette: shot_Pal - -// Palettes: -extern const unsigned short shot_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char shot_Sprite[32] _GFX_ALIGN; // Palette: shot_Pal + +// Palettes: +extern const unsigned short shot_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/16c/16cSprites/16cSprites/source/main.c b/examples/16c/16cSprites/16cSprites/source/main.c index 25ddfa3..4ebf609 100644 --- a/examples/16c/16cSprites/16cSprites/source/main.c +++ b/examples/16c/16cSprites/16cSprites/source/main.c @@ -1,73 +1,73 @@ -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - -#define N_SHOTS 400 // number of shots - - -typedef struct{ - u8 screen; - s16 screenx, screeny; - s32 x, y, vx, vy; -} shottype; - -shottype shots[N_SHOTS]; // Have 200 shots... - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - // Init a 16c background for both screens - PA_InitComplete16c(1, // background number to use - (void*)shot_Pal); // palette to use... - - s32 i; - - // Fill shots with random postions and directions... - for (i = 0; i < N_SHOTS; i++){ - shots[i].x = 8+PA_Rand()%240; shots[i].x = shots[i].x << 8; // 8 bit fixed point - shots[i].y = 8+PA_Rand()%366; shots[i].y = shots[i].y << 8; - shots[i].screen = 0; shots[i].screenx = 256; shots[i].screeny = 0; // hide sprite at first - s16 angle = PA_Rand()%512; - shots[i].vx = PA_Cos(angle); - shots[i].vy = -PA_Sin(angle); - } - - - // Infinite loop to keep the program running - while (1) - { - // Move shots - for (i = 0; i < N_SHOTS; i++) { - // Add speed... - shots[i].x += shots[i].vx; - shots[i].y += shots[i].vy; - - // Screen positions - shots[i].screenx = (shots[i].x >> 8); // screen position... - shots[i].screeny = (shots[i].y >> 8); // same here... - - // Adjust speed to avoid moving out of screen... - if((shots[i].screenx < 4)||(shots[i].screenx > 256-4)) shots[i].vx = -shots[i].vx; - if((shots[i].screeny < 4)||(shots[i].screeny > 387)) shots[i].vy = -shots[i].vy; - - // See on which screen we'll display it... - if(shots[i].screeny < 199) shots[i].screen = 1; // top screen - else { - shots[i].screen = 0; // bottom screen - shots[i].screeny = shots[i].screeny-200; // 8pixel space between screens, just for the sake of it ! - } - } - - PA_WaitForVBL(); - PA_Dual16cErase(); // Erase both screens right after VBL... - - // Display shots... must be done RIGHT AFTER the erase... - for (i = 0; i < N_SHOTS; i++) PA_16c8X8(shots[i].screen, shots[i].screenx-4, shots[i].screeny-4, (void*)shot_Sprite); - } - - return 0; +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + +#define N_SHOTS 400 // number of shots + + +typedef struct{ + u8 screen; + s16 screenx, screeny; + s32 x, y, vx, vy; +} shottype; + +shottype shots[N_SHOTS]; // Have 200 shots... + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + // Init a 16c background for both screens + PA_InitComplete16c(1, // background number to use + (void*)shot_Pal); // palette to use... + + s32 i; + + // Fill shots with random postions and directions... + for (i = 0; i < N_SHOTS; i++){ + shots[i].x = 8+PA_Rand()%240; shots[i].x = shots[i].x << 8; // 8 bit fixed point + shots[i].y = 8+PA_Rand()%366; shots[i].y = shots[i].y << 8; + shots[i].screen = 0; shots[i].screenx = 256; shots[i].screeny = 0; // hide sprite at first + s16 angle = PA_Rand()%512; + shots[i].vx = PA_Cos(angle); + shots[i].vy = -PA_Sin(angle); + } + + + // Infinite loop to keep the program running + while (1) + { + // Move shots + for (i = 0; i < N_SHOTS; i++) { + // Add speed... + shots[i].x += shots[i].vx; + shots[i].y += shots[i].vy; + + // Screen positions + shots[i].screenx = (shots[i].x >> 8); // screen position... + shots[i].screeny = (shots[i].y >> 8); // same here... + + // Adjust speed to avoid moving out of screen... + if((shots[i].screenx < 4)||(shots[i].screenx > 256-4)) shots[i].vx = -shots[i].vx; + if((shots[i].screeny < 4)||(shots[i].screeny > 387)) shots[i].vy = -shots[i].vy; + + // See on which screen we'll display it... + if(shots[i].screeny < 199) shots[i].screen = 1; // top screen + else { + shots[i].screen = 0; // bottom screen + shots[i].screeny = shots[i].screeny-200; // 8pixel space between screens, just for the sake of it ! + } + } + + PA_WaitForVBL(); + PA_Dual16cErase(); // Erase both screens right after VBL... + + // Display shots... must be done RIGHT AFTER the erase... + for (i = 0; i < N_SHOTS; i++) PA_16c8X8(shots[i].screen, shots[i].screenx-4, shots[i].screeny-4, (void*)shot_Sprite); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/16c/16cText/16cText/Makefile b/examples/16c/16cText/16cText/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/16c/16cText/16cText/Makefile +++ b/examples/16c/16cText/16cText/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/16c/16cText/16cText/source/main.c b/examples/16c/16cText/16cText/source/main.c index eb56bdb..6b41239 100644 --- a/examples/16c/16cText/16cText/source/main.c +++ b/examples/16c/16cText/16cText/source/main.c @@ -1,42 +1,42 @@ -// Includes -#include // Include for PA_Lib - - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - - PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text - - PA_16cText(1, //screen - 10, 10, 255, 20, //x1, y1, x2, y2 position - "Hello World", //text - 1, //color (1-10) - 0, // text size (0-4) - 100); // maximum number of characters (use like 10000 if you don't know) - PA_16cText(1, 10, 25, 255, 40, "Hello World", 1, 1, 100); - PA_16cText(1, 10, 40, 255, 60, "Hello World", 1, 2, 100); - PA_16cText(1, 10, 60, 255, 80, "Hello World", 1, 3, 100); - PA_16cText(1, 10, 80, 255, 100, "Hello World", 1, 4, 100); - - u8 i; - - // Different colors on the bottom sreen... - for (i = 0; i < 10; i++){ - PA_16cText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 3, 100); - } - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// Includes +#include // Include for PA_Lib + + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + + PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text + + PA_16cText(1, //screen + 10, 10, 255, 20, //x1, y1, x2, y2 position + "Hello World", //text + 1, //color (1-10) + 0, // text size (0-4) + 100); // maximum number of characters (use like 10000 if you don't know) + PA_16cText(1, 10, 25, 255, 40, "Hello World", 1, 1, 100); + PA_16cText(1, 10, 40, 255, 60, "Hello World", 1, 2, 100); + PA_16cText(1, 10, 60, 255, 80, "Hello World", 1, 3, 100); + PA_16cText(1, 10, 80, 255, 100, "Hello World", 1, 4, 100); + + u8 i; + + // Different colors on the bottom sreen... + for (i = 0; i < 10; i++){ + PA_16cText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 3, 100); + } + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/16c/16cText/16cText2/Makefile b/examples/16c/16cText/16cText2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/16c/16cText/16cText2/Makefile +++ b/examples/16c/16cText/16cText2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/16c/16cText/16cText2/source/main.c b/examples/16c/16cText/16cText2/source/main.c index 4f74d37..ac9ba23 100644 --- a/examples/16c/16cText/16cText2/source/main.c +++ b/examples/16c/16cText/16cText2/source/main.c @@ -1,36 +1,36 @@ -// Includes -#include // Include for PA_Lib - -#include // standard lib for texts... - -char text[200]; - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - - PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text - - - - - // Infinite loop to keep the program running - while (1) - { - sprintf(text, // string to use - "%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); // String to transform - PA_16cText(0, 10, 20, 255, 40, text, 1, 3, 100); // Display the text transformed :) - - // And the time... - sprintf(text, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds); - PA_16cText(0, 10, 40, 255, 60, text, 1, 3, 100); // Display the text transformed :) - - PA_WaitForVBL(); - PA_16cErase(0); - } - - return 0; +// Includes +#include // Include for PA_Lib + +#include // standard lib for texts... + +char text[200]; + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + + PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text + + + + + // Infinite loop to keep the program running + while (1) + { + sprintf(text, // string to use + "%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); // String to transform + PA_16cText(0, 10, 20, 255, 40, text, 1, 3, 100); // Display the text transformed :) + + // And the time... + sprintf(text, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds); + PA_16cText(0, 10, 40, 255, 60, text, 1, 3, 100); // Display the text transformed :) + + PA_WaitForVBL(); + PA_16cErase(0); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/16c/16cText/16cTextAlign/Makefile b/examples/16c/16cText/16cTextAlign/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/16c/16cText/16cTextAlign/Makefile +++ b/examples/16c/16cText/16cTextAlign/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/16c/16cText/16cTextAlign/source/main.c b/examples/16c/16cText/16cTextAlign/source/main.c index 4293a94..6d83ed7 100644 --- a/examples/16c/16cText/16cTextAlign/source/main.c +++ b/examples/16c/16cText/16cTextAlign/source/main.c @@ -1,34 +1,34 @@ -// Includes -#include // Include for PA_Lib - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(0, 0); - - PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text - - PA_16cTextAlign(ALIGN_LEFT); - PA_16cText(1, 0, 10, 255, 50, "Left aligned text, blabla, blabla, life is life, and if you don't like PAlib, just don't use it and stop ditching... More blabla to make the text long enough to test the text system.", 1, 2, 1000); - - PA_16cTextAlign(ALIGN_RIGHT); - PA_16cText(1, 0, 50, 255, 90, "Right aligned text, blabla, blabla, life is life, and if you don't like PAlib, just don't use it and stop ditching... More blabla to make the text long enough to test the text system.", 1, 2, 1000); - - PA_16cTextAlign(ALIGN_CENTER); - PA_16cText(1, 0, 90, 255, 130, "Centered text, blabla, blabla, life is life, and if you don't like PAlib, just don't use it and stop ditching... More blabla to make the text long enough to test the text system.", 1, 2, 1000); - - PA_16cTextAlign(ALIGN_JUSTIFY); - PA_16cText(1, 0, 130, 255, 180, "Justified text, blabla, blabla, life is life, and if you don't like PAlib, just don't use it and stop ditching... More blabla to make the text long enough to test the text system.", 1, 2, 1000); - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// Includes +#include // Include for PA_Lib + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(0, 0); + + PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text + + PA_16cTextAlign(ALIGN_LEFT); + PA_16cText(1, 0, 10, 255, 50, "Left aligned text, blabla, blabla, life is life, and if you don't like PAlib, just don't use it and stop ditching... More blabla to make the text long enough to test the text system.", 1, 2, 1000); + + PA_16cTextAlign(ALIGN_RIGHT); + PA_16cText(1, 0, 50, 255, 90, "Right aligned text, blabla, blabla, life is life, and if you don't like PAlib, just don't use it and stop ditching... More blabla to make the text long enough to test the text system.", 1, 2, 1000); + + PA_16cTextAlign(ALIGN_CENTER); + PA_16cText(1, 0, 90, 255, 130, "Centered text, blabla, blabla, life is life, and if you don't like PAlib, just don't use it and stop ditching... More blabla to make the text long enough to test the text system.", 1, 2, 1000); + + PA_16cTextAlign(ALIGN_JUSTIFY); + PA_16cText(1, 0, 130, 255, 180, "Justified text, blabla, blabla, life is life, and if you don't like PAlib, just don't use it and stop ditching... More blabla to make the text long enough to test the text system.", 1, 2, 1000); + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/16c/16cText/16cTextFont/Makefile b/examples/16c/16cText/16cTextFont/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/16c/16cText/16cTextFont/Makefile +++ b/examples/16c/16cText/16cTextFont/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/16c/16cText/16cTextFont/gfx/all_gfx.h b/examples/16c/16cText/16cTextFont/gfx/all_gfx.h index bc6cf63..46e4942 100644 --- a/examples/16c/16cText/16cTextFont/gfx/all_gfx.h +++ b/examples/16c/16cText/16cTextFont/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct bigfont; -extern const PA_BgStruct smallfont; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct bigfont; +extern const PA_BgStruct smallfont; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/16c/16cText/16cTextFont/gfx/bin/bigfont.c b/examples/16c/16cText/16cTextFont/gfx/bin/bigfont.c index f70db6e..484e66b 100644 --- a/examples/16c/16cText/16cTextFont/gfx/bin/bigfont.c +++ b/examples/16c/16cText/16cTextFont/gfx/bin/bigfont.c @@ -1,17 +1,17 @@ -#include - -extern const char bigfont_Tiles[]; -extern const char bigfont_Map[]; -extern const char bigfont_Sizes[]; - -const PA_BgStruct bigfont = { - PA_Font4bit, - 512, 128, - - bigfont_Tiles, - bigfont_Map, - {bigfont_Sizes}, - - 8256, - {14} -}; +#include + +extern const char bigfont_Tiles[]; +extern const char bigfont_Map[]; +extern const char bigfont_Sizes[]; + +const PA_BgStruct bigfont = { + PA_Font4bit, + 512, 128, + + bigfont_Tiles, + bigfont_Map, + {bigfont_Sizes}, + + 8256, + {14} +}; diff --git a/examples/16c/16cText/16cTextFont/gfx/bin/smallfont.c b/examples/16c/16cText/16cTextFont/gfx/bin/smallfont.c index bb7d788..a24f0ac 100644 --- a/examples/16c/16cText/16cTextFont/gfx/bin/smallfont.c +++ b/examples/16c/16cText/16cTextFont/gfx/bin/smallfont.c @@ -1,17 +1,17 @@ -#include - -extern const char smallfont_Tiles[]; -extern const char smallfont_Map[]; -extern const char smallfont_Sizes[]; - -const PA_BgStruct smallfont = { - PA_Font4bit, - 256, 64, - - smallfont_Tiles, - smallfont_Map, - {smallfont_Sizes}, - - 3168, - {6} -}; +#include + +extern const char smallfont_Tiles[]; +extern const char smallfont_Map[]; +extern const char smallfont_Sizes[]; + +const PA_BgStruct smallfont = { + PA_Font4bit, + 256, 64, + + smallfont_Tiles, + smallfont_Map, + {smallfont_Sizes}, + + 3168, + {6} +}; diff --git a/examples/16c/16cText/16cTextFont/source/main.c b/examples/16c/16cText/16cTextFont/source/main.c index 0db6e0c..f7c02f8 100644 --- a/examples/16c/16cText/16cTextFont/source/main.c +++ b/examples/16c/16cText/16cTextFont/source/main.c @@ -1,31 +1,31 @@ -#include - -// Include the newly converted fonts... -#include "all_gfx.h" - -int main(){ - int i; - - PA_Init(); - - // 16 color background init with default colors for text - PA_Init16cBg(0, 3); - PA_Init16cBg(1, 3); - - // Slots 0-4 are already used by default PAlib fonts, so we'll load on slots 5 and 6. - // Available slots : 5-9. You can overwrite a PAlib font though if you want to use slot 0 for example... - PA_Add16cFont(5, &smallfont); - PA_Add16cFont(6, &bigfont); - - PA_16cText(1, 10, 25, 255, 40, "Small custom font...", 1, 5, 100); - PA_16cText(1, 10, 40, 255, 60, "Big custom font...", 1, 6, 100); - - // Different colors on the bottom sreen... - for (i = 0; i < 10; i++) - PA_16cText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 6, 100); - - // Infinite loop to keep the program running - while(true){ - PA_WaitForVBL(); - } +#include + +// Include the newly converted fonts... +#include "all_gfx.h" + +int main(){ + int i; + + PA_Init(); + + // 16 color background init with default colors for text + PA_Init16cBg(0, 3); + PA_Init16cBg(1, 3); + + // Slots 0-4 are already used by default PAlib fonts, so we'll load on slots 5 and 6. + // Available slots : 5-9. You can overwrite a PAlib font though if you want to use slot 0 for example... + PA_Add16cFont(5, &smallfont); + PA_Add16cFont(6, &bigfont); + + PA_16cText(1, 10, 25, 255, 40, "Small custom font...", 1, 5, 100); + PA_16cText(1, 10, 40, 255, 60, "Big custom font...", 1, 6, 100); + + // Different colors on the bottom sreen... + for (i = 0; i < 10; i++) + PA_16cText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 6, 100); + + // Infinite loop to keep the program running + while(true){ + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/3DSprites/3D1024Sprites/Makefile b/examples/3DSprites/3D1024Sprites/Makefile index 21f133f..a49fbfb 100644 --- a/examples/3DSprites/3D1024Sprites/Makefile +++ b/examples/3DSprites/3D1024Sprites/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/3DSprites/3D1024Sprites/gfx/all_gfx.h b/examples/3DSprites/3D1024Sprites/gfx/all_gfx.h index 59a25f1..303df11 100644 --- a/examples/3DSprites/3D1024Sprites/gfx/all_gfx.h +++ b/examples/3DSprites/3D1024Sprites/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // 16bit texture - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // 16bit texture + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/3D1024Sprites/source/main.c b/examples/3DSprites/3D1024Sprites/source/main.c index 855efdc..2a2ea25 100644 --- a/examples/3DSprites/3D1024Sprites/source/main.c +++ b/examples/3DSprites/3D1024Sprites/source/main.c @@ -1,79 +1,79 @@ -/* -// 3D Sprite Moving example... -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - -#define N_SPRITES 1024 // Number of sprites in the example - -u16 gfx[3]; - -typedef struct{ - s32 x, y, vx, vy; -} spritepos; -spritepos sprites[1024]; // Let's manage the sprite positions ^^ - - - - -// Function: main() -int main(void) -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0 - PA_Reset3DSprites(); - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, 1); - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 6, " 3d Sprite Example, 1024 64x64sprites resized to 16x16 and moving around !"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture - 64, 64, // Width, Height - TEX_16BITS ); // Texture Format - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16BITS); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16BITS); - - s32 i; - u16 angle; - for(i = 0; i < N_SPRITES; i++) { - sprites[i].x = 16+(PA_Rand()%224); - sprites[i].y = 16+(PA_Rand()%160); - PA_3DCreateSpriteFromTex(i, // Sprite number - gfx[PA_Rand()%3], // Gfx, random one :p - 64, 64, // Width, Height - 0, // Palette - sprites[i].x, sprites[i].y); // X, Y - PA_3DSetSpriteWidthHeight(i, 16, 16); // Resize to way smaller ^^ - angle = PA_Rand()&511; // random angle - sprites[i].vx = PA_Cos(angle)>>7; - sprites[i].vy = -PA_Sin(angle)>>7; - } - - - - while(1) { - - for(i = 0; i < N_SPRITES; i++){ // Move them around and change speed if touches screen - sprites[i].x += sprites[i].vx; - if(((sprites[i].x <= 8)&&(sprites[i].vx < 0))||((sprites[i].x>=255-8)&&(sprites[i].vx > 0))) sprites[i].vx = -sprites[i].vx; - sprites[i].y += sprites[i].vy; - if(((sprites[i].y <= 8)&&(sprites[i].vy < 0))||((sprites[i].y>=191-8)&&(sprites[i].vy > 0))) sprites[i].vy = -sprites[i].vy; - PA_3DSetSpriteXY(i, sprites[i].x, sprites[i].y); // Set new position - } - - - PA_WaitForVBL(); - PA_3DProcess(); // Update 3DSprites - } - - - return 0; +/* +// 3D Sprite Moving example... +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + +#define N_SPRITES 1024 // Number of sprites in the example + +u16 gfx[3]; + +typedef struct{ + s32 x, y, vx, vy; +} spritepos; +spritepos sprites[1024]; // Let's manage the sprite positions ^^ + + + + +// Function: main() +int main(void) +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0 + PA_Reset3DSprites(); + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, 1); + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 6, " 3d Sprite Example, 1024 64x64sprites resized to 16x16 and moving around !"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture + 64, 64, // Width, Height + TEX_16BITS ); // Texture Format + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16BITS); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16BITS); + + s32 i; + u16 angle; + for(i = 0; i < N_SPRITES; i++) { + sprites[i].x = 16+(PA_Rand()%224); + sprites[i].y = 16+(PA_Rand()%160); + PA_3DCreateSpriteFromTex(i, // Sprite number + gfx[PA_Rand()%3], // Gfx, random one :p + 64, 64, // Width, Height + 0, // Palette + sprites[i].x, sprites[i].y); // X, Y + PA_3DSetSpriteWidthHeight(i, 16, 16); // Resize to way smaller ^^ + angle = PA_Rand()&511; // random angle + sprites[i].vx = PA_Cos(angle)>>7; + sprites[i].vy = -PA_Sin(angle)>>7; + } + + + + while(1) { + + for(i = 0; i < N_SPRITES; i++){ // Move them around and change speed if touches screen + sprites[i].x += sprites[i].vx; + if(((sprites[i].x <= 8)&&(sprites[i].vx < 0))||((sprites[i].x>=255-8)&&(sprites[i].vx > 0))) sprites[i].vx = -sprites[i].vx; + sprites[i].y += sprites[i].vy; + if(((sprites[i].y <= 8)&&(sprites[i].vy < 0))||((sprites[i].y>=191-8)&&(sprites[i].vy > 0))) sprites[i].vy = -sprites[i].vy; + PA_3DSetSpriteXY(i, sprites[i].x, sprites[i].y); // Set new position + } + + + PA_WaitForVBL(); + PA_3DProcess(); // Update 3DSprites + } + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/3DCreateSprite/16bit/Makefile b/examples/3DSprites/3DCreateSprite/16bit/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/3DCreateSprite/16bit/Makefile +++ b/examples/3DSprites/3DCreateSprite/16bit/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/3DCreateSprite/16bit/gfx/all_gfx.h b/examples/3DSprites/3DCreateSprite/16bit/gfx/all_gfx.h index 59a25f1..303df11 100644 --- a/examples/3DSprites/3DCreateSprite/16bit/gfx/all_gfx.h +++ b/examples/3DSprites/3DCreateSprite/16bit/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // 16bit texture - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // 16bit texture + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/3DCreateSprite/16bit/source/main.c b/examples/3DSprites/3DCreateSprite/16bit/source/main.c index 5e825d0..32bbd9f 100644 --- a/examples/3DSprites/3DCreateSprite/16bit/source/main.c +++ b/examples/3DSprites/3DCreateSprite/16bit/source/main.c @@ -1,57 +1,57 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 6, " 3DSprites Example : 16bits"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture - 64, 64, // Width, Height - TEX_16BITS ); // Texture Format - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16BITS); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16BITS); - - // Create 3 sprites... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette, unused in 16bit... - 32, 32); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 0, 96, 96); - PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 0, 160, 96+64); - - - while(1) { - - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 6, " 3DSprites Example : 16bits"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture + 64, 64, // Width, Height + TEX_16BITS ); // Texture Format + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16BITS); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16BITS); + + // Create 3 sprites... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette, unused in 16bit... + 32, 32); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 0, 96, 96); + PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 0, 160, 96+64); + + + while(1) { + + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/3DCreateSprite/16colors/Makefile b/examples/3DSprites/3DCreateSprite/16colors/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/3DCreateSprite/16colors/Makefile +++ b/examples/3DSprites/3DCreateSprite/16colors/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/3DCreateSprite/16colors/gfx/all_gfx.h b/examples/3DSprites/3DCreateSprite/16colors/gfx/all_gfx.h index 8b2e09e..013bf8e 100644 --- a/examples/3DSprites/3DCreateSprite/16colors/gfx/all_gfx.h +++ b/examples/3DSprites/3DCreateSprite/16colors/gfx/all_gfx.h @@ -1,23 +1,23 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[2048] _GFX_ALIGN; // Palette: mollusk_Pal -extern const unsigned char AnarX_Texture[2048] _GFX_ALIGN; // Palette: AnarX_Pal -extern const unsigned char Abrexxes_Texture[2048] _GFX_ALIGN; // Palette: Abrexxes_Pal - -// Palettes: -extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; -extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; -extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[2048] _GFX_ALIGN; // Palette: mollusk_Pal +extern const unsigned char AnarX_Texture[2048] _GFX_ALIGN; // Palette: AnarX_Pal +extern const unsigned char Abrexxes_Texture[2048] _GFX_ALIGN; // Palette: Abrexxes_Pal + +// Palettes: +extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; +extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; +extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/3DCreateSprite/16colors/source/main.c b/examples/3DSprites/3DCreateSprite/16colors/source/main.c index a22a45d..99fbb23 100644 --- a/examples/3DSprites/3DCreateSprite/16colors/source/main.c +++ b/examples/3DSprites/3DCreateSprite/16colors/source/main.c @@ -1,63 +1,63 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 2, "3DSprites Example : 16colors"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16colors textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture - 64, 64, // Width, Height - TEX_16COL ); // Texture Format - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16COL); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16COL); - - // Load the Palettes ! - PA_Load3DSpritePal(0, // Slot - (void*)mollusk_Pal); // Palette - PA_Load3DSpritePal(1, (void*)AnarX_Pal); - PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); - - // Create 3 sprites... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette, unused in 16bit... - 32, 32); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 96, 96); - PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 160, 96+64); - - - while(1) { - - - PA_3DProcess(); // Update sprites - - PA_WaitForVBL(); - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 2, "3DSprites Example : 16colors"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16colors textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture + 64, 64, // Width, Height + TEX_16COL ); // Texture Format + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16COL); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16COL); + + // Load the Palettes ! + PA_Load3DSpritePal(0, // Slot + (void*)mollusk_Pal); // Palette + PA_Load3DSpritePal(1, (void*)AnarX_Pal); + PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); + + // Create 3 sprites... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette, unused in 16bit... + 32, 32); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 96, 96); + PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 160, 96+64); + + + while(1) { + + + PA_3DProcess(); // Update sprites + + PA_WaitForVBL(); + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/3DCreateSprite/256colors/Makefile b/examples/3DSprites/3DCreateSprite/256colors/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/3DCreateSprite/256colors/Makefile +++ b/examples/3DSprites/3DCreateSprite/256colors/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/3DCreateSprite/256colors/gfx/all_gfx.h b/examples/3DSprites/3DCreateSprite/256colors/gfx/all_gfx.h index 062df3a..a1dc6b8 100644 --- a/examples/3DSprites/3DCreateSprite/256colors/gfx/all_gfx.h +++ b/examples/3DSprites/3DCreateSprite/256colors/gfx/all_gfx.h @@ -1,23 +1,23 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // Palette: mollusk_Pal -extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // Palette: AnarX_Pal -extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // Palette: Abrexxes_Pal - -// Palettes: -extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; -extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; -extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // Palette: mollusk_Pal +extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // Palette: AnarX_Pal +extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // Palette: Abrexxes_Pal + +// Palettes: +extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; +extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; +extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/3DCreateSprite/256colors/source/main.c b/examples/3DSprites/3DCreateSprite/256colors/source/main.c index d0bee50..004fef7 100644 --- a/examples/3DSprites/3DCreateSprite/256colors/source/main.c +++ b/examples/3DSprites/3DCreateSprite/256colors/source/main.c @@ -1,62 +1,62 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 2, "3DSprites Example : 256colors"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture - 64, 64, // Width, Height - TEX_256COL ); // Texture Format - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_256COL); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_256COL); - - // Load the Palettes ! - PA_Load3DSpritePal(0, // Slot - (void*)mollusk_Pal); // Palette - PA_Load3DSpritePal(1, (void*)AnarX_Pal); - PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); - - // Create 3 sprites... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette, unused in 16bit... - 32, 32); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 96, 96); - PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 160, 96+64); - - - while(1) { - - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 2, "3DSprites Example : 256colors"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture + 64, 64, // Width, Height + TEX_256COL ); // Texture Format + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_256COL); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_256COL); + + // Load the Palettes ! + PA_Load3DSpritePal(0, // Slot + (void*)mollusk_Pal); // Palette + PA_Load3DSpritePal(1, (void*)AnarX_Pal); + PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); + + // Create 3 sprites... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette, unused in 16bit... + 32, 32); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 96, 96); + PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 160, 96+64); + + + while(1) { + + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/3DCreateSprite/4colors/Makefile b/examples/3DSprites/3DCreateSprite/4colors/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/3DCreateSprite/4colors/Makefile +++ b/examples/3DSprites/3DCreateSprite/4colors/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/3DCreateSprite/4colors/gfx/all_gfx.h b/examples/3DSprites/3DCreateSprite/4colors/gfx/all_gfx.h index 76df0f9..7a9f8ae 100644 --- a/examples/3DSprites/3DCreateSprite/4colors/gfx/all_gfx.h +++ b/examples/3DSprites/3DCreateSprite/4colors/gfx/all_gfx.h @@ -1,23 +1,23 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[1024] _GFX_ALIGN; // Palette: mollusk_Pal -extern const unsigned char AnarX_Texture[1024] _GFX_ALIGN; // Palette: AnarX_Pal -extern const unsigned char Abrexxes_Texture[1024] _GFX_ALIGN; // Palette: Abrexxes_Pal - -// Palettes: -extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; -extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; -extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[1024] _GFX_ALIGN; // Palette: mollusk_Pal +extern const unsigned char AnarX_Texture[1024] _GFX_ALIGN; // Palette: AnarX_Pal +extern const unsigned char Abrexxes_Texture[1024] _GFX_ALIGN; // Palette: Abrexxes_Pal + +// Palettes: +extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; +extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; +extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/3DCreateSprite/4colors/source/main.c b/examples/3DSprites/3DCreateSprite/4colors/source/main.c index 5880026..4814927 100644 --- a/examples/3DSprites/3DCreateSprite/4colors/source/main.c +++ b/examples/3DSprites/3DCreateSprite/4colors/source/main.c @@ -1,62 +1,62 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 2, "3DSprites Example : 16colors"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16colors textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture - 64, 64, // Width, Height - TEX_4COL ); // Texture Format - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_4COL); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_4COL); - - // Load the Palettes ! - PA_Load3DSpritePal(0, // Slot - (void*)mollusk_Pal); // Palette - PA_Load3DSpritePal(1, (void*)AnarX_Pal); - PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); - - // Create 3 sprites... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette, unused in 16bit... - 32, 32); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 96, 96); - PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 160, 96+64); - - - while(1) { - - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 2, "3DSprites Example : 16colors"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16colors textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture + 64, 64, // Width, Height + TEX_4COL ); // Texture Format + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_4COL); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_4COL); + + // Load the Palettes ! + PA_Load3DSpritePal(0, // Slot + (void*)mollusk_Pal); // Palette + PA_Load3DSpritePal(1, (void*)AnarX_Pal); + PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); + + // Create 3 sprites... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette, unused in 16bit... + 32, 32); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 96, 96); + PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 160, 96+64); + + + while(1) { + + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/3DCreateSprite/Rectangle/Makefile b/examples/3DSprites/3DCreateSprite/Rectangle/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/3DCreateSprite/Rectangle/Makefile +++ b/examples/3DSprites/3DCreateSprite/Rectangle/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/3DCreateSprite/Rectangle/gfx/all_gfx.h b/examples/3DSprites/3DCreateSprite/Rectangle/gfx/all_gfx.h index ac3c575..3497449 100644 --- a/examples/3DSprites/3DCreateSprite/Rectangle/gfx/all_gfx.h +++ b/examples/3DSprites/3DCreateSprite/Rectangle/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char bar_Texture[8192] _GFX_ALIGN; // Palette: bar_Pal - -// Palettes: -extern const unsigned short bar_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char bar_Texture[8192] _GFX_ALIGN; // Palette: bar_Pal + +// Palettes: +extern const unsigned short bar_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/3DCreateSprite/Rectangle/source/main.c b/examples/3DSprites/3DCreateSprite/Rectangle/source/main.c index 8bdce1e..2af8428 100644 --- a/examples/3DSprites/3DCreateSprite/Rectangle/source/main.c +++ b/examples/3DSprites/3DCreateSprite/Rectangle/source/main.c @@ -1,52 +1,52 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 2, "3DSprites Example : 256colors"); - - - // Load the Palettes ! - PA_Load3DSpritePal(0, // Slot - (void*)bar_Pal); // Palette - - - // Create 3 sprites... - PA_3DCreateSprite(0, // Sprite number - (void*)bar_Texture, // Texture - 256, 32, // Width, Height - TEX_256COL, // Type - 0, // Palette, unused in 16bit... - 128, 96); // X, Y SPRITE CENTER ! - - - while(1) { - - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 2, "3DSprites Example : 256colors"); + + + // Load the Palettes ! + PA_Load3DSpritePal(0, // Slot + (void*)bar_Pal); // Palette + + + // Create 3 sprites... + PA_3DCreateSprite(0, // Sprite number + (void*)bar_Texture, // Texture + 256, 32, // Width, Height + TEX_256COL, // Type + 0, // Palette, unused in 16bit... + 128, 96); // X, Y SPRITE CENTER ! + + + while(1) { + + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/3DMoveSprite/Makefile b/examples/3DSprites/3DMoveSprite/Makefile index 21f133f..a49fbfb 100644 --- a/examples/3DSprites/3DMoveSprite/Makefile +++ b/examples/3DSprites/3DMoveSprite/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/3DSprites/3DMoveSprite/gfx/all_gfx.h b/examples/3DSprites/3DMoveSprite/gfx/all_gfx.h index e3bbb03..1204ca2 100644 --- a/examples/3DSprites/3DMoveSprite/gfx/all_gfx.h +++ b/examples/3DSprites/3DMoveSprite/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/3DMoveSprite/source/main.c b/examples/3DSprites/3DMoveSprite/source/main.c index a239e55..bf227fd 100644 --- a/examples/3DSprites/3DMoveSprite/source/main.c +++ b/examples/3DSprites/3DMoveSprite/source/main.c @@ -1,50 +1,50 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0 - PA_Reset3DSprites(); - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, 1); - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 0, 6, "Move the Sprite with the stylus"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16bit sprites in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS); - - // Create sprite... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette - 128, 96); // X, Y SPRITE CENTER ! - - while(1) { - - if(Stylus.Held) PA_3DSetSpriteXY(0, Stylus.X, Stylus.Y); // Move sprite 0 to Stylus Position... This is the sprite's center ! - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0 + PA_Reset3DSprites(); + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, 1); + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 0, 6, "Move the Sprite with the stylus"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16bit sprites in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS); + + // Create sprite... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette + 128, 96); // X, Y SPRITE CENTER ! + + while(1) { + + if(Stylus.Held) PA_3DSetSpriteXY(0, Stylus.X, Stylus.Y); // Move sprite 0 to Stylus Position... This is the sprite's center ! + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/3DPriorities/Makefile b/examples/3DSprites/3DPriorities/Makefile index 21f133f..a49fbfb 100644 --- a/examples/3DSprites/3DPriorities/Makefile +++ b/examples/3DSprites/3DPriorities/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/3DSprites/3DPriorities/gfx/all_gfx.h b/examples/3DSprites/3DPriorities/gfx/all_gfx.h index 062df3a..a1dc6b8 100644 --- a/examples/3DSprites/3DPriorities/gfx/all_gfx.h +++ b/examples/3DSprites/3DPriorities/gfx/all_gfx.h @@ -1,23 +1,23 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // Palette: mollusk_Pal -extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // Palette: AnarX_Pal -extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // Palette: Abrexxes_Pal - -// Palettes: -extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; -extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; -extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // Palette: mollusk_Pal +extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // Palette: AnarX_Pal +extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // Palette: Abrexxes_Pal + +// Palettes: +extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; +extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; +extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/3DPriorities/source/main.c b/examples/3DSprites/3DPriorities/source/main.c index a8512d6..09e9f11 100644 --- a/examples/3DSprites/3DPriorities/source/main.c +++ b/examples/3DSprites/3DPriorities/source/main.c @@ -1,64 +1,64 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 0, 8, "Move 3DSprite to change priority"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture - 64, 64, // Width, Height - TEX_256COL ); // Texture Format - - - // Load the Palettes ! - PA_Load3DSpritePal(0, // Slot - (void*)mollusk_Pal); // Palette - - // Create a few sprites - PA_3DCreateSpriteFromTex(0, gfx[0], 64, 64, 0, 128, 96); - - u8 i; - for(i = 0; i < 24; i++){ - PA_3DCreateSpriteFromTex(i+1, gfx[0], 64, 64, 0, 32, i*8); - PA_3DSetSpritePrio(i+1, 1024 + i*8); // Priority... (default is 1024) - } - - while(1) { - if(Stylus.Held) { - PA_3DSetSpriteXY(0, Stylus.X, Stylus.Y); - PA_3DSetSpritePrio(0, 1024 + Stylus.Y); // Priority depending on Y position... - } - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 0, 8, "Move 3DSprite to change priority"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture + 64, 64, // Width, Height + TEX_256COL ); // Texture Format + + + // Load the Palettes ! + PA_Load3DSpritePal(0, // Slot + (void*)mollusk_Pal); // Palette + + // Create a few sprites + PA_3DCreateSpriteFromTex(0, gfx[0], 64, 64, 0, 128, 96); + + u8 i; + for(i = 0; i < 24; i++){ + PA_3DCreateSpriteFromTex(i+1, gfx[0], 64, 64, 0, 32, i*8); + PA_3DSetSpritePrio(i+1, 1024 + i*8); // Priority... (default is 1024) + } + + while(1) { + if(Stylus.Held) { + PA_3DSetSpriteXY(0, Stylus.X, Stylus.Y); + PA_3DSetSpritePrio(0, 1024 + Stylus.Y); // Priority depending on Y position... + } + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/3DSetSpriteTex/Makefile b/examples/3DSprites/3DSetSpriteTex/Makefile index 21f133f..a49fbfb 100644 --- a/examples/3DSprites/3DSetSpriteTex/Makefile +++ b/examples/3DSprites/3DSetSpriteTex/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/3DSprites/3DSetSpriteTex/gfx/all_gfx.h b/examples/3DSprites/3DSetSpriteTex/gfx/all_gfx.h index 062df3a..a1dc6b8 100644 --- a/examples/3DSprites/3DSetSpriteTex/gfx/all_gfx.h +++ b/examples/3DSprites/3DSetSpriteTex/gfx/all_gfx.h @@ -1,23 +1,23 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // Palette: mollusk_Pal -extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // Palette: AnarX_Pal -extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // Palette: Abrexxes_Pal - -// Palettes: -extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; -extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; -extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // Palette: mollusk_Pal +extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // Palette: AnarX_Pal +extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // Palette: Abrexxes_Pal + +// Palettes: +extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; +extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; +extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/3DSetSpriteTex/source/main.c b/examples/3DSprites/3DSetSpriteTex/source/main.c index 2e1b8b7..7e35d75 100644 --- a/examples/3DSprites/3DSetSpriteTex/source/main.c +++ b/examples/3DSprites/3DSetSpriteTex/source/main.c @@ -1,72 +1,72 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 6, "Click to set random texture"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture - 64, 64, // Width, Height - TEX_256COL ); // Texture Format - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_256COL); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_256COL); - - // Load the Palettes ! - PA_Load3DSpritePal(0, // Slot - (void*)mollusk_Pal); // Palette - PA_Load3DSpritePal(1, (void*)AnarX_Pal); - PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); - - // Create 3 sprites... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette, unused in 16bit... - 32, 32); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 96, 96); - PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 160, 96+64); - - s32 i; - - while(1) { - if(Stylus.Newpress){ - for(i = 0; i < 3; i++){ - if(PA_3DSpriteTouched(i)){ // If sprite touched - u8 random = PA_Rand()%3; - PA_3DSetSpriteTex(i, gfx[random]); // Change to random texture... - PA_3DSetSpritePal(i, random); // Don't forget to change palette too ^^ - } - } - } - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 6, "Click to set random texture"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture + 64, 64, // Width, Height + TEX_256COL ); // Texture Format + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_256COL); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_256COL); + + // Load the Palettes ! + PA_Load3DSpritePal(0, // Slot + (void*)mollusk_Pal); // Palette + PA_Load3DSpritePal(1, (void*)AnarX_Pal); + PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); + + // Create 3 sprites... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette, unused in 16bit... + 32, 32); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 96, 96); + PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 160, 96+64); + + s32 i; + + while(1) { + if(Stylus.Newpress){ + for(i = 0; i < 3; i++){ + if(PA_3DSpriteTouched(i)){ // If sprite touched + u8 random = PA_Rand()%3; + PA_3DSetSpriteTex(i, gfx[random]); // Change to random texture... + PA_3DSetSpritePal(i, random); // Don't forget to change palette too ^^ + } + } + } + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/3DSpriteTouched/Makefile b/examples/3DSprites/3DSpriteTouched/Makefile index 21f133f..a49fbfb 100644 --- a/examples/3DSprites/3DSpriteTouched/Makefile +++ b/examples/3DSprites/3DSpriteTouched/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/3DSprites/3DSpriteTouched/gfx/all_gfx.h b/examples/3DSprites/3DSpriteTouched/gfx/all_gfx.h index 062df3a..a1dc6b8 100644 --- a/examples/3DSprites/3DSpriteTouched/gfx/all_gfx.h +++ b/examples/3DSprites/3DSpriteTouched/gfx/all_gfx.h @@ -1,23 +1,23 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // Palette: mollusk_Pal -extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // Palette: AnarX_Pal -extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // Palette: Abrexxes_Pal - -// Palettes: -extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; -extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; -extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // Palette: mollusk_Pal +extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // Palette: AnarX_Pal +extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // Palette: Abrexxes_Pal + +// Palettes: +extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; +extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; +extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/3DSpriteTouched/source/main.c b/examples/3DSprites/3DSpriteTouched/source/main.c index e92bb6c..1784ae6 100644 --- a/examples/3DSprites/3DSpriteTouched/source/main.c +++ b/examples/3DSprites/3DSpriteTouched/source/main.c @@ -1,71 +1,71 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - PA_LoadDefaultText(0, 1); - - PA_OutputSimpleText(1, 2, 2, "3DSprites Example : 256colors"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture - 64, 64, // Width, Height - TEX_256COL ); // Texture Format - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_256COL); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_256COL); - - // Load the Palettes ! - PA_Load3DSpritePal(0, // Slot - (void*)mollusk_Pal); // Palette - PA_Load3DSpritePal(1, (void*)AnarX_Pal); - PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); - - // Create 3 sprites... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette, unused in 16bit... - 32, 32); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 96, 96); - PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 160, 96+64); - - - while(1) { - - // Check if you touch one of them... - if(Stylus.Held){ - if(PA_3DSpriteTouched(0)) PA_OutputSimpleText(0, 10, 2, "Mollusk is touched ! "); - else if(PA_3DSpriteTouched(1)) PA_OutputSimpleText(0, 10, 2, "AnarX is touched ! "); - else if(PA_3DSpriteTouched(2)) PA_OutputSimpleText(0, 10, 2, "Abrexxes is touched !"); - else PA_OutputSimpleText(0, 10, 2, " "); // If not, erase ^^ - } - else PA_OutputSimpleText(0, 10, 2, " "); // If not, erase ^^ - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + PA_LoadDefaultText(0, 1); + + PA_OutputSimpleText(1, 2, 2, "3DSprites Example : 256colors"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture + 64, 64, // Width, Height + TEX_256COL ); // Texture Format + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_256COL); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_256COL); + + // Load the Palettes ! + PA_Load3DSpritePal(0, // Slot + (void*)mollusk_Pal); // Palette + PA_Load3DSpritePal(1, (void*)AnarX_Pal); + PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); + + // Create 3 sprites... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette, unused in 16bit... + 32, 32); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 96, 96); + PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 160, 96+64); + + + while(1) { + + // Check if you touch one of them... + if(Stylus.Held){ + if(PA_3DSpriteTouched(0)) PA_OutputSimpleText(0, 10, 2, "Mollusk is touched ! "); + else if(PA_3DSpriteTouched(1)) PA_OutputSimpleText(0, 10, 2, "AnarX is touched ! "); + else if(PA_3DSpriteTouched(2)) PA_OutputSimpleText(0, 10, 2, "Abrexxes is touched !"); + else PA_OutputSimpleText(0, 10, 2, " "); // If not, erase ^^ + } + else PA_OutputSimpleText(0, 10, 2, " "); // If not, erase ^^ + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/Animations/Frames/Makefile b/examples/3DSprites/Animations/Frames/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/Animations/Frames/Makefile +++ b/examples/3DSprites/Animations/Frames/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/Animations/Frames/gfx/all_gfx.h b/examples/3DSprites/Animations/Frames/gfx/all_gfx.h index d4d9430..0ed95d4 100644 --- a/examples/3DSprites/Animations/Frames/gfx/all_gfx.h +++ b/examples/3DSprites/Animations/Frames/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char frames_Texture[4096] _GFX_ALIGN; // Palette: frames_Pal - -// Palettes: -extern const unsigned short frames_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char frames_Texture[4096] _GFX_ALIGN; // Palette: frames_Pal + +// Palettes: +extern const unsigned short frames_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Animations/Frames/source/main.c b/examples/3DSprites/Animations/Frames/source/main.c index 1bf5cb5..267c0d9 100644 --- a/examples/3DSprites/Animations/Frames/source/main.c +++ b/examples/3DSprites/Animations/Frames/source/main.c @@ -1,53 +1,53 @@ -/* Sprite Frames... -*/ - - -// Includes, only one sprite -#include - - -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount; //Frame count... -u16 gfx[3]; - - - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - - PA_LoadDefaultText(1, 0); - - PA_OutputText(1, 0, 10, "Press Pad to change frame"); - - // Load the sprite palette, - PA_Load3DSpritePal(0, // Palette number - (void*)frames_Pal); // Palette name - - gfx[0] = PA_3DCreateTex((void*)frames_Texture, 32, 32, TEX_256COL); - - PA_3DCreateSpriteFromTex(0, gfx[0], 32, 32, 0, 128, 96); - - - while(1) - { - if (Pad.Held.Up) PA_3DSetSpriteFrame(0, 0); // screen, sprite, frame - if (Pad.Held.Down) PA_3DSetSpriteFrame(0, 2); // screen, sprite, frame - if (Pad.Held.Left) PA_3DSetSpriteFrame(0, 3); // screen, sprite, frame - if (Pad.Held.Right) PA_3DSetSpriteFrame(0, 1); // screen, sprite, frame - - PA_WaitForVBL(); - PA_3DProcess(); - } - - return 0; +/* Sprite Frames... +*/ + + +// Includes, only one sprite +#include + + +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount; //Frame count... +u16 gfx[3]; + + + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + + PA_LoadDefaultText(1, 0); + + PA_OutputText(1, 0, 10, "Press Pad to change frame"); + + // Load the sprite palette, + PA_Load3DSpritePal(0, // Palette number + (void*)frames_Pal); // Palette name + + gfx[0] = PA_3DCreateTex((void*)frames_Texture, 32, 32, TEX_256COL); + + PA_3DCreateSpriteFromTex(0, gfx[0], 32, 32, 0, 128, 96); + + + while(1) + { + if (Pad.Held.Up) PA_3DSetSpriteFrame(0, 0); // screen, sprite, frame + if (Pad.Held.Down) PA_3DSetSpriteFrame(0, 2); // screen, sprite, frame + if (Pad.Held.Left) PA_3DSetSpriteFrame(0, 3); // screen, sprite, frame + if (Pad.Held.Right) PA_3DSetSpriteFrame(0, 1); // screen, sprite, frame + + PA_WaitForVBL(); + PA_3DProcess(); + } + + return 0; } \ No newline at end of file diff --git a/examples/3DSprites/Animations/PaperMario/Makefile b/examples/3DSprites/Animations/PaperMario/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/Animations/PaperMario/Makefile +++ b/examples/3DSprites/Animations/PaperMario/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/Animations/PaperMario/gfx/all_gfx.h b/examples/3DSprites/Animations/PaperMario/gfx/all_gfx.h index 988e5ba..d878b8c 100644 --- a/examples/3DSprites/Animations/PaperMario/gfx/all_gfx.h +++ b/examples/3DSprites/Animations/PaperMario/gfx/all_gfx.h @@ -1,22 +1,22 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct mariobg; - -// Sprites: -extern const unsigned char mario_Texture[16384] _GFX_ALIGN; // Palette: mario_Pal - -// Palettes: -extern const unsigned short mario_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct mariobg; + +// Sprites: +extern const unsigned char mario_Texture[16384] _GFX_ALIGN; // Palette: mario_Pal + +// Palettes: +extern const unsigned short mario_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Animations/PaperMario/gfx/bin/mariobg.c b/examples/3DSprites/Animations/PaperMario/gfx/bin/mariobg.c index 76110e6..7ff9c8c 100644 --- a/examples/3DSprites/Animations/PaperMario/gfx/bin/mariobg.c +++ b/examples/3DSprites/Animations/PaperMario/gfx/bin/mariobg.c @@ -1,17 +1,17 @@ -#include - -extern const char mariobg_Tiles[]; -extern const char mariobg_Map[]; -extern const char mariobg_Pal[]; - -const PA_BgStruct mariobg = { - PA_BgNormal, - 256, 192, - - mariobg_Tiles, - mariobg_Map, - {mariobg_Pal}, - - 11840, - {1536} -}; +#include + +extern const char mariobg_Tiles[]; +extern const char mariobg_Map[]; +extern const char mariobg_Pal[]; + +const PA_BgStruct mariobg = { + PA_BgNormal, + 256, 192, + + mariobg_Tiles, + mariobg_Map, + {mariobg_Pal}, + + 11840, + {1536} +}; diff --git a/examples/3DSprites/Animations/PaperMario/source/main.c b/examples/3DSprites/Animations/PaperMario/source/main.c index 24e7e4d..2f6f9d6 100644 --- a/examples/3DSprites/Animations/PaperMario/source/main.c +++ b/examples/3DSprites/Animations/PaperMario/source/main.c @@ -1,86 +1,86 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - -u16 gfx[3]; - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0 - PA_Reset3DSprites(); - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, 1); - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 0, 6, "Move the Stylus to move Mario"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16bit sprites in PAGfx - gfx[0] = PA_3DCreateTex((void*)mario_Texture, 64, 64, TEX_256COL); - - PA_Load3DSpritePal(0, (void*)mario_Pal); - - PA_LoadBackground(0, 3, &mariobg); // Mario background - - // Create sprite... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette - 128, 128); // X, Y SPRITE CENTER ! - - PA_3DSetSpriteWidthHeight(0, 96, 96); - - s16 xangle = 0; - s16 x = 128; - - while(1) { - - if(!Stylus.Held) { - while(PA_3DGetSpriteAnimFrame(0) != 0){ // Wait for animation to end... - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - PA_3DStopSpriteAnim(0); - } - - if(Stylus.Held) { - if(sprite3danims[0].play == 0) PA_3DStartSpriteAnim(0, 0, 3, 10); // Sprite animation ! - if(Stylus.X < x-12){ - while(xangle < 256) { - xangle += 16; // change angle... - PA_3DSetSpriteRotateY(0, xangle); - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - x -= 2; - } - else if(Stylus.X > x+12){ - while(xangle > 0) { - xangle -= 16; // change angle... - PA_3DSetSpriteRotateY(0, xangle); - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - x += 2; - } - PA_3DSetSpriteX(0, x); - } - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + +u16 gfx[3]; + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0 + PA_Reset3DSprites(); + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, 1); + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 0, 6, "Move the Stylus to move Mario"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16bit sprites in PAGfx + gfx[0] = PA_3DCreateTex((void*)mario_Texture, 64, 64, TEX_256COL); + + PA_Load3DSpritePal(0, (void*)mario_Pal); + + PA_LoadBackground(0, 3, &mariobg); // Mario background + + // Create sprite... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette + 128, 128); // X, Y SPRITE CENTER ! + + PA_3DSetSpriteWidthHeight(0, 96, 96); + + s16 xangle = 0; + s16 x = 128; + + while(1) { + + if(!Stylus.Held) { + while(PA_3DGetSpriteAnimFrame(0) != 0){ // Wait for animation to end... + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + PA_3DStopSpriteAnim(0); + } + + if(Stylus.Held) { + if(sprite3danims[0].play == 0) PA_3DStartSpriteAnim(0, 0, 3, 10); // Sprite animation ! + if(Stylus.X < x-12){ + while(xangle < 256) { + xangle += 16; // change angle... + PA_3DSetSpriteRotateY(0, xangle); + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + x -= 2; + } + else if(Stylus.X > x+12){ + while(xangle > 0) { + xangle -= 16; // change angle... + PA_3DSetSpriteRotateY(0, xangle); + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + x += 2; + } + PA_3DSetSpriteX(0, x); + } + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/Animations/SpriteAnim/Makefile b/examples/3DSprites/Animations/SpriteAnim/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/Animations/SpriteAnim/Makefile +++ b/examples/3DSprites/Animations/SpriteAnim/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/Animations/SpriteAnim/gfx/all_gfx.h b/examples/3DSprites/Animations/SpriteAnim/gfx/all_gfx.h index 59e092b..3939bf9 100644 --- a/examples/3DSprites/Animations/SpriteAnim/gfx/all_gfx.h +++ b/examples/3DSprites/Animations/SpriteAnim/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char explosion_Texture[28672] _GFX_ALIGN; // Palette: explosion_Pal - -// Palettes: -extern const unsigned short explosion_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char explosion_Texture[28672] _GFX_ALIGN; // Palette: explosion_Pal + +// Palettes: +extern const unsigned short explosion_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Animations/SpriteAnim/source/main.c b/examples/3DSprites/Animations/SpriteAnim/source/main.c index 02825f3..bb58d67 100644 --- a/examples/3DSprites/Animations/SpriteAnim/source/main.c +++ b/examples/3DSprites/Animations/SpriteAnim/source/main.c @@ -1,57 +1,57 @@ -/* This will show the new sprite animation functions !! Yay ! -Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) -*/ - - -// Includes, only one sprite -#include - - -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount; //Frame count... - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - PA_LoadDefaultText(1, 0); - - // Load the sprite palette, - PA_Load3DSpritePal(0, // Palette number - (void*)explosion_Pal); // Palette name - - // Here, we'll load a few similar sprites sprite to animate... at different speed - PA_3DCreateSprite(0,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 32, 96); - PA_3DCreateSprite(1,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 64+32, 96); - PA_3DCreateSprite(2,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 128+32, 96); - PA_3DCreateSprite(3,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 196+32, 96); - - - // Start the animation. Once started, it works on its own ! - PA_3DStartSpriteAnim(0, // sprite number - 0, // first frame is 0 - 6, // last frame is 3, since we have 4 frames... - 5); // Speed, set to 5 frames per second - PA_3DStartSpriteAnim(1, 0, 6, 15); // for the second one, speed of 15 fps... - PA_3DStartSpriteAnim(2, 0, 6, 30); // for the third one, speed of 30 fps... - PA_3DStartSpriteAnim(3, 0, 6, 60); // for the last one, speed of 60 fps... - - - - while(1) - { - - PA_WaitForVBL(); - PA_3DProcess(); // Update... - } - - return 0; +/* This will show the new sprite animation functions !! Yay ! +Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) +*/ + + +// Includes, only one sprite +#include + + +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount; //Frame count... + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + PA_LoadDefaultText(1, 0); + + // Load the sprite palette, + PA_Load3DSpritePal(0, // Palette number + (void*)explosion_Pal); // Palette name + + // Here, we'll load a few similar sprites sprite to animate... at different speed + PA_3DCreateSprite(0,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 32, 96); + PA_3DCreateSprite(1,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 64+32, 96); + PA_3DCreateSprite(2,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 128+32, 96); + PA_3DCreateSprite(3,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 196+32, 96); + + + // Start the animation. Once started, it works on its own ! + PA_3DStartSpriteAnim(0, // sprite number + 0, // first frame is 0 + 6, // last frame is 3, since we have 4 frames... + 5); // Speed, set to 5 frames per second + PA_3DStartSpriteAnim(1, 0, 6, 15); // for the second one, speed of 15 fps... + PA_3DStartSpriteAnim(2, 0, 6, 30); // for the third one, speed of 30 fps... + PA_3DStartSpriteAnim(3, 0, 6, 60); // for the last one, speed of 60 fps... + + + + while(1) + { + + PA_WaitForVBL(); + PA_3DProcess(); // Update... + } + + return 0; } \ No newline at end of file diff --git a/examples/3DSprites/Animations/SpriteAnim2/Makefile b/examples/3DSprites/Animations/SpriteAnim2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/Animations/SpriteAnim2/Makefile +++ b/examples/3DSprites/Animations/SpriteAnim2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/Animations/SpriteAnim2/gfx/all_gfx.h b/examples/3DSprites/Animations/SpriteAnim2/gfx/all_gfx.h index 2a11f34..666b8b0 100644 --- a/examples/3DSprites/Animations/SpriteAnim2/gfx/all_gfx.h +++ b/examples/3DSprites/Animations/SpriteAnim2/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char som_Texture[12288] _GFX_ALIGN; // Palette: som_Pal - -// Palettes: -extern const unsigned short som_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char som_Texture[12288] _GFX_ALIGN; // Palette: som_Pal + +// Palettes: +extern const unsigned short som_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Animations/SpriteAnim2/source/main.c b/examples/3DSprites/Animations/SpriteAnim2/source/main.c index 4a2e3e4..ec34416 100644 --- a/examples/3DSprites/Animations/SpriteAnim2/source/main.c +++ b/examples/3DSprites/Animations/SpriteAnim2/source/main.c @@ -1,61 +1,61 @@ -/* This will show the new sprite animation functions !! Yay ! -Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) -*/ - - -// Includes, only one sprite -#include - - -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount; //Frame count... - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_Init3D(); - PA_Reset3DSprites(); - - PA_LoadDefaultText(1, 0); - - PA_Load3DSpritePal(0, (void*)som_Pal); // Palette.... - - s32 x = 128; s32 y = 96; - - PA_3DCreateSprite(0,(void*)som_Texture, 32, 32, TEX_256COL, 0, x, y); // Sprite - - while(1) - { - // Animation code... - if(Pad.Newpress.Up) PA_3DStartSpriteAnim(0, 0, 3, 6); - if(Pad.Newpress.Down) PA_3DStartSpriteAnim(0, 8, 11, 6); - - if(Pad.Newpress.Right) { - PA_3DStartSpriteAnim(0, 4, 7, 6); - PA_3DSetSpriteHflip(0, 0); - } - if(Pad.Newpress.Left) { - PA_3DStartSpriteAnim(0, 4, 7, 6); - PA_3DSetSpriteHflip(0, 1); - } - - - if(!((Pad.Held.Left)||(Pad.Held.Up)||(Pad.Held.Down)||(Pad.Held.Right))) PA_3DSpriteAnimPause(0, 1); - - - // Moving Code - y += Pad.Held.Down - Pad.Held.Up; - x += Pad.Held.Right - Pad.Held.Left; - PA_3DSetSpriteXY(0, x, y); - - PA_WaitForVBL(); - PA_3DProcess(); // Update 3D... - } - - return 0; +/* This will show the new sprite animation functions !! Yay ! +Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) +*/ + + +// Includes, only one sprite +#include + + +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount; //Frame count... + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_Init3D(); + PA_Reset3DSprites(); + + PA_LoadDefaultText(1, 0); + + PA_Load3DSpritePal(0, (void*)som_Pal); // Palette.... + + s32 x = 128; s32 y = 96; + + PA_3DCreateSprite(0,(void*)som_Texture, 32, 32, TEX_256COL, 0, x, y); // Sprite + + while(1) + { + // Animation code... + if(Pad.Newpress.Up) PA_3DStartSpriteAnim(0, 0, 3, 6); + if(Pad.Newpress.Down) PA_3DStartSpriteAnim(0, 8, 11, 6); + + if(Pad.Newpress.Right) { + PA_3DStartSpriteAnim(0, 4, 7, 6); + PA_3DSetSpriteHflip(0, 0); + } + if(Pad.Newpress.Left) { + PA_3DStartSpriteAnim(0, 4, 7, 6); + PA_3DSetSpriteHflip(0, 1); + } + + + if(!((Pad.Held.Left)||(Pad.Held.Up)||(Pad.Held.Down)||(Pad.Held.Right))) PA_3DSpriteAnimPause(0, 1); + + + // Moving Code + y += Pad.Held.Down - Pad.Held.Up; + x += Pad.Held.Right - Pad.Held.Left; + PA_3DSetSpriteXY(0, x, y); + + PA_WaitForVBL(); + PA_3DProcess(); // Update 3D... + } + + return 0; } \ No newline at end of file diff --git a/examples/3DSprites/Animations/SpriteAnim3/Makefile b/examples/3DSprites/Animations/SpriteAnim3/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/Animations/SpriteAnim3/Makefile +++ b/examples/3DSprites/Animations/SpriteAnim3/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/Animations/SpriteAnim3/gfx/all_gfx.h b/examples/3DSprites/Animations/SpriteAnim3/gfx/all_gfx.h index 59e092b..3939bf9 100644 --- a/examples/3DSprites/Animations/SpriteAnim3/gfx/all_gfx.h +++ b/examples/3DSprites/Animations/SpriteAnim3/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char explosion_Texture[28672] _GFX_ALIGN; // Palette: explosion_Pal - -// Palettes: -extern const unsigned short explosion_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char explosion_Texture[28672] _GFX_ALIGN; // Palette: explosion_Pal + +// Palettes: +extern const unsigned short explosion_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Animations/SpriteAnim3/source/main.c b/examples/3DSprites/Animations/SpriteAnim3/source/main.c index 2157aa1..96735c4 100644 --- a/examples/3DSprites/Animations/SpriteAnim3/source/main.c +++ b/examples/3DSprites/Animations/SpriteAnim3/source/main.c @@ -1,59 +1,59 @@ -/* This will show the new sprite animation functions !! Yay ! -Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) -*/ - - -// Includes, only one sprite -#include - - -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount; //Frame count... -const unsigned char explosion[28672] __attribute__ ((aligned (4))); - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_Init3D(); - PA_Reset3DSprites(); - - PA_LoadDefaultText(0, 1); - - // Load the sprite palette, - PA_Load3DSpritePal(0, // Palette number - (void*)explosion_Pal); // Palette name - - // Here, we'll load a few similar sprites sprite to animate... at different speed - PA_3DCreateSprite(0,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 32, 96); - PA_3DCreateSprite(1,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 96, 96); - PA_3DCreateSprite(2,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 160, 96); - PA_3DCreateSprite(3,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 224, 96); - - // First animation will be normal - PA_3DStartSpriteAnim(0, // sprite number - 0, // first frame is 0 - 6, // last frame is 3, since we have 4 frames... - 5); // Speed, set to 5 frames per second - - // Extended animations for the rest - PA_3DStartSpriteAnimEx(1, 0, 6, 5, ANIM_ONESHOT); // just play it once... - PA_3DStartSpriteAnimEx(2, 0, 6, 5, ANIM_UPDOWN, -1); // back and forth, infinite number of times - PA_3DStartSpriteAnimEx(3, 0, 6, 5, ANIM_LOOP, 5); // Play it 5 times - - PA_OutputSimpleText(0, 0, 6, "Infinite"); - PA_OutputSimpleText(0, 8, 7, "OneShot"); - PA_OutputSimpleText(0, 16, 6, " UpDown"); - PA_OutputSimpleText(0, 24, 7, "5 Times"); - - while(1) - { - PA_WaitForVBL(); - PA_3DProcess(); - } - - return 0; +/* This will show the new sprite animation functions !! Yay ! +Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) +*/ + + +// Includes, only one sprite +#include + + +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount; //Frame count... +const unsigned char explosion[28672] __attribute__ ((aligned (4))); + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_Init3D(); + PA_Reset3DSprites(); + + PA_LoadDefaultText(0, 1); + + // Load the sprite palette, + PA_Load3DSpritePal(0, // Palette number + (void*)explosion_Pal); // Palette name + + // Here, we'll load a few similar sprites sprite to animate... at different speed + PA_3DCreateSprite(0,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 32, 96); + PA_3DCreateSprite(1,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 96, 96); + PA_3DCreateSprite(2,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 160, 96); + PA_3DCreateSprite(3,(void*)explosion_Texture, 64, 64, TEX_256COL, 0, 224, 96); + + // First animation will be normal + PA_3DStartSpriteAnim(0, // sprite number + 0, // first frame is 0 + 6, // last frame is 3, since we have 4 frames... + 5); // Speed, set to 5 frames per second + + // Extended animations for the rest + PA_3DStartSpriteAnimEx(1, 0, 6, 5, ANIM_ONESHOT); // just play it once... + PA_3DStartSpriteAnimEx(2, 0, 6, 5, ANIM_UPDOWN, -1); // back and forth, infinite number of times + PA_3DStartSpriteAnimEx(3, 0, 6, 5, ANIM_LOOP, 5); // Play it 5 times + + PA_OutputSimpleText(0, 0, 6, "Infinite"); + PA_OutputSimpleText(0, 8, 7, "OneShot"); + PA_OutputSimpleText(0, 16, 6, " UpDown"); + PA_OutputSimpleText(0, 24, 7, "5 Times"); + + while(1) + { + PA_WaitForVBL(); + PA_3DProcess(); + } + + return 0; } \ No newline at end of file diff --git a/examples/3DSprites/Effects/3DAlpha/Makefile b/examples/3DSprites/Effects/3DAlpha/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/Effects/3DAlpha/Makefile +++ b/examples/3DSprites/Effects/3DAlpha/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/Effects/3DAlpha/gfx/all_gfx.h b/examples/3DSprites/Effects/3DAlpha/gfx/all_gfx.h index fa16a05..ba0eb38 100644 --- a/examples/3DSprites/Effects/3DAlpha/gfx/all_gfx.h +++ b/examples/3DSprites/Effects/3DAlpha/gfx/all_gfx.h @@ -1,25 +1,25 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // Palette: mollusk_Pal -extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // Palette: AnarX_Pal -extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // Palette: Abrexxes_Pal -extern const unsigned char pasplash_Texture[65536] _GFX_ALIGN; // Palette: pasplash_Pal - -// Palettes: -extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; -extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; -extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; -extern const unsigned short pasplash_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // Palette: mollusk_Pal +extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // Palette: AnarX_Pal +extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // Palette: Abrexxes_Pal +extern const unsigned char pasplash_Texture[65536] _GFX_ALIGN; // Palette: pasplash_Pal + +// Palettes: +extern const unsigned short mollusk_Pal[256] _GFX_ALIGN; +extern const unsigned short AnarX_Pal[256] _GFX_ALIGN; +extern const unsigned short Abrexxes_Pal[256] _GFX_ALIGN; +extern const unsigned short pasplash_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Effects/3DAlpha/source/main.c b/examples/3DSprites/Effects/3DAlpha/source/main.c index 1895a5e..b4c632a 100644 --- a/examples/3DSprites/Effects/3DAlpha/source/main.c +++ b/examples/3DSprites/Effects/3DAlpha/source/main.c @@ -1,73 +1,73 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[4]; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 2, "3DSprites Example : Alpha"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture - 64, 64, // Width, Height - TEX_256COL ); // Texture Format - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_256COL); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_256COL); - gfx[3] = PA_3DCreateTex((void*)pasplash_Texture, 256, 256, TEX_256COL); - - // Load the Palettes ! - PA_Load3DSpritePal(0, // Slot - (void*)mollusk_Pal); // Palette - PA_Load3DSpritePal(1, (void*)AnarX_Pal); - PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); - PA_Load3DSpritePal(3, (void*)pasplash_Pal); - - // Create 3 sprites... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette, unused in 16bit... - 32, 32); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 64, 64); - PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 96, 96); - PA_3DCreateSpriteFromTex(3, gfx[3], 256, 256, 3, 128, 96); - PA_3DSetSpritePrio(3, 800); - - // Different alpha levels for the 3 sprites - PA_3DSetSpriteAlpha(0, 15); - PA_3DSetSpriteAlpha(1, 10); - PA_3DSetSpriteAlpha(2, 5); - PA_3DSetSpriteAlpha(2, 16); - - u8 i; - for(i = 0; i < 4; i++) PA_3DSetSpritePolyID(i, i); // Set a different polyID for each sprite (0-63 values) - - while(1) { - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[4]; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 2, "3DSprites Example : Alpha"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture + 64, 64, // Width, Height + TEX_256COL ); // Texture Format + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_256COL); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_256COL); + gfx[3] = PA_3DCreateTex((void*)pasplash_Texture, 256, 256, TEX_256COL); + + // Load the Palettes ! + PA_Load3DSpritePal(0, // Slot + (void*)mollusk_Pal); // Palette + PA_Load3DSpritePal(1, (void*)AnarX_Pal); + PA_Load3DSpritePal(2, (void*)Abrexxes_Pal); + PA_Load3DSpritePal(3, (void*)pasplash_Pal); + + // Create 3 sprites... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette, unused in 16bit... + 32, 32); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 1, 64, 64); + PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 2, 96, 96); + PA_3DCreateSpriteFromTex(3, gfx[3], 256, 256, 3, 128, 96); + PA_3DSetSpritePrio(3, 800); + + // Different alpha levels for the 3 sprites + PA_3DSetSpriteAlpha(0, 15); + PA_3DSetSpriteAlpha(1, 10); + PA_3DSetSpriteAlpha(2, 5); + PA_3DSetSpriteAlpha(2, 16); + + u8 i; + for(i = 0; i < 4; i++) PA_3DSetSpritePolyID(i, i); // Set a different polyID for each sprite (0-63 values) + + while(1) { + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/Effects/3DDeform/Makefile b/examples/3DSprites/Effects/3DDeform/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/Effects/3DDeform/Makefile +++ b/examples/3DSprites/Effects/3DDeform/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/Effects/3DDeform/gfx/all_gfx.h b/examples/3DSprites/Effects/3DDeform/gfx/all_gfx.h index e3bbb03..1204ca2 100644 --- a/examples/3DSprites/Effects/3DDeform/gfx/all_gfx.h +++ b/examples/3DSprites/Effects/3DDeform/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Effects/3DDeform/source/main.c b/examples/3DSprites/Effects/3DDeform/source/main.c index 6d230b8..6a5d9f9 100644 --- a/examples/3DSprites/Effects/3DDeform/source/main.c +++ b/examples/3DSprites/Effects/3DDeform/source/main.c @@ -1,54 +1,54 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 0, 6, "Touch one of the screen corners to move the sprite corners..."); - - - // Create 3 sprites... - PA_3DCreateSprite(0, // Sprite number - (void*)mollusk_Texture, - 64, 64, // Width, Height - TEX_16BITS, - 0, // Palette, unused in 16bit... - 128, 96); // X, Y SPRITE CENTER ! - - - while(1) { - if(Stylus.Held) { - if((Stylus.X < 128)&&(Stylus.Y < 96)) PA_3DSetSpriteTopLeft(0, Stylus.X - (128-32), Stylus.Y - (96-32)); // Top left corner change - if((Stylus.X > 128)&&(Stylus.Y < 96)) PA_3DSetSpriteTopRight(0, Stylus.X - (128+32), Stylus.Y - (96-32)); // Top left corner change - if((Stylus.X < 128)&&(Stylus.Y > 96)) PA_3DSetSpriteBottomLeft(0, Stylus.X - (128-32), Stylus.Y - (96+32)); // Top left corner change - if((Stylus.X > 128)&&(Stylus.Y > 96)) PA_3DSetSpriteBottomRight(0, Stylus.X - (128+32), Stylus.Y - (96+32)); // Top left corner change - } - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 0, 6, "Touch one of the screen corners to move the sprite corners..."); + + + // Create 3 sprites... + PA_3DCreateSprite(0, // Sprite number + (void*)mollusk_Texture, + 64, 64, // Width, Height + TEX_16BITS, + 0, // Palette, unused in 16bit... + 128, 96); // X, Y SPRITE CENTER ! + + + while(1) { + if(Stylus.Held) { + if((Stylus.X < 128)&&(Stylus.Y < 96)) PA_3DSetSpriteTopLeft(0, Stylus.X - (128-32), Stylus.Y - (96-32)); // Top left corner change + if((Stylus.X > 128)&&(Stylus.Y < 96)) PA_3DSetSpriteTopRight(0, Stylus.X - (128+32), Stylus.Y - (96-32)); // Top left corner change + if((Stylus.X < 128)&&(Stylus.Y > 96)) PA_3DSetSpriteBottomLeft(0, Stylus.X - (128-32), Stylus.Y - (96+32)); // Top left corner change + if((Stylus.X > 128)&&(Stylus.Y > 96)) PA_3DSetSpriteBottomRight(0, Stylus.X - (128+32), Stylus.Y - (96+32)); // Top left corner change + } + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/Effects/3DDeform2/Makefile b/examples/3DSprites/Effects/3DDeform2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/Effects/3DDeform2/Makefile +++ b/examples/3DSprites/Effects/3DDeform2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/Effects/3DDeform2/gfx/all_gfx.h b/examples/3DSprites/Effects/3DDeform2/gfx/all_gfx.h index 4a5a98d..5e039bf 100644 --- a/examples/3DSprites/Effects/3DDeform2/gfx/all_gfx.h +++ b/examples/3DSprites/Effects/3DDeform2/gfx/all_gfx.h @@ -1,21 +1,21 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk0_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char mollusk1_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char mollusk2_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char mollusk3_Texture[4096] _GFX_ALIGN; // 16bit texture - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk0_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char mollusk1_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char mollusk2_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char mollusk3_Texture[4096] _GFX_ALIGN; // 16bit texture + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Effects/3DDeform2/source/main.c b/examples/3DSprites/Effects/3DDeform2/source/main.c index ab36f0c..c311c4f 100644 --- a/examples/3DSprites/Effects/3DDeform2/source/main.c +++ b/examples/3DSprites/Effects/3DDeform2/source/main.c @@ -1,53 +1,53 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0, Init 3D... - PA_Reset3DSprites(); // Init or Reset 3D Sprites - - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 0, 8, "Touch to deform ^^ Doesn't look as good as expected though"); - - - // Create 3 sprites... - PA_3DCreateSprite(0, (void*)mollusk0_Texture,64, 64, TEX_16BITS, 0, 128-32, 96-32); // X, Y SPRITE CENTER ! - PA_3DCreateSprite(1, (void*)mollusk1_Texture,64, 64, TEX_16BITS, 0, 128+32, 96-32); // X, Y SPRITE CENTER ! - PA_3DCreateSprite(2, (void*)mollusk2_Texture,64, 64, TEX_16BITS, 0, 128-32, 96+32); // X, Y SPRITE CENTER ! - PA_3DCreateSprite(3, (void*)mollusk3_Texture,64, 64, TEX_16BITS, 0, 128+32, 96+32); // X, Y SPRITE CENTER ! - - - - while(1) { - if((Stylus.Held)) { // in the center part - PA_3DSetSpriteBottomRight(0, Stylus.X - 128, Stylus.Y - 96); - PA_3DSetSpriteBottomLeft(1, Stylus.X - 128, Stylus.Y - 96); - PA_3DSetSpriteTopRight(2, Stylus.X - 128, Stylus.Y - 96); - PA_3DSetSpriteTopLeft(3, Stylus.X - 128, Stylus.Y - 96); - } - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0, Init 3D... + PA_Reset3DSprites(); // Init or Reset 3D Sprites + + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 0, 8, "Touch to deform ^^ Doesn't look as good as expected though"); + + + // Create 3 sprites... + PA_3DCreateSprite(0, (void*)mollusk0_Texture,64, 64, TEX_16BITS, 0, 128-32, 96-32); // X, Y SPRITE CENTER ! + PA_3DCreateSprite(1, (void*)mollusk1_Texture,64, 64, TEX_16BITS, 0, 128+32, 96-32); // X, Y SPRITE CENTER ! + PA_3DCreateSprite(2, (void*)mollusk2_Texture,64, 64, TEX_16BITS, 0, 128-32, 96+32); // X, Y SPRITE CENTER ! + PA_3DCreateSprite(3, (void*)mollusk3_Texture,64, 64, TEX_16BITS, 0, 128+32, 96+32); // X, Y SPRITE CENTER ! + + + + while(1) { + if((Stylus.Held)) { // in the center part + PA_3DSetSpriteBottomRight(0, Stylus.X - 128, Stylus.Y - 96); + PA_3DSetSpriteBottomLeft(1, Stylus.X - 128, Stylus.Y - 96); + PA_3DSetSpriteTopRight(2, Stylus.X - 128, Stylus.Y - 96); + PA_3DSetSpriteTopLeft(3, Stylus.X - 128, Stylus.Y - 96); + } + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/Effects/3DFlips/Makefile b/examples/3DSprites/Effects/3DFlips/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/3DSprites/Effects/3DFlips/Makefile +++ b/examples/3DSprites/Effects/3DFlips/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/3DSprites/Effects/3DFlips/gfx/all_gfx.h b/examples/3DSprites/Effects/3DFlips/gfx/all_gfx.h index e3bbb03..1204ca2 100644 --- a/examples/3DSprites/Effects/3DFlips/gfx/all_gfx.h +++ b/examples/3DSprites/Effects/3DFlips/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Effects/3DFlips/source/main.c b/examples/3DSprites/Effects/3DFlips/source/main.c index 09eff3f..d425d1a 100644 --- a/examples/3DSprites/Effects/3DFlips/source/main.c +++ b/examples/3DSprites/Effects/3DFlips/source/main.c @@ -1,54 +1,54 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0 - PA_Reset3DSprites(); - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, 1); - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 0, 6, "Move the Sprite with the stylus"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16bit sprites in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS); - - // Create 4 sprites for the different flips...... - PA_3DCreateSpriteFromTex(0, gfx[0], 64, 64, 0, 80, 48); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(1, gfx[0], 64, 64, 0, 80+96, 48); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(2, gfx[0], 64, 64, 0, 80, 80+64); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(3, gfx[0], 64, 64, 0, 80+96, 80+64); // X, Y SPRITE CENTER ! - - // Set the flips - PA_3DSetSpriteHflip(0, 0); PA_3DSetSpriteVflip(0, 0); - PA_3DSetSpriteHflip(1, 1); PA_3DSetSpriteVflip(1, 0); - PA_3DSetSpriteHflip(2, 0); PA_3DSetSpriteVflip(2, 1); - PA_3DSetSpriteHflip(3, 1); PA_3DSetSpriteVflip(3, 1); - - while(1) { - - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0 + PA_Reset3DSprites(); + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, 1); + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 0, 6, "Move the Sprite with the stylus"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16bit sprites in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS); + + // Create 4 sprites for the different flips...... + PA_3DCreateSpriteFromTex(0, gfx[0], 64, 64, 0, 80, 48); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(1, gfx[0], 64, 64, 0, 80+96, 48); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(2, gfx[0], 64, 64, 0, 80, 80+64); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(3, gfx[0], 64, 64, 0, 80+96, 80+64); // X, Y SPRITE CENTER ! + + // Set the flips + PA_3DSetSpriteHflip(0, 0); PA_3DSetSpriteVflip(0, 0); + PA_3DSetSpriteHflip(1, 1); PA_3DSetSpriteVflip(1, 0); + PA_3DSetSpriteHflip(2, 0); PA_3DSetSpriteVflip(2, 1); + PA_3DSetSpriteHflip(3, 1); PA_3DSetSpriteVflip(3, 1); + + while(1) { + + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/Makefile b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/Makefile index 0af8d65..0fd40ba 100644 --- a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/Makefile +++ b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/Makefile @@ -1 +1 @@ -include ../../../../Makefile_example +include ../../../../Makefile_example diff --git a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/gfx/all_gfx.h b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/gfx/all_gfx.h index e3bbb03..1204ca2 100644 --- a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/gfx/all_gfx.h +++ b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/source/main.c b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/source/main.c index 5ae282e..d79b465 100644 --- a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/source/main.c +++ b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteResize/source/main.c @@ -1,56 +1,56 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0 - PA_Reset3DSprites(); - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, 1); - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 6, "Touch the screen to resize !"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS); - - // Create sprite... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette - 128, 96); // X, Y SPRITE CENTER ! - - while(1) { - if(Stylus.Held){ // Resize if held... - if(Stylus.X >= 128) PA_3DSetSpriteWidth(0, (Stylus.X-128)*2); - else PA_3DSetSpriteWidth(0, (128-Stylus.X)*2); - if(Stylus.Y >= 96) PA_3DSetSpriteHeight(0, (Stylus.Y-96)*2); - else PA_3DSetSpriteHeight(0, (96-Stylus.Y)*2); - - } - - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0 + PA_Reset3DSprites(); + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, 1); + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 6, "Touch the screen to resize !"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS); + + // Create sprite... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette + 128, 96); // X, Y SPRITE CENTER ! + + while(1) { + if(Stylus.Held){ // Resize if held... + if(Stylus.X >= 128) PA_3DSetSpriteWidth(0, (Stylus.X-128)*2); + else PA_3DSetSpriteWidth(0, (128-Stylus.X)*2); + if(Stylus.Y >= 96) PA_3DSetSpriteHeight(0, (Stylus.Y-96)*2); + else PA_3DSetSpriteHeight(0, (96-Stylus.Y)*2); + + } + + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/Makefile b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/Makefile index 0af8d65..0fd40ba 100644 --- a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/Makefile +++ b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/Makefile @@ -1 +1 @@ -include ../../../../Makefile_example +include ../../../../Makefile_example diff --git a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/gfx/all_gfx.h b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/gfx/all_gfx.h index 59a25f1..303df11 100644 --- a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/gfx/all_gfx.h +++ b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // 16bit texture - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // 16bit texture + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/source/main.c b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/source/main.c index 8f31ee5..b0569f0 100644 --- a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/source/main.c +++ b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotate/source/main.c @@ -1,64 +1,64 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0 - PA_Reset3DSprites(); - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, 1); - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 6, "3D Sprite Rotation !"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS); - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16BITS); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16BITS); - - - // Create 3 sprites... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette - 32, 32); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 0, 96, 96); - PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 0, 160, 96+64); - - u16 rot = 0; - - while(1) { - rot += 4; // add to angle... - rot &= 511; // limit range to 0-511... - - PA_3DSetSpriteRotate(0, rot); // Sprite, angle (0-511) - PA_3DSetSpriteRotate(1, -rot); // Other way around - PA_3DSetSpriteRotate(2, rot*2); // Twice as fast - - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0 + PA_Reset3DSprites(); + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, 1); + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 6, "3D Sprite Rotation !"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS); + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16BITS); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16BITS); + + + // Create 3 sprites... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette + 32, 32); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 0, 96, 96); + PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 0, 160, 96+64); + + u16 rot = 0; + + while(1) { + rot += 4; // add to angle... + rot &= 511; // limit range to 0-511... + + PA_3DSetSpriteRotate(0, rot); // Sprite, angle (0-511) + PA_3DSetSpriteRotate(1, -rot); // Other way around + PA_3DSetSpriteRotate(2, rot*2); // Twice as fast + + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/Makefile b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/Makefile index 0af8d65..0fd40ba 100644 --- a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/Makefile +++ b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/Makefile @@ -1 +1 @@ -include ../../../../Makefile_example +include ../../../../Makefile_example diff --git a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/gfx/all_gfx.h b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/gfx/all_gfx.h index 59a25f1..303df11 100644 --- a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/gfx/all_gfx.h +++ b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // 16bit texture - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // 16bit texture + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/source/main.c b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/source/main.c index 7607f0d..48f1ca3 100644 --- a/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/source/main.c +++ b/examples/3DSprites/Effects/3DRotAndZoom/3DSpriteRotateXY/source/main.c @@ -1,64 +1,64 @@ -/* -// 3DCreateSprite -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -u16 gfx[3]; - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0 - PA_Reset3DSprites(); - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, 1); - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 6, "3D Sprite Rotations Revisited ^^"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS); - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16BITS); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16BITS); - - - // Create 3 sprites... - PA_3DCreateSpriteFromTex(0, // Sprite number - gfx[0], // Gfx... - 64, 64, // Width, Height - 0, // Palette - 32, 32); // X, Y SPRITE CENTER ! - PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 0, 96, 96); - PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 0, 160, 96+64); - - u16 rot = 0; - - while(1) { - rot += 4; // add to angle... - rot &= 511; // limit range to 0-511... -// if(Stylus.Held) PA_3DSetSpriteXY(0, Stylus.X, Stylus.Y); - - PA_3DSetSpriteRotateX(0, rot); // Xrot - PA_3DSetSpriteRotateY(1, rot); // Yrot - PA_3DSetSpriteRotateXYZ(2, rot, rot, rot); // Let's do triple rotation and see what it does ^^ - - - PA_WaitForVBL(); - PA_3DProcess(); // Update sprites - } - - - - return 0; +/* +// 3DCreateSprite +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + + +u16 gfx[3]; + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0 + PA_Reset3DSprites(); + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, 1); + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 6, "3D Sprite Rotations Revisited ^^"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS); + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16BITS); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16BITS); + + + // Create 3 sprites... + PA_3DCreateSpriteFromTex(0, // Sprite number + gfx[0], // Gfx... + 64, 64, // Width, Height + 0, // Palette + 32, 32); // X, Y SPRITE CENTER ! + PA_3DCreateSpriteFromTex(1, gfx[1], 64, 64, 0, 96, 96); + PA_3DCreateSpriteFromTex(2, gfx[2], 64, 64, 0, 160, 96+64); + + u16 rot = 0; + + while(1) { + rot += 4; // add to angle... + rot &= 511; // limit range to 0-511... +// if(Stylus.Held) PA_3DSetSpriteXY(0, Stylus.X, Stylus.Y); + + PA_3DSetSpriteRotateX(0, rot); // Xrot + PA_3DSetSpriteRotateY(1, rot); // Yrot + PA_3DSetSpriteRotateXYZ(2, rot, rot, rot); // Let's do triple rotation and see what it does ^^ + + + PA_WaitForVBL(); + PA_3DProcess(); // Update sprites + } + + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/3DSprites/KeybAnd3D/Makefile b/examples/3DSprites/KeybAnd3D/Makefile index 21f133f..a49fbfb 100644 --- a/examples/3DSprites/KeybAnd3D/Makefile +++ b/examples/3DSprites/KeybAnd3D/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/3DSprites/KeybAnd3D/gfx/all_gfx.h b/examples/3DSprites/KeybAnd3D/gfx/all_gfx.h index 59a25f1..303df11 100644 --- a/examples/3DSprites/KeybAnd3D/gfx/all_gfx.h +++ b/examples/3DSprites/KeybAnd3D/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // 16bit texture -extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // 16bit texture - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char AnarX_Texture[4096] _GFX_ALIGN; // 16bit texture +extern const unsigned char Abrexxes_Texture[4096] _GFX_ALIGN; // 16bit texture + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/3DSprites/KeybAnd3D/source/main.c b/examples/3DSprites/KeybAnd3D/source/main.c index 7ea5990..403a8f1 100644 --- a/examples/3DSprites/KeybAnd3D/source/main.c +++ b/examples/3DSprites/KeybAnd3D/source/main.c @@ -1,89 +1,89 @@ -/* -// 3D Sprite Moving example... -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - -#define N_SPRITES 128 // Number of sprites in the example - -u16 gfx[3]; - -typedef struct{ - s32 x, y, vx, vy; -} spritepos; -spritepos sprites[1024]; // Let's manage the sprite positions ^^ - - - - -// Function: main() -int main(void) -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0 - PA_Reset3DSprites(); - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, 1); - PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 2, 6, " 3d Sprite Example, 1024 64x64sprites resized to 16x16 and moving around !"); - - // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx - gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture - 64, 64, // Width, Height - TEX_16BITS ); // Texture Format - gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16BITS); - gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16BITS); - - s32 i; - u16 angle; - for(i = 0; i < N_SPRITES; i++) { - sprites[i].x = ((i&31)<<4); - sprites[i].y = ((i>>5)<<4)-32; - PA_3DCreateSpriteFromTex(i, // Sprite number - gfx[PA_Rand()%3], // Gfx, random one :p - 64, 64, // Width, Height - 0, // Palette - sprites[i].x, sprites[i].y); // X, Y - PA_3DSetSpriteWidthHeight(i, 16, 16); // Resize to way smaller ^^ - angle = PA_Rand()&511; // random angle - sprites[i].vx = PA_Cos(angle)>>7; - sprites[i].vy = -PA_Sin(angle)>>7; - } - - PA_SwitchScreens(); // Put the 3D on top - - PA_SetKeyboardScreen(1); // Top screen - PA_LoadDefaultKeyboard(1); // Bg 1 - - PA_WaitForVBL(); - PA_3DProcess(); // Update 3DSprites - - PA_KeyboardIn(16, 192-104); // Scroll in - - while(1) { - - for(i = 0; i < N_SPRITES; i++){ // Move them around and change speed if touches screen - sprites[i].x += sprites[i].vx; - if(((sprites[i].x <= 8)&&(sprites[i].vx < 0))||((sprites[i].x>=255-8)&&(sprites[i].vx > 0))) sprites[i].vx = -sprites[i].vx; - sprites[i].y += sprites[i].vy; - if(((sprites[i].y <= 8)&&(sprites[i].vy < 0))||((sprites[i].y>=191-8)&&(sprites[i].vy > 0))) sprites[i].vy = -sprites[i].vy; - PA_3DSetSpriteXY(i, sprites[i].x, sprites[i].y); // Set new position - } - - PA_CheckKeyboard(); - - PA_WaitForVBL(); - PA_3DProcess(); // Update 3DSprites - } - - - - return 0; -} // End of main() +/* +// 3D Sprite Moving example... +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + +#define N_SPRITES 128 // Number of sprites in the example + +u16 gfx[3]; + +typedef struct{ + s32 x, y, vx, vy; +} spritepos; +spritepos sprites[1024]; // Let's manage the sprite positions ^^ + + + + +// Function: main() +int main(void) +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0 + PA_Reset3DSprites(); + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, 1); + PA_LoadDefaultText(1, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 2, 6, " 3d Sprite Example, 1024 64x64sprites resized to 16x16 and moving around !"); + + // First, create the gfx with the corresponding images and sizes. Images converted as 16bit textures in PAGfx + gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, // Texture + 64, 64, // Width, Height + TEX_16BITS ); // Texture Format + gfx[1] = PA_3DCreateTex((void*)AnarX_Texture, 64, 64, TEX_16BITS); + gfx[2] = PA_3DCreateTex((void*)Abrexxes_Texture, 64, 64, TEX_16BITS); + + s32 i; + u16 angle; + for(i = 0; i < N_SPRITES; i++) { + sprites[i].x = ((i&31)<<4); + sprites[i].y = ((i>>5)<<4)-32; + PA_3DCreateSpriteFromTex(i, // Sprite number + gfx[PA_Rand()%3], // Gfx, random one :p + 64, 64, // Width, Height + 0, // Palette + sprites[i].x, sprites[i].y); // X, Y + PA_3DSetSpriteWidthHeight(i, 16, 16); // Resize to way smaller ^^ + angle = PA_Rand()&511; // random angle + sprites[i].vx = PA_Cos(angle)>>7; + sprites[i].vy = -PA_Sin(angle)>>7; + } + + PA_SwitchScreens(); // Put the 3D on top + + PA_SetKeyboardScreen(1); // Top screen + PA_LoadDefaultKeyboard(1); // Bg 1 + + PA_WaitForVBL(); + PA_3DProcess(); // Update 3DSprites + + PA_KeyboardIn(16, 192-104); // Scroll in + + while(1) { + + for(i = 0; i < N_SPRITES; i++){ // Move them around and change speed if touches screen + sprites[i].x += sprites[i].vx; + if(((sprites[i].x <= 8)&&(sprites[i].vx < 0))||((sprites[i].x>=255-8)&&(sprites[i].vx > 0))) sprites[i].vx = -sprites[i].vx; + sprites[i].y += sprites[i].vy; + if(((sprites[i].y <= 8)&&(sprites[i].vy < 0))||((sprites[i].y>=191-8)&&(sprites[i].vy > 0))) sprites[i].vy = -sprites[i].vy; + PA_3DSetSpriteXY(i, sprites[i].x, sprites[i].y); // Set new position + } + + PA_CheckKeyboard(); + + PA_WaitForVBL(); + PA_3DProcess(); // Update 3DSprites + } + + + + return 0; +} // End of main() diff --git a/examples/Backgrounds/Advanced/GetBgPixel/Makefile b/examples/Backgrounds/Advanced/GetBgPixel/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel/Makefile +++ b/examples/Backgrounds/Advanced/GetBgPixel/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Advanced/GetBgPixel/gfx/all_gfx.h b/examples/Backgrounds/Advanced/GetBgPixel/gfx/all_gfx.h index a7cfe50..42ac0a8 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel/gfx/all_gfx.h +++ b/examples/Backgrounds/Advanced/GetBgPixel/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct bg0; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct bg0; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Advanced/GetBgPixel/gfx/bin/bg0.c b/examples/Backgrounds/Advanced/GetBgPixel/gfx/bin/bg0.c index 2dc4b20..62deca7 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel/gfx/bin/bg0.c +++ b/examples/Backgrounds/Advanced/GetBgPixel/gfx/bin/bg0.c @@ -1,17 +1,17 @@ -#include - -extern const char bg0_Tiles[]; -extern const char bg0_Map[]; -extern const char bg0_Pal[]; - -const PA_BgStruct bg0 = { - PA_BgNormal, - 256, 192, - - bg0_Tiles, - bg0_Map, - {bg0_Pal}, - - 12352, - {1536} -}; +#include + +extern const char bg0_Tiles[]; +extern const char bg0_Map[]; +extern const char bg0_Pal[]; + +const PA_BgStruct bg0 = { + PA_BgNormal, + 256, 192, + + bg0_Tiles, + bg0_Map, + {bg0_Pal}, + + 12352, + {1536} +}; diff --git a/examples/Backgrounds/Advanced/GetBgPixel/source/main.c b/examples/Backgrounds/Advanced/GetBgPixel/source/main.c index 59d46fb..c863970 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel/source/main.c +++ b/examples/Backgrounds/Advanced/GetBgPixel/source/main.c @@ -1,27 +1,27 @@ -// Includes -#include - -// Converted using PAGfx -#include "all_gfx.h" - -int main(){ - PA_Init(); - - PA_LoadDefaultText(1, 0); - - // Load Backgrounds with their palettes ! - PA_LoadBackground(0, // screen - 3, // background number (0-3) - &bg0); // Background name, used by PAGfx... - - PA_OutputSimpleText(1, 2, 10, "Touch the screen to display the color on top screen"); - - // Infinite loop to keep the program running - while(true){ - PA_OutputText(1, 2, 5, "Palette Color : %d ", PA_EasyBgGetPixel(0, 3, Stylus.X, Stylus.Y)); // Screen, Bg_number, X/Y position - // Returns the palette number (0-255) - - PA_SetBgColor(1, PA_EasyBgGetPixelCol(0, 3, Stylus.X, Stylus.Y)); // Same thing, but returns Color value... - PA_WaitForVBL(); - } +// Includes +#include + +// Converted using PAGfx +#include "all_gfx.h" + +int main(){ + PA_Init(); + + PA_LoadDefaultText(1, 0); + + // Load Backgrounds with their palettes ! + PA_LoadBackground(0, // screen + 3, // background number (0-3) + &bg0); // Background name, used by PAGfx... + + PA_OutputSimpleText(1, 2, 10, "Touch the screen to display the color on top screen"); + + // Infinite loop to keep the program running + while(true){ + PA_OutputText(1, 2, 5, "Palette Color : %d ", PA_EasyBgGetPixel(0, 3, Stylus.X, Stylus.Y)); // Screen, Bg_number, X/Y position + // Returns the palette number (0-255) + + PA_SetBgColor(1, PA_EasyBgGetPixelCol(0, 3, Stylus.X, Stylus.Y)); // Same thing, but returns Color value... + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/Advanced/GetBgPixel2/Makefile b/examples/Backgrounds/Advanced/GetBgPixel2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel2/Makefile +++ b/examples/Backgrounds/Advanced/GetBgPixel2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Advanced/GetBgPixel2/gfx/all_gfx.h b/examples/Backgrounds/Advanced/GetBgPixel2/gfx/all_gfx.h index a874008..06533aa 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel2/gfx/all_gfx.h +++ b/examples/Backgrounds/Advanced/GetBgPixel2/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct zelda; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct zelda; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Advanced/GetBgPixel2/gfx/bin/zelda.c b/examples/Backgrounds/Advanced/GetBgPixel2/gfx/bin/zelda.c index 77e1eda..2a27270 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel2/gfx/bin/zelda.c +++ b/examples/Backgrounds/Advanced/GetBgPixel2/gfx/bin/zelda.c @@ -1,17 +1,17 @@ -#include - -extern const char zelda_Tiles[]; -extern const char zelda_Map[]; -extern const char zelda_Pal[]; - -const PA_BgStruct zelda = { - PA_BgLarge, - 2048, 2048, - - zelda_Tiles, - zelda_Map, - {zelda_Pal}, - - 15552, - {131072} -}; +#include + +extern const char zelda_Tiles[]; +extern const char zelda_Map[]; +extern const char zelda_Pal[]; + +const PA_BgStruct zelda = { + PA_BgLarge, + 2048, 2048, + + zelda_Tiles, + zelda_Map, + {zelda_Pal}, + + 15552, + {131072} +}; diff --git a/examples/Backgrounds/Advanced/GetBgPixel2/source/main.c b/examples/Backgrounds/Advanced/GetBgPixel2/source/main.c index 38e1ec0..f1ce1ac 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel2/source/main.c +++ b/examples/Backgrounds/Advanced/GetBgPixel2/source/main.c @@ -1,40 +1,40 @@ -#include - -// Converted using PAGfx -#include "all_gfx.h" - -int main(){ - PA_Init(); - - // Load a background converted with PAGfx... - PA_LoadBackground(0, //screen - 3, //background number (0-3) - &zelda); // Name - - PA_LoadDefaultText(1, 0); - - PA_OutputSimpleText(1, 2, 10, "Touch the screen to display the color on top screen"); - - // Next we'll scroll, here are the variables... - s32 scrollx = 0; - s32 scrolly = 0; - - // Infinite loop to keep the program running - while(true){ - // We need to change the scroll according to the held keys... - scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time - scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing - - PA_EasyBgScrollXY(0, // screen - 3, // background number - scrollx, // X scroll - scrolly); // and Y scroll - - PA_OutputText(1, 2, 5, "Palette Color: %d ", PA_EasyBgGetPixel(0, 3, Stylus.X, Stylus.Y)); // Screen, Bg_number, X/Y position - // Returns the palette number (0-255) - - PA_SetBgColor(1, PA_EasyBgGetPixelCol(0, 3, Stylus.X, Stylus.Y)); // Same thing, but returns Color value... - - PA_WaitForVBL(); - } +#include + +// Converted using PAGfx +#include "all_gfx.h" + +int main(){ + PA_Init(); + + // Load a background converted with PAGfx... + PA_LoadBackground(0, //screen + 3, //background number (0-3) + &zelda); // Name + + PA_LoadDefaultText(1, 0); + + PA_OutputSimpleText(1, 2, 10, "Touch the screen to display the color on top screen"); + + // Next we'll scroll, here are the variables... + s32 scrollx = 0; + s32 scrolly = 0; + + // Infinite loop to keep the program running + while(true){ + // We need to change the scroll according to the held keys... + scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time + scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing + + PA_EasyBgScrollXY(0, // screen + 3, // background number + scrollx, // X scroll + scrolly); // and Y scroll + + PA_OutputText(1, 2, 5, "Palette Color: %d ", PA_EasyBgGetPixel(0, 3, Stylus.X, Stylus.Y)); // Screen, Bg_number, X/Y position + // Returns the palette number (0-255) + + PA_SetBgColor(1, PA_EasyBgGetPixelCol(0, 3, Stylus.X, Stylus.Y)); // Same thing, but returns Color value... + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/Advanced/GetBgPixel3/Makefile b/examples/Backgrounds/Advanced/GetBgPixel3/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel3/Makefile +++ b/examples/Backgrounds/Advanced/GetBgPixel3/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Advanced/GetBgPixel3/gfx/all_gfx.h b/examples/Backgrounds/Advanced/GetBgPixel3/gfx/all_gfx.h index 0f15b80..e9b9fa9 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel3/gfx/all_gfx.h +++ b/examples/Backgrounds/Advanced/GetBgPixel3/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct Town; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct Town; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Advanced/GetBgPixel3/gfx/bin/Town.c b/examples/Backgrounds/Advanced/GetBgPixel3/gfx/bin/Town.c index 065224a..e038b4d 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel3/gfx/bin/Town.c +++ b/examples/Backgrounds/Advanced/GetBgPixel3/gfx/bin/Town.c @@ -1,17 +1,17 @@ -#include - -extern const char Town_Tiles[]; -extern const char Town_Map[]; -extern const char Town_Pal[]; - -const PA_BgStruct Town = { - PA_BgUnlimited, - 1024, 1024, - - Town_Tiles, - Town_Map, - {Town_Pal}, - - 114560, - {16384} -}; +#include + +extern const char Town_Tiles[]; +extern const char Town_Map[]; +extern const char Town_Pal[]; + +const PA_BgStruct Town = { + PA_BgUnlimited, + 1024, 1024, + + Town_Tiles, + Town_Map, + {Town_Pal}, + + 114560, + {16384} +}; diff --git a/examples/Backgrounds/Advanced/GetBgPixel3/source/main.c b/examples/Backgrounds/Advanced/GetBgPixel3/source/main.c index bbf62f2..b00029b 100644 --- a/examples/Backgrounds/Advanced/GetBgPixel3/source/main.c +++ b/examples/Backgrounds/Advanced/GetBgPixel3/source/main.c @@ -1,34 +1,34 @@ -#include - -// Converted using PAGfx -#include "all_gfx.h" - -int main(){ - PA_Init(); - - PA_LoadDefaultText(1, 0); - - // Load a background converted with PAGfx... InfiniteMap - PA_LoadBackground(0, //screen - 3, //background number (0-3) - &Town); // Name - - // Next we'll scroll, here are the variables... - s32 scrollx = 0; - s32 scrolly = 0; - - // Infinite loop to keep the program running - while(true){ - // We need to change the scroll according to the held keys... - scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time - scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing - PA_EasyBgScrollXY(0, 3, scrollx, scrolly); - - PA_OutputText(1, 2, 5, "Palette Color: %d ", PA_EasyBgGetPixel(0, 3, Stylus.X, Stylus.Y)); // Screen, Bg_number, X/Y position - // Returns the palette number (0-255) - - PA_SetBgColor(1, PA_EasyBgGetPixelCol(0, 3, Stylus.X, Stylus.Y)); // Same thing, but returns Color value... - - PA_WaitForVBL(); - } +#include + +// Converted using PAGfx +#include "all_gfx.h" + +int main(){ + PA_Init(); + + PA_LoadDefaultText(1, 0); + + // Load a background converted with PAGfx... InfiniteMap + PA_LoadBackground(0, //screen + 3, //background number (0-3) + &Town); // Name + + // Next we'll scroll, here are the variables... + s32 scrollx = 0; + s32 scrolly = 0; + + // Infinite loop to keep the program running + while(true){ + // We need to change the scroll according to the held keys... + scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time + scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing + PA_EasyBgScrollXY(0, 3, scrollx, scrolly); + + PA_OutputText(1, 2, 5, "Palette Color: %d ", PA_EasyBgGetPixel(0, 3, Stylus.X, Stylus.Y)); // Screen, Bg_number, X/Y position + // Returns the palette number (0-255) + + PA_SetBgColor(1, PA_EasyBgGetPixelCol(0, 3, Stylus.X, Stylus.Y)); // Same thing, but returns Color value... + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/Advanced/Parallax/Makefile b/examples/Backgrounds/Advanced/Parallax/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Advanced/Parallax/Makefile +++ b/examples/Backgrounds/Advanced/Parallax/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Advanced/Parallax/gfx/all_gfx.h b/examples/Backgrounds/Advanced/Parallax/gfx/all_gfx.h index 536ce48..4ef116a 100644 --- a/examples/Backgrounds/Advanced/Parallax/gfx/all_gfx.h +++ b/examples/Backgrounds/Advanced/Parallax/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct BG1; -extern const PA_BgStruct BG2; -extern const PA_BgStruct BG3; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct BG1; +extern const PA_BgStruct BG2; +extern const PA_BgStruct BG3; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG1.c b/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG1.c index d8ea2d7..bb52108 100644 --- a/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG1.c +++ b/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG1.c @@ -1,17 +1,17 @@ -#include - -extern const char BG1_Tiles[]; -extern const char BG1_Map[]; -extern const char BG1_Pal[]; - -const PA_BgStruct BG1 = { - PA_BgNormal, - 256, 256, - - BG1_Tiles, - BG1_Map, - {BG1_Pal}, - - 3712, - {2048} -}; +#include + +extern const char BG1_Tiles[]; +extern const char BG1_Map[]; +extern const char BG1_Pal[]; + +const PA_BgStruct BG1 = { + PA_BgNormal, + 256, 256, + + BG1_Tiles, + BG1_Map, + {BG1_Pal}, + + 3712, + {2048} +}; diff --git a/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG2.c b/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG2.c index a3454ec..023fc73 100644 --- a/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG2.c +++ b/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG2.c @@ -1,17 +1,17 @@ -#include - -extern const char BG2_Tiles[]; -extern const char BG2_Map[]; -extern const char BG2_Pal[]; - -const PA_BgStruct BG2 = { - PA_BgNormal, - 256, 256, - - BG2_Tiles, - BG2_Map, - {BG2_Pal}, - - 1472, - {2048} -}; +#include + +extern const char BG2_Tiles[]; +extern const char BG2_Map[]; +extern const char BG2_Pal[]; + +const PA_BgStruct BG2 = { + PA_BgNormal, + 256, 256, + + BG2_Tiles, + BG2_Map, + {BG2_Pal}, + + 1472, + {2048} +}; diff --git a/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG3.c b/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG3.c index 61b2790..14d5c9c 100644 --- a/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG3.c +++ b/examples/Backgrounds/Advanced/Parallax/gfx/bin/BG3.c @@ -1,17 +1,17 @@ -#include - -extern const char BG3_Tiles[]; -extern const char BG3_Map[]; -extern const char BG3_Pal[]; - -const PA_BgStruct BG3 = { - PA_BgNormal, - 256, 256, - - BG3_Tiles, - BG3_Map, - {BG3_Pal}, - - 65536, - {2048} -}; +#include + +extern const char BG3_Tiles[]; +extern const char BG3_Map[]; +extern const char BG3_Pal[]; + +const PA_BgStruct BG3 = { + PA_BgNormal, + 256, 256, + + BG3_Tiles, + BG3_Map, + {BG3_Pal}, + + 65536, + {2048} +}; diff --git a/examples/Backgrounds/Advanced/Parallax/source/main.c b/examples/Backgrounds/Advanced/Parallax/source/main.c index 92f2a3d..547feb1 100644 --- a/examples/Backgrounds/Advanced/Parallax/source/main.c +++ b/examples/Backgrounds/Advanced/Parallax/source/main.c @@ -1,35 +1,35 @@ -// Includes -#include - -#include "all_gfx.h" - -int main(){ - PA_Init(); - - // Load the 4 Backgrounds on the bottom screen... - PA_LoadBackground(0, 1, &BG1); - PA_LoadBackground(0, 2, &BG2); - PA_LoadBackground(0, 3, &BG3); - - // Initialise parallax vertically (Y axis) for both backgrounds - // 256 is normal speed, 128 half speed, 512 twice as fast... - PA_InitParallaxY(0, //screen - 0, //Parallax speed for Background 0. 0 is no parallax (will scroll independently with BGScroll) - 256, // Normal speed for Bg1 - 192, // 3/4 speed - 128); // Half speed - PA_InitParallaxY(1, 0, 256, 192, 128); // Same thing, but for SCreen 1... - - s32 scroll = 0; - - // Infinite loop to keep the program running - while(true){ - scroll ++; // Scroll by one pixel... - // Backgrounds with a parallax speed of 256 will scroll 1 pixel, 192 will scroll 0.75, and 128 0.5 - // We could also have put a negative parallax speed to have some backgrounds scroll in different directions - - PA_ParallaxScrollY(0, -scroll); // Scroll the screen 0 backgrounds. - - PA_WaitForVBL(); - } +// Includes +#include + +#include "all_gfx.h" + +int main(){ + PA_Init(); + + // Load the 4 Backgrounds on the bottom screen... + PA_LoadBackground(0, 1, &BG1); + PA_LoadBackground(0, 2, &BG2); + PA_LoadBackground(0, 3, &BG3); + + // Initialise parallax vertically (Y axis) for both backgrounds + // 256 is normal speed, 128 half speed, 512 twice as fast... + PA_InitParallaxY(0, //screen + 0, //Parallax speed for Background 0. 0 is no parallax (will scroll independently with BGScroll) + 256, // Normal speed for Bg1 + 192, // 3/4 speed + 128); // Half speed + PA_InitParallaxY(1, 0, 256, 192, 128); // Same thing, but for SCreen 1... + + s32 scroll = 0; + + // Infinite loop to keep the program running + while(true){ + scroll ++; // Scroll by one pixel... + // Backgrounds with a parallax speed of 256 will scroll 1 pixel, 192 will scroll 0.75, and 128 0.5 + // We could also have put a negative parallax speed to have some backgrounds scroll in different directions + + PA_ParallaxScrollY(0, -scroll); // Scroll the screen 0 backgrounds. + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/Advanced/RotBgTiles/Makefile b/examples/Backgrounds/Advanced/RotBgTiles/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Advanced/RotBgTiles/Makefile +++ b/examples/Backgrounds/Advanced/RotBgTiles/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Advanced/RotBgTiles/gfx/all_gfx.h b/examples/Backgrounds/Advanced/RotBgTiles/gfx/all_gfx.h index 65a419c..3a6ea49 100644 --- a/examples/Backgrounds/Advanced/RotBgTiles/gfx/all_gfx.h +++ b/examples/Backgrounds/Advanced/RotBgTiles/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct Rot; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct Rot; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Advanced/RotBgTiles/gfx/bin/Rot.c b/examples/Backgrounds/Advanced/RotBgTiles/gfx/bin/Rot.c index 6e0b1c4..b6622c6 100644 --- a/examples/Backgrounds/Advanced/RotBgTiles/gfx/bin/Rot.c +++ b/examples/Backgrounds/Advanced/RotBgTiles/gfx/bin/Rot.c @@ -1,17 +1,17 @@ -#include - -extern const char Rot_Tiles[]; -extern const char Rot_Map[]; -extern const char Rot_Pal[]; - -const PA_BgStruct Rot = { - PA_BgRot, - 256, 256, - - Rot_Tiles, - Rot_Map, - {Rot_Pal}, - - 1024, - {1024} -}; +#include + +extern const char Rot_Tiles[]; +extern const char Rot_Map[]; +extern const char Rot_Pal[]; + +const PA_BgStruct Rot = { + PA_BgRot, + 256, 256, + + Rot_Tiles, + Rot_Map, + {Rot_Pal}, + + 1024, + {1024} +}; diff --git a/examples/Backgrounds/Advanced/RotBgTiles/source/main.c b/examples/Backgrounds/Advanced/RotBgTiles/source/main.c index 6c5a48e..395867b 100644 --- a/examples/Backgrounds/Advanced/RotBgTiles/source/main.c +++ b/examples/Backgrounds/Advanced/RotBgTiles/source/main.c @@ -1,40 +1,40 @@ -#include - -#include "all_gfx.h" - -int main(){ - PA_Init(); - - PA_SetVideoMode(0, 2); //screen, mode - - PA_LoadBackground(0, //screen - 3, // background number - &Rot); // background name in PAGfx - - PA_SetBgWrap(0, 3, 1); - PA_LoadDefaultText(1, 0); - - PA_OutputSimpleText(1, 0, 10, "Stylus to change a given RotTile"); - PA_OutputSimpleText(1, 0, 12, "Up/Down to change tile number: "); - - int tilenumber = 0; - - while(true){ - // Change tile number according to keys - if (Pad.Newpress.Up && (tilenumber < 15)) tilenumber++; // limited number of tiles on this background, just for test :) - if (Pad.Newpress.Down && (tilenumber >0)) tilenumber--; - - PA_OutputText(1, 2, 13, "Tile : %02d", tilenumber); // Display tile number - - if(Stylus.Held) - PA_SetRotMapTile(0, // screen - 3, //bg_select - Stylus.X >> 3, // X in tiles, each tile being 8x8 you divide by 8 (equivalent to >> 3) - Stylus.Y >> 3, // Same as for X, but for Y... - tilenumber); // Tile Number, 0-255 - - PA_WaitForVBL(); - } - - return 0; +#include + +#include "all_gfx.h" + +int main(){ + PA_Init(); + + PA_SetVideoMode(0, 2); //screen, mode + + PA_LoadBackground(0, //screen + 3, // background number + &Rot); // background name in PAGfx + + PA_SetBgWrap(0, 3, 1); + PA_LoadDefaultText(1, 0); + + PA_OutputSimpleText(1, 0, 10, "Stylus to change a given RotTile"); + PA_OutputSimpleText(1, 0, 12, "Up/Down to change tile number: "); + + int tilenumber = 0; + + while(true){ + // Change tile number according to keys + if (Pad.Newpress.Up && (tilenumber < 15)) tilenumber++; // limited number of tiles on this background, just for test :) + if (Pad.Newpress.Down && (tilenumber >0)) tilenumber--; + + PA_OutputText(1, 2, 13, "Tile : %02d", tilenumber); // Display tile number + + if(Stylus.Held) + PA_SetRotMapTile(0, // screen + 3, //bg_select + Stylus.X >> 3, // X in tiles, each tile being 8x8 you divide by 8 (equivalent to >> 3) + Stylus.Y >> 3, // Same as for X, but for Y... + tilenumber); // Tile Number, 0-255 + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Backgrounds/Basics/LargeBgs/Makefile b/examples/Backgrounds/Basics/LargeBgs/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Basics/LargeBgs/Makefile +++ b/examples/Backgrounds/Basics/LargeBgs/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Basics/LargeBgs/gfx/all_gfx.h b/examples/Backgrounds/Basics/LargeBgs/gfx/all_gfx.h index a874008..06533aa 100644 --- a/examples/Backgrounds/Basics/LargeBgs/gfx/all_gfx.h +++ b/examples/Backgrounds/Basics/LargeBgs/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct zelda; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct zelda; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Basics/LargeBgs/gfx/bin/zelda.c b/examples/Backgrounds/Basics/LargeBgs/gfx/bin/zelda.c index 77e1eda..2a27270 100644 --- a/examples/Backgrounds/Basics/LargeBgs/gfx/bin/zelda.c +++ b/examples/Backgrounds/Basics/LargeBgs/gfx/bin/zelda.c @@ -1,17 +1,17 @@ -#include - -extern const char zelda_Tiles[]; -extern const char zelda_Map[]; -extern const char zelda_Pal[]; - -const PA_BgStruct zelda = { - PA_BgLarge, - 2048, 2048, - - zelda_Tiles, - zelda_Map, - {zelda_Pal}, - - 15552, - {131072} -}; +#include + +extern const char zelda_Tiles[]; +extern const char zelda_Map[]; +extern const char zelda_Pal[]; + +const PA_BgStruct zelda = { + PA_BgLarge, + 2048, 2048, + + zelda_Tiles, + zelda_Map, + {zelda_Pal}, + + 15552, + {131072} +}; diff --git a/examples/Backgrounds/Basics/LargeBgs/source/main.c b/examples/Backgrounds/Basics/LargeBgs/source/main.c index 2b55902..2e8a9c0 100644 --- a/examples/Backgrounds/Basics/LargeBgs/source/main.c +++ b/examples/Backgrounds/Basics/LargeBgs/source/main.c @@ -1,39 +1,39 @@ -// Includes -#include - -// Converted using PAGfxConverter -#include "all_gfx.h" - -int main(){ - PA_Init(); - - // Load a large scrolling background converted with PAGfx... - PA_LoadBackground(0, // Screen - 3, // Background number (0-3) - &zelda); // Name - - // Next we'll scroll, here are the variables... - s32 scrollx = 0; - s32 scrolly = 0; - - // Infinite loop to keep the program running - while(true){ - PA_WaitForVBL(); - - // We need to change the scroll according to the held keys... - scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time - scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing - - if(scrollx < 0) scrollx = 0; - if(scrollx > (2048-256)) scrollx = (2048-256); - - if(scrolly < 0) scrolly = 0; - if(scrolly > (2048-192)) scrolly = (2048-192); - - PA_EasyBgScrollXY(0, // screen - 3, // background number - scrollx, // X scroll - scrolly); // and Y scroll - - } +// Includes +#include + +// Converted using PAGfxConverter +#include "all_gfx.h" + +int main(){ + PA_Init(); + + // Load a large scrolling background converted with PAGfx... + PA_LoadBackground(0, // Screen + 3, // Background number (0-3) + &zelda); // Name + + // Next we'll scroll, here are the variables... + s32 scrollx = 0; + s32 scrolly = 0; + + // Infinite loop to keep the program running + while(true){ + PA_WaitForVBL(); + + // We need to change the scroll according to the held keys... + scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time + scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing + + if(scrollx < 0) scrollx = 0; + if(scrollx > (2048-256)) scrollx = (2048-256); + + if(scrolly < 0) scrolly = 0; + if(scrolly > (2048-192)) scrolly = (2048-192); + + PA_EasyBgScrollXY(0, // screen + 3, // background number + scrollx, // X scroll + scrolly); // and Y scroll + + } } \ No newline at end of file diff --git a/examples/Backgrounds/Basics/NormalBgs/Makefile b/examples/Backgrounds/Basics/NormalBgs/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Basics/NormalBgs/Makefile +++ b/examples/Backgrounds/Basics/NormalBgs/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Basics/NormalBgs/gfx/all_gfx.h b/examples/Backgrounds/Basics/NormalBgs/gfx/all_gfx.h index a3d0e8c..d24368d 100644 --- a/examples/Backgrounds/Basics/NormalBgs/gfx/all_gfx.h +++ b/examples/Backgrounds/Basics/NormalBgs/gfx/all_gfx.h @@ -1,21 +1,21 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct bg0; -extern const PA_BgStruct bg1; -extern const PA_BgStruct bg2; -extern const PA_BgStruct bg3; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct bg0; +extern const PA_BgStruct bg1; +extern const PA_BgStruct bg2; +extern const PA_BgStruct bg3; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg0.c b/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg0.c index 2dc4b20..62deca7 100644 --- a/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg0.c +++ b/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg0.c @@ -1,17 +1,17 @@ -#include - -extern const char bg0_Tiles[]; -extern const char bg0_Map[]; -extern const char bg0_Pal[]; - -const PA_BgStruct bg0 = { - PA_BgNormal, - 256, 192, - - bg0_Tiles, - bg0_Map, - {bg0_Pal}, - - 12352, - {1536} -}; +#include + +extern const char bg0_Tiles[]; +extern const char bg0_Map[]; +extern const char bg0_Pal[]; + +const PA_BgStruct bg0 = { + PA_BgNormal, + 256, 192, + + bg0_Tiles, + bg0_Map, + {bg0_Pal}, + + 12352, + {1536} +}; diff --git a/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg1.c b/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg1.c index 924a9a9..9fbdaef 100644 --- a/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg1.c +++ b/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg1.c @@ -1,17 +1,17 @@ -#include - -extern const char bg1_Tiles[]; -extern const char bg1_Map[]; -extern const char bg1_Pal[]; - -const PA_BgStruct bg1 = { - PA_BgNormal, - 256, 192, - - bg1_Tiles, - bg1_Map, - {bg1_Pal}, - - 11008, - {1536} -}; +#include + +extern const char bg1_Tiles[]; +extern const char bg1_Map[]; +extern const char bg1_Pal[]; + +const PA_BgStruct bg1 = { + PA_BgNormal, + 256, 192, + + bg1_Tiles, + bg1_Map, + {bg1_Pal}, + + 11008, + {1536} +}; diff --git a/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg2.c b/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg2.c index a1f341b..8a1317a 100644 --- a/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg2.c +++ b/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg2.c @@ -1,17 +1,17 @@ -#include - -extern const char bg2_Tiles[]; -extern const char bg2_Map[]; -extern const char bg2_Pal[]; - -const PA_BgStruct bg2 = { - PA_BgNormal, - 256, 192, - - bg2_Tiles, - bg2_Map, - {bg2_Pal}, - - 11968, - {1536} -}; +#include + +extern const char bg2_Tiles[]; +extern const char bg2_Map[]; +extern const char bg2_Pal[]; + +const PA_BgStruct bg2 = { + PA_BgNormal, + 256, 192, + + bg2_Tiles, + bg2_Map, + {bg2_Pal}, + + 11968, + {1536} +}; diff --git a/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg3.c b/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg3.c index 43c9c84..57e6984 100644 --- a/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg3.c +++ b/examples/Backgrounds/Basics/NormalBgs/gfx/bin/bg3.c @@ -1,17 +1,17 @@ -#include - -extern const char bg3_Tiles[]; -extern const char bg3_Map[]; -extern const char bg3_Pal[]; - -const PA_BgStruct bg3 = { - PA_BgNormal, - 256, 192, - - bg3_Tiles, - bg3_Map, - {bg3_Pal}, - - 11264, - {1536} -}; +#include + +extern const char bg3_Tiles[]; +extern const char bg3_Map[]; +extern const char bg3_Pal[]; + +const PA_BgStruct bg3 = { + PA_BgNormal, + 256, 192, + + bg3_Tiles, + bg3_Map, + {bg3_Pal}, + + 11264, + {1536} +}; diff --git a/examples/Backgrounds/Basics/NormalBgs/source/main.c b/examples/Backgrounds/Basics/NormalBgs/source/main.c index ba346ed..c2e7803 100644 --- a/examples/Backgrounds/Basics/NormalBgs/source/main.c +++ b/examples/Backgrounds/Basics/NormalBgs/source/main.c @@ -1,22 +1,22 @@ -// This example just shows how the DS can be intelligent... Loading 4 different backgrounds, each with it's own palette... - -// Includes -#include - -// Graphics converted using PAGfx -#include "all_gfx.h" - -int main(){ - PA_Init(); - - // Load the 4 Backgrounds - PA_LoadBackground(0, 0, &bg0); - PA_LoadBackground(0, 1, &bg1); - PA_LoadBackground(0, 2, &bg2); - PA_LoadBackground(0, 3, &bg3); - - // Infinite loop to keep the program running - while(true){ - PA_WaitForVBL(); - } +// This example just shows how the DS can be intelligent... Loading 4 different backgrounds, each with it's own palette... + +// Includes +#include + +// Graphics converted using PAGfx +#include "all_gfx.h" + +int main(){ + PA_Init(); + + // Load the 4 Backgrounds + PA_LoadBackground(0, 0, &bg0); + PA_LoadBackground(0, 1, &bg1); + PA_LoadBackground(0, 2, &bg2); + PA_LoadBackground(0, 3, &bg3); + + // Infinite loop to keep the program running + while(true){ + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/Basics/RotBgs/Makefile b/examples/Backgrounds/Basics/RotBgs/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Basics/RotBgs/Makefile +++ b/examples/Backgrounds/Basics/RotBgs/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Basics/RotBgs/gfx/all_gfx.h b/examples/Backgrounds/Basics/RotBgs/gfx/all_gfx.h index 65a419c..3a6ea49 100644 --- a/examples/Backgrounds/Basics/RotBgs/gfx/all_gfx.h +++ b/examples/Backgrounds/Basics/RotBgs/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct Rot; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct Rot; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Basics/RotBgs/gfx/bin/Rot.c b/examples/Backgrounds/Basics/RotBgs/gfx/bin/Rot.c index 6e0b1c4..b6622c6 100644 --- a/examples/Backgrounds/Basics/RotBgs/gfx/bin/Rot.c +++ b/examples/Backgrounds/Basics/RotBgs/gfx/bin/Rot.c @@ -1,17 +1,17 @@ -#include - -extern const char Rot_Tiles[]; -extern const char Rot_Map[]; -extern const char Rot_Pal[]; - -const PA_BgStruct Rot = { - PA_BgRot, - 256, 256, - - Rot_Tiles, - Rot_Map, - {Rot_Pal}, - - 1024, - {1024} -}; +#include + +extern const char Rot_Tiles[]; +extern const char Rot_Map[]; +extern const char Rot_Pal[]; + +const PA_BgStruct Rot = { + PA_BgRot, + 256, 256, + + Rot_Tiles, + Rot_Map, + {Rot_Pal}, + + 1024, + {1024} +}; diff --git a/examples/Backgrounds/Basics/RotBgs/source/main.c b/examples/Backgrounds/Basics/RotBgs/source/main.c index 1fb3684..272fc5b 100644 --- a/examples/Backgrounds/Basics/RotBgs/source/main.c +++ b/examples/Backgrounds/Basics/RotBgs/source/main.c @@ -1,49 +1,49 @@ -// Rotational backgrounds example - -// Includes -#include - -#include "all_gfx.h" - -int main(){ - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_SetVideoMode(0, 2); //screen, mode - - PA_LoadBackground(0, //screen - 3, // background number - &Rot); // background name in PAGfx - - // Make the background wraparound - PA_SetBgWrap(0, 3, 1); - - s32 scrollx = 0; - s32 scrolly = 0; - s32 rotcenterx = 0; - s32 rotcentery = 0; - s16 angle = 0; - s32 zoom = 256; - - PA_OutputSimpleText(1, 2, 2, "Zoom : Start/Select"); - PA_OutputSimpleText(1, 2, 3, "ScrollX : Left/Right"); - PA_OutputSimpleText(1, 2, 4, "Scrolly : Up/Down"); - PA_OutputSimpleText(1, 2, 5, "RotCenterX : A/Y"); - PA_OutputSimpleText(1, 2, 6, "RotCenterY : B/X"); - PA_OutputSimpleText(1, 2, 7, "Angle : R/L"); - - while(true){ - zoom += Pad.Held.Start - Pad.Held.Select; - scrollx += Pad.Held.Right - Pad.Held.Left; - scrolly += Pad.Held.Down - Pad.Held.Up; - rotcenterx += Pad.Held.A - Pad.Held.Y; - rotcentery += Pad.Held.B - Pad.Held.X; - angle += Pad.Held.R - Pad.Held.L; - - PA_SetBgRot(0, 3, scrollx, scrolly, rotcenterx, rotcentery, angle, zoom); - - PA_WaitForVBL(); - } - +// Rotational backgrounds example + +// Includes +#include + +#include "all_gfx.h" + +int main(){ + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_SetVideoMode(0, 2); //screen, mode + + PA_LoadBackground(0, //screen + 3, // background number + &Rot); // background name in PAGfx + + // Make the background wraparound + PA_SetBgWrap(0, 3, 1); + + s32 scrollx = 0; + s32 scrolly = 0; + s32 rotcenterx = 0; + s32 rotcentery = 0; + s16 angle = 0; + s32 zoom = 256; + + PA_OutputSimpleText(1, 2, 2, "Zoom : Start/Select"); + PA_OutputSimpleText(1, 2, 3, "ScrollX : Left/Right"); + PA_OutputSimpleText(1, 2, 4, "Scrolly : Up/Down"); + PA_OutputSimpleText(1, 2, 5, "RotCenterX : A/Y"); + PA_OutputSimpleText(1, 2, 6, "RotCenterY : B/X"); + PA_OutputSimpleText(1, 2, 7, "Angle : R/L"); + + while(true){ + zoom += Pad.Held.Start - Pad.Held.Select; + scrollx += Pad.Held.Right - Pad.Held.Left; + scrolly += Pad.Held.Down - Pad.Held.Up; + rotcenterx += Pad.Held.A - Pad.Held.Y; + rotcentery += Pad.Held.B - Pad.Held.X; + angle += Pad.Held.R - Pad.Held.L; + + PA_SetBgRot(0, 3, scrollx, scrolly, rotcenterx, rotcentery, angle, zoom); + + PA_WaitForVBL(); + } + } \ No newline at end of file diff --git a/examples/Backgrounds/Basics/UnlimitedBgs/Makefile b/examples/Backgrounds/Basics/UnlimitedBgs/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Basics/UnlimitedBgs/Makefile +++ b/examples/Backgrounds/Basics/UnlimitedBgs/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Basics/UnlimitedBgs/gfx/all_gfx.h b/examples/Backgrounds/Basics/UnlimitedBgs/gfx/all_gfx.h index 0f15b80..e9b9fa9 100644 --- a/examples/Backgrounds/Basics/UnlimitedBgs/gfx/all_gfx.h +++ b/examples/Backgrounds/Basics/UnlimitedBgs/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct Town; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct Town; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Basics/UnlimitedBgs/gfx/bin/Town.c b/examples/Backgrounds/Basics/UnlimitedBgs/gfx/bin/Town.c index 065224a..e038b4d 100644 --- a/examples/Backgrounds/Basics/UnlimitedBgs/gfx/bin/Town.c +++ b/examples/Backgrounds/Basics/UnlimitedBgs/gfx/bin/Town.c @@ -1,17 +1,17 @@ -#include - -extern const char Town_Tiles[]; -extern const char Town_Map[]; -extern const char Town_Pal[]; - -const PA_BgStruct Town = { - PA_BgUnlimited, - 1024, 1024, - - Town_Tiles, - Town_Map, - {Town_Pal}, - - 114560, - {16384} -}; +#include + +extern const char Town_Tiles[]; +extern const char Town_Map[]; +extern const char Town_Pal[]; + +const PA_BgStruct Town = { + PA_BgUnlimited, + 1024, 1024, + + Town_Tiles, + Town_Map, + {Town_Pal}, + + 114560, + {16384} +}; diff --git a/examples/Backgrounds/Basics/UnlimitedBgs/source/main.c b/examples/Backgrounds/Basics/UnlimitedBgs/source/main.c index eddfd04..82bbc6b 100644 --- a/examples/Backgrounds/Basics/UnlimitedBgs/source/main.c +++ b/examples/Backgrounds/Basics/UnlimitedBgs/source/main.c @@ -1,32 +1,32 @@ -// Welcome to the magic of large and very large maps! You can have as many tiles as you want now! - -// Includes -#include - -// Converted using PAGfx -#include "all_gfx.h" - -int main(){ - PA_Init(); - - PA_LoadDefaultText(1, 0); - - // Load a UnlimitedBg converted with PAGfx... - PA_LoadBackground(0, // Screen - 3, // Background number (0-3) - &Town); // "Name" (pointer to background struct) - - // Next we'll scroll, here are the variables... - int scrollx = 0; - int scrolly = 0; - - // Infinite loop to keep the program running - while(true){ - PA_WaitForVBL(); - - // We need to change the scroll according to the held keys... - scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time - scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing - PA_EasyBgScrollXY(0, 3, scrollx, scrolly); - } +// Welcome to the magic of large and very large maps! You can have as many tiles as you want now! + +// Includes +#include + +// Converted using PAGfx +#include "all_gfx.h" + +int main(){ + PA_Init(); + + PA_LoadDefaultText(1, 0); + + // Load a UnlimitedBg converted with PAGfx... + PA_LoadBackground(0, // Screen + 3, // Background number (0-3) + &Town); // "Name" (pointer to background struct) + + // Next we'll scroll, here are the variables... + int scrollx = 0; + int scrolly = 0; + + // Infinite loop to keep the program running + while(true){ + PA_WaitForVBL(); + + // We need to change the scroll according to the held keys... + scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time + scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing + PA_EasyBgScrollXY(0, 3, scrollx, scrolly); + } } \ No newline at end of file diff --git a/examples/Backgrounds/DualBgs/Parallax/Makefile b/examples/Backgrounds/DualBgs/Parallax/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/DualBgs/Parallax/Makefile +++ b/examples/Backgrounds/DualBgs/Parallax/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/DualBgs/Parallax/gfx/all_gfx.h b/examples/Backgrounds/DualBgs/Parallax/gfx/all_gfx.h index 536ce48..4ef116a 100644 --- a/examples/Backgrounds/DualBgs/Parallax/gfx/all_gfx.h +++ b/examples/Backgrounds/DualBgs/Parallax/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct BG1; -extern const PA_BgStruct BG2; -extern const PA_BgStruct BG3; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct BG1; +extern const PA_BgStruct BG2; +extern const PA_BgStruct BG3; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG1.c b/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG1.c index d8ea2d7..bb52108 100644 --- a/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG1.c +++ b/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG1.c @@ -1,17 +1,17 @@ -#include - -extern const char BG1_Tiles[]; -extern const char BG1_Map[]; -extern const char BG1_Pal[]; - -const PA_BgStruct BG1 = { - PA_BgNormal, - 256, 256, - - BG1_Tiles, - BG1_Map, - {BG1_Pal}, - - 3712, - {2048} -}; +#include + +extern const char BG1_Tiles[]; +extern const char BG1_Map[]; +extern const char BG1_Pal[]; + +const PA_BgStruct BG1 = { + PA_BgNormal, + 256, 256, + + BG1_Tiles, + BG1_Map, + {BG1_Pal}, + + 3712, + {2048} +}; diff --git a/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG2.c b/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG2.c index a3454ec..023fc73 100644 --- a/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG2.c +++ b/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG2.c @@ -1,17 +1,17 @@ -#include - -extern const char BG2_Tiles[]; -extern const char BG2_Map[]; -extern const char BG2_Pal[]; - -const PA_BgStruct BG2 = { - PA_BgNormal, - 256, 256, - - BG2_Tiles, - BG2_Map, - {BG2_Pal}, - - 1472, - {2048} -}; +#include + +extern const char BG2_Tiles[]; +extern const char BG2_Map[]; +extern const char BG2_Pal[]; + +const PA_BgStruct BG2 = { + PA_BgNormal, + 256, 256, + + BG2_Tiles, + BG2_Map, + {BG2_Pal}, + + 1472, + {2048} +}; diff --git a/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG3.c b/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG3.c index 61b2790..14d5c9c 100644 --- a/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG3.c +++ b/examples/Backgrounds/DualBgs/Parallax/gfx/bin/BG3.c @@ -1,17 +1,17 @@ -#include - -extern const char BG3_Tiles[]; -extern const char BG3_Map[]; -extern const char BG3_Pal[]; - -const PA_BgStruct BG3 = { - PA_BgNormal, - 256, 256, - - BG3_Tiles, - BG3_Map, - {BG3_Pal}, - - 65536, - {2048} -}; +#include + +extern const char BG3_Tiles[]; +extern const char BG3_Map[]; +extern const char BG3_Pal[]; + +const PA_BgStruct BG3 = { + PA_BgNormal, + 256, 256, + + BG3_Tiles, + BG3_Map, + {BG3_Pal}, + + 65536, + {2048} +}; diff --git a/examples/Backgrounds/DualBgs/Parallax/source/main.c b/examples/Backgrounds/DualBgs/Parallax/source/main.c index aaa9e3b..33b95b6 100644 --- a/examples/Backgrounds/DualBgs/Parallax/source/main.c +++ b/examples/Backgrounds/DualBgs/Parallax/source/main.c @@ -1,33 +1,33 @@ -#include - -// Graphics Includes -#include "all_gfx.h" - -int main(){ - PA_Init(); - - // Load the 3 Backgrounds... - PA_DualLoadBackground(1, &BG1); - PA_DualLoadBackground(2, &BG2); - PA_DualLoadBackground(3, &BG3); - - // Initialise parallax vertically (Y axis) for both backgrounds - // 256 is normal speed, 128 half speed, 512 twice as fast... - PA_DualInitParallaxY(0, //Parallax speed for Background 0. 0 is no parallax (will scroll independently with BGScroll) - 256, // Normal speed for Bg1 - 192, // 3/4 speed - 128); // Half speed - - s32 scroll = 0; - - // Infinite loop to keep the program running - while(true){ - scroll ++; // Scroll by one pixel... - // Backgrounds with a parallax speed of 256 will scroll 1 pixel, 192 will scroll 0.75, and 128 0.5 - // We could also have put a negative parallax speed to have some backgrounds scroll in different directions - - PA_DualParallaxScrollY(-scroll); // Scroll the screen 0 backgrounds. - - PA_WaitForVBL(); - } +#include + +// Graphics Includes +#include "all_gfx.h" + +int main(){ + PA_Init(); + + // Load the 3 Backgrounds... + PA_DualLoadBackground(1, &BG1); + PA_DualLoadBackground(2, &BG2); + PA_DualLoadBackground(3, &BG3); + + // Initialise parallax vertically (Y axis) for both backgrounds + // 256 is normal speed, 128 half speed, 512 twice as fast... + PA_DualInitParallaxY(0, //Parallax speed for Background 0. 0 is no parallax (will scroll independently with BGScroll) + 256, // Normal speed for Bg1 + 192, // 3/4 speed + 128); // Half speed + + s32 scroll = 0; + + // Infinite loop to keep the program running + while(true){ + scroll ++; // Scroll by one pixel... + // Backgrounds with a parallax speed of 256 will scroll 1 pixel, 192 will scroll 0.75, and 128 0.5 + // We could also have put a negative parallax speed to have some backgrounds scroll in different directions + + PA_DualParallaxScrollY(-scroll); // Scroll the screen 0 backgrounds. + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/DualBgs/ScrollBg/Makefile b/examples/Backgrounds/DualBgs/ScrollBg/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/DualBgs/ScrollBg/Makefile +++ b/examples/Backgrounds/DualBgs/ScrollBg/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/DualBgs/ScrollBg/gfx/all_gfx.h b/examples/Backgrounds/DualBgs/ScrollBg/gfx/all_gfx.h index cbd05b0..4687950 100644 --- a/examples/Backgrounds/DualBgs/ScrollBg/gfx/all_gfx.h +++ b/examples/Backgrounds/DualBgs/ScrollBg/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct BG3; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct BG3; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/DualBgs/ScrollBg/gfx/bin/BG3.c b/examples/Backgrounds/DualBgs/ScrollBg/gfx/bin/BG3.c index 61b2790..14d5c9c 100644 --- a/examples/Backgrounds/DualBgs/ScrollBg/gfx/bin/BG3.c +++ b/examples/Backgrounds/DualBgs/ScrollBg/gfx/bin/BG3.c @@ -1,17 +1,17 @@ -#include - -extern const char BG3_Tiles[]; -extern const char BG3_Map[]; -extern const char BG3_Pal[]; - -const PA_BgStruct BG3 = { - PA_BgNormal, - 256, 256, - - BG3_Tiles, - BG3_Map, - {BG3_Pal}, - - 65536, - {2048} -}; +#include + +extern const char BG3_Tiles[]; +extern const char BG3_Map[]; +extern const char BG3_Pal[]; + +const PA_BgStruct BG3 = { + PA_BgNormal, + 256, 256, + + BG3_Tiles, + BG3_Map, + {BG3_Pal}, + + 65536, + {2048} +}; diff --git a/examples/Backgrounds/DualBgs/ScrollBg/source/main.c b/examples/Backgrounds/DualBgs/ScrollBg/source/main.c index 7fc562e..be50549 100644 --- a/examples/Backgrounds/DualBgs/ScrollBg/source/main.c +++ b/examples/Backgrounds/DualBgs/ScrollBg/source/main.c @@ -1,33 +1,33 @@ -// This time around, we'll scroll a background... - -// Includes -#include - -// Converted using PAGfx -#include "all_gfx.h" - -int main(){ - PA_Init(); - - // Load the dual background... - PA_DualLoadBackground(3, //bg number - &BG3); //background name - - s32 scrollx = 0; // No X scroll by default... - s32 scrolly = 0; // No Y scroll by default... - - // Infinite loop to keep the program running - while(true){ - // We'll modify scrollx and scrolly according to the keys pressed - scrollx += (Pad.Held.Left - Pad.Held.Right) * 4; // Move 4 pixels per press - scrolly += (Pad.Held.Up - Pad.Held.Down) * 4; // Move 4 pixels per press - - // Scroll the background to scrollx, scrolly... - PA_DualBGScrollXY(3, // Background number - scrollx, // X scroll - scrolly); // Y scroll - - - PA_WaitForVBL(); - } +// This time around, we'll scroll a background... + +// Includes +#include + +// Converted using PAGfx +#include "all_gfx.h" + +int main(){ + PA_Init(); + + // Load the dual background... + PA_DualLoadBackground(3, //bg number + &BG3); //background name + + s32 scrollx = 0; // No X scroll by default... + s32 scrolly = 0; // No Y scroll by default... + + // Infinite loop to keep the program running + while(true){ + // We'll modify scrollx and scrolly according to the keys pressed + scrollx += (Pad.Held.Left - Pad.Held.Right) * 4; // Move 4 pixels per press + scrolly += (Pad.Held.Up - Pad.Held.Down) * 4; // Move 4 pixels per press + + // Scroll the background to scrollx, scrolly... + PA_DualBGScrollXY(3, // Background number + scrollx, // X scroll + scrolly); // Y scroll + + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/DualBgs/UnlimitedBg/Makefile b/examples/Backgrounds/DualBgs/UnlimitedBg/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/DualBgs/UnlimitedBg/Makefile +++ b/examples/Backgrounds/DualBgs/UnlimitedBg/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/DualBgs/UnlimitedBg/gfx/all_gfx.h b/examples/Backgrounds/DualBgs/UnlimitedBg/gfx/all_gfx.h index 0f15b80..e9b9fa9 100644 --- a/examples/Backgrounds/DualBgs/UnlimitedBg/gfx/all_gfx.h +++ b/examples/Backgrounds/DualBgs/UnlimitedBg/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct Town; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct Town; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/DualBgs/UnlimitedBg/gfx/bin/Town.c b/examples/Backgrounds/DualBgs/UnlimitedBg/gfx/bin/Town.c index 065224a..e038b4d 100644 --- a/examples/Backgrounds/DualBgs/UnlimitedBg/gfx/bin/Town.c +++ b/examples/Backgrounds/DualBgs/UnlimitedBg/gfx/bin/Town.c @@ -1,17 +1,17 @@ -#include - -extern const char Town_Tiles[]; -extern const char Town_Map[]; -extern const char Town_Pal[]; - -const PA_BgStruct Town = { - PA_BgUnlimited, - 1024, 1024, - - Town_Tiles, - Town_Map, - {Town_Pal}, - - 114560, - {16384} -}; +#include + +extern const char Town_Tiles[]; +extern const char Town_Map[]; +extern const char Town_Pal[]; + +const PA_BgStruct Town = { + PA_BgUnlimited, + 1024, 1024, + + Town_Tiles, + Town_Map, + {Town_Pal}, + + 114560, + {16384} +}; diff --git a/examples/Backgrounds/DualBgs/UnlimitedBg/source/main.c b/examples/Backgrounds/DualBgs/UnlimitedBg/source/main.c index 01a82c4..a12b582 100644 --- a/examples/Backgrounds/DualBgs/UnlimitedBg/source/main.c +++ b/examples/Backgrounds/DualBgs/UnlimitedBg/source/main.c @@ -1,31 +1,31 @@ -// Welcome to the magic of large and very large maps! You can have as many tiles as you want now! - -// Includes -#include - -// Converted using PAGfx -#include "all_gfx.h" - -int main(){ - PA_Init(); - - PA_LoadDefaultText(1, 0); - - // Load a large scrolling background converted with PAGfx... InfiniteMap - PA_DualLoadBackground(3, //background number (0-3) - &Town); // Name - - // Next we'll scroll, here are the variables... - s32 scrollx = 0; - s32 scrolly = 0; - - // Infinite loop to keep the program running - while(true){ - // We need to change the scroll according to the held keys... - scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time - scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing - PA_DualEasyBgScrollXY(3, scrollx, scrolly); - - PA_WaitForVBL(); - } +// Welcome to the magic of large and very large maps! You can have as many tiles as you want now! + +// Includes +#include + +// Converted using PAGfx +#include "all_gfx.h" + +int main(){ + PA_Init(); + + PA_LoadDefaultText(1, 0); + + // Load a large scrolling background converted with PAGfx... InfiniteMap + PA_DualLoadBackground(3, //background number (0-3) + &Town); // Name + + // Next we'll scroll, here are the variables... + s32 scrollx = 0; + s32 scrolly = 0; + + // Infinite loop to keep the program running + while(true){ + // We need to change the scroll according to the held keys... + scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time + scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing + PA_DualEasyBgScrollXY(3, scrollx, scrolly); + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/Effects/BgAlpha/Makefile b/examples/Backgrounds/Effects/BgAlpha/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Effects/BgAlpha/Makefile +++ b/examples/Backgrounds/Effects/BgAlpha/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Effects/BgAlpha/gfx/all_gfx.h b/examples/Backgrounds/Effects/BgAlpha/gfx/all_gfx.h index 5eb2767..b065420 100644 --- a/examples/Backgrounds/Effects/BgAlpha/gfx/all_gfx.h +++ b/examples/Backgrounds/Effects/BgAlpha/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct bg0; -extern const PA_BgStruct bg1; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct bg0; +extern const PA_BgStruct bg1; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Effects/BgAlpha/gfx/bin/bg0.c b/examples/Backgrounds/Effects/BgAlpha/gfx/bin/bg0.c index 2bca9fa..2f1c70a 100644 --- a/examples/Backgrounds/Effects/BgAlpha/gfx/bin/bg0.c +++ b/examples/Backgrounds/Effects/BgAlpha/gfx/bin/bg0.c @@ -1,17 +1,17 @@ -#include - -extern const char bg0_Tiles[]; -extern const char bg0_Map[]; -extern const char bg0_Pal[]; - -const PA_BgStruct bg0 = { - PA_BgNormal, - 256, 192, - - bg0_Tiles, - bg0_Map, - {bg0_Pal}, - - 3776, - {1536} -}; +#include + +extern const char bg0_Tiles[]; +extern const char bg0_Map[]; +extern const char bg0_Pal[]; + +const PA_BgStruct bg0 = { + PA_BgNormal, + 256, 192, + + bg0_Tiles, + bg0_Map, + {bg0_Pal}, + + 3776, + {1536} +}; diff --git a/examples/Backgrounds/Effects/BgAlpha/gfx/bin/bg1.c b/examples/Backgrounds/Effects/BgAlpha/gfx/bin/bg1.c index b108df0..f5ecace 100644 --- a/examples/Backgrounds/Effects/BgAlpha/gfx/bin/bg1.c +++ b/examples/Backgrounds/Effects/BgAlpha/gfx/bin/bg1.c @@ -1,17 +1,17 @@ -#include - -extern const char bg1_Tiles[]; -extern const char bg1_Map[]; -extern const char bg1_Pal[]; - -const PA_BgStruct bg1 = { - PA_BgNormal, - 256, 192, - - bg1_Tiles, - bg1_Map, - {bg1_Pal}, - - 256, - {1536} -}; +#include + +extern const char bg1_Tiles[]; +extern const char bg1_Map[]; +extern const char bg1_Pal[]; + +const PA_BgStruct bg1 = { + PA_BgNormal, + 256, 192, + + bg1_Tiles, + bg1_Map, + {bg1_Pal}, + + 256, + {1536} +}; diff --git a/examples/Backgrounds/Effects/BgAlpha/source/main.c b/examples/Backgrounds/Effects/BgAlpha/source/main.c index 91aee39..bcafc70 100644 --- a/examples/Backgrounds/Effects/BgAlpha/source/main.c +++ b/examples/Backgrounds/Effects/BgAlpha/source/main.c @@ -1,46 +1,46 @@ -// This example just shows how the DS can be smart... - -// Includes -#include - -// Graphics converted using PAGfxConverter -#include "all_gfx.h" - -int main(){ - PA_Init(); - - PA_LoadDefaultText(1, 0); - PA_OutputText(1,3,2, "--- BG Alpha Example ---"); - PA_OutputText(1,3,4, "D-Pad Left : Alpha1--"); - PA_OutputText(1,3,5, "D-Pad Right: Alpha1++"); - PA_OutputText(1,3,6, "D-Pad Up : Alpha2--"); - PA_OutputText(1,3,7, "D-Pad Down : Alpha2++"); - - //turn on alpha.... - PA_EnableSpecialFx(0, SFX_ALPHA, SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD, SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD); - - // Load the Backgrounds - PA_LoadBackground(0, 0, &bg0); - PA_LoadBackground(0, 1, &bg1); - - int alpha1 = 15; - int alpha2 = 15; - PA_SetSFXAlpha(0, alpha1, alpha2); - - // Infinite loop to keep the program running - while(true){ - if (Pad.Newpress.Left && alpha1 > 0) alpha1--; - else if (Pad.Newpress.Right && alpha1 < 31) alpha1++; - - if (Pad.Newpress.Down && alpha2 > 0) alpha2--; - else if (Pad.Newpress.Up && alpha2 < 31) alpha2++; - - //update the alpha values - PA_SetSFXAlpha(0, alpha1, alpha2); - - PA_OutputText(1,2,9, "Alpha 1: %d ", alpha1); - PA_OutputText(1,2,10, "Alpha 2: %d ", alpha2); - - PA_WaitForVBL(); - } +// This example just shows how the DS can be smart... + +// Includes +#include + +// Graphics converted using PAGfxConverter +#include "all_gfx.h" + +int main(){ + PA_Init(); + + PA_LoadDefaultText(1, 0); + PA_OutputText(1,3,2, "--- BG Alpha Example ---"); + PA_OutputText(1,3,4, "D-Pad Left : Alpha1--"); + PA_OutputText(1,3,5, "D-Pad Right: Alpha1++"); + PA_OutputText(1,3,6, "D-Pad Up : Alpha2--"); + PA_OutputText(1,3,7, "D-Pad Down : Alpha2++"); + + //turn on alpha.... + PA_EnableSpecialFx(0, SFX_ALPHA, SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD, SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD); + + // Load the Backgrounds + PA_LoadBackground(0, 0, &bg0); + PA_LoadBackground(0, 1, &bg1); + + int alpha1 = 15; + int alpha2 = 15; + PA_SetSFXAlpha(0, alpha1, alpha2); + + // Infinite loop to keep the program running + while(true){ + if (Pad.Newpress.Left && alpha1 > 0) alpha1--; + else if (Pad.Newpress.Right && alpha1 < 31) alpha1++; + + if (Pad.Newpress.Down && alpha2 > 0) alpha2--; + else if (Pad.Newpress.Up && alpha2 < 31) alpha2++; + + //update the alpha values + PA_SetSFXAlpha(0, alpha1, alpha2); + + PA_OutputText(1,2,9, "Alpha 1: %d ", alpha1); + PA_OutputText(1,2,10, "Alpha 2: %d ", alpha2); + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/Effects/Mode7/Makefile b/examples/Backgrounds/Effects/Mode7/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Effects/Mode7/Makefile +++ b/examples/Backgrounds/Effects/Mode7/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Effects/Mode7/gfx/all_gfx.h b/examples/Backgrounds/Effects/Mode7/gfx/all_gfx.h index 65a419c..3a6ea49 100644 --- a/examples/Backgrounds/Effects/Mode7/gfx/all_gfx.h +++ b/examples/Backgrounds/Effects/Mode7/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct Rot; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct Rot; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Effects/Mode7/gfx/bin/Rot.c b/examples/Backgrounds/Effects/Mode7/gfx/bin/Rot.c index 6e0b1c4..b6622c6 100644 --- a/examples/Backgrounds/Effects/Mode7/gfx/bin/Rot.c +++ b/examples/Backgrounds/Effects/Mode7/gfx/bin/Rot.c @@ -1,17 +1,17 @@ -#include - -extern const char Rot_Tiles[]; -extern const char Rot_Map[]; -extern const char Rot_Pal[]; - -const PA_BgStruct Rot = { - PA_BgRot, - 256, 256, - - Rot_Tiles, - Rot_Map, - {Rot_Pal}, - - 1024, - {1024} -}; +#include + +extern const char Rot_Tiles[]; +extern const char Rot_Map[]; +extern const char Rot_Pal[]; + +const PA_BgStruct Rot = { + PA_BgRot, + 256, 256, + + Rot_Tiles, + Rot_Map, + {Rot_Pal}, + + 1024, + {1024} +}; diff --git a/examples/Backgrounds/Effects/Mode7/source/main.c b/examples/Backgrounds/Effects/Mode7/source/main.c index f72cff7..53db8cc 100644 --- a/examples/Backgrounds/Effects/Mode7/source/main.c +++ b/examples/Backgrounds/Effects/Mode7/source/main.c @@ -1,52 +1,52 @@ -// Mode 7 example. - -// Includes -#include - -#include "all_gfx.h" - -int main(){ - PA_Init(); - - PA_SetVideoMode(0, 2); //screen, mode - PA_SetVideoMode(1, 2); //screen, mode - - // Yup, we use the standard bg load function! - PA_LoadBackground(0, //screen - 3, // background number - &Rot); // background name in PAGfx - PA_LoadBackground(1, 3, &Rot); - - // Wraparound (!) - PA_SetBgWrap(0, 3, 1); - PA_SetBgWrap(1, 3, 1); - - PA_LoadDefaultText(1, 0); - - PA_InitMode7(3); - - u16 angle = 0; - u16 height = 8192; - - while(true){ - // Change the angle - angle += Pad.Held.Right - Pad.Held.Left; - angle &= 511; - PA_Mode7Angle(angle); - - // Move left/right - PA_Mode7MoveLeftRight(Pad.Held.A - Pad.Held.Y); - - // Move Forward/backward - PA_Mode7MoveForwardBack(Pad.Held.Up - Pad.Held.Down); - - // Height - height += (Pad.Held.X - Pad.Held.B)<<7; - PA_Mode7Height(height); - - PA_OutputText(1, 0, 0, "Angle : %d ", angle); - PA_OutputText(1, 0, 1, "Height : %d ", height); - - PA_WaitForVBL(); - } +// Mode 7 example. + +// Includes +#include + +#include "all_gfx.h" + +int main(){ + PA_Init(); + + PA_SetVideoMode(0, 2); //screen, mode + PA_SetVideoMode(1, 2); //screen, mode + + // Yup, we use the standard bg load function! + PA_LoadBackground(0, //screen + 3, // background number + &Rot); // background name in PAGfx + PA_LoadBackground(1, 3, &Rot); + + // Wraparound (!) + PA_SetBgWrap(0, 3, 1); + PA_SetBgWrap(1, 3, 1); + + PA_LoadDefaultText(1, 0); + + PA_InitMode7(3); + + u16 angle = 0; + u16 height = 8192; + + while(true){ + // Change the angle + angle += Pad.Held.Right - Pad.Held.Left; + angle &= 511; + PA_Mode7Angle(angle); + + // Move left/right + PA_Mode7MoveLeftRight(Pad.Held.A - Pad.Held.Y); + + // Move Forward/backward + PA_Mode7MoveForwardBack(Pad.Held.Up - Pad.Held.Down); + + // Height + height += (Pad.Held.X - Pad.Held.B)<<7; + PA_Mode7Height(height); + + PA_OutputText(1, 0, 0, "Angle : %d ", angle); + PA_OutputText(1, 0, 1, "Height : %d ", height); + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/Effects/SineBg/Makefile b/examples/Backgrounds/Effects/SineBg/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Effects/SineBg/Makefile +++ b/examples/Backgrounds/Effects/SineBg/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Effects/SineBg/gfx/all_gfx.h b/examples/Backgrounds/Effects/SineBg/gfx/all_gfx.h index a874008..06533aa 100644 --- a/examples/Backgrounds/Effects/SineBg/gfx/all_gfx.h +++ b/examples/Backgrounds/Effects/SineBg/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct zelda; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct zelda; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Effects/SineBg/gfx/bin/zelda.c b/examples/Backgrounds/Effects/SineBg/gfx/bin/zelda.c index 77e1eda..2a27270 100644 --- a/examples/Backgrounds/Effects/SineBg/gfx/bin/zelda.c +++ b/examples/Backgrounds/Effects/SineBg/gfx/bin/zelda.c @@ -1,17 +1,17 @@ -#include - -extern const char zelda_Tiles[]; -extern const char zelda_Map[]; -extern const char zelda_Pal[]; - -const PA_BgStruct zelda = { - PA_BgLarge, - 2048, 2048, - - zelda_Tiles, - zelda_Map, - {zelda_Pal}, - - 15552, - {131072} -}; +#include + +extern const char zelda_Tiles[]; +extern const char zelda_Map[]; +extern const char zelda_Pal[]; + +const PA_BgStruct zelda = { + PA_BgLarge, + 2048, 2048, + + zelda_Tiles, + zelda_Map, + {zelda_Pal}, + + 15552, + {131072} +}; diff --git a/examples/Backgrounds/Effects/SineBg/source/main.c b/examples/Backgrounds/Effects/SineBg/source/main.c index bb98d50..e80bad3 100644 --- a/examples/Backgrounds/Effects/SineBg/source/main.c +++ b/examples/Backgrounds/Effects/SineBg/source/main.c @@ -1,63 +1,63 @@ -// Sine effect! (Shaking) - -// Includes -#include - -// Converted using PAGfxConverter -#include "all_gfx.h" - -// Settings to change (ingame) in order to adjust width/height of the sine wave -s8 width = 8; -s8 height = 8; -u16 add = 0; -s32 scrollx = 0; // Scroll positions... -s32 scrolly = 0; - -void MoveSine(){ - s16 vcount = PA_GetVcount(); - vcount++; - if(vcount > 192) vcount = 0; // Get correct vcount - - // Sin wav, variable width, height, and add to change start point ;) - PA_BGScrollX(0, 3, (scrollx&511) + ((PA_Sin((vcount+scrolly)*height+add)*width)>>8)); -} - -int main(){ - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_OutputSimpleText(1, 9, 10, "Sine Bg example"); - - // Load a large scrolling background converted with PAGfx... - PA_LoadBackground(0, //screen - 3, //background number (0-3) - &zelda); // Name - - // Tell the DS to run our function just before each scanline - // is going to be drawn. That way we can move the background - // and shake it. - irqSet(IRQ_HBLANK, MoveSine); - irqEnable(IRQ_HBLANK); - - // Next we'll scroll, here are the variables... - scrollx = 0; - scrolly = 0; - - // Infinite loop to keep the program running - while(true){ - add+=4; add&= 511; // Move wave... - - // We need to change the scroll according to the held keys... - scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time - if(scrollx < 0) scrollx = 0; if(scrollx > 2047-256) scrollx = 2047-256; - scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing - if(scrolly < 0) scrolly = 0; if(scrolly > 2047-192) scrolly = 2047-192; - - PA_EasyBgScrollXY(0, // screen - 3, // background number - scrollx, // X scroll - scrolly); // and Y scroll - PA_WaitForVBL(); - } +// Sine effect! (Shaking) + +// Includes +#include + +// Converted using PAGfxConverter +#include "all_gfx.h" + +// Settings to change (ingame) in order to adjust width/height of the sine wave +s8 width = 8; +s8 height = 8; +u16 add = 0; +s32 scrollx = 0; // Scroll positions... +s32 scrolly = 0; + +void MoveSine(){ + s16 vcount = PA_GetVcount(); + vcount++; + if(vcount > 192) vcount = 0; // Get correct vcount + + // Sin wav, variable width, height, and add to change start point ;) + PA_BGScrollX(0, 3, (scrollx&511) + ((PA_Sin((vcount+scrolly)*height+add)*width)>>8)); +} + +int main(){ + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_OutputSimpleText(1, 9, 10, "Sine Bg example"); + + // Load a large scrolling background converted with PAGfx... + PA_LoadBackground(0, //screen + 3, //background number (0-3) + &zelda); // Name + + // Tell the DS to run our function just before each scanline + // is going to be drawn. That way we can move the background + // and shake it. + irqSet(IRQ_HBLANK, MoveSine); + irqEnable(IRQ_HBLANK); + + // Next we'll scroll, here are the variables... + scrollx = 0; + scrolly = 0; + + // Infinite loop to keep the program running + while(true){ + add+=4; add&= 511; // Move wave... + + // We need to change the scroll according to the held keys... + scrollx += (Pad.Held.Right - Pad.Held.Left)*4; // scroll 4 pixels at a time + if(scrollx < 0) scrollx = 0; if(scrollx > 2047-256) scrollx = 2047-256; + scrolly += (Pad.Held.Down - Pad.Held.Up)*4; // Same thing + if(scrolly < 0) scrolly = 0; if(scrolly > 2047-192) scrolly = 2047-192; + + PA_EasyBgScrollXY(0, // screen + 3, // background number + scrollx, // X scroll + scrolly); // and Y scroll + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Backgrounds/Transitions/BgTransCenter/Makefile b/examples/Backgrounds/Transitions/BgTransCenter/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Transitions/BgTransCenter/Makefile +++ b/examples/Backgrounds/Transitions/BgTransCenter/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Transitions/BgTransCenter/gfx/all_gfx.h b/examples/Backgrounds/Transitions/BgTransCenter/gfx/all_gfx.h index fc4f0f3..fa577f4 100644 --- a/examples/Backgrounds/Transitions/BgTransCenter/gfx/all_gfx.h +++ b/examples/Backgrounds/Transitions/BgTransCenter/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct pasplash; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct pasplash; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Transitions/BgTransCenter/gfx/bin/pasplash.c b/examples/Backgrounds/Transitions/BgTransCenter/gfx/bin/pasplash.c index c5b075b..07f17ce 100644 --- a/examples/Backgrounds/Transitions/BgTransCenter/gfx/bin/pasplash.c +++ b/examples/Backgrounds/Transitions/BgTransCenter/gfx/bin/pasplash.c @@ -1,17 +1,17 @@ -#include - -extern const char pasplash_Tiles[]; -extern const char pasplash_Map[]; -extern const char pasplash_Pal[]; - -const PA_BgStruct pasplash = { - PA_BgNormal, - 256, 192, - - pasplash_Tiles, - pasplash_Map, - {pasplash_Pal}, - - 14528, - {1536} -}; +#include + +extern const char pasplash_Tiles[]; +extern const char pasplash_Map[]; +extern const char pasplash_Pal[]; + +const PA_BgStruct pasplash = { + PA_BgNormal, + 256, 192, + + pasplash_Tiles, + pasplash_Map, + {pasplash_Pal}, + + 14528, + {1536} +}; diff --git a/examples/Backgrounds/Transitions/BgTransCenter/source/main.c b/examples/Backgrounds/Transitions/BgTransCenter/source/main.c index f6ba68b..305ff17 100644 --- a/examples/Backgrounds/Transitions/BgTransCenter/source/main.c +++ b/examples/Backgrounds/Transitions/BgTransCenter/source/main.c @@ -1,68 +1,68 @@ -// This is basicly an example using the window functions to fade in/out of a screen... -// When fading out with windows, the color shown is the background color... -// This only works on DS, not on emulator ! - - - -// Includes -#include // Include for PA_Lib - - - -#include "all_gfx.h" - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1, 0); - - PA_LoadBackground(0, 1, &pasplash); // Load your backgrounds... - - PA_InitBgTrans(0); // Init BgTransition system, uses background 0 but little memory... - // If you want it to hide your sprites, set your sprites' priorities to 1 or more... - - u8 transtype = 0; - - s8 i; - u8 invert; - - // Infinite loop to keep the program running - while (1) - { - transtype = PA_Rand()%5; // random - invert = PA_Rand()&1; // invert - - PA_OutputText(1, 8, 8, "Transition : %d ", transtype); - PA_OutputText(1, 10, 9, "Invert : %d ", invert); - - // Transition out... - for (i = 0; i <= TRANS_LENGTH; i++) { // Fade length... - PA_BgTransCenter(0, // screen - transtype, // fade type, from 0 to 4, test them out ! - invert, // invert - i); // Time, 0 being the screen completely visible, 32 completely out - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - } - - transtype = PA_Rand()%5; // random - invert = PA_Rand()&1; // invert - - PA_OutputText(1, 8, 8, "Transition : %d ", transtype); - PA_OutputText(1, 10, 9, "Invert : %d ", invert); - - // Transition back in... - for (i = TRANS_LENGTH; i >= 0; i--) { // Fade length... - PA_BgTransCenter(0, transtype, invert, i);// same thing... - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - } - - - PA_WaitForVBL(); - } - - return 0; +// This is basicly an example using the window functions to fade in/out of a screen... +// When fading out with windows, the color shown is the background color... +// This only works on DS, not on emulator ! + + + +// Includes +#include // Include for PA_Lib + + + +#include "all_gfx.h" + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1, 0); + + PA_LoadBackground(0, 1, &pasplash); // Load your backgrounds... + + PA_InitBgTrans(0); // Init BgTransition system, uses background 0 but little memory... + // If you want it to hide your sprites, set your sprites' priorities to 1 or more... + + u8 transtype = 0; + + s8 i; + u8 invert; + + // Infinite loop to keep the program running + while (1) + { + transtype = PA_Rand()%5; // random + invert = PA_Rand()&1; // invert + + PA_OutputText(1, 8, 8, "Transition : %d ", transtype); + PA_OutputText(1, 10, 9, "Invert : %d ", invert); + + // Transition out... + for (i = 0; i <= TRANS_LENGTH; i++) { // Fade length... + PA_BgTransCenter(0, // screen + transtype, // fade type, from 0 to 4, test them out ! + invert, // invert + i); // Time, 0 being the screen completely visible, 32 completely out + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + } + + transtype = PA_Rand()%5; // random + invert = PA_Rand()&1; // invert + + PA_OutputText(1, 8, 8, "Transition : %d ", transtype); + PA_OutputText(1, 10, 9, "Invert : %d ", invert); + + // Transition back in... + for (i = TRANS_LENGTH; i >= 0; i--) { // Fade length... + PA_BgTransCenter(0, transtype, invert, i);// same thing... + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + } + + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Backgrounds/Transitions/BgTransDiag/Makefile b/examples/Backgrounds/Transitions/BgTransDiag/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Transitions/BgTransDiag/Makefile +++ b/examples/Backgrounds/Transitions/BgTransDiag/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Transitions/BgTransDiag/gfx/all_gfx.h b/examples/Backgrounds/Transitions/BgTransDiag/gfx/all_gfx.h index fc4f0f3..fa577f4 100644 --- a/examples/Backgrounds/Transitions/BgTransDiag/gfx/all_gfx.h +++ b/examples/Backgrounds/Transitions/BgTransDiag/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct pasplash; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct pasplash; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Transitions/BgTransDiag/gfx/bin/pasplash.c b/examples/Backgrounds/Transitions/BgTransDiag/gfx/bin/pasplash.c index c5b075b..07f17ce 100644 --- a/examples/Backgrounds/Transitions/BgTransDiag/gfx/bin/pasplash.c +++ b/examples/Backgrounds/Transitions/BgTransDiag/gfx/bin/pasplash.c @@ -1,17 +1,17 @@ -#include - -extern const char pasplash_Tiles[]; -extern const char pasplash_Map[]; -extern const char pasplash_Pal[]; - -const PA_BgStruct pasplash = { - PA_BgNormal, - 256, 192, - - pasplash_Tiles, - pasplash_Map, - {pasplash_Pal}, - - 14528, - {1536} -}; +#include + +extern const char pasplash_Tiles[]; +extern const char pasplash_Map[]; +extern const char pasplash_Pal[]; + +const PA_BgStruct pasplash = { + PA_BgNormal, + 256, 192, + + pasplash_Tiles, + pasplash_Map, + {pasplash_Pal}, + + 14528, + {1536} +}; diff --git a/examples/Backgrounds/Transitions/BgTransDiag/source/main.c b/examples/Backgrounds/Transitions/BgTransDiag/source/main.c index 0fe7d95..081fa99 100644 --- a/examples/Backgrounds/Transitions/BgTransDiag/source/main.c +++ b/examples/Backgrounds/Transitions/BgTransDiag/source/main.c @@ -1,71 +1,71 @@ -// This is basicly an example using the window functions to fade in/out of a screen... -// When fading out with windows, the color shown is the background color... -// This only works on DS, not on emulator ! - - - -// Includes -#include // Include for PA_Lib - - - -#include "all_gfx.h" - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1, 0); - - PA_LoadBackground(0, 1, &pasplash); // Load your backgrounds... - - PA_InitBgTrans(0); // Init BgTransition system, uses background 0 but little memory... - // If you want it to hide your sprites, set your sprites' priorities to 1 or more... - - u8 transtype = 0; - - s8 i; - u8 hflip, vflip; - - // Infinite loop to keep the program running - while (1) - { - hflip = PA_Rand()&1; // random - vflip = PA_Rand()&1; // random - transtype = PA_Rand()%5; // random - - PA_OutputText(1, 8, 8, "Transition : %d ", transtype); - PA_OutputText(1, 6, 9, "Hflip : %d Vflip : %d ", hflip, vflip); - - // Transition out... - for (i = 0; i <= TRANS_LENGTH; i++) { // Fade length... - PA_BgTransDiag(0, // screen - transtype, // fade type, from 0 to 4, test them out ! - hflip, // horizontal flip - vflip, // vertical flip - i); // Time, 0 being the screen completely visible, 32 completely out - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - } - - hflip = PA_Rand()&1; // random - vflip = PA_Rand()&1; // random - transtype = PA_Rand()%5; // random - - PA_OutputText(1, 8, 8, "Transition : %d ", transtype); - PA_OutputText(1, 6, 9, "Hflip : %d Vflip : %d ", hflip, vflip); - - // Transition back in... - for (i = TRANS_LENGTH; i >= 0; i--) { // Fade length... - PA_BgTransDiag(0, transtype, hflip, vflip, i);// same thing... - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - } - - - PA_WaitForVBL(); - } - - return 0; +// This is basicly an example using the window functions to fade in/out of a screen... +// When fading out with windows, the color shown is the background color... +// This only works on DS, not on emulator ! + + + +// Includes +#include // Include for PA_Lib + + + +#include "all_gfx.h" + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1, 0); + + PA_LoadBackground(0, 1, &pasplash); // Load your backgrounds... + + PA_InitBgTrans(0); // Init BgTransition system, uses background 0 but little memory... + // If you want it to hide your sprites, set your sprites' priorities to 1 or more... + + u8 transtype = 0; + + s8 i; + u8 hflip, vflip; + + // Infinite loop to keep the program running + while (1) + { + hflip = PA_Rand()&1; // random + vflip = PA_Rand()&1; // random + transtype = PA_Rand()%5; // random + + PA_OutputText(1, 8, 8, "Transition : %d ", transtype); + PA_OutputText(1, 6, 9, "Hflip : %d Vflip : %d ", hflip, vflip); + + // Transition out... + for (i = 0; i <= TRANS_LENGTH; i++) { // Fade length... + PA_BgTransDiag(0, // screen + transtype, // fade type, from 0 to 4, test them out ! + hflip, // horizontal flip + vflip, // vertical flip + i); // Time, 0 being the screen completely visible, 32 completely out + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + } + + hflip = PA_Rand()&1; // random + vflip = PA_Rand()&1; // random + transtype = PA_Rand()%5; // random + + PA_OutputText(1, 8, 8, "Transition : %d ", transtype); + PA_OutputText(1, 6, 9, "Hflip : %d Vflip : %d ", hflip, vflip); + + // Transition back in... + for (i = TRANS_LENGTH; i >= 0; i--) { // Fade length... + PA_BgTransDiag(0, transtype, hflip, vflip, i);// same thing... + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + } + + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Backgrounds/Transitions/BgTransLeftRight/Makefile b/examples/Backgrounds/Transitions/BgTransLeftRight/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Transitions/BgTransLeftRight/Makefile +++ b/examples/Backgrounds/Transitions/BgTransLeftRight/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Transitions/BgTransLeftRight/gfx/all_gfx.h b/examples/Backgrounds/Transitions/BgTransLeftRight/gfx/all_gfx.h index fc4f0f3..fa577f4 100644 --- a/examples/Backgrounds/Transitions/BgTransLeftRight/gfx/all_gfx.h +++ b/examples/Backgrounds/Transitions/BgTransLeftRight/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct pasplash; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct pasplash; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Transitions/BgTransLeftRight/gfx/bin/pasplash.c b/examples/Backgrounds/Transitions/BgTransLeftRight/gfx/bin/pasplash.c index c5b075b..07f17ce 100644 --- a/examples/Backgrounds/Transitions/BgTransLeftRight/gfx/bin/pasplash.c +++ b/examples/Backgrounds/Transitions/BgTransLeftRight/gfx/bin/pasplash.c @@ -1,17 +1,17 @@ -#include - -extern const char pasplash_Tiles[]; -extern const char pasplash_Map[]; -extern const char pasplash_Pal[]; - -const PA_BgStruct pasplash = { - PA_BgNormal, - 256, 192, - - pasplash_Tiles, - pasplash_Map, - {pasplash_Pal}, - - 14528, - {1536} -}; +#include + +extern const char pasplash_Tiles[]; +extern const char pasplash_Map[]; +extern const char pasplash_Pal[]; + +const PA_BgStruct pasplash = { + PA_BgNormal, + 256, 192, + + pasplash_Tiles, + pasplash_Map, + {pasplash_Pal}, + + 14528, + {1536} +}; diff --git a/examples/Backgrounds/Transitions/BgTransLeftRight/source/main.c b/examples/Backgrounds/Transitions/BgTransLeftRight/source/main.c index 9dbb5ad..4d64ec2 100644 --- a/examples/Backgrounds/Transitions/BgTransLeftRight/source/main.c +++ b/examples/Backgrounds/Transitions/BgTransLeftRight/source/main.c @@ -1,70 +1,70 @@ -// This is basicly an example using the window functions to fade in/out of a screen... -// When fading out with windows, the color shown is the background color... -// This only works on DS, not on emulator ! - - - -// Includes -#include // Include for PA_Lib - - - -#include "all_gfx.h" - - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1, 0); - - PA_LoadBackground(0, 1, &pasplash); // Load your backgrounds... - - PA_InitBgTrans(0); // Init BgTransition system, uses background 0 but little memory... - // If you want it to hide your sprites, set your sprites' priorities to 1 or more... - - u8 transtype = 0; - - s8 i; - u8 hflip; - - // Infinite loop to keep the program running - while (1) - { - hflip = PA_Rand()&1; // random - transtype = PA_Rand()%5; // random - - PA_OutputText(1, 8, 8, "Transition : %d ", transtype); - PA_OutputText(1, 10, 9, "Hflip : %d ", hflip); - - // Transition out... - for (i = 0; i <= TRANS_LENGTH; i++) { // Fade length... - PA_BgTransLeftRight(0, // screen - transtype, // fade type, from 0 to 4, test them out ! - hflip, // horizontal flip - i); // Time, 0 being the screen completely visible, 32 completely out - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - } - - hflip = PA_Rand()&1; // random - transtype = PA_Rand()%5; // random - - PA_OutputText(1, 8, 8, "Transition : %d ", transtype); - PA_OutputText(1, 10, 9, "Hflip : %d ", hflip); - - // Transition back in... - for (i = TRANS_LENGTH; i >= 0; i--) { // Fade length... - PA_BgTransLeftRight(0, transtype, hflip, i);// same thing... - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - } - - - PA_WaitForVBL(); - } - - return 0; +// This is basicly an example using the window functions to fade in/out of a screen... +// When fading out with windows, the color shown is the background color... +// This only works on DS, not on emulator ! + + + +// Includes +#include // Include for PA_Lib + + + +#include "all_gfx.h" + + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1, 0); + + PA_LoadBackground(0, 1, &pasplash); // Load your backgrounds... + + PA_InitBgTrans(0); // Init BgTransition system, uses background 0 but little memory... + // If you want it to hide your sprites, set your sprites' priorities to 1 or more... + + u8 transtype = 0; + + s8 i; + u8 hflip; + + // Infinite loop to keep the program running + while (1) + { + hflip = PA_Rand()&1; // random + transtype = PA_Rand()%5; // random + + PA_OutputText(1, 8, 8, "Transition : %d ", transtype); + PA_OutputText(1, 10, 9, "Hflip : %d ", hflip); + + // Transition out... + for (i = 0; i <= TRANS_LENGTH; i++) { // Fade length... + PA_BgTransLeftRight(0, // screen + transtype, // fade type, from 0 to 4, test them out ! + hflip, // horizontal flip + i); // Time, 0 being the screen completely visible, 32 completely out + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + } + + hflip = PA_Rand()&1; // random + transtype = PA_Rand()%5; // random + + PA_OutputText(1, 8, 8, "Transition : %d ", transtype); + PA_OutputText(1, 10, 9, "Hflip : %d ", hflip); + + // Transition back in... + for (i = TRANS_LENGTH; i >= 0; i--) { // Fade length... + PA_BgTransLeftRight(0, transtype, hflip, i);// same thing... + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + } + + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Backgrounds/Transitions/BgTransUpDown/Makefile b/examples/Backgrounds/Transitions/BgTransUpDown/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Transitions/BgTransUpDown/Makefile +++ b/examples/Backgrounds/Transitions/BgTransUpDown/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Transitions/BgTransUpDown/gfx/all_gfx.h b/examples/Backgrounds/Transitions/BgTransUpDown/gfx/all_gfx.h index fc4f0f3..fa577f4 100644 --- a/examples/Backgrounds/Transitions/BgTransUpDown/gfx/all_gfx.h +++ b/examples/Backgrounds/Transitions/BgTransUpDown/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct pasplash; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct pasplash; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Transitions/BgTransUpDown/gfx/bin/pasplash.c b/examples/Backgrounds/Transitions/BgTransUpDown/gfx/bin/pasplash.c index c5b075b..07f17ce 100644 --- a/examples/Backgrounds/Transitions/BgTransUpDown/gfx/bin/pasplash.c +++ b/examples/Backgrounds/Transitions/BgTransUpDown/gfx/bin/pasplash.c @@ -1,17 +1,17 @@ -#include - -extern const char pasplash_Tiles[]; -extern const char pasplash_Map[]; -extern const char pasplash_Pal[]; - -const PA_BgStruct pasplash = { - PA_BgNormal, - 256, 192, - - pasplash_Tiles, - pasplash_Map, - {pasplash_Pal}, - - 14528, - {1536} -}; +#include + +extern const char pasplash_Tiles[]; +extern const char pasplash_Map[]; +extern const char pasplash_Pal[]; + +const PA_BgStruct pasplash = { + PA_BgNormal, + 256, 192, + + pasplash_Tiles, + pasplash_Map, + {pasplash_Pal}, + + 14528, + {1536} +}; diff --git a/examples/Backgrounds/Transitions/BgTransUpDown/source/main.c b/examples/Backgrounds/Transitions/BgTransUpDown/source/main.c index 9035c41..25ad470 100644 --- a/examples/Backgrounds/Transitions/BgTransUpDown/source/main.c +++ b/examples/Backgrounds/Transitions/BgTransUpDown/source/main.c @@ -1,71 +1,71 @@ -// This is basicly an example using the window functions to fade in/out of a screen... -// When fading out with windows, the color shown is the background color... -// This only works on DS, not on emulator ! - - - -// Includes -#include // Include for PA_Lib - - - -#include "all_gfx.h" - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1, 0); - - PA_LoadBackground(0, 1, &pasplash); // Load your backgrounds... - - PA_InitBgTrans(0); // Init BgTransition system, uses background 0 but little memory... - // If you want it to hide your sprites, set your sprites' priorities to 1 or more... - - u8 transtype = 0; - - s8 i; - u8 vflip; - - // Infinite loop to keep the program running - while (1) - { - vflip = PA_Rand()&1; // random - transtype = PA_Rand()%5; // random - - PA_OutputText(1, 8, 8, "Transition : %d ", transtype); - PA_OutputText(1, 10, 9, "Vflip : %d ", vflip); - - // Transition out... - for (i = 0; i <= TRANS_LENGTH; i++) { // Fade length... - PA_BgTransUpDown(0, // screen - transtype, // fade type, from 0 to 4, test them out ! - vflip, // vertical flip - i); // Time, 0 being the screen completely visible, 32 completely out - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - } - - vflip = PA_Rand()&1; // random - transtype = PA_Rand()%5; // random - - PA_OutputText(1, 8, 8, "Transition : %d ", transtype); - PA_OutputText(1, 10, 9, "Vflip : %d ", vflip); - - // Transition back in... - for (i = TRANS_LENGTH; i >= 0; i--) { // Fade length... - PA_BgTransUpDown(0, // screen - transtype, // fade type, from 0 to 4, test them out ! - vflip, // vertical flip - i); // Time, 0 being the screen completely visible, 32 completely out - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - } - - - PA_WaitForVBL(); - } - - return 0; +// This is basicly an example using the window functions to fade in/out of a screen... +// When fading out with windows, the color shown is the background color... +// This only works on DS, not on emulator ! + + + +// Includes +#include // Include for PA_Lib + + + +#include "all_gfx.h" + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1, 0); + + PA_LoadBackground(0, 1, &pasplash); // Load your backgrounds... + + PA_InitBgTrans(0); // Init BgTransition system, uses background 0 but little memory... + // If you want it to hide your sprites, set your sprites' priorities to 1 or more... + + u8 transtype = 0; + + s8 i; + u8 vflip; + + // Infinite loop to keep the program running + while (1) + { + vflip = PA_Rand()&1; // random + transtype = PA_Rand()%5; // random + + PA_OutputText(1, 8, 8, "Transition : %d ", transtype); + PA_OutputText(1, 10, 9, "Vflip : %d ", vflip); + + // Transition out... + for (i = 0; i <= TRANS_LENGTH; i++) { // Fade length... + PA_BgTransUpDown(0, // screen + transtype, // fade type, from 0 to 4, test them out ! + vflip, // vertical flip + i); // Time, 0 being the screen completely visible, 32 completely out + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + } + + vflip = PA_Rand()&1; // random + transtype = PA_Rand()%5; // random + + PA_OutputText(1, 8, 8, "Transition : %d ", transtype); + PA_OutputText(1, 10, 9, "Vflip : %d ", vflip); + + // Transition back in... + for (i = TRANS_LENGTH; i >= 0; i--) { // Fade length... + PA_BgTransUpDown(0, // screen + transtype, // fade type, from 0 to 4, test them out ! + vflip, // vertical flip + i); // Time, 0 being the screen completely visible, 32 completely out + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + } + + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Backgrounds/Transitions/BrightnessFade/Makefile b/examples/Backgrounds/Transitions/BrightnessFade/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Transitions/BrightnessFade/Makefile +++ b/examples/Backgrounds/Transitions/BrightnessFade/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Transitions/BrightnessFade/gfx/all_gfx.h b/examples/Backgrounds/Transitions/BrightnessFade/gfx/all_gfx.h index fc4f0f3..fa577f4 100644 --- a/examples/Backgrounds/Transitions/BrightnessFade/gfx/all_gfx.h +++ b/examples/Backgrounds/Transitions/BrightnessFade/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct pasplash; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct pasplash; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Transitions/BrightnessFade/gfx/bin/pasplash.c b/examples/Backgrounds/Transitions/BrightnessFade/gfx/bin/pasplash.c index c5b075b..07f17ce 100644 --- a/examples/Backgrounds/Transitions/BrightnessFade/gfx/bin/pasplash.c +++ b/examples/Backgrounds/Transitions/BrightnessFade/gfx/bin/pasplash.c @@ -1,17 +1,17 @@ -#include - -extern const char pasplash_Tiles[]; -extern const char pasplash_Map[]; -extern const char pasplash_Pal[]; - -const PA_BgStruct pasplash = { - PA_BgNormal, - 256, 192, - - pasplash_Tiles, - pasplash_Map, - {pasplash_Pal}, - - 14528, - {1536} -}; +#include + +extern const char pasplash_Tiles[]; +extern const char pasplash_Map[]; +extern const char pasplash_Pal[]; + +const PA_BgStruct pasplash = { + PA_BgNormal, + 256, 192, + + pasplash_Tiles, + pasplash_Map, + {pasplash_Pal}, + + 14528, + {1536} +}; diff --git a/examples/Backgrounds/Transitions/BrightnessFade/source/main.c b/examples/Backgrounds/Transitions/BrightnessFade/source/main.c index e3af68a..59a5e7f 100644 --- a/examples/Backgrounds/Transitions/BrightnessFade/source/main.c +++ b/examples/Backgrounds/Transitions/BrightnessFade/source/main.c @@ -1,74 +1,74 @@ -// This is basicly an example using the brightness to fade in/out... - - - -// Includes -#include // Include for PA_Lib - - - -#include "all_gfx.h" - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1, 0); - - PA_LoadBackground(0, 1, &pasplash); - - s8 i; - - // Infinite loop to keep the program running - while (1) - { - - PA_OutputText(1, 8, 9, "Fading to White... "); - // Fade out to white - for (i = 0; i <= 31; i++) { - PA_SetBrightness(0, // Screen - i); // Brightness, 0 for normal, 31 for white, -31 for black, intermediates possible... - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - PA_WaitForVBL(); - } - - for(i = 0; i < 32; i++) PA_WaitForVBL(); // Wait a litte... - - PA_OutputText(1, 8, 9, "Back to normal... "); - - // Fade back in from white - for (i = 31; i >= 0; i--) { - PA_SetBrightness(0, i); - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - PA_WaitForVBL(); - } - - for(i = 0; i < 32; i++) PA_WaitForVBL(); // Wait a litte... - - PA_OutputText(1, 8, 9, "Fading to Black... "); - // Fade out to black - for (i = 0; i >= -31; i--) { - PA_SetBrightness(0, i); - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - PA_WaitForVBL(); - } - - for(i = 0; i < 32; i++) PA_WaitForVBL(); // Wait a litte... - - PA_OutputText(1, 8, 9, "Back to normal... "); - // Back in from black... - for (i = -31; i <= 0; i++) { - PA_SetBrightness(0, i); - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - PA_WaitForVBL(); - } - - for(i = 0; i < 32; i++) PA_WaitForVBL(); // Wait a litte... - } - - return 0; +// This is basicly an example using the brightness to fade in/out... + + + +// Includes +#include // Include for PA_Lib + + + +#include "all_gfx.h" + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1, 0); + + PA_LoadBackground(0, 1, &pasplash); + + s8 i; + + // Infinite loop to keep the program running + while (1) + { + + PA_OutputText(1, 8, 9, "Fading to White... "); + // Fade out to white + for (i = 0; i <= 31; i++) { + PA_SetBrightness(0, // Screen + i); // Brightness, 0 for normal, 31 for white, -31 for black, intermediates possible... + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + PA_WaitForVBL(); + } + + for(i = 0; i < 32; i++) PA_WaitForVBL(); // Wait a litte... + + PA_OutputText(1, 8, 9, "Back to normal... "); + + // Fade back in from white + for (i = 31; i >= 0; i--) { + PA_SetBrightness(0, i); + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + PA_WaitForVBL(); + } + + for(i = 0; i < 32; i++) PA_WaitForVBL(); // Wait a litte... + + PA_OutputText(1, 8, 9, "Fading to Black... "); + // Fade out to black + for (i = 0; i >= -31; i--) { + PA_SetBrightness(0, i); + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + PA_WaitForVBL(); + } + + for(i = 0; i < 32; i++) PA_WaitForVBL(); // Wait a litte... + + PA_OutputText(1, 8, 9, "Back to normal... "); + // Back in from black... + for (i = -31; i <= 0; i++) { + PA_SetBrightness(0, i); + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + PA_WaitForVBL(); + } + + for(i = 0; i < 32; i++) PA_WaitForVBL(); // Wait a litte... + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Backgrounds/Transitions/BrightnessFade2/Makefile b/examples/Backgrounds/Transitions/BrightnessFade2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Transitions/BrightnessFade2/Makefile +++ b/examples/Backgrounds/Transitions/BrightnessFade2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Transitions/BrightnessFade2/source/main.c b/examples/Backgrounds/Transitions/BrightnessFade2/source/main.c index 4f82844..f49e941 100644 --- a/examples/Backgrounds/Transitions/BrightnessFade2/source/main.c +++ b/examples/Backgrounds/Transitions/BrightnessFade2/source/main.c @@ -1,66 +1,66 @@ -// This is basicly an example using the brightness to fade in/out... - - - -// Includes -#include // Include for PA_Lib - -#include "test.h" -s16 level = 0; -s16 fade; -u8 black = 0; - -void HBL_function(void){ - s16 vcount = PA_GetVcount(); - vcount++; - if(vcount > 192) vcount = 0; // Get correct vcount - fade = (vcount+(level*4)-192)>>2; - if(fade < 0) fade = 0; - if(fade > 31) fade = 31; - - if(black) PA_SetBrightness(0, fade-31); - else PA_SetBrightness(0, 31-fade); -} - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1, 0); - - PA_SetBrightness(0, 31); - - PA_Init8bitBg(0, 3); - PA_LoadGif(0, (void*)test); - - - - irqSet(IRQ_HBLANK, HBL_function); - irqEnable(IRQ_HBLANK); - - u8 i; - level = 0; - while(1){ - PA_OutputText(1, 8, 10, "Fading in, white "); - for(level = 0; level < 80; level++) PA_WaitForVBL(); - for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second - - black = 1; - PA_OutputText(1, 8, 10, "Fading out, black "); - for(level = 80; level > 0; level--) PA_WaitForVBL(); - for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second - - PA_OutputText(1, 8, 10, "Fading in, black "); - for(level = 0; level < 80; level++) PA_WaitForVBL(); - for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second - - black = 0; - PA_OutputText(1, 8, 10, "Fading out, white "); - for(level = 80; level > 0; level--) PA_WaitForVBL(); - for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second - } - - return 0; +// This is basicly an example using the brightness to fade in/out... + + + +// Includes +#include // Include for PA_Lib + +#include "test.h" +s16 level = 0; +s16 fade; +u8 black = 0; + +void HBL_function(void){ + s16 vcount = PA_GetVcount(); + vcount++; + if(vcount > 192) vcount = 0; // Get correct vcount + fade = (vcount+(level*4)-192)>>2; + if(fade < 0) fade = 0; + if(fade > 31) fade = 31; + + if(black) PA_SetBrightness(0, fade-31); + else PA_SetBrightness(0, 31-fade); +} + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1, 0); + + PA_SetBrightness(0, 31); + + PA_Init8bitBg(0, 3); + PA_LoadGif(0, (void*)test); + + + + irqSet(IRQ_HBLANK, HBL_function); + irqEnable(IRQ_HBLANK); + + u8 i; + level = 0; + while(1){ + PA_OutputText(1, 8, 10, "Fading in, white "); + for(level = 0; level < 80; level++) PA_WaitForVBL(); + for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second + + black = 1; + PA_OutputText(1, 8, 10, "Fading out, black "); + for(level = 80; level > 0; level--) PA_WaitForVBL(); + for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second + + PA_OutputText(1, 8, 10, "Fading in, black "); + for(level = 0; level < 80; level++) PA_WaitForVBL(); + for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second + + black = 0; + PA_OutputText(1, 8, 10, "Fading out, white "); + for(level = 80; level > 0; level--) PA_WaitForVBL(); + for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Backgrounds/Transitions/WindowFade/Makefile b/examples/Backgrounds/Transitions/WindowFade/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Backgrounds/Transitions/WindowFade/Makefile +++ b/examples/Backgrounds/Transitions/WindowFade/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Backgrounds/Transitions/WindowFade/gfx/all_gfx.h b/examples/Backgrounds/Transitions/WindowFade/gfx/all_gfx.h index fc4f0f3..fa577f4 100644 --- a/examples/Backgrounds/Transitions/WindowFade/gfx/all_gfx.h +++ b/examples/Backgrounds/Transitions/WindowFade/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct pasplash; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct pasplash; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Backgrounds/Transitions/WindowFade/gfx/bin/pasplash.c b/examples/Backgrounds/Transitions/WindowFade/gfx/bin/pasplash.c index c5b075b..07f17ce 100644 --- a/examples/Backgrounds/Transitions/WindowFade/gfx/bin/pasplash.c +++ b/examples/Backgrounds/Transitions/WindowFade/gfx/bin/pasplash.c @@ -1,17 +1,17 @@ -#include - -extern const char pasplash_Tiles[]; -extern const char pasplash_Map[]; -extern const char pasplash_Pal[]; - -const PA_BgStruct pasplash = { - PA_BgNormal, - 256, 192, - - pasplash_Tiles, - pasplash_Map, - {pasplash_Pal}, - - 14528, - {1536} -}; +#include + +extern const char pasplash_Tiles[]; +extern const char pasplash_Map[]; +extern const char pasplash_Pal[]; + +const PA_BgStruct pasplash = { + PA_BgNormal, + 256, 192, + + pasplash_Tiles, + pasplash_Map, + {pasplash_Pal}, + + 14528, + {1536} +}; diff --git a/examples/Backgrounds/Transitions/WindowFade/source/main.c b/examples/Backgrounds/Transitions/WindowFade/source/main.c index 735e986..9206c5e 100644 --- a/examples/Backgrounds/Transitions/WindowFade/source/main.c +++ b/examples/Backgrounds/Transitions/WindowFade/source/main.c @@ -1,63 +1,63 @@ -// This is basicly an example using the window functions to fade in/out of a screen... -// When fading out with windows, the color shown is the background color... -// This only works on DS, not on emulator ! - - - -// Includes -#include // Include for PA_Lib - - - -#include "all_gfx.h" - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1, 0); - - PA_LoadBackground(0, 1, &pasplash); // Load your backgrounds... - - u8 fadetype0 = 0; - - s8 i; - - // Infinite loop to keep the program running - while (1) - { - - - // First we fade out... to fade out, move the time from 0 to 32, 32 included ! - for (i = 0; i <= 32; i++) { - PA_WindowFade(0, // screen - fadetype0, // fade type, from 0 to 7, test them out ! - i); // Time, 0 being the screen completely visible, 32 completely out - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - } - - - fadetype0 = PA_Rand()&7; // Random fade type for screen 0... from 0 to 7 - PA_OutputText(1, 8, 9, "Window Fade : %d ", fadetype0); - - - // To fade in, same thing, but from 32 to 0 included... - for (i = 32; i >= 0; i--) { - PA_WindowFade(0, fadetype0, i); - PA_WaitForVBL(); // To slow down the fades, we wait a frame... - } - - fadetype0 = PA_Rand()&7; // Random fade type for screen 0... - PA_OutputText(1, 8, 9, "Window Fade : %d ", fadetype0); - - - - PA_WaitForVBL(); - } - - return 0; +// This is basicly an example using the window functions to fade in/out of a screen... +// When fading out with windows, the color shown is the background color... +// This only works on DS, not on emulator ! + + + +// Includes +#include // Include for PA_Lib + + + +#include "all_gfx.h" + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1, 0); + + PA_LoadBackground(0, 1, &pasplash); // Load your backgrounds... + + u8 fadetype0 = 0; + + s8 i; + + // Infinite loop to keep the program running + while (1) + { + + + // First we fade out... to fade out, move the time from 0 to 32, 32 included ! + for (i = 0; i <= 32; i++) { + PA_WindowFade(0, // screen + fadetype0, // fade type, from 0 to 7, test them out ! + i); // Time, 0 being the screen completely visible, 32 completely out + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + } + + + fadetype0 = PA_Rand()&7; // Random fade type for screen 0... from 0 to 7 + PA_OutputText(1, 8, 9, "Window Fade : %d ", fadetype0); + + + // To fade in, same thing, but from 32 to 0 included... + for (i = 32; i >= 0; i--) { + PA_WindowFade(0, fadetype0, i); + PA_WaitForVBL(); // To slow down the fades, we wait a frame... + } + + fadetype0 = PA_Rand()&7; // Random fade type for screen 0... + PA_OutputText(1, 8, 9, "Window Fade : %d ", fadetype0); + + + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/16bitDoubleBuffer/Makefile b/examples/Bitmap/16bitDoubleBuffer/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Bitmap/16bitDoubleBuffer/Makefile +++ b/examples/Bitmap/16bitDoubleBuffer/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Bitmap/16bitDoubleBuffer/source/main.c b/examples/Bitmap/16bitDoubleBuffer/source/main.c index d8bb7d2..0f54d92 100644 --- a/examples/Bitmap/16bitDoubleBuffer/source/main.c +++ b/examples/Bitmap/16bitDoubleBuffer/source/main.c @@ -1,34 +1,34 @@ -// Drawing on DS is easy... This'll show you to what point ! - -// Includes -#include // Include for PA_Lib - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_Init16bitDblBuffer(0, 3); // Double buffer... Draw on the hidden background, then show - PA_LoadDefaultText(1, 0); // Text background - - PA_OutputText(1, 4, 10, "Press A to swap buffer..."); - - - // Infinite loop to keep the program running - while (1) - { - if(Pad.Newpress.A) PA_16bitSwapBuffer(0); // Swap buffer... - - // Simple draw function, draws on the screen... - PA_16bitDraw(0, // Screen - PA_RGB(31, 0, 0)); // Palette color - - - PA_WaitForVBL(); - } - - return 0; +// Drawing on DS is easy... This'll show you to what point ! + +// Includes +#include // Include for PA_Lib + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_Init16bitDblBuffer(0, 3); // Double buffer... Draw on the hidden background, then show + PA_LoadDefaultText(1, 0); // Text background + + PA_OutputText(1, 4, 10, "Press A to swap buffer..."); + + + // Infinite loop to keep the program running + while (1) + { + if(Pad.Newpress.A) PA_16bitSwapBuffer(0); // Swap buffer... + + // Simple draw function, draws on the screen... + PA_16bitDraw(0, // Screen + PA_RGB(31, 0, 0)); // Palette color + + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/16bitDraw/Makefile b/examples/Bitmap/16bitDraw/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Bitmap/16bitDraw/Makefile +++ b/examples/Bitmap/16bitDraw/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Bitmap/16bitDraw/source/main.c b/examples/Bitmap/16bitDraw/source/main.c index 63eca67..f2835cb 100644 --- a/examples/Bitmap/16bitDraw/source/main.c +++ b/examples/Bitmap/16bitDraw/source/main.c @@ -1,37 +1,37 @@ -// Drawing on DS is easy... This'll show you to what point ! - -// Includes -#include // Include for PA_Lib - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - - // Let's not load any backgrounds :p - PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); // Set the bottom screen color to white - PA_SetBgPalCol(1, 0, PA_RGB(0, 0, 0)); // set the top screen color to black - - // This will initialise a 16 bit background on each screen. This must be loaded before any other background. - // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload - // your backgrounds... - PA_Init16bitBg(0, 3); - PA_Init16bitBg(1, 3); - - // Infinite loop to keep the program running - while (1) - { - // Simple draw function, draws on the screen... - PA_16bitDraw(0, // Screen - PA_RGB(31, 0, 0)); // Color : full red... - // (The first shooting line on emu is a bug from the emu, I don't have it on DS) - - PA_Put16bitPixel(1, Stylus.X, Stylus.Y, PA_RGB(0, 31, 0)); // Draws a pixel on the top screen, corresponding to the stylus's position - PA_WaitForVBL(); - } - - return 0; +// Drawing on DS is easy... This'll show you to what point ! + +// Includes +#include // Include for PA_Lib + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + + // Let's not load any backgrounds :p + PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); // Set the bottom screen color to white + PA_SetBgPalCol(1, 0, PA_RGB(0, 0, 0)); // set the top screen color to black + + // This will initialise a 16 bit background on each screen. This must be loaded before any other background. + // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload + // your backgrounds... + PA_Init16bitBg(0, 3); + PA_Init16bitBg(1, 3); + + // Infinite loop to keep the program running + while (1) + { + // Simple draw function, draws on the screen... + PA_16bitDraw(0, // Screen + PA_RGB(31, 0, 0)); // Color : full red... + // (The first shooting line on emu is a bug from the emu, I don't have it on DS) + + PA_Put16bitPixel(1, Stylus.X, Stylus.Y, PA_RGB(0, 31, 0)); // Draws a pixel on the top screen, corresponding to the stylus's position + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/8bitDoubleBuffer/Makefile b/examples/Bitmap/8bitDoubleBuffer/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Bitmap/8bitDoubleBuffer/Makefile +++ b/examples/Bitmap/8bitDoubleBuffer/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Bitmap/8bitDoubleBuffer/source/main.c b/examples/Bitmap/8bitDoubleBuffer/source/main.c index dc78b2a..15d251c 100644 --- a/examples/Bitmap/8bitDoubleBuffer/source/main.c +++ b/examples/Bitmap/8bitDoubleBuffer/source/main.c @@ -1,46 +1,46 @@ -// Drawing on DS is easy... This'll show you to what point ! - -// Includes -#include // Include for PA_Lib - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Let's put some colors... in the background palettes - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); - PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); - - - - PA_Init8bitDblBuffer(0, 3); // Double buffer... Draw on the hidden background, then show - PA_LoadDefaultText(1, 0); // Text background - - PA_OutputText(1, 4, 10, "Press A to swap buffer..."); - - - // Infinite loop to keep the program running - while (1) - { - if(Pad.Newpress.A) PA_8bitSwapBuffer(0); // Swap buffer... - - // Simple draw function, draws on the screen... - PA_8bitDraw(0, // Screen - 1); // Palette color - - - PA_WaitForVBL(); - } - - return 0; +// Drawing on DS is easy... This'll show you to what point ! + +// Includes +#include // Include for PA_Lib + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Let's put some colors... in the background palettes + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); + PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); + + + + PA_Init8bitDblBuffer(0, 3); // Double buffer... Draw on the hidden background, then show + PA_LoadDefaultText(1, 0); // Text background + + PA_OutputText(1, 4, 10, "Press A to swap buffer..."); + + + // Infinite loop to keep the program running + while (1) + { + if(Pad.Newpress.A) PA_8bitSwapBuffer(0); // Swap buffer... + + // Simple draw function, draws on the screen... + PA_8bitDraw(0, // Screen + 1); // Palette color + + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/8bitDraw/Makefile b/examples/Bitmap/8bitDraw/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Bitmap/8bitDraw/Makefile +++ b/examples/Bitmap/8bitDraw/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Bitmap/8bitDraw/source/main.c b/examples/Bitmap/8bitDraw/source/main.c index be9edf5..9204763 100644 --- a/examples/Bitmap/8bitDraw/source/main.c +++ b/examples/Bitmap/8bitDraw/source/main.c @@ -1,44 +1,44 @@ -// Drawing on DS is easy... This'll show you to what point ! - -// Includes -#include // Include for PA_Lib - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Let's put some colors... in the background palettes - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); - PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); - - - // This will initialise an bit background on each screen. This must be loaded before any other background. - // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload - // your backgrounds... - PA_Init8bitBg(0, 3); - PA_Init8bitBg(1, 3); - - - // Infinite loop to keep the program running - while (1) - { - // Simple draw function, draws on the screen... - PA_8bitDraw(0, // Screen - 1); // Palette color - - PA_Put8bitPixel(1, Stylus.X, Stylus.Y, 2); // Draws a pixel on the top screen, corresponding to the stylus's position - - PA_WaitForVBL(); - } - - return 0; +// Drawing on DS is easy... This'll show you to what point ! + +// Includes +#include // Include for PA_Lib + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Let's put some colors... in the background palettes + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); + PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); + + + // This will initialise an bit background on each screen. This must be loaded before any other background. + // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload + // your backgrounds... + PA_Init8bitBg(0, 3); + PA_Init8bitBg(1, 3); + + + // Infinite loop to keep the program running + while (1) + { + // Simple draw function, draws on the screen... + PA_8bitDraw(0, // Screen + 1); // Palette color + + PA_Put8bitPixel(1, Stylus.X, Stylus.Y, 2); // Draws a pixel on the top screen, corresponding to the stylus's position + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/8bitText/Makefile b/examples/Bitmap/8bitText/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Bitmap/8bitText/Makefile +++ b/examples/Bitmap/8bitText/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Bitmap/8bitText/source/main.c b/examples/Bitmap/8bitText/source/main.c index 5e4508b..b202e0c 100644 --- a/examples/Bitmap/8bitText/source/main.c +++ b/examples/Bitmap/8bitText/source/main.c @@ -1,68 +1,68 @@ -// This example shows how to use 8 bit backgrounds, -// on which you can draw with the stylus or show text in different sizes, colors, or rotations - -// Includes -#include // Include for PA_Lib - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - //PA_LoadSplash(); // PA_Lib splash screen - - // Let's put some colors... in the background palettes - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); - PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); - - // Let's not load any backgrounds :p - - // This will initialise an bit background on each screen. This must be loaded before any other background. - // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload - // your backgrounds... - PA_Init8bitBg(0, 3); - PA_Init8bitBg(1, 3); - - // On these backgrounds, you can plot pixels, draw lines... and draw some custom text ! - PA_SmartText(1, // SCreen - 0, // Top left X - 1, // Top left Y - 255, // Botton right X - 20, // Bottom right Y - "Hello World", // Text - 1, // Text palette color (0-255) - 0, // Text size (0-4) - 0, // Text mode (0 - normal, 1 - transparent, 2 - no text, 3 - rotated 90°, 4 - 90° other way) - 100); // Maximum number of characters, if you want to right letter by letter... - PA_SmartText(1, 0, 20, 255, 40, "Hello World", 2, 1, 1, 100); - PA_SmartText(1, 0, 40, 255, 60, "Hello World", 3, 2, 1, 100); - PA_SmartText(1, 0, 60, 255, 80, "Hello World", 4, 3, 1, 100); - PA_SmartText(1, 0, 80, 255, 100, "Hello World", 1, 4, 1, 100); - - - // Let's have some rotated text :p - // X and Y positions are taken as if the DS was turned - PA_SmartText(1, 1, 1, 190, 20, "Hello World", 3, 3, 3, 100); - PA_SmartText(1, 1, 200, 190, 220, "Hello World", 3, 3, 4, 100); - - // And a centered text, to check if it works - PA_CenterSmartText(1, 0, 100, 255, 120, "Hello World", 2, 4, 1); // Same as Smart text, but no letter limit - - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// This example shows how to use 8 bit backgrounds, +// on which you can draw with the stylus or show text in different sizes, colors, or rotations + +// Includes +#include // Include for PA_Lib + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + //PA_LoadSplash(); // PA_Lib splash screen + + // Let's put some colors... in the background palettes + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); + PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); + + // Let's not load any backgrounds :p + + // This will initialise an bit background on each screen. This must be loaded before any other background. + // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload + // your backgrounds... + PA_Init8bitBg(0, 3); + PA_Init8bitBg(1, 3); + + // On these backgrounds, you can plot pixels, draw lines... and draw some custom text ! + PA_SmartText(1, // SCreen + 0, // Top left X + 1, // Top left Y + 255, // Botton right X + 20, // Bottom right Y + "Hello World", // Text + 1, // Text palette color (0-255) + 0, // Text size (0-4) + 0, // Text mode (0 - normal, 1 - transparent, 2 - no text, 3 - rotated 90°, 4 - 90° other way) + 100); // Maximum number of characters, if you want to right letter by letter... + PA_SmartText(1, 0, 20, 255, 40, "Hello World", 2, 1, 1, 100); + PA_SmartText(1, 0, 40, 255, 60, "Hello World", 3, 2, 1, 100); + PA_SmartText(1, 0, 60, 255, 80, "Hello World", 4, 3, 1, 100); + PA_SmartText(1, 0, 80, 255, 100, "Hello World", 1, 4, 1, 100); + + + // Let's have some rotated text :p + // X and Y positions are taken as if the DS was turned + PA_SmartText(1, 1, 1, 190, 20, "Hello World", 3, 3, 3, 100); + PA_SmartText(1, 1, 200, 190, 220, "Hello World", 3, 3, 4, 100); + + // And a centered text, to check if it works + PA_CenterSmartText(1, 0, 100, 255, 120, "Hello World", 2, 4, 1); // Same as Smart text, but no letter limit + + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/8bitText2/Makefile b/examples/Bitmap/8bitText2/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Bitmap/8bitText2/Makefile +++ b/examples/Bitmap/8bitText2/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Bitmap/8bitText2/source/main.c b/examples/Bitmap/8bitText2/source/main.c index 062c02c..a020152 100644 --- a/examples/Bitmap/8bitText2/source/main.c +++ b/examples/Bitmap/8bitText2/source/main.c @@ -1,38 +1,38 @@ -// This example shows how to use 8 bit backgrounds, -// on which you can draw with the stylus or show text in different sizes, colors, or rotations - -// Includes -#include // Include for PA_Lib - -#include // standard lib for texts... - -char text[200]; - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - // Let's put some colors... in the background palettes - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); - - PA_Init8bitBg(0, 3); - - - // Infinite loop to keep the program running - while (1) - { - sprintf(text, // string to use - "%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); // String to transform - PA_SmartText(0, 10, 20, 255, 40, text, 1, 3, 0, 100); // Display the text transformed :) - - // And the time... - sprintf(text, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds); - PA_SmartText(0, 10, 40, 255, 60, text, 1, 3, 0, 100); // Display the text transformed :) - - PA_WaitForVBL(); - } - - return 0; +// This example shows how to use 8 bit backgrounds, +// on which you can draw with the stylus or show text in different sizes, colors, or rotations + +// Includes +#include // Include for PA_Lib + +#include // standard lib for texts... + +char text[200]; + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + // Let's put some colors... in the background palettes + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); + + PA_Init8bitBg(0, 3); + + + // Infinite loop to keep the program running + while (1) + { + sprintf(text, // string to use + "%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); // String to transform + PA_SmartText(0, 10, 20, 255, 40, text, 1, 3, 0, 100); // Display the text transformed :) + + // And the time... + sprintf(text, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds); + PA_SmartText(0, 10, 40, 255, 60, text, 1, 3, 0, 100); // Display the text transformed :) + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/8bitTextFont/Makefile b/examples/Bitmap/8bitTextFont/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Bitmap/8bitTextFont/Makefile +++ b/examples/Bitmap/8bitTextFont/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Bitmap/8bitTextFont/gfx/all_gfx.h b/examples/Bitmap/8bitTextFont/gfx/all_gfx.h index bc6cf63..46e4942 100644 --- a/examples/Bitmap/8bitTextFont/gfx/all_gfx.h +++ b/examples/Bitmap/8bitTextFont/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct bigfont; -extern const PA_BgStruct smallfont; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct bigfont; +extern const PA_BgStruct smallfont; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Bitmap/8bitTextFont/gfx/bin/bigfont.c b/examples/Bitmap/8bitTextFont/gfx/bin/bigfont.c index 342beda..c9e66ff 100644 --- a/examples/Bitmap/8bitTextFont/gfx/bin/bigfont.c +++ b/examples/Bitmap/8bitTextFont/gfx/bin/bigfont.c @@ -1,17 +1,17 @@ -#include - -extern const char bigfont_Tiles[]; -extern const char bigfont_Map[]; -extern const char bigfont_Sizes[]; - -const PA_BgStruct bigfont = { - PA_Font8bit, - 512, 128, - - bigfont_Tiles, - bigfont_Map, - {bigfont_Sizes}, - - 16512, - {14} -}; +#include + +extern const char bigfont_Tiles[]; +extern const char bigfont_Map[]; +extern const char bigfont_Sizes[]; + +const PA_BgStruct bigfont = { + PA_Font8bit, + 512, 128, + + bigfont_Tiles, + bigfont_Map, + {bigfont_Sizes}, + + 16512, + {14} +}; diff --git a/examples/Bitmap/8bitTextFont/gfx/bin/smallfont.c b/examples/Bitmap/8bitTextFont/gfx/bin/smallfont.c index 744fb57..e71d954 100644 --- a/examples/Bitmap/8bitTextFont/gfx/bin/smallfont.c +++ b/examples/Bitmap/8bitTextFont/gfx/bin/smallfont.c @@ -1,17 +1,17 @@ -#include - -extern const char smallfont_Tiles[]; -extern const char smallfont_Map[]; -extern const char smallfont_Sizes[]; - -const PA_BgStruct smallfont = { - PA_Font8bit, - 256, 64, - - smallfont_Tiles, - smallfont_Map, - {smallfont_Sizes}, - - 6336, - {6} -}; +#include + +extern const char smallfont_Tiles[]; +extern const char smallfont_Map[]; +extern const char smallfont_Sizes[]; + +const PA_BgStruct smallfont = { + PA_Font8bit, + 256, 64, + + smallfont_Tiles, + smallfont_Map, + {smallfont_Sizes}, + + 6336, + {6} +}; diff --git a/examples/Bitmap/8bitTextFont/source/main.c b/examples/Bitmap/8bitTextFont/source/main.c index c7811a9..b608926 100644 --- a/examples/Bitmap/8bitTextFont/source/main.c +++ b/examples/Bitmap/8bitTextFont/source/main.c @@ -1,48 +1,48 @@ -// This example shows how to use 8 bit backgrounds, -// on which you can draw with the stylus or show text in different sizes, colors, or rotations - -// Includes -#include - -// Include the newly converted fonts... -#include "all_gfx.h" - -int main(){ - PA_Init(); - - // Let's put some colors... in the background palettes - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); - PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); - - // Let's not load any backgrounds :p - - // This will initialise an bit background on each screen. This must be loaded before any other background. - // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload - // your backgrounds... - PA_Init8bitBg(0, 3); - PA_Init8bitBg(1, 3); - - // Slots 0-4 are already used by default PAlib fonts, so we'll load on slots 5 and 6. - // Available slots : 5-9. You can overwrite a PAlib font though if you want to use slot 0 for example... - PA_AddBitmapFont(5, &smallfont); - PA_AddBitmapFont(6, &bigfont); - - PA_8bitText(1, 0, 20, 255, 40, "Small custom font...", 1, 5, 1, 100); - PA_8bitText(1, 0, 40, 255, 60, "Big custom font...", 1, 6, 1, 100); - - // Different colors on the bottom sreen... - int i; - for(i = 0; i < 10; i++) - PA_8bitText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 6, 1, 100); - - // Infinite loop to keep the program running - while(true){ - PA_WaitForVBL(); - } +// This example shows how to use 8 bit backgrounds, +// on which you can draw with the stylus or show text in different sizes, colors, or rotations + +// Includes +#include + +// Include the newly converted fonts... +#include "all_gfx.h" + +int main(){ + PA_Init(); + + // Let's put some colors... in the background palettes + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); + PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); + + // Let's not load any backgrounds :p + + // This will initialise an bit background on each screen. This must be loaded before any other background. + // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload + // your backgrounds... + PA_Init8bitBg(0, 3); + PA_Init8bitBg(1, 3); + + // Slots 0-4 are already used by default PAlib fonts, so we'll load on slots 5 and 6. + // Available slots : 5-9. You can overwrite a PAlib font though if you want to use slot 0 for example... + PA_AddBitmapFont(5, &smallfont); + PA_AddBitmapFont(6, &bigfont); + + PA_8bitText(1, 0, 20, 255, 40, "Small custom font...", 1, 5, 1, 100); + PA_8bitText(1, 0, 40, 255, 60, "Big custom font...", 1, 6, 1, 100); + + // Different colors on the bottom sreen... + int i; + for(i = 0; i < 10; i++) + PA_8bitText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 6, 1, 100); + + // Infinite loop to keep the program running + while(true){ + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Bitmap/Fake16bit/Makefile b/examples/Bitmap/Fake16bit/Makefile index db93290..9c67e5c 100644 --- a/examples/Bitmap/Fake16bit/Makefile +++ b/examples/Bitmap/Fake16bit/Makefile @@ -1,3 +1,3 @@ -BINDIRS := data gfx/bin - -include ../../Makefile_example +BINDIRS := data gfx/bin + +include ../../Makefile_example diff --git a/examples/Bitmap/Fake16bit/gfx/all_gfx.h b/examples/Bitmap/Fake16bit/gfx/all_gfx.h index d1ffec8..d9c16a5 100644 --- a/examples/Bitmap/Fake16bit/gfx/all_gfx.h +++ b/examples/Bitmap/Fake16bit/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const unsigned short test_Bitmap[49152] _GFX_ALIGN; // 16bit bitmap - - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const unsigned short test_Bitmap[49152] _GFX_ALIGN; // 16bit bitmap + + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Bitmap/Fake16bit/source/main.c b/examples/Bitmap/Fake16bit/source/main.c index f0c0137..ec97be3 100644 --- a/examples/Bitmap/Fake16bit/source/main.c +++ b/examples/Bitmap/Fake16bit/source/main.c @@ -1,75 +1,75 @@ -// Includes -#include // Include for PA_Lib - -// PAGfx include -#include "all_gfx.h" - -// Image includes -#include "photo.h" -#include "bmpimg.h" -#include "gifimg.h" -#include "gifanim.h" - -#define PA_RandColor() (PA_RGB(PA_RandMinMax(0, 31), PA_RandMinMax(0, 31), PA_RandMinMax(0, 31))) -#define PA_HangUp() while(true) PA_WaitForVBL() - -void DrawTest(u8 s) -{ - PA_LoadFake16bitBitmap(s, (void*)test_Bitmap); - PA_PutFake16bitPixel(s, 0, 0, PA_RGB(31, 31, 31)); - PA_PutFake16bitPixel(s, 20, 40, PA_RGB(31, 0, 31)); - PA_DrawFake16bitLine(s, 1, 1, 20, 20, PA_RGB(0, 0, 0)); - PA_DrawFake16bitRect(s, 50, 50, 200, 191, PA_RGB(0, 15, 15)); -} - -// Function: main() -int main() -{ - PA_Init(); - PA_InitFake16bitBg(0, 3); - PA_InitFake16bitBg(1, 3); - int oldx = 0, oldy = 0; - while(true) - { - DrawTest(0); - DrawTest(1); - while(true) - { - if(Pad.Newpress.A) - break; - if(Stylus.Newpress) - { - // Draw! - u16 c = PA_RandColor(); - PA_PutFake16bitPixel(0, Stylus.X, Stylus.Y, c); - PA_PutFake16bitPixel(1, Stylus.X, Stylus.Y, c); - oldx = Stylus.X; - oldy = Stylus.Y; - }else if(Stylus.Held) - { - u16 c = PA_RandColor(); - PA_DrawFake16bitLine(0, oldx, oldy, Stylus.X, Stylus.Y, c); - PA_DrawFake16bitLine(1, oldx, oldy, Stylus.X, Stylus.Y, c); - oldx = Stylus.X; - oldy = Stylus.Y; - } - PA_WaitForVBL(); - } - PA_ClearFake16bitBg(1); - PA_Fake16bitLoadJpeg(1,(void*)photo); - PA_WaitFor(Pad.Newpress.A); - PA_ClearFake16bitBg(1); - PA_Fake16bitLoadBmpEx(1,(void*)bmpimg, 40, 20); - PA_Fake16bitLoadBmpEx(1,(void*)bmpimg, 80, 40); - PA_WaitFor(Pad.Newpress.A); - PA_ClearFake16bitBg(1); - PA_Fake16bitLoadGifXY(1,gifimg, 50, 10); - PA_Fake16bitLoadGifXY(1,gifimg, 70, 30); - PA_WaitFor(Pad.Newpress.A); - PA_ClearFake16bitBg(1); - PA_Fake16bitLoadGifXY(1,gifanim, 10, 10); - PA_WaitFor(Pad.Newpress.A); - PA_ClearFake16bitBg(1); - PA_WaitForVBL(); - } +// Includes +#include // Include for PA_Lib + +// PAGfx include +#include "all_gfx.h" + +// Image includes +#include "photo.h" +#include "bmpimg.h" +#include "gifimg.h" +#include "gifanim.h" + +#define PA_RandColor() (PA_RGB(PA_RandMinMax(0, 31), PA_RandMinMax(0, 31), PA_RandMinMax(0, 31))) +#define PA_HangUp() while(true) PA_WaitForVBL() + +void DrawTest(u8 s) +{ + PA_LoadFake16bitBitmap(s, (void*)test_Bitmap); + PA_PutFake16bitPixel(s, 0, 0, PA_RGB(31, 31, 31)); + PA_PutFake16bitPixel(s, 20, 40, PA_RGB(31, 0, 31)); + PA_DrawFake16bitLine(s, 1, 1, 20, 20, PA_RGB(0, 0, 0)); + PA_DrawFake16bitRect(s, 50, 50, 200, 191, PA_RGB(0, 15, 15)); +} + +// Function: main() +int main() +{ + PA_Init(); + PA_InitFake16bitBg(0, 3); + PA_InitFake16bitBg(1, 3); + int oldx = 0, oldy = 0; + while(true) + { + DrawTest(0); + DrawTest(1); + while(true) + { + if(Pad.Newpress.A) + break; + if(Stylus.Newpress) + { + // Draw! + u16 c = PA_RandColor(); + PA_PutFake16bitPixel(0, Stylus.X, Stylus.Y, c); + PA_PutFake16bitPixel(1, Stylus.X, Stylus.Y, c); + oldx = Stylus.X; + oldy = Stylus.Y; + }else if(Stylus.Held) + { + u16 c = PA_RandColor(); + PA_DrawFake16bitLine(0, oldx, oldy, Stylus.X, Stylus.Y, c); + PA_DrawFake16bitLine(1, oldx, oldy, Stylus.X, Stylus.Y, c); + oldx = Stylus.X; + oldy = Stylus.Y; + } + PA_WaitForVBL(); + } + PA_ClearFake16bitBg(1); + PA_Fake16bitLoadJpeg(1,(void*)photo); + PA_WaitFor(Pad.Newpress.A); + PA_ClearFake16bitBg(1); + PA_Fake16bitLoadBmpEx(1,(void*)bmpimg, 40, 20); + PA_Fake16bitLoadBmpEx(1,(void*)bmpimg, 80, 40); + PA_WaitFor(Pad.Newpress.A); + PA_ClearFake16bitBg(1); + PA_Fake16bitLoadGifXY(1,gifimg, 50, 10); + PA_Fake16bitLoadGifXY(1,gifimg, 70, 30); + PA_WaitFor(Pad.Newpress.A); + PA_ClearFake16bitBg(1); + PA_Fake16bitLoadGifXY(1,gifanim, 10, 10); + PA_WaitFor(Pad.Newpress.A); + PA_ClearFake16bitBg(1); + PA_WaitForVBL(); + } } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/Load16bitBitmap/Makefile b/examples/Bitmap/Load16bitBitmap/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Bitmap/Load16bitBitmap/Makefile +++ b/examples/Bitmap/Load16bitBitmap/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Bitmap/Load16bitBitmap/gfx/all_gfx.h b/examples/Bitmap/Load16bitBitmap/gfx/all_gfx.h index 2e58df3..a713a66 100644 --- a/examples/Bitmap/Load16bitBitmap/gfx/all_gfx.h +++ b/examples/Bitmap/Load16bitBitmap/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const unsigned short Photo16bit_Bitmap[49152] _GFX_ALIGN; // 16bit bitmap - - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const unsigned short Photo16bit_Bitmap[49152] _GFX_ALIGN; // 16bit bitmap + + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Bitmap/Load16bitBitmap/source/main.c b/examples/Bitmap/Load16bitBitmap/source/main.c index bba767d..6863ea1 100644 --- a/examples/Bitmap/Load16bitBitmap/source/main.c +++ b/examples/Bitmap/Load16bitBitmap/source/main.c @@ -1,35 +1,35 @@ -// Load an 16 bit bitmap on the DS screen... -// Gfx2gba command line : gfx2gba -D -fsrc -c32k *.BMP - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" // Include the picture... - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - // This will initialise a 16 bit background on each screen. This must be loaded before any other background. - // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload - // your backgrounds... - PA_Init16bitBg(0, 3); - PA_Init16bitBg(1, 3); - - // No need to load a palette ! - - PA_Load16bitBitmap(0, // screen - Photo16bit_Bitmap); // image - PA_Load16bitBitmap(1, Photo16bit_Bitmap); - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// Load an 16 bit bitmap on the DS screen... +// Gfx2gba command line : gfx2gba -D -fsrc -c32k *.BMP + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" // Include the picture... + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + // This will initialise a 16 bit background on each screen. This must be loaded before any other background. + // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload + // your backgrounds... + PA_Init16bitBg(0, 3); + PA_Init16bitBg(1, 3); + + // No need to load a palette ! + + PA_Load16bitBitmap(0, // screen + Photo16bit_Bitmap); // image + PA_Load16bitBitmap(1, Photo16bit_Bitmap); + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/Load8bitBitmap/Makefile b/examples/Bitmap/Load8bitBitmap/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Bitmap/Load8bitBitmap/Makefile +++ b/examples/Bitmap/Load8bitBitmap/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Bitmap/Load8bitBitmap/gfx/all_gfx.h b/examples/Bitmap/Load8bitBitmap/gfx/all_gfx.h index 9d5496d..0ccb9a7 100644 --- a/examples/Bitmap/Load8bitBitmap/gfx/all_gfx.h +++ b/examples/Bitmap/Load8bitBitmap/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const unsigned char Photo8bit_Bitmap[49152] _GFX_ALIGN; // Palette: bitmap_Pal - - -// Palettes: -extern const unsigned short bitmap_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const unsigned char Photo8bit_Bitmap[49152] _GFX_ALIGN; // Palette: bitmap_Pal + + +// Palettes: +extern const unsigned short bitmap_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Bitmap/Load8bitBitmap/source/main.c b/examples/Bitmap/Load8bitBitmap/source/main.c index 0818f28..dc20db9 100644 --- a/examples/Bitmap/Load8bitBitmap/source/main.c +++ b/examples/Bitmap/Load8bitBitmap/source/main.c @@ -1,36 +1,36 @@ -// Load an 8 bit bitmap on the DS screen... -// Converted using PAlib Gfx Converter - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" // Include the picture... - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - // This will initialise an bit background on each screen. This must be loaded before any other background. - // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload - // your backgrounds... - PA_Init8bitBg(0, 3); - PA_Init8bitBg(1, 3); - - PA_Load8bitBgPal(0, (u8*)bitmap_Pal); - PA_Load8bitBgPal(1, (u8*)bitmap_Pal); - - PA_Load8bitBitmap(0, // screen - Photo8bit_Bitmap); // image - PA_Load8bitBitmap(1, Photo8bit_Bitmap); - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// Load an 8 bit bitmap on the DS screen... +// Converted using PAlib Gfx Converter + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" // Include the picture... + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + // This will initialise an bit background on each screen. This must be loaded before any other background. + // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload + // your backgrounds... + PA_Init8bitBg(0, 3); + PA_Init8bitBg(1, 3); + + PA_Load8bitBgPal(0, (u8*)bitmap_Pal); + PA_Load8bitBgPal(1, (u8*)bitmap_Pal); + + PA_Load8bitBitmap(0, // screen + Photo8bit_Bitmap); // image + PA_Load8bitBitmap(1, Photo8bit_Bitmap); + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/LoadJpeg/Makefile b/examples/Bitmap/LoadJpeg/Makefile index fb2ebc4..9b4693a 100644 --- a/examples/Bitmap/LoadJpeg/Makefile +++ b/examples/Bitmap/LoadJpeg/Makefile @@ -1,3 +1,3 @@ -BINDIRS := data - -include ../../Makefile_example +BINDIRS := data + +include ../../Makefile_example diff --git a/examples/Bitmap/LoadJpeg/source/main.c b/examples/Bitmap/LoadJpeg/source/main.c index 5e8778b..9bbb3dd 100644 --- a/examples/Bitmap/LoadJpeg/source/main.c +++ b/examples/Bitmap/LoadJpeg/source/main.c @@ -1,33 +1,33 @@ -// Load an 16 bit jpeg on the screen ! -// The jpeg must be put in the data folder... - - - -// Includes -#include // Include for PA_Lib - -#include "Photo.h" // Include the jpeg... - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - // This will initialise a 16 bit background on each screen. This must be loaded before any other background. - // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init16bit, then reload your backgrounds... - PA_Init16bitBg(0, 3); - PA_Init16bitBg(1, 3); - - // Load the jpeg on the given screen... pretty simple ! - PA_LoadJpeg(0, (void*)Photo); - PA_LoadJpeg(1, (void*)Photo); - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// Load an 16 bit jpeg on the screen ! +// The jpeg must be put in the data folder... + + + +// Includes +#include // Include for PA_Lib + +#include "Photo.h" // Include the jpeg... + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + // This will initialise a 16 bit background on each screen. This must be loaded before any other background. + // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init16bit, then reload your backgrounds... + PA_Init16bitBg(0, 3); + PA_Init16bitBg(1, 3); + + // Load the jpeg on the given screen... pretty simple ! + PA_LoadJpeg(0, (void*)Photo); + PA_LoadJpeg(1, (void*)Photo); + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Bitmap/TextRot/Makefile b/examples/Bitmap/TextRot/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Bitmap/TextRot/Makefile +++ b/examples/Bitmap/TextRot/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Bitmap/TextRot/source/main.c b/examples/Bitmap/TextRot/source/main.c index cdc9a8a..e43ec56 100644 --- a/examples/Bitmap/TextRot/source/main.c +++ b/examples/Bitmap/TextRot/source/main.c @@ -1,76 +1,76 @@ -// This example shows how to use 8 bit backgrounds, -// on which you can draw with the stylus or show text in different sizes, colors, or rotations - -// Includes -#include // Include for PA_Lib - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - //PA_LoadSplash(); // PA_Lib splash screen - - // Let's put some colors... in the background palettes - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); - - // Let's not load any backgrounds :p - - // This will initialise an bit background on each screen. This must be loaded before any other background. - // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload - // your backgrounds... - PA_Init8bitBg(0, 3); - - PA_SmartText(0, 0, 80, 255, 100, "Hello World", 1, 4, 1, 100); - - - // Let's have some rotated text :p - // X and Y positions are taken as if the DS was turned - PA_SmartText(0, 1, 1, 190, 20, "Hello World", 3, 3, 3, 100); - - // And a centered text, to check if it works - PA_CenterSmartText(0, 0, 100, 255, 120, "Hello World", 2, 4, 1); // Same as Smart text, but no letter limit - - - - PA_LoadDefaultText(1, 0); - - // Infinite loop to keep the program running - s32 scrollx = 0; - s32 scrolly = 0; - s32 rotcenterx = 0; - s32 rotcentery = 0; - s16 angle = 0; - s32 zoom = 256; - - PA_OutputSimpleText(1, 2, 2, "Zoom : Start/Select"); - PA_OutputSimpleText(1, 2, 3, "ScrollX : Left/Right"); - PA_OutputSimpleText(1, 2, 4, "Scrolly : Up/Down"); - PA_OutputSimpleText(1, 2, 5, "RotCenterX : A/Y"); - PA_OutputSimpleText(1, 2, 6, "RotCenterY : B/X"); - PA_OutputSimpleText(1, 2, 7, "Angle : R/L"); - - - while (1) - { - zoom += Pad.Held.Start - Pad.Held.Select; - scrollx += Pad.Held.Right - Pad.Held.Left; - scrolly += Pad.Held.Down - Pad.Held.Up; - rotcenterx += Pad.Held.A - Pad.Held.Y; - rotcentery += Pad.Held.B - Pad.Held.X; - angle += Pad.Held.R - Pad.Held.L; - - PA_SetBgRot(0, 3, scrollx, scrolly, rotcenterx, rotcentery, angle, zoom); - - PA_WaitForVBL(); - } - - - return 0; +// This example shows how to use 8 bit backgrounds, +// on which you can draw with the stylus or show text in different sizes, colors, or rotations + +// Includes +#include // Include for PA_Lib + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + //PA_LoadSplash(); // PA_Lib splash screen + + // Let's put some colors... in the background palettes + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); + + // Let's not load any backgrounds :p + + // This will initialise an bit background on each screen. This must be loaded before any other background. + // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload + // your backgrounds... + PA_Init8bitBg(0, 3); + + PA_SmartText(0, 0, 80, 255, 100, "Hello World", 1, 4, 1, 100); + + + // Let's have some rotated text :p + // X and Y positions are taken as if the DS was turned + PA_SmartText(0, 1, 1, 190, 20, "Hello World", 3, 3, 3, 100); + + // And a centered text, to check if it works + PA_CenterSmartText(0, 0, 100, 255, 120, "Hello World", 2, 4, 1); // Same as Smart text, but no letter limit + + + + PA_LoadDefaultText(1, 0); + + // Infinite loop to keep the program running + s32 scrollx = 0; + s32 scrolly = 0; + s32 rotcenterx = 0; + s32 rotcentery = 0; + s16 angle = 0; + s32 zoom = 256; + + PA_OutputSimpleText(1, 2, 2, "Zoom : Start/Select"); + PA_OutputSimpleText(1, 2, 3, "ScrollX : Left/Right"); + PA_OutputSimpleText(1, 2, 4, "Scrolly : Up/Down"); + PA_OutputSimpleText(1, 2, 5, "RotCenterX : A/Y"); + PA_OutputSimpleText(1, 2, 6, "RotCenterY : B/X"); + PA_OutputSimpleText(1, 2, 7, "Angle : R/L"); + + + while (1) + { + zoom += Pad.Held.Start - Pad.Held.Select; + scrollx += Pad.Held.Right - Pad.Held.Left; + scrolly += Pad.Held.Down - Pad.Held.Up; + rotcenterx += Pad.Held.A - Pad.Held.Y; + rotcentery += Pad.Held.B - Pad.Held.X; + angle += Pad.Held.R - Pad.Held.L; + + PA_SetBgRot(0, 3, scrollx, scrolly, rotcenterx, rotcentery, angle, zoom); + + PA_WaitForVBL(); + } + + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/C++/Gravity/Makefile b/examples/C++/Gravity/Makefile index 21f133f..a49fbfb 100644 --- a/examples/C++/Gravity/Makefile +++ b/examples/C++/Gravity/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/C++/Gravity/gfx/all_gfx.h b/examples/C++/Gravity/gfx/all_gfx.h index c4729ad..c8e78ee 100644 --- a/examples/C++/Gravity/gfx/all_gfx.h +++ b/examples/C++/Gravity/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char ball_Sprite[1024] _GFX_ALIGN; // Palette: ball_Pal - -// Palettes: -extern const unsigned short ball_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char ball_Sprite[1024] _GFX_ALIGN; // Palette: ball_Pal + +// Palettes: +extern const unsigned short ball_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/C++/Gravity/source/main.cpp b/examples/C++/Gravity/source/main.cpp index accdf3c..49b46ce 100644 --- a/examples/C++/Gravity/source/main.cpp +++ b/examples/C++/Gravity/source/main.cpp @@ -1,52 +1,52 @@ -////////////////////////////////////////////////// -// PAlib C++ project template // -// main.cpp // -// Contains the entry point of the program. // -////////////////////////////////////////////////// - -#include - -#include "all_gfx.h" - -#define JUMPFORCE (-4) -#define GRAVITY 0.25f - -using PA::Sprite; -using PA::Fixed; - -// Sprite with Y velocity -class VelSprite: public Sprite{ -public: - VelSprite(int a, int b) : Sprite(a, b){} - Fixed vy; - - void vUpdate(){ pos.y += vy; } - void custupdate(){ PA_SetSpriteXY(screen, sprid, pos.x - 15, pos.y - 31); } -}; - -VelSprite ball(1, 0); - -int main(){ - PA_Init(); - - PA_LoadSpritePal(1, 0, (void*) ball_Pal); - ball.create((void*) ball_Sprite, OBJ_SIZE_32X32, 0); - ball.move(128, 191); - ball.vy = JUMPFORCE; - - for(;;){ - PA_WaitForVBlank(); - - if(ball.pos.y < 192) - // Constant floats are automatically converted - // to fixed-point at compile-time 8) - ball.vy += GRAVITY; - - ball.vUpdate(); - - if(ball.pos.y >= 192) - ball.vy = JUMPFORCE, ball.pos.y = 191; - - ball.custupdate(); - } -} +////////////////////////////////////////////////// +// PAlib C++ project template // +// main.cpp // +// Contains the entry point of the program. // +////////////////////////////////////////////////// + +#include + +#include "all_gfx.h" + +#define JUMPFORCE (-4) +#define GRAVITY 0.25f + +using PA::Sprite; +using PA::Fixed; + +// Sprite with Y velocity +class VelSprite: public Sprite{ +public: + VelSprite(int a, int b) : Sprite(a, b){} + Fixed vy; + + void vUpdate(){ pos.y += vy; } + void custupdate(){ PA_SetSpriteXY(screen, sprid, pos.x - 15, pos.y - 31); } +}; + +VelSprite ball(1, 0); + +int main(){ + PA_Init(); + + PA_LoadSpritePal(1, 0, (void*) ball_Pal); + ball.create((void*) ball_Sprite, OBJ_SIZE_32X32, 0); + ball.move(128, 191); + ball.vy = JUMPFORCE; + + for(;;){ + PA_WaitForVBlank(); + + if(ball.pos.y < 192) + // Constant floats are automatically converted + // to fixed-point at compile-time 8) + ball.vy += GRAVITY; + + ball.vUpdate(); + + if(ball.pos.y >= 192) + ball.vy = JUMPFORCE, ball.pos.y = 191; + + ball.custupdate(); + } +} diff --git a/examples/C++/HandleProvider/Makefile b/examples/C++/HandleProvider/Makefile index 21f133f..a49fbfb 100644 --- a/examples/C++/HandleProvider/Makefile +++ b/examples/C++/HandleProvider/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/C++/HandleProvider/gfx/all_gfx.h b/examples/C++/HandleProvider/gfx/all_gfx.h index 6f872fd..306716d 100644 --- a/examples/C++/HandleProvider/gfx/all_gfx.h +++ b/examples/C++/HandleProvider/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char rocket_Sprite[1024] _GFX_ALIGN; // Palette: rocket_Pal - -// Palettes: -extern const unsigned short rocket_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char rocket_Sprite[1024] _GFX_ALIGN; // Palette: rocket_Pal + +// Palettes: +extern const unsigned short rocket_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/C++/HandleProvider/source/MyApp.cpp b/examples/C++/HandleProvider/source/MyApp.cpp index 8362d3d..e84628f 100644 --- a/examples/C++/HandleProvider/source/MyApp.cpp +++ b/examples/C++/HandleProvider/source/MyApp.cpp @@ -1,57 +1,57 @@ -////////////////////////////////////////////////// -// PAlib C++ project template // -// MyApp.cpp // -// Main project source code file. // -////////////////////////////////////////////////// - -// Include the application header -#include "MyApp.h" - -// Declare variables -Sprite* MyApp::sprites; -HandleProvider<128> MyApp::hnd; // max number of handles - -// Initialization function -void MyApp::init(){ - // Initialize the text system - PA_LoadDefaultText(1, 0); - - // Load the graphics - u16 rocketgfx = loadrocket(); - - // Create the sprites - sprites = new Sprite[8]; - - for(int i = 0; i < 8; i ++){ - // The init() method behaves the same way as the constructor. - sprites[i].init(1, hnd.newhandle()); - sprites[i].create(rocketgfx, OBJ_SIZE_32X32, 0); // also accepts a gfx id - - // Print the sprite ID - PA_OutputText(1, 1, 1+i, "%d", sprites[i].sprid); - - // Move the sprite - sprites[i].move(i<<5, i<<3); - sprites[i].priority(1); - } -} - -// Rocket graphic loading function -u16 MyApp::loadrocket(){ - PA_LoadSpritePal(1, 0, (void*)rocket_Pal); - return PA_CreateGfx(1, (void*)rocket_Sprite, OBJ_SIZE_32X32, 1); -} - -// Render function: called after each VBlank -void MyApp::render(){ - // Render the sprites - for(int i = 0; i < 8; i ++) - sprites[i].render(); -} - -// Update function -bool MyApp::update(){ - - // Keep going - return true; -} +////////////////////////////////////////////////// +// PAlib C++ project template // +// MyApp.cpp // +// Main project source code file. // +////////////////////////////////////////////////// + +// Include the application header +#include "MyApp.h" + +// Declare variables +Sprite* MyApp::sprites; +HandleProvider<128> MyApp::hnd; // max number of handles + +// Initialization function +void MyApp::init(){ + // Initialize the text system + PA_LoadDefaultText(1, 0); + + // Load the graphics + u16 rocketgfx = loadrocket(); + + // Create the sprites + sprites = new Sprite[8]; + + for(int i = 0; i < 8; i ++){ + // The init() method behaves the same way as the constructor. + sprites[i].init(1, hnd.newhandle()); + sprites[i].create(rocketgfx, OBJ_SIZE_32X32, 0); // also accepts a gfx id + + // Print the sprite ID + PA_OutputText(1, 1, 1+i, "%d", sprites[i].sprid); + + // Move the sprite + sprites[i].move(i<<5, i<<3); + sprites[i].priority(1); + } +} + +// Rocket graphic loading function +u16 MyApp::loadrocket(){ + PA_LoadSpritePal(1, 0, (void*)rocket_Pal); + return PA_CreateGfx(1, (void*)rocket_Sprite, OBJ_SIZE_32X32, 1); +} + +// Render function: called after each VBlank +void MyApp::render(){ + // Render the sprites + for(int i = 0; i < 8; i ++) + sprites[i].render(); +} + +// Update function +bool MyApp::update(){ + + // Keep going + return true; +} diff --git a/examples/C++/HandleProvider/source/MyApp.h b/examples/C++/HandleProvider/source/MyApp.h index 2208284..fdb49c1 100644 --- a/examples/C++/HandleProvider/source/MyApp.h +++ b/examples/C++/HandleProvider/source/MyApp.h @@ -1,35 +1,35 @@ -////////////////////////////////////////////////// -// PAlib C++ project template // -// MyApp.h // -// Main project header. // -////////////////////////////////////////////////// - -#pragma once - -// Include the PAlib header -#include - -// Include our graphics -#include "all_gfx.h" - -// Using statements -using PA::Application; -using PA::Sprite; -using PA::HandleProvider; - -// Main application class -class MyApp: public Application{ - // Put your variables here - // Also don't forget to declare them - // in the MyApp.cpp file! - static Sprite* sprites; - static HandleProvider<128> hnd; - - // Main methods (needed by run()) - void init(); - void render(); - bool update(); - - // Our own methods - u16 loadrocket(); -}; +////////////////////////////////////////////////// +// PAlib C++ project template // +// MyApp.h // +// Main project header. // +////////////////////////////////////////////////// + +#pragma once + +// Include the PAlib header +#include + +// Include our graphics +#include "all_gfx.h" + +// Using statements +using PA::Application; +using PA::Sprite; +using PA::HandleProvider; + +// Main application class +class MyApp: public Application{ + // Put your variables here + // Also don't forget to declare them + // in the MyApp.cpp file! + static Sprite* sprites; + static HandleProvider<128> hnd; + + // Main methods (needed by run()) + void init(); + void render(); + bool update(); + + // Our own methods + u16 loadrocket(); +}; diff --git a/examples/C++/HandleProvider/source/main.cpp b/examples/C++/HandleProvider/source/main.cpp index fb49e43..5b90663 100644 --- a/examples/C++/HandleProvider/source/main.cpp +++ b/examples/C++/HandleProvider/source/main.cpp @@ -1,20 +1,20 @@ -////////////////////////////////////////////////// -// PAlib C++ project template // -// main.cpp // -// Contains the entry point of the program. // -////////////////////////////////////////////////// - -// Include the application header -#include "MyApp.h" - -// Entry point -int main(){ - // Initialize PAlib - PA_Init(); - - // Run the application - MyApp app; - app.run(); - - return 0; -} +////////////////////////////////////////////////// +// PAlib C++ project template // +// main.cpp // +// Contains the entry point of the program. // +////////////////////////////////////////////////// + +// Include the application header +#include "MyApp.h" + +// Entry point +int main(){ + // Initialize PAlib + PA_Init(); + + // Run the application + MyApp app; + app.run(); + + return 0; +} diff --git a/examples/Demos/Bunny/Makefile b/examples/Demos/Bunny/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Demos/Bunny/Makefile +++ b/examples/Demos/Bunny/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Demos/Bunny/gfx/all_gfx.h b/examples/Demos/Bunny/gfx/all_gfx.h index 433b5a7..87809f2 100644 --- a/examples/Demos/Bunny/gfx/all_gfx.h +++ b/examples/Demos/Bunny/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char bunny_Sprite[24576] _GFX_ALIGN; // Palette: bunny_Pal -extern const unsigned char bunnyrip_Sprite[24576] _GFX_ALIGN; // Palette: bunny_Pal - -// Palettes: -extern const unsigned short bunny_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char bunny_Sprite[24576] _GFX_ALIGN; // Palette: bunny_Pal +extern const unsigned char bunnyrip_Sprite[24576] _GFX_ALIGN; // Palette: bunny_Pal + +// Palettes: +extern const unsigned short bunny_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/Bunny/source/main.c b/examples/Demos/Bunny/source/main.c index 883efb2..de0e763 100644 --- a/examples/Demos/Bunny/source/main.c +++ b/examples/Demos/Bunny/source/main.c @@ -1,39 +1,39 @@ -#include -#include "all_gfx.h" - -int main(){ - PA_Init(); - - PA_LoadSpritePal(0, 0, (void*)bunny_Pal); // Load the sprite palette - - PA_SetBgColor(0, PA_RGB(31, 31, 31)); - - // Load a sprite... - int i; - PA_CreateSprite(0, 0, (void*)bunny_Sprite, OBJ_SIZE_64X64,1, 0, 128-32, 96-32); //Create a sprites - for(i = 0; i < 6; i ++){ - PA_CreateSprite(0, i+1,(void*)bunnyrip_Sprite, OBJ_SIZE_64X64,1, 0, 128-32, 96-32); - PA_SetSpriteAnim(0, i+1, i); - } - - PA_InitAllSpriteDraw(); // Inits the sprite draw mode, necessary for the pixel-perfect touch detection - - bool moved[6]; - for (i = 0; i < 6; i++) moved[i] = 0; - - while(true){ - for (i = 0; i < 6; i++) { - bool temp = PA_MoveSpritePix(i+1); - if ((temp == 1) && (moved[i] == 0) && (PA_Distance(PA_MovedSprite.X, 0, 128-32, 0) >= 20*20)){ - PA_StartSpriteAnimEx(0, 0, 0, 5, 20, ANIM_UPDOWN, 2); - moved[i] = 1; - }else if ((temp == 1) && (moved[i] == 0) && (PA_Distance(PA_MovedSprite.X, 0, 128-32, 0) < 20*20)) - PA_SetSpriteXY(0, i+1, 128-32 + ((PA_MovedSprite.X - (128-32))>>2), 96-32 + ((PA_MovedSprite.Y - (96-32))>>3)); - } - int var = 0; - for (i = 0; i < 6; i++) var+= moved[i]; - if (var == 6) PA_SetSpriteAnim(0, 0, 5); - - PA_WaitForVBL(); - } +#include +#include "all_gfx.h" + +int main(){ + PA_Init(); + + PA_LoadSpritePal(0, 0, (void*)bunny_Pal); // Load the sprite palette + + PA_SetBgColor(0, PA_RGB(31, 31, 31)); + + // Load a sprite... + int i; + PA_CreateSprite(0, 0, (void*)bunny_Sprite, OBJ_SIZE_64X64,1, 0, 128-32, 96-32); //Create a sprites + for(i = 0; i < 6; i ++){ + PA_CreateSprite(0, i+1,(void*)bunnyrip_Sprite, OBJ_SIZE_64X64,1, 0, 128-32, 96-32); + PA_SetSpriteAnim(0, i+1, i); + } + + PA_InitAllSpriteDraw(); // Inits the sprite draw mode, necessary for the pixel-perfect touch detection + + bool moved[6]; + for (i = 0; i < 6; i++) moved[i] = 0; + + while(true){ + for (i = 0; i < 6; i++) { + bool temp = PA_MoveSpritePix(i+1); + if ((temp == 1) && (moved[i] == 0) && (PA_Distance(PA_MovedSprite.X, 0, 128-32, 0) >= 20*20)){ + PA_StartSpriteAnimEx(0, 0, 0, 5, 20, ANIM_UPDOWN, 2); + moved[i] = 1; + }else if ((temp == 1) && (moved[i] == 0) && (PA_Distance(PA_MovedSprite.X, 0, 128-32, 0) < 20*20)) + PA_SetSpriteXY(0, i+1, 128-32 + ((PA_MovedSprite.X - (128-32))>>2), 96-32 + ((PA_MovedSprite.Y - (96-32))>>3)); + } + int var = 0; + for (i = 0; i < 6; i++) var+= moved[i]; + if (var == 6) PA_SetSpriteAnim(0, 0, 5); + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Demos/CarreRouge/Makefile b/examples/Demos/CarreRouge/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Demos/CarreRouge/Makefile +++ b/examples/Demos/CarreRouge/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Demos/CarreRouge/gfx/all_gfx.h b/examples/Demos/CarreRouge/gfx/all_gfx.h index 1e4d43c..1b40767 100644 --- a/examples/Demos/CarreRouge/gfx/all_gfx.h +++ b/examples/Demos/CarreRouge/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char blue_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal -extern const unsigned char red_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char blue_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal +extern const unsigned char red_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/CarreRouge/source/main.c b/examples/Demos/CarreRouge/source/main.c index 7b2854d..5f3243f 100644 --- a/examples/Demos/CarreRouge/source/main.c +++ b/examples/Demos/CarreRouge/source/main.c @@ -1,128 +1,128 @@ -// Includes -#include - -#include "all_gfx.h" -#define MAXBLUE 4 // number of blue ones... - -typedef struct{ - s16 x, y; // position in pixels - s32 fx, fy; // Position in fixed point - s32 vx, vy; // speed... - s16 w, h; // HALF width and HALF height, because that's what we'll use... -} rectangle; - -rectangle blue[MAXBLUE]; // MAXBLUE possible rectangles, we'll probably use less - -rectangle red; // Our rectangle... - - -// Blue rectangle inits -void Blue16x32(u8 number); -void Blue32x16(u8 number); -void Blue32x32(u8 number); - -void MoveBlue(u8 number); // Blue rect move -void CheckCollision(u8 number); // Checks if there is a collision... - - -// Fixed-Normal conversions -extern inline void ToFixedPoint(u8 number){ - blue[number].fx = blue[number].x <<8; - blue[number].fy = blue[number].y <<8; -} - -extern inline void ToNormal(u8 number){ - blue[number].x = blue[number].fx >>8; - blue[number].y = blue[number].fy >>8; -} - - - -int main(void){ - - PA_Init(); - - PA_LoadDefaultText(1,0); // On the top screen - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); - - red.x = 128; red.y = 96; - red.w = 16; red.h = 16; // Half width and height... - PA_CreateSprite(0, 0,(void*)red_Sprite, OBJ_SIZE_32X32,1, 0, red.x - red.w, red.y - red.h); - - int i; - - for(i = 0; i < MAXBLUE; i++){ - u8 random = PA_Rand()%3; - if (random == 0) Blue16x32(i); - else if (random == 1) Blue32x32(i); - else if (random == 2) Blue32x16(i); - - // Position and random angle - blue[i].x = (i&1)*256; blue[i].y = (i>>1)*192; - u16 angle = PA_Rand()&511; - blue[i].vx = PA_Cos(angle); - blue[i].vy = -PA_Sin(angle); - - ToFixedPoint(i); // Add the fixed point values based on the position... - } - - - while(1) - { - if (PA_MoveSprite(0)){ - red.x = PA_MovedSprite.X; - red.y = PA_MovedSprite.Y; - } - - for (i = 0; i < MAXBLUE; i++) { - MoveBlue(i); // Move all the blue rectangles... - CheckCollision(i); // Check collision - } - - PA_WaitForVBL(); - } - return 0; -} - - -void Blue16x32(u8 number){ - blue[number].w = 8; blue[number].h = 16; - PA_CreateSprite(0, number+1, (void*)blue_Sprite, OBJ_SIZE_16X32,1, 0, 0, 0); -} - -void Blue32x16(u8 number){ - blue[number].w = 16; blue[number].h = 8; - PA_CreateSprite(0, number+1, (void*)blue_Sprite, OBJ_SIZE_32X16,1, 0, 0, 0); -} - -void Blue32x32(u8 number){ - blue[number].w = 16; blue[number].h = 16; - PA_CreateSprite(0, number+1, (void*)blue_Sprite, OBJ_SIZE_32X32,1, 0, 0, 0); -} - - - - -void MoveBlue(u8 number){ - - blue[number].fx += blue[number].vx; - blue[number].fy += blue[number].vy; - - ToNormal(number); // Convert to normal again, to check easily if out... - - if ((blue[number].x - blue[number].w <= 0) && (blue[number].vx < 0)) blue[number].vx = -blue[number].vx; - else if ((blue[number].x + blue[number].w >= 256)&&(blue[number].vx > 0)) blue[number].vx = - blue[number].vx; - - // Same thing, for top and bottom limits... - if ((blue[number].y - blue[number].h <= 0) && (blue[number].vy < 0)) blue[number].vy = -blue[number].vy; - else if ((blue[number].y + blue[number].h >= 192)&& (blue[number].vy > 0)) blue[number].vy = - blue[number].vy; - - PA_SetSpriteXY(0, number+1, blue[number].x-blue[number].w, blue[number].y-blue[number].h); -} - - -void CheckCollision(u8 number){ - if ((red.x >= blue[number].x - (blue[number].w + red.w)) && (red.x <= blue[number].x + (blue[number].w + red.w)) && (red.y >= blue[number].y - (blue[number].h + red.h)) && (red.y <= blue[number].y + (blue[number].h + red.h))) PA_OutputText(1, 2, 10, "Collision !!"); - +// Includes +#include + +#include "all_gfx.h" +#define MAXBLUE 4 // number of blue ones... + +typedef struct{ + s16 x, y; // position in pixels + s32 fx, fy; // Position in fixed point + s32 vx, vy; // speed... + s16 w, h; // HALF width and HALF height, because that's what we'll use... +} rectangle; + +rectangle blue[MAXBLUE]; // MAXBLUE possible rectangles, we'll probably use less + +rectangle red; // Our rectangle... + + +// Blue rectangle inits +void Blue16x32(u8 number); +void Blue32x16(u8 number); +void Blue32x32(u8 number); + +void MoveBlue(u8 number); // Blue rect move +void CheckCollision(u8 number); // Checks if there is a collision... + + +// Fixed-Normal conversions +extern inline void ToFixedPoint(u8 number){ + blue[number].fx = blue[number].x <<8; + blue[number].fy = blue[number].y <<8; +} + +extern inline void ToNormal(u8 number){ + blue[number].x = blue[number].fx >>8; + blue[number].y = blue[number].fy >>8; +} + + + +int main(void){ + + PA_Init(); + + PA_LoadDefaultText(1,0); // On the top screen + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); + + red.x = 128; red.y = 96; + red.w = 16; red.h = 16; // Half width and height... + PA_CreateSprite(0, 0,(void*)red_Sprite, OBJ_SIZE_32X32,1, 0, red.x - red.w, red.y - red.h); + + int i; + + for(i = 0; i < MAXBLUE; i++){ + u8 random = PA_Rand()%3; + if (random == 0) Blue16x32(i); + else if (random == 1) Blue32x32(i); + else if (random == 2) Blue32x16(i); + + // Position and random angle + blue[i].x = (i&1)*256; blue[i].y = (i>>1)*192; + u16 angle = PA_Rand()&511; + blue[i].vx = PA_Cos(angle); + blue[i].vy = -PA_Sin(angle); + + ToFixedPoint(i); // Add the fixed point values based on the position... + } + + + while(1) + { + if (PA_MoveSprite(0)){ + red.x = PA_MovedSprite.X; + red.y = PA_MovedSprite.Y; + } + + for (i = 0; i < MAXBLUE; i++) { + MoveBlue(i); // Move all the blue rectangles... + CheckCollision(i); // Check collision + } + + PA_WaitForVBL(); + } + return 0; +} + + +void Blue16x32(u8 number){ + blue[number].w = 8; blue[number].h = 16; + PA_CreateSprite(0, number+1, (void*)blue_Sprite, OBJ_SIZE_16X32,1, 0, 0, 0); +} + +void Blue32x16(u8 number){ + blue[number].w = 16; blue[number].h = 8; + PA_CreateSprite(0, number+1, (void*)blue_Sprite, OBJ_SIZE_32X16,1, 0, 0, 0); +} + +void Blue32x32(u8 number){ + blue[number].w = 16; blue[number].h = 16; + PA_CreateSprite(0, number+1, (void*)blue_Sprite, OBJ_SIZE_32X32,1, 0, 0, 0); +} + + + + +void MoveBlue(u8 number){ + + blue[number].fx += blue[number].vx; + blue[number].fy += blue[number].vy; + + ToNormal(number); // Convert to normal again, to check easily if out... + + if ((blue[number].x - blue[number].w <= 0) && (blue[number].vx < 0)) blue[number].vx = -blue[number].vx; + else if ((blue[number].x + blue[number].w >= 256)&&(blue[number].vx > 0)) blue[number].vx = - blue[number].vx; + + // Same thing, for top and bottom limits... + if ((blue[number].y - blue[number].h <= 0) && (blue[number].vy < 0)) blue[number].vy = -blue[number].vy; + else if ((blue[number].y + blue[number].h >= 192)&& (blue[number].vy > 0)) blue[number].vy = - blue[number].vy; + + PA_SetSpriteXY(0, number+1, blue[number].x-blue[number].w, blue[number].y-blue[number].h); +} + + +void CheckCollision(u8 number){ + if ((red.x >= blue[number].x - (blue[number].w + red.w)) && (red.x <= blue[number].x + (blue[number].w + red.w)) && (red.y >= blue[number].y - (blue[number].h + red.h)) && (red.y <= blue[number].y + (blue[number].h + red.h))) PA_OutputText(1, 2, 10, "Collision !!"); + } \ No newline at end of file diff --git a/examples/Demos/DSMotion/MotionDraw/Makefile b/examples/Demos/DSMotion/MotionDraw/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/DSMotion/MotionDraw/Makefile +++ b/examples/Demos/DSMotion/MotionDraw/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/DSMotion/MotionDraw/source/main.c b/examples/Demos/DSMotion/MotionDraw/source/main.c index 3f626cf..b6159c6 100644 --- a/examples/Demos/DSMotion/MotionDraw/source/main.c +++ b/examples/Demos/DSMotion/MotionDraw/source/main.c @@ -1,75 +1,75 @@ -/* DS Motion Example !! -*/ - - -// Includes -#include // Include for PA_Lib - - - - -// global variable indicating whether DS Motion Card is plugged in -int ndsmotion = 0; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(0, 0); // Initialise the text system on the top screen - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 0, 5, "Please insert your DS Motion and press any key"); // Ask to insert the DS Motion... - - PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... - PA_ClearTextBg(1); // Erase text screen... - - // Turn on the DS Motion... - PA_MotionInit(); - - while ( !PA_CheckDSMotion()) { // Checks for the DS Motion, continues looking for it until it actually finds it... - PA_WaitForVBL(); - - // If no DSMotion found... - PA_OutputText(1, 0, 5, " DS Motion not found ! \nPlease insert your DS Motion and press any key"); // Ask to insert the DS Motion... again... - - PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... - PA_MotionInit(); - } - - PA_ClearTextBg(1); // erase the text... - - PA_OutputText(1, 0, 5, "Move to draw, simple but effective ^^"); - PA_OutputText(1, 0, 5, "Press any key to erase..."); - PA_ResetBgSysScreen(0); - - s16 x = 128; - s16 y = 96; - - PA_Init8bitBg(0, 0); - PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(0, 1, 0); - - // Infinite loop to keep the program running - while (1) - { - - x += Motion.Held.Right - Motion.Held.Left; - y += Motion.Held.Down - Motion.Held.Up; - if(x < 0) x = 0; if (x > 255) x = 255; - if(y < 0) y = 0; if (y > 191) y = 191; - - PA_Put8bitPixel(0, x, y, 1); // Plot a pixel.. - - if(Pad.Newpress.Anykey){ - x = 128; - y = 96; - PA_Clear8bitBg(0); // Erase all... - } - - PA_WaitForVBL(); - } - - return 0; +/* DS Motion Example !! +*/ + + +// Includes +#include // Include for PA_Lib + + + + +// global variable indicating whether DS Motion Card is plugged in +int ndsmotion = 0; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(0, 0); // Initialise the text system on the top screen + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 0, 5, "Please insert your DS Motion and press any key"); // Ask to insert the DS Motion... + + PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... + PA_ClearTextBg(1); // Erase text screen... + + // Turn on the DS Motion... + PA_MotionInit(); + + while ( !PA_CheckDSMotion()) { // Checks for the DS Motion, continues looking for it until it actually finds it... + PA_WaitForVBL(); + + // If no DSMotion found... + PA_OutputText(1, 0, 5, " DS Motion not found ! \nPlease insert your DS Motion and press any key"); // Ask to insert the DS Motion... again... + + PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... + PA_MotionInit(); + } + + PA_ClearTextBg(1); // erase the text... + + PA_OutputText(1, 0, 5, "Move to draw, simple but effective ^^"); + PA_OutputText(1, 0, 5, "Press any key to erase..."); + PA_ResetBgSysScreen(0); + + s16 x = 128; + s16 y = 96; + + PA_Init8bitBg(0, 0); + PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(0, 1, 0); + + // Infinite loop to keep the program running + while (1) + { + + x += Motion.Held.Right - Motion.Held.Left; + y += Motion.Held.Down - Motion.Held.Up; + if(x < 0) x = 0; if (x > 255) x = 255; + if(y < 0) y = 0; if (y > 191) y = 191; + + PA_Put8bitPixel(0, x, y, 1); // Plot a pixel.. + + if(Pad.Newpress.Anykey){ + x = 128; + y = 96; + PA_Clear8bitBg(0); // Erase all... + } + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Demos/DSMotion/MotionDraw2/Makefile b/examples/Demos/DSMotion/MotionDraw2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/DSMotion/MotionDraw2/Makefile +++ b/examples/Demos/DSMotion/MotionDraw2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/DSMotion/MotionDraw2/source/main.c b/examples/Demos/DSMotion/MotionDraw2/source/main.c index 89d00dc..fb8ae06 100644 --- a/examples/Demos/DSMotion/MotionDraw2/source/main.c +++ b/examples/Demos/DSMotion/MotionDraw2/source/main.c @@ -1,82 +1,82 @@ -/* DS Motion Example !! -*/ - - -// Includes -#include // Include for PA_Lib - - - - -// global variable indicating whether DS Motion Card is plugged in -int ndsmotion = 0; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(0, 0); // Initialise the text system on the top screen - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 0, 5, "Please insert your DS Motion and press any key"); // Ask to insert the DS Motion... - - PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... - PA_ClearTextBg(1); // Erase text screen... - - - // Turn on the DS Motion... - PA_MotionInit(); - - while ( !PA_CheckDSMotion()) { // Checks for the DS Motion, continues looking for it until it actually finds it... - PA_WaitForVBL(); - - // If no DSMotion found... - PA_OutputText(1, 0, 5, " DS Motion not found ! \nPlease insert your DS Motion and press any key"); // Ask to insert the DS Motion... again... - - PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... - PA_MotionInit(); - } - - PA_ClearTextBg(1); // erase the text... - - PA_OutputText(1, 0, 5, "Move to draw, simple but effective ^^"); - PA_OutputText(1, 0, 5, "Press any key to erase..."); - PA_ResetBgSysScreen(0); - - s32 x = 128<<8; - s32 y = 96<<8; - s32 oldx, oldy; - - PA_Init8bitBg(0, 0); - PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(0, 1, 0); - - PA_SetDrawSize(0, 1); - - // Infinite loop to keep the program running - while (1) - { - // Backup old coordinates - oldx = x; - oldy = y; - - x -= Motion.X<<3; - y += Motion.Y<<3; - if(x < 0) x = 0; if (x > 255<<8) x = 255<<8; - if(y < 0) y = 0; if (y > 191<<8) y = 191<<8; - - PA_Draw8bitLine(0, oldx>>8, oldy>>8, x>>8, y>>8, 1); - - if(Pad.Newpress.Anykey){ - x = 128<<8; - y = 96<<8; - PA_Clear8bitBg(0); // Erase all... - } - - PA_WaitForVBL(); - } - - return 0; +/* DS Motion Example !! +*/ + + +// Includes +#include // Include for PA_Lib + + + + +// global variable indicating whether DS Motion Card is plugged in +int ndsmotion = 0; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(0, 0); // Initialise the text system on the top screen + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 0, 5, "Please insert your DS Motion and press any key"); // Ask to insert the DS Motion... + + PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... + PA_ClearTextBg(1); // Erase text screen... + + + // Turn on the DS Motion... + PA_MotionInit(); + + while ( !PA_CheckDSMotion()) { // Checks for the DS Motion, continues looking for it until it actually finds it... + PA_WaitForVBL(); + + // If no DSMotion found... + PA_OutputText(1, 0, 5, " DS Motion not found ! \nPlease insert your DS Motion and press any key"); // Ask to insert the DS Motion... again... + + PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... + PA_MotionInit(); + } + + PA_ClearTextBg(1); // erase the text... + + PA_OutputText(1, 0, 5, "Move to draw, simple but effective ^^"); + PA_OutputText(1, 0, 5, "Press any key to erase..."); + PA_ResetBgSysScreen(0); + + s32 x = 128<<8; + s32 y = 96<<8; + s32 oldx, oldy; + + PA_Init8bitBg(0, 0); + PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(0, 1, 0); + + PA_SetDrawSize(0, 1); + + // Infinite loop to keep the program running + while (1) + { + // Backup old coordinates + oldx = x; + oldy = y; + + x -= Motion.X<<3; + y += Motion.Y<<3; + if(x < 0) x = 0; if (x > 255<<8) x = 255<<8; + if(y < 0) y = 0; if (y > 191<<8) y = 191<<8; + + PA_Draw8bitLine(0, oldx>>8, oldy>>8, x>>8, y>>8, 1); + + if(Pad.Newpress.Anykey){ + x = 128<<8; + y = 96<<8; + PA_Clear8bitBg(0); // Erase all... + } + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Demos/DSMotion/MotionTurn/Makefile b/examples/Demos/DSMotion/MotionTurn/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/DSMotion/MotionTurn/Makefile +++ b/examples/Demos/DSMotion/MotionTurn/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/DSMotion/MotionTurn/gfx/all_gfx.h b/examples/Demos/DSMotion/MotionTurn/gfx/all_gfx.h index cd50833..50c44a1 100644 --- a/examples/Demos/DSMotion/MotionTurn/gfx/all_gfx.h +++ b/examples/Demos/DSMotion/MotionTurn/gfx/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mario_Sprite[8192] _GFX_ALIGN; // Palette: mario_Pal -extern const unsigned char chomp_Sprite[4096] _GFX_ALIGN; // Palette: mario_Pal - -// Palettes: -extern const unsigned short mario_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mario_Sprite[8192] _GFX_ALIGN; // Palette: mario_Pal +extern const unsigned char chomp_Sprite[4096] _GFX_ALIGN; // Palette: mario_Pal + +// Palettes: +extern const unsigned short mario_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/DSMotion/MotionTurn/source/main.c b/examples/Demos/DSMotion/MotionTurn/source/main.c index cbb3d4c..12df3ed 100644 --- a/examples/Demos/DSMotion/MotionTurn/source/main.c +++ b/examples/Demos/DSMotion/MotionTurn/source/main.c @@ -1,72 +1,72 @@ -/* This will show the new sprite animation functions !! Yay ! -Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) -*/ - - -// Includes, only one sprite -#include - - -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount; //Frame count... - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(1, 0); - - // Load the sprite palette, - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)mario_Pal); // Palette name - - // Here, we'll load a few similar sprites sprite to animate... at different speed - PA_CreateSprite(0, 0,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); - PA_SetSpritePrio(0, 0, 1); - - - - PA_OutputSimpleText(1, 0, 5, "Please insert your DS Motion and press any key"); // Ask to insert the DS Motion... - - PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... - PA_ClearTextBg(1); // Erase text screen... - - - // Turn on the DS Motion... - PA_MotionInit(); - - while ( !PA_CheckDSMotion()) { // Checks for the DS Motion, continues looking for it until it actually finds it... - PA_WaitForVBL(); - - // If no DSMotion found... - PA_OutputText(1, 0, 5, " DS Motion not found ! \nPlease insert your DS Motion and press any key"); // Ask to insert the DS Motion... again... - - PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... - PA_MotionInit(); - } - - - PA_CreateSprite(0, 1,(void*)chomp_Sprite, OBJ_SIZE_64X64,1, 0, 256, 96-32); - PA_SetSpriteRotEnable(0, 1, 0); - - while(1) - { - - u16 angle = Motion.Angle; - if(Motion.Force > 10) { // Requires a minimum force to do... - PA_SetSpriteAnim(0, 0, ((angle-128+32)>>6)&7); // Set frame according to DS Motion Angle ! Minimum force needed : 15 - PA_SetSpriteXY(0, 1, 128-32+(PA_Cos(Motion.Angle)>>3), 96-32-(PA_Sin(Motion.Angle)>>3)); - PA_SetRotsetNoZoom(0, 0, (Motion.Angle-128)&511); - if(Motion.Angle > 255) PA_SetSpritePrio(0, 1, 0); - if(Motion.Angle < 255) PA_SetSpritePrio(0, 1, 2); - } - PA_WaitForVBL(); - } - - return 0; +/* This will show the new sprite animation functions !! Yay ! +Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) +*/ + + +// Includes, only one sprite +#include + + +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount; //Frame count... + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(1, 0); + + // Load the sprite palette, + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)mario_Pal); // Palette name + + // Here, we'll load a few similar sprites sprite to animate... at different speed + PA_CreateSprite(0, 0,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); + PA_SetSpritePrio(0, 0, 1); + + + + PA_OutputSimpleText(1, 0, 5, "Please insert your DS Motion and press any key"); // Ask to insert the DS Motion... + + PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... + PA_ClearTextBg(1); // Erase text screen... + + + // Turn on the DS Motion... + PA_MotionInit(); + + while ( !PA_CheckDSMotion()) { // Checks for the DS Motion, continues looking for it until it actually finds it... + PA_WaitForVBL(); + + // If no DSMotion found... + PA_OutputText(1, 0, 5, " DS Motion not found ! \nPlease insert your DS Motion and press any key"); // Ask to insert the DS Motion... again... + + PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... + PA_MotionInit(); + } + + + PA_CreateSprite(0, 1,(void*)chomp_Sprite, OBJ_SIZE_64X64,1, 0, 256, 96-32); + PA_SetSpriteRotEnable(0, 1, 0); + + while(1) + { + + u16 angle = Motion.Angle; + if(Motion.Force > 10) { // Requires a minimum force to do... + PA_SetSpriteAnim(0, 0, ((angle-128+32)>>6)&7); // Set frame according to DS Motion Angle ! Minimum force needed : 15 + PA_SetSpriteXY(0, 1, 128-32+(PA_Cos(Motion.Angle)>>3), 96-32-(PA_Sin(Motion.Angle)>>3)); + PA_SetRotsetNoZoom(0, 0, (Motion.Angle-128)&511); + if(Motion.Angle > 255) PA_SetSpritePrio(0, 1, 0); + if(Motion.Angle < 255) PA_SetSpritePrio(0, 1, 2); + } + PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Demos/Fireworks/Makefile b/examples/Demos/Fireworks/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Demos/Fireworks/Makefile +++ b/examples/Demos/Fireworks/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Demos/Fireworks/gfx/all_gfx.h b/examples/Demos/Fireworks/gfx/all_gfx.h index bba27ca..4639004 100644 --- a/examples/Demos/Fireworks/gfx/all_gfx.h +++ b/examples/Demos/Fireworks/gfx/all_gfx.h @@ -1,25 +1,25 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char red_Texture[64] _GFX_ALIGN; // Palette: fw_Pal -extern const unsigned char orange_Texture[64] _GFX_ALIGN; // Palette: fw_Pal -extern const unsigned char yellow_Texture[64] _GFX_ALIGN; // Palette: fw_Pal -extern const unsigned char green_Texture[64] _GFX_ALIGN; // Palette: fw_Pal -extern const unsigned char blue_Texture[16] _GFX_ALIGN; // Palette: fw_Pal -extern const unsigned char indigo_Texture[64] _GFX_ALIGN; // Palette: fw_Pal -extern const unsigned char violet_Texture[64] _GFX_ALIGN; // Palette: fw_Pal - -// Palettes: -extern const unsigned short fw_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char red_Texture[64] _GFX_ALIGN; // Palette: fw_Pal +extern const unsigned char orange_Texture[64] _GFX_ALIGN; // Palette: fw_Pal +extern const unsigned char yellow_Texture[64] _GFX_ALIGN; // Palette: fw_Pal +extern const unsigned char green_Texture[64] _GFX_ALIGN; // Palette: fw_Pal +extern const unsigned char blue_Texture[16] _GFX_ALIGN; // Palette: fw_Pal +extern const unsigned char indigo_Texture[64] _GFX_ALIGN; // Palette: fw_Pal +extern const unsigned char violet_Texture[64] _GFX_ALIGN; // Palette: fw_Pal + +// Palettes: +extern const unsigned short fw_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/Fireworks/source/main.c b/examples/Demos/Fireworks/source/main.c index 410fd8b..0c75dc2 100644 --- a/examples/Demos/Fireworks/source/main.c +++ b/examples/Demos/Fireworks/source/main.c @@ -1,161 +1,161 @@ -/* -// 3D Sprite Moving example... -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - -#define SPC 120 //sprites per color -#define COLORS 7 -// -#define RED 0 -#define ORANGE 1 -#define YELLOW 2 -#define GREEN 3 -#define BLUE 4 -#define INDIGO 5 -#define VIOLET 6 - - - - -u16 gfx[COLORS]; - -typedef struct{ - s32 x, y, vx, vy; - u16 angle; - bool onscreen; -} spriteinfo; -spriteinfo sprites[SPC*COLORS]; // Let's manage the sprite positions ^^ - - -void createFireworks(void); -void updateFireworks(void); - - -// Function: main() -int main(void) -{ - PA_Init(); // Initializes PA_Lib - - PA_Init3D(); // Uses Bg0 - PA_Reset3DSprites(); - - // Initialise the text system on the top screen - PA_LoadDefaultText(1, 1); - PA_LoadDefaultText(0, 1); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 1, 6, " 3d Sprite Example: Fireworks!"); - - // Just use one pallet and load 6 textures off it... - PA_Load3DSpritePal(0, (void*)fw_Pal); - gfx[RED] = PA_3DCreateTex((void*)red_Texture, 8, 8, TEX_256COL); - gfx[ORANGE] = PA_3DCreateTex((void*)orange_Texture, 8, 8, TEX_256COL); - gfx[YELLOW] = PA_3DCreateTex((void*)yellow_Texture, 8, 8, TEX_256COL); - gfx[GREEN] = PA_3DCreateTex((void*)green_Texture, 8, 8, TEX_256COL); - gfx[BLUE] = PA_3DCreateTex((void*)blue_Texture, 8, 8, TEX_256COL); - gfx[INDIGO] = PA_3DCreateTex((void*)indigo_Texture, 8, 8, TEX_256COL); - gfx[VIOLET] = PA_3DCreateTex((void*)violet_Texture, 8, 8, TEX_256COL); - - //create sprites for each color - s32 i, j; - for (i = 0; i < COLORS; i++) - { - for (j = 0; j < SPC; j++) - { - sprites[j+(i*SPC)].x = -10;//10+15*i+i; - sprites[j+(i*SPC)].y = j*8; - PA_3DCreateSpriteFromTex(j+(i*SPC), gfx[i], 8, 8, 0, sprites[j+(i*SPC)].x , sprites[j+(i*SPC)].y); - sprites[j+(i*SPC)].angle = j*(512/SPC); - PA_3DSetSpriteRotateZ(j+(i*SPC), sprites[j+(i*SPC)].angle); - sprites[j+(i*SPC)].vx = PA_Cos(sprites[j+(i*SPC)].angle)>>6; - sprites[j+(i*SPC)].vy = -PA_Sin(sprites[j+(i*SPC)].angle)>>6; - sprites[j+(i*SPC)].onscreen = false; - - } -} - - - - int countdown = PA_RandMinMax(10,30); - - while(1) { - - if (countdown == 0 || Stylus.Newpress) - { - countdown = PA_RandMinMax(10,30); - createFireworks(); - - } - else - { - countdown--; - } - - - updateFireworks(); - PA_3DProcess(); // Update 3DSprites - - PA_WaitForVBL(); - } - - - - return 0; -} // End of main() - - -void createFireworks(void) -{ - int color = PA_RandMinMax(0,COLORS); - int maxtry = COLORS; - while (sprites[color*SPC].onscreen && maxtry > 0){ if (color < COLORS) { color++;} else {color = 0;} maxtry--;} - - if (maxtry > 0) //don't run if we couldn't find a free group of sprites - { - int i, randx, randy; - randx = PA_RandMinMax(30,230); - randy = PA_RandMinMax(30,160); - - for(i = 0; i < SPC; i++) - { - if (Stylus.Newpress) - { - sprites[i+(color*SPC)].x= Stylus.X-10+PA_RandMax(20); - sprites[i+(color*SPC)].y=Stylus.Y-10+PA_RandMax(20);; - } - else - { - sprites[i+(color*SPC)].x=randx-10+PA_RandMax(20);; - sprites[i+(color*SPC)].y=randy-10+PA_RandMax(20);; - } - - PA_3DSetSpriteXY(i+(color*SPC), sprites[i+(color*SPC)].x, sprites[i+(color*SPC)].y); - sprites[i+(color*SPC)].onscreen = true; - } - - } -} - -void updateFireworks(void) -{ - int i; - //PA_3DSetSpriteWidthHeight(i, 8, 8); // Resize to way smaller ^^ - for(i = 0; i < COLORS*SPC; i++) - { - if (sprites[i].onscreen) - { - sprites[i].x+=sprites[i].vx; - sprites[i].y+=sprites[i].vy; - PA_3DSetSpriteXY(i, sprites[i].x, sprites[i].y); - if (sprites[i].x > 256+8 || sprites[i].x < -8 || sprites[i].y > 192+8 || sprites[i].y < -8) - { - sprites[i].onscreen = false; - PA_3DSetSpriteXY(i, -10, sprites[i].y); - } - } - } +/* +// 3D Sprite Moving example... +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + +#define SPC 120 //sprites per color +#define COLORS 7 +// +#define RED 0 +#define ORANGE 1 +#define YELLOW 2 +#define GREEN 3 +#define BLUE 4 +#define INDIGO 5 +#define VIOLET 6 + + + + +u16 gfx[COLORS]; + +typedef struct{ + s32 x, y, vx, vy; + u16 angle; + bool onscreen; +} spriteinfo; +spriteinfo sprites[SPC*COLORS]; // Let's manage the sprite positions ^^ + + +void createFireworks(void); +void updateFireworks(void); + + +// Function: main() +int main(void) +{ + PA_Init(); // Initializes PA_Lib + + PA_Init3D(); // Uses Bg0 + PA_Reset3DSprites(); + + // Initialise the text system on the top screen + PA_LoadDefaultText(1, 1); + PA_LoadDefaultText(0, 1); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 1, 6, " 3d Sprite Example: Fireworks!"); + + // Just use one pallet and load 6 textures off it... + PA_Load3DSpritePal(0, (void*)fw_Pal); + gfx[RED] = PA_3DCreateTex((void*)red_Texture, 8, 8, TEX_256COL); + gfx[ORANGE] = PA_3DCreateTex((void*)orange_Texture, 8, 8, TEX_256COL); + gfx[YELLOW] = PA_3DCreateTex((void*)yellow_Texture, 8, 8, TEX_256COL); + gfx[GREEN] = PA_3DCreateTex((void*)green_Texture, 8, 8, TEX_256COL); + gfx[BLUE] = PA_3DCreateTex((void*)blue_Texture, 8, 8, TEX_256COL); + gfx[INDIGO] = PA_3DCreateTex((void*)indigo_Texture, 8, 8, TEX_256COL); + gfx[VIOLET] = PA_3DCreateTex((void*)violet_Texture, 8, 8, TEX_256COL); + + //create sprites for each color + s32 i, j; + for (i = 0; i < COLORS; i++) + { + for (j = 0; j < SPC; j++) + { + sprites[j+(i*SPC)].x = -10;//10+15*i+i; + sprites[j+(i*SPC)].y = j*8; + PA_3DCreateSpriteFromTex(j+(i*SPC), gfx[i], 8, 8, 0, sprites[j+(i*SPC)].x , sprites[j+(i*SPC)].y); + sprites[j+(i*SPC)].angle = j*(512/SPC); + PA_3DSetSpriteRotateZ(j+(i*SPC), sprites[j+(i*SPC)].angle); + sprites[j+(i*SPC)].vx = PA_Cos(sprites[j+(i*SPC)].angle)>>6; + sprites[j+(i*SPC)].vy = -PA_Sin(sprites[j+(i*SPC)].angle)>>6; + sprites[j+(i*SPC)].onscreen = false; + + } +} + + + + int countdown = PA_RandMinMax(10,30); + + while(1) { + + if (countdown == 0 || Stylus.Newpress) + { + countdown = PA_RandMinMax(10,30); + createFireworks(); + + } + else + { + countdown--; + } + + + updateFireworks(); + PA_3DProcess(); // Update 3DSprites + + PA_WaitForVBL(); + } + + + + return 0; +} // End of main() + + +void createFireworks(void) +{ + int color = PA_RandMinMax(0,COLORS); + int maxtry = COLORS; + while (sprites[color*SPC].onscreen && maxtry > 0){ if (color < COLORS) { color++;} else {color = 0;} maxtry--;} + + if (maxtry > 0) //don't run if we couldn't find a free group of sprites + { + int i, randx, randy; + randx = PA_RandMinMax(30,230); + randy = PA_RandMinMax(30,160); + + for(i = 0; i < SPC; i++) + { + if (Stylus.Newpress) + { + sprites[i+(color*SPC)].x= Stylus.X-10+PA_RandMax(20); + sprites[i+(color*SPC)].y=Stylus.Y-10+PA_RandMax(20);; + } + else + { + sprites[i+(color*SPC)].x=randx-10+PA_RandMax(20);; + sprites[i+(color*SPC)].y=randy-10+PA_RandMax(20);; + } + + PA_3DSetSpriteXY(i+(color*SPC), sprites[i+(color*SPC)].x, sprites[i+(color*SPC)].y); + sprites[i+(color*SPC)].onscreen = true; + } + + } +} + +void updateFireworks(void) +{ + int i; + //PA_3DSetSpriteWidthHeight(i, 8, 8); // Resize to way smaller ^^ + for(i = 0; i < COLORS*SPC; i++) + { + if (sprites[i].onscreen) + { + sprites[i].x+=sprites[i].vx; + sprites[i].y+=sprites[i].vy; + PA_3DSetSpriteXY(i, sprites[i].x, sprites[i].y); + if (sprites[i].x > 256+8 || sprites[i].x < -8 || sprites[i].y > 192+8 || sprites[i].y < -8) + { + sprites[i].onscreen = false; + PA_3DSetSpriteXY(i, -10, sprites[i].y); + } + } + } } \ No newline at end of file diff --git a/examples/Demos/FollowStylus/Makefile b/examples/Demos/FollowStylus/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Demos/FollowStylus/Makefile +++ b/examples/Demos/FollowStylus/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Demos/FollowStylus/gfx/all_gfx.h b/examples/Demos/FollowStylus/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Demos/FollowStylus/gfx/all_gfx.h +++ b/examples/Demos/FollowStylus/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/FollowStylus/source/main.c b/examples/Demos/FollowStylus/source/main.c index 0d7630f..c43208e 100644 --- a/examples/Demos/FollowStylus/source/main.c +++ b/examples/Demos/FollowStylus/source/main.c @@ -1,42 +1,42 @@ - -// Includes -#include - -// PAGfxConverter Include -#include "all_gfx.h" -int main(void){ - - PA_Init(); - - PA_LoadDefaultText(1,0); // On the top screen - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); - - PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); // Create the ship in the center... - PA_SetSpriteRotEnable(0,0,0);// Enable rotations and use Rotset 0... - - s32 x = (128) << 8; // ship x position in 8bit fixed point - s32 y = (96) << 8; // Y - u16 angle = 0; // direction in which to move ! - - - - while(1) - { - angle = PA_GetAngle(x>>8, y>>8, Stylus.X, Stylus.Y); - PA_SetRotsetNoZoom(0, 0, angle); // Turn the ship in the correct direction - - if (Stylus.Held){ // Move forward - x += PA_Cos(angle); - y -= PA_Sin(angle); - } - - PA_OutputText(1, 5, 10, "Angle : %d ", angle); - - PA_SetSpriteXY(0, 0, (x>>8)-16, (y>>8)-16); // Sprite position converted to normal... - - PA_WaitForVBL(); - - } - return 0; + +// Includes +#include + +// PAGfxConverter Include +#include "all_gfx.h" +int main(void){ + + PA_Init(); + + PA_LoadDefaultText(1,0); // On the top screen + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); + + PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); // Create the ship in the center... + PA_SetSpriteRotEnable(0,0,0);// Enable rotations and use Rotset 0... + + s32 x = (128) << 8; // ship x position in 8bit fixed point + s32 y = (96) << 8; // Y + u16 angle = 0; // direction in which to move ! + + + + while(1) + { + angle = PA_GetAngle(x>>8, y>>8, Stylus.X, Stylus.Y); + PA_SetRotsetNoZoom(0, 0, angle); // Turn the ship in the correct direction + + if (Stylus.Held){ // Move forward + x += PA_Cos(angle); + y -= PA_Sin(angle); + } + + PA_OutputText(1, 5, 10, "Angle : %d ", angle); + + PA_SetSpriteXY(0, 0, (x>>8)-16, (y>>8)-16); // Sprite position converted to normal... + + PA_WaitForVBL(); + + } + return 0; } \ No newline at end of file diff --git a/examples/Demos/Frisbee/Frisbee/Makefile b/examples/Demos/Frisbee/Frisbee/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/Frisbee/Frisbee/Makefile +++ b/examples/Demos/Frisbee/Frisbee/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/Frisbee/Frisbee/Readme.txt b/examples/Demos/Frisbee/Frisbee/Readme.txt index a3c963c..9ca8210 100644 --- a/examples/Demos/Frisbee/Frisbee/Readme.txt +++ b/examples/Demos/Frisbee/Frisbee/Readme.txt @@ -1,14 +1,14 @@ -Hi there ! - -Ok, I decided to start a small game, and release different versions of it for you to understand several tricks... - -This first demo is simple : a frisbee, rotating, goes around the screen, from one screen to another. The important stuff in the sources : -- Have the frisbee sprite loaded on both screens... Duh ! -- Added a SCREENHOLE definition, put it to 48... on emulator it'll look weird, since the screens are next to one another, but it looks perfect on DS. You can try other sizes (32 wasn't good) -- Try to get the fixed point clear in your head... Fixed point is used instead of float, because it's way faster... -- And look at the trick to position the sprites from one screen to another, it's really simple ! - - -Have fun for now, I'll update this demo when I work on it a little more :p - +Hi there ! + +Ok, I decided to start a small game, and release different versions of it for you to understand several tricks... + +This first demo is simple : a frisbee, rotating, goes around the screen, from one screen to another. The important stuff in the sources : +- Have the frisbee sprite loaded on both screens... Duh ! +- Added a SCREENHOLE definition, put it to 48... on emulator it'll look weird, since the screens are next to one another, but it looks perfect on DS. You can try other sizes (32 wasn't good) +- Try to get the fixed point clear in your head... Fixed point is used instead of float, because it's way faster... +- And look at the trick to position the sprites from one screen to another, it's really simple ! + + +Have fun for now, I'll update this demo when I work on it a little more :p + Mollusk \ No newline at end of file diff --git a/examples/Demos/Frisbee/Frisbee/gfx/all_gfx.h b/examples/Demos/Frisbee/Frisbee/gfx/all_gfx.h index 0db5322..07a6043 100644 --- a/examples/Demos/Frisbee/Frisbee/gfx/all_gfx.h +++ b/examples/Demos/Frisbee/Frisbee/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/Frisbee/Frisbee/source/main.c b/examples/Demos/Frisbee/Frisbee/source/main.c index 6efa6b8..5617f68 100644 --- a/examples/Demos/Frisbee/Frisbee/source/main.c +++ b/examples/Demos/Frisbee/Frisbee/source/main.c @@ -1,82 +1,82 @@ -// Frisbee future game ! - -#include - -// Include the sprites : -#include "all_gfx.h" - -#define FRISBEE 10 // Sprite number... -#define SCREENHOLE 48 // Size of the space between the screens... This is what looked the best - - -typedef struct{ - s16 x, y; // This is for the frisbee's position - s16 vx, vy; // Frisbee speed - s16 angle; // To make the frisbee turn on itself -}frisinfos; - -frisinfos frisbee; // Frisbee structure variable - - - -int main(void) -{ - -// Initialise the lib... -PA_Init(); - -PA_LoadDefaultText(1, 0); - -// Load the palettes for the sprites on both screens -PA_DualLoadSpritePal(0, (void*)sprite0_Pal); - -// Create the sprite on both screens... -PA_DualCreateSprite(FRISBEE, (void*)frisbee_Sprite, OBJ_SIZE_32X32, 1, 0, 96, 300); // Bottom screen -PA_DualSetSpriteRotEnable(FRISBEE, 0); // Enable rotation/zoom, rotset 0 - -// Sprite initial position... -frisbee.x = 96+16; -frisbee.y = 300+16; // on the bottom screen - -// Speed of frisbee in both ways -frisbee.vx = 0; -frisbee.vy = 0; - - while(1) - { - // Move with the stylus, or move on... - if (PA_MoveSprite(FRISBEE)){ - frisbee.x = PA_MovedSprite.X; - frisbee.y = PA_MovedSprite.Y + 192 + SCREENHOLE; - frisbee.vx = PA_MovedSprite.Vx; frisbee.vy = PA_MovedSprite.Vy; - } - else{ - // Now, the frisbee's fixed point position will be updated according to the speed... - frisbee.x += frisbee.vx; - frisbee.y += frisbee.vy; - - // If the sprite touches the left or right border, flip the horizontal speed - if ((frisbee.x -16 <= 0) && (frisbee.vx < 0)) frisbee.vx = -frisbee.vx; - else if ((frisbee.x + 16 >= 256)&&(frisbee.vx > 0)) frisbee.vx = - frisbee.vx; - - // Same thing, for top and bottom limits... - if ((frisbee.y -16 <= 0) && (frisbee.vy < 0)) frisbee.vy = -frisbee.vy; - else if ((frisbee.y + 16 >= 192 + 192 + SCREENHOLE)&& (frisbee.vy > 0)) frisbee.vy = - frisbee.vy; - // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... - PA_DualSetSpriteXY(FRISBEE, frisbee.x-16, frisbee.y-16); - - } - - PA_OutputText(1, 2, 10, "SpeedX : %d ", frisbee.vx); - PA_OutputText(1, 2, 11, "SpeedY : %d ", frisbee.vy); - frisbee.angle+=4; // Make the frisbee turn... - PA_DualSetRotsetNoZoom(0, frisbee.angle); - - - PA_WaitForVBL(); // Synch to the framerate... - } - -return 0; -} - +// Frisbee future game ! + +#include + +// Include the sprites : +#include "all_gfx.h" + +#define FRISBEE 10 // Sprite number... +#define SCREENHOLE 48 // Size of the space between the screens... This is what looked the best + + +typedef struct{ + s16 x, y; // This is for the frisbee's position + s16 vx, vy; // Frisbee speed + s16 angle; // To make the frisbee turn on itself +}frisinfos; + +frisinfos frisbee; // Frisbee structure variable + + + +int main(void) +{ + +// Initialise the lib... +PA_Init(); + +PA_LoadDefaultText(1, 0); + +// Load the palettes for the sprites on both screens +PA_DualLoadSpritePal(0, (void*)sprite0_Pal); + +// Create the sprite on both screens... +PA_DualCreateSprite(FRISBEE, (void*)frisbee_Sprite, OBJ_SIZE_32X32, 1, 0, 96, 300); // Bottom screen +PA_DualSetSpriteRotEnable(FRISBEE, 0); // Enable rotation/zoom, rotset 0 + +// Sprite initial position... +frisbee.x = 96+16; +frisbee.y = 300+16; // on the bottom screen + +// Speed of frisbee in both ways +frisbee.vx = 0; +frisbee.vy = 0; + + while(1) + { + // Move with the stylus, or move on... + if (PA_MoveSprite(FRISBEE)){ + frisbee.x = PA_MovedSprite.X; + frisbee.y = PA_MovedSprite.Y + 192 + SCREENHOLE; + frisbee.vx = PA_MovedSprite.Vx; frisbee.vy = PA_MovedSprite.Vy; + } + else{ + // Now, the frisbee's fixed point position will be updated according to the speed... + frisbee.x += frisbee.vx; + frisbee.y += frisbee.vy; + + // If the sprite touches the left or right border, flip the horizontal speed + if ((frisbee.x -16 <= 0) && (frisbee.vx < 0)) frisbee.vx = -frisbee.vx; + else if ((frisbee.x + 16 >= 256)&&(frisbee.vx > 0)) frisbee.vx = - frisbee.vx; + + // Same thing, for top and bottom limits... + if ((frisbee.y -16 <= 0) && (frisbee.vy < 0)) frisbee.vy = -frisbee.vy; + else if ((frisbee.y + 16 >= 192 + 192 + SCREENHOLE)&& (frisbee.vy > 0)) frisbee.vy = - frisbee.vy; + // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... + PA_DualSetSpriteXY(FRISBEE, frisbee.x-16, frisbee.y-16); + + } + + PA_OutputText(1, 2, 10, "SpeedX : %d ", frisbee.vx); + PA_OutputText(1, 2, 11, "SpeedY : %d ", frisbee.vy); + frisbee.angle+=4; // Make the frisbee turn... + PA_DualSetRotsetNoZoom(0, frisbee.angle); + + + PA_WaitForVBL(); // Synch to the framerate... + } + +return 0; +} + // That's all folks, easy, right ? :p \ No newline at end of file diff --git a/examples/Demos/Frisbee/Frisbee2/Makefile b/examples/Demos/Frisbee/Frisbee2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/Frisbee/Frisbee2/Makefile +++ b/examples/Demos/Frisbee/Frisbee2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/Frisbee/Frisbee2/Readme.txt b/examples/Demos/Frisbee/Frisbee2/Readme.txt index a3c963c..9ca8210 100644 --- a/examples/Demos/Frisbee/Frisbee2/Readme.txt +++ b/examples/Demos/Frisbee/Frisbee2/Readme.txt @@ -1,14 +1,14 @@ -Hi there ! - -Ok, I decided to start a small game, and release different versions of it for you to understand several tricks... - -This first demo is simple : a frisbee, rotating, goes around the screen, from one screen to another. The important stuff in the sources : -- Have the frisbee sprite loaded on both screens... Duh ! -- Added a SCREENHOLE definition, put it to 48... on emulator it'll look weird, since the screens are next to one another, but it looks perfect on DS. You can try other sizes (32 wasn't good) -- Try to get the fixed point clear in your head... Fixed point is used instead of float, because it's way faster... -- And look at the trick to position the sprites from one screen to another, it's really simple ! - - -Have fun for now, I'll update this demo when I work on it a little more :p - +Hi there ! + +Ok, I decided to start a small game, and release different versions of it for you to understand several tricks... + +This first demo is simple : a frisbee, rotating, goes around the screen, from one screen to another. The important stuff in the sources : +- Have the frisbee sprite loaded on both screens... Duh ! +- Added a SCREENHOLE definition, put it to 48... on emulator it'll look weird, since the screens are next to one another, but it looks perfect on DS. You can try other sizes (32 wasn't good) +- Try to get the fixed point clear in your head... Fixed point is used instead of float, because it's way faster... +- And look at the trick to position the sprites from one screen to another, it's really simple ! + + +Have fun for now, I'll update this demo when I work on it a little more :p + Mollusk \ No newline at end of file diff --git a/examples/Demos/Frisbee/Frisbee2/gfx/all_gfx.h b/examples/Demos/Frisbee/Frisbee2/gfx/all_gfx.h index 0db5322..07a6043 100644 --- a/examples/Demos/Frisbee/Frisbee2/gfx/all_gfx.h +++ b/examples/Demos/Frisbee/Frisbee2/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/Frisbee/Frisbee2/source/main.c b/examples/Demos/Frisbee/Frisbee2/source/main.c index d058889..3c9ba2b 100644 --- a/examples/Demos/Frisbee/Frisbee2/source/main.c +++ b/examples/Demos/Frisbee/Frisbee2/source/main.c @@ -1,89 +1,89 @@ -// Frisbee future game ! - -#include - -// Include the sprites : -#include "all_gfx.h" - -#define FRISBEE 10 // Sprite number... -#define SCREENHOLE 48 // Size of the space between the screens... This is what looked the best - - -typedef struct{ - s16 x, y; // This is for the frisbee's position - s16 vx, vy; // Frisbee speed - s16 angle; // To make the frisbee turn on itself -}frisinfos; - -frisinfos frisbee[10]; // 10 Frisbees !! - - - -int main(void) -{ - -// Initialise the lib... -PA_Init(); - -PA_LoadDefaultText(1, 0); - -// Load the palettes for the sprites on both screens -PA_DualLoadSpritePal(0, (void*)sprite0_Pal); - -s32 i; // will be used in for loops to cycle through the frisbees... - -PA_InitRand(); // Init the random stuff... - -for (i = 0; i < 10; i++){ - // Sprite initial position... - frisbee[i].x = (PA_Rand()%256)-16; // random position on the screen - frisbee[i].y = 192+SCREENHOLE + (PA_Rand()%192)-16; // random position on the bottom screen; - - // Speed of frisbee in both ways - frisbee[i].vx = 0; - frisbee[i].vy = 0; - - frisbee[i].angle = 0; - - // Create the sprite on both screens... - PA_DualCreateSprite(FRISBEE+i, (void*)frisbee_Sprite, OBJ_SIZE_32X32, 1, 0, frisbee[i].x-16, frisbee[i].y-16); - PA_DualSetSpriteRotEnable(FRISBEE+i, i); // Enable rotation/zoom, rotset 0 -} - - while(1) - { - for (i = 0; i < 10; i++){ - // Move with the stylus, or move on... - if (PA_MoveSprite(FRISBEE+i)){ - frisbee[i].x = PA_MovedSprite.X; - frisbee[i].y = PA_MovedSprite.Y + 192 + SCREENHOLE; - frisbee[i].vx = PA_MovedSprite.Vx; frisbee[i].vy = PA_MovedSprite.Vy; - } - else{ - // Now, the frisbee's fixed point position will be updated according to the speed... - frisbee[i].x += frisbee[i].vx; - frisbee[i].y += frisbee[i].vy; - - // If the sprite touches the left or right border, flip the horizontal speed - if ((frisbee[i].x - 16 <= 0) && (frisbee[i].vx < 0)) frisbee[i].vx = -frisbee[i].vx; - else if ((frisbee[i].x + 16 >= 256)&&(frisbee[i].vx > 0)) frisbee[i].vx = - frisbee[i].vx; - - // Same thing, for top and bottom limits... - if ((frisbee[i].y - 16 <= 0) && (frisbee[i].vy < 0)) frisbee[i].vy = -frisbee[i].vy; - else if ((frisbee[i].y + 16 >= 192 + 192 + SCREENHOLE)&& (frisbee[i].vy > 0)) frisbee[i].vy = - frisbee[i].vy; - // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... - PA_DualSetSpriteXY(FRISBEE+i, frisbee[i].x-16, frisbee[i].y-16); - - } - frisbee[i].angle+=4; // Make the frisbee turn... - PA_DualSetRotsetNoZoom(i, frisbee[i].angle); - } - - - PA_WaitForVBL(); // Synch to the framerate... - } - -return 0; -} - +// Frisbee future game ! + +#include + +// Include the sprites : +#include "all_gfx.h" + +#define FRISBEE 10 // Sprite number... +#define SCREENHOLE 48 // Size of the space between the screens... This is what looked the best + + +typedef struct{ + s16 x, y; // This is for the frisbee's position + s16 vx, vy; // Frisbee speed + s16 angle; // To make the frisbee turn on itself +}frisinfos; + +frisinfos frisbee[10]; // 10 Frisbees !! + + + +int main(void) +{ + +// Initialise the lib... +PA_Init(); + +PA_LoadDefaultText(1, 0); + +// Load the palettes for the sprites on both screens +PA_DualLoadSpritePal(0, (void*)sprite0_Pal); + +s32 i; // will be used in for loops to cycle through the frisbees... + +PA_InitRand(); // Init the random stuff... + +for (i = 0; i < 10; i++){ + // Sprite initial position... + frisbee[i].x = (PA_Rand()%256)-16; // random position on the screen + frisbee[i].y = 192+SCREENHOLE + (PA_Rand()%192)-16; // random position on the bottom screen; + + // Speed of frisbee in both ways + frisbee[i].vx = 0; + frisbee[i].vy = 0; + + frisbee[i].angle = 0; + + // Create the sprite on both screens... + PA_DualCreateSprite(FRISBEE+i, (void*)frisbee_Sprite, OBJ_SIZE_32X32, 1, 0, frisbee[i].x-16, frisbee[i].y-16); + PA_DualSetSpriteRotEnable(FRISBEE+i, i); // Enable rotation/zoom, rotset 0 +} + + while(1) + { + for (i = 0; i < 10; i++){ + // Move with the stylus, or move on... + if (PA_MoveSprite(FRISBEE+i)){ + frisbee[i].x = PA_MovedSprite.X; + frisbee[i].y = PA_MovedSprite.Y + 192 + SCREENHOLE; + frisbee[i].vx = PA_MovedSprite.Vx; frisbee[i].vy = PA_MovedSprite.Vy; + } + else{ + // Now, the frisbee's fixed point position will be updated according to the speed... + frisbee[i].x += frisbee[i].vx; + frisbee[i].y += frisbee[i].vy; + + // If the sprite touches the left or right border, flip the horizontal speed + if ((frisbee[i].x - 16 <= 0) && (frisbee[i].vx < 0)) frisbee[i].vx = -frisbee[i].vx; + else if ((frisbee[i].x + 16 >= 256)&&(frisbee[i].vx > 0)) frisbee[i].vx = - frisbee[i].vx; + + // Same thing, for top and bottom limits... + if ((frisbee[i].y - 16 <= 0) && (frisbee[i].vy < 0)) frisbee[i].vy = -frisbee[i].vy; + else if ((frisbee[i].y + 16 >= 192 + 192 + SCREENHOLE)&& (frisbee[i].vy > 0)) frisbee[i].vy = - frisbee[i].vy; + // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... + PA_DualSetSpriteXY(FRISBEE+i, frisbee[i].x-16, frisbee[i].y-16); + + } + frisbee[i].angle+=4; // Make the frisbee turn... + PA_DualSetRotsetNoZoom(i, frisbee[i].angle); + } + + + PA_WaitForVBL(); // Synch to the framerate... + } + +return 0; +} + // That's all folks, easy, right ? :p \ No newline at end of file diff --git a/examples/Demos/Frisbee/Frisbee3/Makefile b/examples/Demos/Frisbee/Frisbee3/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/Frisbee/Frisbee3/Makefile +++ b/examples/Demos/Frisbee/Frisbee3/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/Frisbee/Frisbee3/Readme.txt b/examples/Demos/Frisbee/Frisbee3/Readme.txt index a3c963c..9ca8210 100644 --- a/examples/Demos/Frisbee/Frisbee3/Readme.txt +++ b/examples/Demos/Frisbee/Frisbee3/Readme.txt @@ -1,14 +1,14 @@ -Hi there ! - -Ok, I decided to start a small game, and release different versions of it for you to understand several tricks... - -This first demo is simple : a frisbee, rotating, goes around the screen, from one screen to another. The important stuff in the sources : -- Have the frisbee sprite loaded on both screens... Duh ! -- Added a SCREENHOLE definition, put it to 48... on emulator it'll look weird, since the screens are next to one another, but it looks perfect on DS. You can try other sizes (32 wasn't good) -- Try to get the fixed point clear in your head... Fixed point is used instead of float, because it's way faster... -- And look at the trick to position the sprites from one screen to another, it's really simple ! - - -Have fun for now, I'll update this demo when I work on it a little more :p - +Hi there ! + +Ok, I decided to start a small game, and release different versions of it for you to understand several tricks... + +This first demo is simple : a frisbee, rotating, goes around the screen, from one screen to another. The important stuff in the sources : +- Have the frisbee sprite loaded on both screens... Duh ! +- Added a SCREENHOLE definition, put it to 48... on emulator it'll look weird, since the screens are next to one another, but it looks perfect on DS. You can try other sizes (32 wasn't good) +- Try to get the fixed point clear in your head... Fixed point is used instead of float, because it's way faster... +- And look at the trick to position the sprites from one screen to another, it's really simple ! + + +Have fun for now, I'll update this demo when I work on it a little more :p + Mollusk \ No newline at end of file diff --git a/examples/Demos/Frisbee/Frisbee3/gfx/all_gfx.h b/examples/Demos/Frisbee/Frisbee3/gfx/all_gfx.h index 0db5322..07a6043 100644 --- a/examples/Demos/Frisbee/Frisbee3/gfx/all_gfx.h +++ b/examples/Demos/Frisbee/Frisbee3/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/Frisbee/Frisbee3/source/main.c b/examples/Demos/Frisbee/Frisbee3/source/main.c index 9808bce..db719b4 100644 --- a/examples/Demos/Frisbee/Frisbee3/source/main.c +++ b/examples/Demos/Frisbee/Frisbee3/source/main.c @@ -1,101 +1,101 @@ -// Frisbee future game ! - -#include - -// Include the sprites : -#include "all_gfx.h" - -#define FRISBEE 10 // Sprite number... -#define SCREENHOLE 48 // Size of the space between the screens... This is what looked the best - - -typedef struct{ - s16 x, y; // This is for the frisbee's position - s16 vx, vy; // Frisbee speed - s16 angle; // To make the frisbee turn on itself -}frisinfos; - -frisinfos frisbee[10]; // 10 Frisbees !! - - - -int main(void) -{ - -// Initialise the lib... -PA_Init(); - -PA_LoadDefaultText(1, 0); - -// Load the palettes for the sprites on both screens -PA_DualLoadSpritePal(0, (void*)sprite0_Pal); - -s32 i; // will be used in for loops to cycle through the frisbees... - -PA_InitRand(); // Init the random stuff... - -for (i = 0; i < 10; i++){ - // Sprite initial position... - frisbee[i].x = (PA_Rand()%256)-16; // random position on the screen - frisbee[i].y = 192+SCREENHOLE + (PA_Rand()%192)-16; // random position on the bottom screen; - - // Speed of frisbee in both ways - frisbee[i].vx = 0; - frisbee[i].vy = 0; - - frisbee[i].angle = 0; - - // Create the sprite on both screens... - PA_DualCreateSprite(FRISBEE+i, (void*)frisbee_Sprite, OBJ_SIZE_32X32, 1, 0, frisbee[i].x-16, frisbee[i].y-16); - PA_DualSetSpriteRotEnable(FRISBEE+i, i); // Enable rotation/zoom, rotset 0 -} - - while(1) - { - for (i = 0; i < 10; i++){ - // Move with the stylus, or move on... - - if (PA_MoveSprite(FRISBEE+i)){ - frisbee[i].x = PA_MovedSprite.X; - frisbee[i].y = PA_MovedSprite.Y + 192 + SCREENHOLE; - frisbee[i].vx = PA_MovedSprite.Vx; frisbee[i].vy = PA_MovedSprite.Vy; - } - else{ - // Now, the frisbee's fixed point position will be updated according to the speed... - frisbee[i].x += frisbee[i].vx; - frisbee[i].y += frisbee[i].vy; - - // If the sprite touches the left or right border, flip the horizontal speed - if ((frisbee[i].x - 16 <= 0) && (frisbee[i].vx < 0)) frisbee[i].vx = -frisbee[i].vx; - else if ((frisbee[i].x + 16 >= 256)&&(frisbee[i].vx > 0)) frisbee[i].vx = - frisbee[i].vx; - - // Same thing, for top and bottom limits... - if ((frisbee[i].y - 16 <= 0) && (frisbee[i].vy < 0)) frisbee[i].vy = -frisbee[i].vy; - else if ((frisbee[i].y + 16 >= 192 + 192 + SCREENHOLE)&& (frisbee[i].vy > 0)) frisbee[i].vy = - frisbee[i].vy; - // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... - PA_DualSetSpriteXY(FRISBEE+i, frisbee[i].x-16, frisbee[i].y-16); - } - - u8 j; - for (j = 0; j < i; j++){ // Test collisions for all frisbees with a smaller number... - if (PA_Distance(frisbee[i].x, frisbee[i].y, frisbee[j].x, frisbee[j].y) < 32*32) { - frisbee[i].vx = (frisbee[i].x - frisbee[j].x)/6; - frisbee[i].vy = (frisbee[i].y - frisbee[j].y)/6; - frisbee[j].vx = -frisbee[i].vx; - frisbee[j].vy = -frisbee[i].vy; - } - } - - - frisbee[i].angle+=4; // Make the frisbee turn... - PA_DualSetRotsetNoZoom(i, frisbee[i].angle); - } - - - PA_WaitForVBL(); // Synch to the framerate... - } - -return 0; -} - +// Frisbee future game ! + +#include + +// Include the sprites : +#include "all_gfx.h" + +#define FRISBEE 10 // Sprite number... +#define SCREENHOLE 48 // Size of the space between the screens... This is what looked the best + + +typedef struct{ + s16 x, y; // This is for the frisbee's position + s16 vx, vy; // Frisbee speed + s16 angle; // To make the frisbee turn on itself +}frisinfos; + +frisinfos frisbee[10]; // 10 Frisbees !! + + + +int main(void) +{ + +// Initialise the lib... +PA_Init(); + +PA_LoadDefaultText(1, 0); + +// Load the palettes for the sprites on both screens +PA_DualLoadSpritePal(0, (void*)sprite0_Pal); + +s32 i; // will be used in for loops to cycle through the frisbees... + +PA_InitRand(); // Init the random stuff... + +for (i = 0; i < 10; i++){ + // Sprite initial position... + frisbee[i].x = (PA_Rand()%256)-16; // random position on the screen + frisbee[i].y = 192+SCREENHOLE + (PA_Rand()%192)-16; // random position on the bottom screen; + + // Speed of frisbee in both ways + frisbee[i].vx = 0; + frisbee[i].vy = 0; + + frisbee[i].angle = 0; + + // Create the sprite on both screens... + PA_DualCreateSprite(FRISBEE+i, (void*)frisbee_Sprite, OBJ_SIZE_32X32, 1, 0, frisbee[i].x-16, frisbee[i].y-16); + PA_DualSetSpriteRotEnable(FRISBEE+i, i); // Enable rotation/zoom, rotset 0 +} + + while(1) + { + for (i = 0; i < 10; i++){ + // Move with the stylus, or move on... + + if (PA_MoveSprite(FRISBEE+i)){ + frisbee[i].x = PA_MovedSprite.X; + frisbee[i].y = PA_MovedSprite.Y + 192 + SCREENHOLE; + frisbee[i].vx = PA_MovedSprite.Vx; frisbee[i].vy = PA_MovedSprite.Vy; + } + else{ + // Now, the frisbee's fixed point position will be updated according to the speed... + frisbee[i].x += frisbee[i].vx; + frisbee[i].y += frisbee[i].vy; + + // If the sprite touches the left or right border, flip the horizontal speed + if ((frisbee[i].x - 16 <= 0) && (frisbee[i].vx < 0)) frisbee[i].vx = -frisbee[i].vx; + else if ((frisbee[i].x + 16 >= 256)&&(frisbee[i].vx > 0)) frisbee[i].vx = - frisbee[i].vx; + + // Same thing, for top and bottom limits... + if ((frisbee[i].y - 16 <= 0) && (frisbee[i].vy < 0)) frisbee[i].vy = -frisbee[i].vy; + else if ((frisbee[i].y + 16 >= 192 + 192 + SCREENHOLE)&& (frisbee[i].vy > 0)) frisbee[i].vy = - frisbee[i].vy; + // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... + PA_DualSetSpriteXY(FRISBEE+i, frisbee[i].x-16, frisbee[i].y-16); + } + + u8 j; + for (j = 0; j < i; j++){ // Test collisions for all frisbees with a smaller number... + if (PA_Distance(frisbee[i].x, frisbee[i].y, frisbee[j].x, frisbee[j].y) < 32*32) { + frisbee[i].vx = (frisbee[i].x - frisbee[j].x)/6; + frisbee[i].vy = (frisbee[i].y - frisbee[j].y)/6; + frisbee[j].vx = -frisbee[i].vx; + frisbee[j].vy = -frisbee[i].vy; + } + } + + + frisbee[i].angle+=4; // Make the frisbee turn... + PA_DualSetRotsetNoZoom(i, frisbee[i].angle); + } + + + PA_WaitForVBL(); // Synch to the framerate... + } + +return 0; +} + // That's all folks, easy, right ? :p \ No newline at end of file diff --git a/examples/Demos/MultipleFiles/Makefile b/examples/Demos/MultipleFiles/Makefile index 54887fb..8edb3b3 100644 --- a/examples/Demos/MultipleFiles/Makefile +++ b/examples/Demos/MultipleFiles/Makefile @@ -1,3 +1,3 @@ -INCLUDEDIRS := include gfx - -include ../../Makefile_example +INCLUDEDIRS := include gfx + +include ../../Makefile_example diff --git a/examples/Demos/MultipleFiles/gfx/all_gfx.h b/examples/Demos/MultipleFiles/gfx/all_gfx.h index 0db5322..07a6043 100644 --- a/examples/Demos/MultipleFiles/gfx/all_gfx.h +++ b/examples/Demos/MultipleFiles/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/MultipleFiles/include/header.h b/examples/Demos/MultipleFiles/include/header.h index a353e50..44f485f 100644 --- a/examples/Demos/MultipleFiles/include/header.h +++ b/examples/Demos/MultipleFiles/include/header.h @@ -1,35 +1,35 @@ -#ifndef __HEADER1__ -#define __HEADER1__ - -#include - -#include "../gfx/all_gfx.h" // Gfx include for the header (.h) - - -// Macros in the header file -#define FRISBEE 10 // Sprite number... -#define SCREENHOLE 48 // Size of the space between the screens... This is what looked the best - -// Typedefs go in header file too... -typedef struct{ - s16 x, y; // This is for the frisbee's position - s16 vx, vy; // Frisbee speed - s16 angle; // To make the frisbee turn on itself -}frisinfos; - -extern frisinfos frisbee[10]; // Variables go in .c files. -// If you want them to be accessible in other files, declare as extern in a header - - -// Function declarations -void GameInit(void); // Game Init... -void PlayGame(void); // Game Play... - - - - - - -#endif - - +#ifndef __HEADER1__ +#define __HEADER1__ + +#include + +#include "../gfx/all_gfx.h" // Gfx include for the header (.h) + + +// Macros in the header file +#define FRISBEE 10 // Sprite number... +#define SCREENHOLE 48 // Size of the space between the screens... This is what looked the best + +// Typedefs go in header file too... +typedef struct{ + s16 x, y; // This is for the frisbee's position + s16 vx, vy; // Frisbee speed + s16 angle; // To make the frisbee turn on itself +}frisinfos; + +extern frisinfos frisbee[10]; // Variables go in .c files. +// If you want them to be accessible in other files, declare as extern in a header + + +// Function declarations +void GameInit(void); // Game Init... +void PlayGame(void); // Game Play... + + + + + + +#endif + + diff --git a/examples/Demos/MultipleFiles/source/game.c b/examples/Demos/MultipleFiles/source/game.c index 75c3062..3a22f1a 100644 --- a/examples/Demos/MultipleFiles/source/game.c +++ b/examples/Demos/MultipleFiles/source/game.c @@ -1,98 +1,98 @@ -// Frisbee future game ! - -#include - -#include "header.h" - - -// Defined in the header... -frisinfos frisbee[10]; // 10 Frisbees !! -/* Contains : - s16 x, y; // This is for the frisbee's position - s16 vx, vy; // Frisbee speed - s16 angle; // To make the frisbee turn on itself -*/ - - -// Game Init Code... -void GameInit(void){ - - PA_InitText(1, 0); - - // Load the palettes for the sprites on both screens - PA_DualLoadSpritePal(0, (void*)sprite0_Pal); - - s32 i; // will be used in for loops to cycle through the frisbees... - - PA_InitRand(); // Init the random stuff... - - for (i = 0; i < 10; i++){ - // Sprite initial position... - frisbee[i].x = (PA_Rand()%256)-16; // random position on the screen - frisbee[i].y = 192+SCREENHOLE + (PA_Rand()%192)-16; // random position on the bottom screen; - - // Speed of frisbee in both ways - frisbee[i].vx = 0; - frisbee[i].vy = 0; - - frisbee[i].angle = 0; - - // Create the sprite on both screens... - PA_DualCreateSprite(FRISBEE+i, (void*)frisbee_Sprite, OBJ_SIZE_32X32, 1, 0, frisbee[i].x-16, frisbee[i].y-16); - PA_DualSetSpriteRotEnable(FRISBEE+i, i); // Enable rotation/zoom, rotset 0 - } -} // End of GameInit - - -void PlayGame(void){ - s32 i; - - while(1) // Main game loop - { - for (i = 0; i < 10; i++){ - // Move with the stylus, or move on... - - if (PA_MoveSprite(FRISBEE+i)){ - frisbee[i].x = PA_MovedSprite.X; - frisbee[i].y = PA_MovedSprite.Y + 192 + SCREENHOLE; - frisbee[i].vx = PA_MovedSprite.Vx; frisbee[i].vy = PA_MovedSprite.Vy; - } - else{ - // Now, the frisbee's fixed point position will be updated according to the speed... - frisbee[i].x += frisbee[i].vx; - frisbee[i].y += frisbee[i].vy; - - // If the sprite touches the left or right border, flip the horizontal speed - if ((frisbee[i].x - 16 <= 0) && (frisbee[i].vx < 0)) frisbee[i].vx = -frisbee[i].vx; - else if ((frisbee[i].x + 16 >= 256)&&(frisbee[i].vx > 0)) frisbee[i].vx = - frisbee[i].vx; - - // Same thing, for top and bottom limits... - if ((frisbee[i].y - 16 <= 0) && (frisbee[i].vy < 0)) frisbee[i].vy = -frisbee[i].vy; - else if ((frisbee[i].y + 16 >= 192 + 192 + SCREENHOLE)&& (frisbee[i].vy > 0)) frisbee[i].vy = - frisbee[i].vy; - // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... - PA_DualSetSpriteXY(FRISBEE+i, frisbee[i].x-16, frisbee[i].y-16); - } - - u8 j; - for (j = 0; j < i; j++){ // Test collisions for all frisbees with a smaller number... - if (PA_Distance(frisbee[i].x, frisbee[i].y, frisbee[j].x, frisbee[j].y) < 32*32) { - frisbee[i].vx = (frisbee[i].x - frisbee[j].x)/6; - frisbee[i].vy = (frisbee[i].y - frisbee[j].y)/6; - frisbee[j].vx = -frisbee[i].vx; - frisbee[j].vy = -frisbee[i].vy; - } - } - - - frisbee[i].angle+=4; // Make the frisbee turn... - PA_DualSetRotsetNoZoom(i, frisbee[i].angle); - } - - - PA_WaitForVBL(); // Synch to the framerate... - } - -} - -// That's all folks, easy, right ? :p - +// Frisbee future game ! + +#include + +#include "header.h" + + +// Defined in the header... +frisinfos frisbee[10]; // 10 Frisbees !! +/* Contains : + s16 x, y; // This is for the frisbee's position + s16 vx, vy; // Frisbee speed + s16 angle; // To make the frisbee turn on itself +*/ + + +// Game Init Code... +void GameInit(void){ + + PA_InitText(1, 0); + + // Load the palettes for the sprites on both screens + PA_DualLoadSpritePal(0, (void*)sprite0_Pal); + + s32 i; // will be used in for loops to cycle through the frisbees... + + PA_InitRand(); // Init the random stuff... + + for (i = 0; i < 10; i++){ + // Sprite initial position... + frisbee[i].x = (PA_Rand()%256)-16; // random position on the screen + frisbee[i].y = 192+SCREENHOLE + (PA_Rand()%192)-16; // random position on the bottom screen; + + // Speed of frisbee in both ways + frisbee[i].vx = 0; + frisbee[i].vy = 0; + + frisbee[i].angle = 0; + + // Create the sprite on both screens... + PA_DualCreateSprite(FRISBEE+i, (void*)frisbee_Sprite, OBJ_SIZE_32X32, 1, 0, frisbee[i].x-16, frisbee[i].y-16); + PA_DualSetSpriteRotEnable(FRISBEE+i, i); // Enable rotation/zoom, rotset 0 + } +} // End of GameInit + + +void PlayGame(void){ + s32 i; + + while(1) // Main game loop + { + for (i = 0; i < 10; i++){ + // Move with the stylus, or move on... + + if (PA_MoveSprite(FRISBEE+i)){ + frisbee[i].x = PA_MovedSprite.X; + frisbee[i].y = PA_MovedSprite.Y + 192 + SCREENHOLE; + frisbee[i].vx = PA_MovedSprite.Vx; frisbee[i].vy = PA_MovedSprite.Vy; + } + else{ + // Now, the frisbee's fixed point position will be updated according to the speed... + frisbee[i].x += frisbee[i].vx; + frisbee[i].y += frisbee[i].vy; + + // If the sprite touches the left or right border, flip the horizontal speed + if ((frisbee[i].x - 16 <= 0) && (frisbee[i].vx < 0)) frisbee[i].vx = -frisbee[i].vx; + else if ((frisbee[i].x + 16 >= 256)&&(frisbee[i].vx > 0)) frisbee[i].vx = - frisbee[i].vx; + + // Same thing, for top and bottom limits... + if ((frisbee[i].y - 16 <= 0) && (frisbee[i].vy < 0)) frisbee[i].vy = -frisbee[i].vy; + else if ((frisbee[i].y + 16 >= 192 + 192 + SCREENHOLE)&& (frisbee[i].vy > 0)) frisbee[i].vy = - frisbee[i].vy; + // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... + PA_DualSetSpriteXY(FRISBEE+i, frisbee[i].x-16, frisbee[i].y-16); + } + + u8 j; + for (j = 0; j < i; j++){ // Test collisions for all frisbees with a smaller number... + if (PA_Distance(frisbee[i].x, frisbee[i].y, frisbee[j].x, frisbee[j].y) < 32*32) { + frisbee[i].vx = (frisbee[i].x - frisbee[j].x)/6; + frisbee[i].vy = (frisbee[i].y - frisbee[j].y)/6; + frisbee[j].vx = -frisbee[i].vx; + frisbee[j].vy = -frisbee[i].vy; + } + } + + + frisbee[i].angle+=4; // Make the frisbee turn... + PA_DualSetRotsetNoZoom(i, frisbee[i].angle); + } + + + PA_WaitForVBL(); // Synch to the framerate... + } + +} + +// That's all folks, easy, right ? :p + diff --git a/examples/Demos/MultipleFiles/source/main.c b/examples/Demos/MultipleFiles/source/main.c index 7b1d642..a735325 100644 --- a/examples/Demos/MultipleFiles/source/main.c +++ b/examples/Demos/MultipleFiles/source/main.c @@ -1,23 +1,23 @@ -// Multiple files ! - -#include - -// Include the sprites : -#include "header.h" // Include header file, that's all ! - - - -int main(void) -{ - - // Initialise the lib... - PA_Init(); - - GameInit(); // Game Init from game.c - - PlayGame(); // Playing the game !! - -return 0; -} - +// Multiple files ! + +#include + +// Include the sprites : +#include "header.h" // Include header file, that's all ! + + + +int main(void) +{ + + // Initialise the lib... + PA_Init(); + + GameInit(); // Game Init from game.c + + PlayGame(); // Playing the game !! + +return 0; +} + // That's all folks, easy, right ? :p \ No newline at end of file diff --git a/examples/Demos/PassingBy/Makefile b/examples/Demos/PassingBy/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Demos/PassingBy/Makefile +++ b/examples/Demos/PassingBy/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Demos/PassingBy/source/main.c b/examples/Demos/PassingBy/source/main.c index 979a325..ef53026 100644 --- a/examples/Demos/PassingBy/source/main.c +++ b/examples/Demos/PassingBy/source/main.c @@ -1,65 +1,65 @@ -// Include any GIF file and output it on an 8bit or 16bit screen ! - -// Includes -#include // Include for PA_Lib - -#include "Mollusk.h" // gif to include -#include "Zoom.h" // sound to include - -u16 spritepal[256]; // our sprite palette - -int main(){ - PA_Init(); - - // Init the sound system - AS_Init(AS_MODE_16CH); - AS_SetDefaultSettings(AS_PCM_8BIT, 11025, 0); - - PA_SetBgColor(0, PA_RGB(31, 31, 31)); // White background color - - // First, convert the gif to a sprite format... - u8* spritegfx = PA_GifToTiles((void*)Mollusk, // Gif file - spritepal); // our palette - - // Next, load the sprite... - PA_CreateSprite(0, 0, spritegfx, OBJ_SIZE_64X64, 1, 0, 64, 64); // Just like plain sprites ! - PA_LoadSpritePal(0, 0, spritepal); // Just like plain palettes ! - - // spritegfx can be used over and over again to load other sprites... - // If you do not need it anymore, use free(spritegfx); to free the memory it uses ! - - s32 spritex = -64; // Sprite position - s32 pan = 0; // Audio panning - - PA_SetSpriteHflip(0, 0, 1); // Turn sprite around... again... - - while(true){ - int snd; - - snd = AS_SoundQuickPlay(Zoom); // Play sound... - - for (spritex = -64; spritex < 256; spritex +=2){ - pan = spritex/2; - if (pan < 0) pan = 0; if (pan > 127) pan = 127; // Limit range... - - PA_SetSpriteX(0, 0, spritex); - AS_SetSoundPan(snd, pan); - PA_WaitForVBL(); - } - - PA_SetSpriteHflip(0, 0, 0); // Turn sprite around... - - snd = AS_SoundQuickPlay(Zoom); - - for (spritex = 256; spritex > -65; spritex -=2){ - pan = spritex/2; - if (pan < 0) pan = 0; if (pan > 127) pan = 127; // Limit range... - - PA_SetSpriteX(0, 0, spritex); - AS_SetSoundPan(snd, pan); - PA_WaitForVBL(); - } - - PA_SetSpriteHflip(0, 0, 1); // Turn sprite around again - } +// Include any GIF file and output it on an 8bit or 16bit screen ! + +// Includes +#include // Include for PA_Lib + +#include "Mollusk.h" // gif to include +#include "Zoom.h" // sound to include + +u16 spritepal[256]; // our sprite palette + +int main(){ + PA_Init(); + + // Init the sound system + AS_Init(AS_MODE_16CH); + AS_SetDefaultSettings(AS_PCM_8BIT, 11025, 0); + + PA_SetBgColor(0, PA_RGB(31, 31, 31)); // White background color + + // First, convert the gif to a sprite format... + u8* spritegfx = PA_GifToTiles((void*)Mollusk, // Gif file + spritepal); // our palette + + // Next, load the sprite... + PA_CreateSprite(0, 0, spritegfx, OBJ_SIZE_64X64, 1, 0, 64, 64); // Just like plain sprites ! + PA_LoadSpritePal(0, 0, spritepal); // Just like plain palettes ! + + // spritegfx can be used over and over again to load other sprites... + // If you do not need it anymore, use free(spritegfx); to free the memory it uses ! + + s32 spritex = -64; // Sprite position + s32 pan = 0; // Audio panning + + PA_SetSpriteHflip(0, 0, 1); // Turn sprite around... again... + + while(true){ + int snd; + + snd = AS_SoundQuickPlay(Zoom); // Play sound... + + for (spritex = -64; spritex < 256; spritex +=2){ + pan = spritex/2; + if (pan < 0) pan = 0; if (pan > 127) pan = 127; // Limit range... + + PA_SetSpriteX(0, 0, spritex); + AS_SetSoundPan(snd, pan); + PA_WaitForVBL(); + } + + PA_SetSpriteHflip(0, 0, 0); // Turn sprite around... + + snd = AS_SoundQuickPlay(Zoom); + + for (spritex = 256; spritex > -65; spritex -=2){ + pan = spritex/2; + if (pan < 0) pan = 0; if (pan > 127) pan = 127; // Limit range... + + PA_SetSpriteX(0, 0, spritex); + AS_SetSoundPan(snd, pan); + PA_WaitForVBL(); + } + + PA_SetSpriteHflip(0, 0, 1); // Turn sprite around again + } } \ No newline at end of file diff --git a/examples/Demos/PlatformGame/PlatformGame/Makefile b/examples/Demos/PlatformGame/PlatformGame/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/PlatformGame/PlatformGame/Makefile +++ b/examples/Demos/PlatformGame/PlatformGame/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/PlatformGame/PlatformGame/gfx/all_gfx.h b/examples/Demos/PlatformGame/PlatformGame/gfx/all_gfx.h index da38397..4a5a3cf 100644 --- a/examples/Demos/PlatformGame/PlatformGame/gfx/all_gfx.h +++ b/examples/Demos/PlatformGame/PlatformGame/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/PlatformGame/PlatformGame/source/main.c b/examples/Demos/PlatformGame/PlatformGame/source/main.c index 4bb7ca8..3637b41 100644 --- a/examples/Demos/PlatformGame/PlatformGame/source/main.c +++ b/examples/Demos/PlatformGame/PlatformGame/source/main.c @@ -1,73 +1,73 @@ -// Includes, only one sprite -#include - -#include "all_gfx.h" - -typedef struct{ - s32 x, y; - s32 vy; // used for jumping... -} mariotype; - -mariotype mario; - -#define GRAVITY 48 - - -void MoveMario(void); - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... - - mario.x = 0<<8; mario.y = (192-32)<<8; // bottom of the screen... fixed point - mario.vy = 0; // not jumping - PA_CreateSprite(0, 0,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, mario.x>>8, mario.y>>8); // Sprite - - while(1) - { - MoveMario(); - - PA_SetSpriteXY(0, 0, mario.x>>8, mario.y>>8); - - PA_WaitForVBL(); - } - - return 0; -} - - - -void MoveMario(void){ - if(Pad.Newpress.Right) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 0); - } - else if(Pad.Newpress.Left) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 1); - } - - if ((Pad.Newpress.A) && (mario.vy == 0)){ // If pressed A and not in the air - mario.vy = -1000; // Start jumping - } - - // Moving Code - mario.x += (Pad.Held.Right - Pad.Held.Left)<<8; // in fixed point... - - // Add gravity - mario.vy += GRAVITY; - mario.y += mario.vy; - if (mario.y >= (192-32)<<8) { - mario.y = (192-32)<<8; - mario.vy = 0; - } - - if (mario.vy != 0) PA_SetSpriteAnim(0, 0, 2); // If going up or down, means the sprite is jumping ! - else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking +// Includes, only one sprite +#include + +#include "all_gfx.h" + +typedef struct{ + s32 x, y; + s32 vy; // used for jumping... +} mariotype; + +mariotype mario; + +#define GRAVITY 48 + + +void MoveMario(void); + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... + + mario.x = 0<<8; mario.y = (192-32)<<8; // bottom of the screen... fixed point + mario.vy = 0; // not jumping + PA_CreateSprite(0, 0,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, mario.x>>8, mario.y>>8); // Sprite + + while(1) + { + MoveMario(); + + PA_SetSpriteXY(0, 0, mario.x>>8, mario.y>>8); + + PA_WaitForVBL(); + } + + return 0; +} + + + +void MoveMario(void){ + if(Pad.Newpress.Right) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 0); + } + else if(Pad.Newpress.Left) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 1); + } + + if ((Pad.Newpress.A) && (mario.vy == 0)){ // If pressed A and not in the air + mario.vy = -1000; // Start jumping + } + + // Moving Code + mario.x += (Pad.Held.Right - Pad.Held.Left)<<8; // in fixed point... + + // Add gravity + mario.vy += GRAVITY; + mario.y += mario.vy; + if (mario.y >= (192-32)<<8) { + mario.y = (192-32)<<8; + mario.vy = 0; + } + + if (mario.vy != 0) PA_SetSpriteAnim(0, 0, 2); // If going up or down, means the sprite is jumping ! + else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking } \ No newline at end of file diff --git a/examples/Demos/PlatformGame/PlatformGame2/Makefile b/examples/Demos/PlatformGame/PlatformGame2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/PlatformGame/PlatformGame2/Makefile +++ b/examples/Demos/PlatformGame/PlatformGame2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/PlatformGame/PlatformGame2/gfx/all_gfx.h b/examples/Demos/PlatformGame/PlatformGame2/gfx/all_gfx.h index 6457164..d094149 100644 --- a/examples/Demos/PlatformGame/PlatformGame2/gfx/all_gfx.h +++ b/examples/Demos/PlatformGame/PlatformGame2/gfx/all_gfx.h @@ -1,23 +1,23 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal - -// Backgrounds: -extern const PA_BgStruct mario_world; -extern const PA_BgStruct back; - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal + +// Backgrounds: +extern const PA_BgStruct mario_world; +extern const PA_BgStruct back; + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/PlatformGame/PlatformGame2/gfx/bin/back.c b/examples/Demos/PlatformGame/PlatformGame2/gfx/bin/back.c index de10830..9230461 100644 --- a/examples/Demos/PlatformGame/PlatformGame2/gfx/bin/back.c +++ b/examples/Demos/PlatformGame/PlatformGame2/gfx/bin/back.c @@ -1,17 +1,17 @@ -#include - -extern const char back_Tiles[]; -extern const char back_Map[]; -extern const char back_Pal[]; - -const PA_BgStruct back = { - PA_BgNormal, - 256, 192, - - back_Tiles, - back_Map, - {back_Pal}, - - 256, - {1536} -}; +#include + +extern const char back_Tiles[]; +extern const char back_Map[]; +extern const char back_Pal[]; + +const PA_BgStruct back = { + PA_BgNormal, + 256, 192, + + back_Tiles, + back_Map, + {back_Pal}, + + 256, + {1536} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame2/gfx/bin/mario_world.c b/examples/Demos/PlatformGame/PlatformGame2/gfx/bin/mario_world.c index 70d2add..5069cdb 100644 --- a/examples/Demos/PlatformGame/PlatformGame2/gfx/bin/mario_world.c +++ b/examples/Demos/PlatformGame/PlatformGame2/gfx/bin/mario_world.c @@ -1,17 +1,17 @@ -#include - -extern const char mario_world_Tiles[]; -extern const char mario_world_Map[]; -extern const char mario_world_Pal[]; - -const PA_BgStruct mario_world = { - PA_BgNormal, - 256, 192, - - mario_world_Tiles, - mario_world_Map, - {mario_world_Pal}, - - 768, - {1536} -}; +#include + +extern const char mario_world_Tiles[]; +extern const char mario_world_Map[]; +extern const char mario_world_Pal[]; + +const PA_BgStruct mario_world = { + PA_BgNormal, + 256, 192, + + mario_world_Tiles, + mario_world_Map, + {mario_world_Pal}, + + 768, + {1536} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame2/source/main.c b/examples/Demos/PlatformGame/PlatformGame2/source/main.c index 406ed67..4d534eb 100644 --- a/examples/Demos/PlatformGame/PlatformGame2/source/main.c +++ b/examples/Demos/PlatformGame/PlatformGame2/source/main.c @@ -1,133 +1,133 @@ -// Includes, only one sprite -#include - -#include "all_gfx.h" - -typedef struct{ - s32 x, y; - s32 vy; // used for jumping... - s32 flip; -} mariotype; - -mariotype mario; - -#define COL_MAP ((u16*)mario_world.BgMap) - -#define GRAVITY 48 -#define MARIO_SPEED 512 - - -void MoveMario(void); -void CheckCollisions(void); -u8 GetTile(s16 x, s16 y); -u8 LeftCollision(void); -u8 RightCollision(void); -u8 DownCollision(void); -u8 TouchingGround(void); - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... - - PA_LoadBackground(0, 1, &mario_world); // platfroms... - PA_LoadBackground(0, 3, &back); // back - - - mario.x = 0<<8; mario.y = (128-32)<<8; // bottom of the screen... fixed point - mario.vy = 0; // not jumping - mario.flip = 0; - PA_CreateSprite(0, 0,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, mario.x>>8, mario.y>>8); // Sprite - - while(1) - { - MoveMario(); - - PA_SetSpriteXY(0, 0, mario.x>>8, mario.y>>8); - - PA_OutputText(1, 2, 9, "X : %d ", mario.x >> 8); - PA_OutputText(1, 2, 10, "Y : %d ", mario.y >> 8); - - PA_WaitForVBL(); - } - - return 0; -} - - - -void MoveMario(void){ - if(Pad.Newpress.Right) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 0); - mario.flip = 0; - } - else if(Pad.Newpress.Left) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 1); - mario.flip = 1; - } - - if ((Pad.Newpress.A) && (TouchingGround())){ // If pressed A and not in the air - mario.vy = -1200; // Start jumping - } - - // Moving Code - mario.x += (Pad.Held.Right - Pad.Held.Left)*MARIO_SPEED; // in fixed point... - - // Add gravity - mario.vy += GRAVITY; - mario.y += mario.vy; - - CheckCollisions(); - - if (!TouchingGround()) PA_SetSpriteAnim(0, 0, 2); // Not on the ground - else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking -} - - - - - -u8 GetTile(s16 x, s16 y){ - if (x < 0) return 1; // Say it was a collision... - return COL_MAP[((y>>3)*32) + (x>>3)]; -} - -u8 LeftCollision(void){ - return GetTile((mario.x>>8)+2, (mario.y>>8)+8+(mario.flip*13)); -} - -u8 RightCollision(void){ - return (GetTile((mario.x>>8)+29, (mario.y>>8)+8 + ((!mario.flip)*13))); -} - -u8 DownCollision(void){ - return (mario.vy >= 0 && GetTile((mario.x>>8)+10 + (mario.flip*11), (mario.y>>8)+31)); -} - -u8 TouchingGround(void){ - return GetTile((mario.x>>8)+10 + (mario.flip*11), (mario.y>>8)+32); -} - -void CheckCollisions(void){ - - while(LeftCollision()){ // Collision on the left of the sprite... - mario.x+= 256; // Move by 1 pixel... - } - while(RightCollision()){ // Collision on the right of the sprite... - mario.x-= 256; // Move by 1 pixel... - } - - while(DownCollision()){ // Collision on the bottom of the sprite... - mario.y -= 128; // Move by 1/2 pixel... - mario.vy = 0; // TOuched the floor... - } - if(TouchingGround()) mario.vy = 0; - +// Includes, only one sprite +#include + +#include "all_gfx.h" + +typedef struct{ + s32 x, y; + s32 vy; // used for jumping... + s32 flip; +} mariotype; + +mariotype mario; + +#define COL_MAP ((u16*)mario_world.BgMap) + +#define GRAVITY 48 +#define MARIO_SPEED 512 + + +void MoveMario(void); +void CheckCollisions(void); +u8 GetTile(s16 x, s16 y); +u8 LeftCollision(void); +u8 RightCollision(void); +u8 DownCollision(void); +u8 TouchingGround(void); + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... + + PA_LoadBackground(0, 1, &mario_world); // platfroms... + PA_LoadBackground(0, 3, &back); // back + + + mario.x = 0<<8; mario.y = (128-32)<<8; // bottom of the screen... fixed point + mario.vy = 0; // not jumping + mario.flip = 0; + PA_CreateSprite(0, 0,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, mario.x>>8, mario.y>>8); // Sprite + + while(1) + { + MoveMario(); + + PA_SetSpriteXY(0, 0, mario.x>>8, mario.y>>8); + + PA_OutputText(1, 2, 9, "X : %d ", mario.x >> 8); + PA_OutputText(1, 2, 10, "Y : %d ", mario.y >> 8); + + PA_WaitForVBL(); + } + + return 0; +} + + + +void MoveMario(void){ + if(Pad.Newpress.Right) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 0); + mario.flip = 0; + } + else if(Pad.Newpress.Left) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 1); + mario.flip = 1; + } + + if ((Pad.Newpress.A) && (TouchingGround())){ // If pressed A and not in the air + mario.vy = -1200; // Start jumping + } + + // Moving Code + mario.x += (Pad.Held.Right - Pad.Held.Left)*MARIO_SPEED; // in fixed point... + + // Add gravity + mario.vy += GRAVITY; + mario.y += mario.vy; + + CheckCollisions(); + + if (!TouchingGround()) PA_SetSpriteAnim(0, 0, 2); // Not on the ground + else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking +} + + + + + +u8 GetTile(s16 x, s16 y){ + if (x < 0) return 1; // Say it was a collision... + return COL_MAP[((y>>3)*32) + (x>>3)]; +} + +u8 LeftCollision(void){ + return GetTile((mario.x>>8)+2, (mario.y>>8)+8+(mario.flip*13)); +} + +u8 RightCollision(void){ + return (GetTile((mario.x>>8)+29, (mario.y>>8)+8 + ((!mario.flip)*13))); +} + +u8 DownCollision(void){ + return (mario.vy >= 0 && GetTile((mario.x>>8)+10 + (mario.flip*11), (mario.y>>8)+31)); +} + +u8 TouchingGround(void){ + return GetTile((mario.x>>8)+10 + (mario.flip*11), (mario.y>>8)+32); +} + +void CheckCollisions(void){ + + while(LeftCollision()){ // Collision on the left of the sprite... + mario.x+= 256; // Move by 1 pixel... + } + while(RightCollision()){ // Collision on the right of the sprite... + mario.x-= 256; // Move by 1 pixel... + } + + while(DownCollision()){ // Collision on the bottom of the sprite... + mario.y -= 128; // Move by 1/2 pixel... + mario.vy = 0; // TOuched the floor... + } + if(TouchingGround()) mario.vy = 0; + } \ No newline at end of file diff --git a/examples/Demos/PlatformGame/PlatformGame3/Makefile b/examples/Demos/PlatformGame/PlatformGame3/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/PlatformGame/PlatformGame3/Makefile +++ b/examples/Demos/PlatformGame/PlatformGame3/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/PlatformGame/PlatformGame3/gfx/all_gfx.h b/examples/Demos/PlatformGame/PlatformGame3/gfx/all_gfx.h index 5e14717..99526ee 100644 --- a/examples/Demos/PlatformGame/PlatformGame3/gfx/all_gfx.h +++ b/examples/Demos/PlatformGame/PlatformGame3/gfx/all_gfx.h @@ -1,24 +1,24 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal - -// Backgrounds: -extern const PA_BgStruct mario_world; -extern const PA_BgStruct hills; -extern const PA_BgStruct back; - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal + +// Backgrounds: +extern const PA_BgStruct mario_world; +extern const PA_BgStruct hills; +extern const PA_BgStruct back; + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/back.c b/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/back.c index 84d3b57..f6f7b60 100644 --- a/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/back.c +++ b/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/back.c @@ -1,17 +1,17 @@ -#include - -extern const char back_Tiles[]; -extern const char back_Map[]; -extern const char back_Pal[]; - -const PA_BgStruct back = { - PA_BgNormal, - 512, 256, - - back_Tiles, - back_Map, - {back_Pal}, - - 320, - {4096} -}; +#include + +extern const char back_Tiles[]; +extern const char back_Map[]; +extern const char back_Pal[]; + +const PA_BgStruct back = { + PA_BgNormal, + 512, 256, + + back_Tiles, + back_Map, + {back_Pal}, + + 320, + {4096} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/hills.c b/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/hills.c index 90435a3..3c02707 100644 --- a/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/hills.c +++ b/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/hills.c @@ -1,17 +1,17 @@ -#include - -extern const char hills_Tiles[]; -extern const char hills_Map[]; -extern const char hills_Pal[]; - -const PA_BgStruct hills = { - PA_BgLarge, - 768, 256, - - hills_Tiles, - hills_Map, - {hills_Pal}, - - 2432, - {6144} -}; +#include + +extern const char hills_Tiles[]; +extern const char hills_Map[]; +extern const char hills_Pal[]; + +const PA_BgStruct hills = { + PA_BgLarge, + 768, 256, + + hills_Tiles, + hills_Map, + {hills_Pal}, + + 2432, + {6144} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/mario_world.c b/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/mario_world.c index 052a85c..d6fa1f5 100644 --- a/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/mario_world.c +++ b/examples/Demos/PlatformGame/PlatformGame3/gfx/bin/mario_world.c @@ -1,17 +1,17 @@ -#include - -extern const char mario_world_Tiles[]; -extern const char mario_world_Map[]; -extern const char mario_world_Pal[]; - -const PA_BgStruct mario_world = { - PA_BgLarge, - 1024, 256, - - mario_world_Tiles, - mario_world_Map, - {mario_world_Pal}, - - 1024, - {8192} -}; +#include + +extern const char mario_world_Tiles[]; +extern const char mario_world_Map[]; +extern const char mario_world_Pal[]; + +const PA_BgStruct mario_world = { + PA_BgLarge, + 1024, 256, + + mario_world_Tiles, + mario_world_Map, + {mario_world_Pal}, + + 1024, + {8192} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame3/source/main.c b/examples/Demos/PlatformGame/PlatformGame3/source/main.c index f418a30..23fc1bc 100644 --- a/examples/Demos/PlatformGame/PlatformGame3/source/main.c +++ b/examples/Demos/PlatformGame/PlatformGame3/source/main.c @@ -1,147 +1,147 @@ -// Includes, only one sprite -#include - -#include "all_gfx.h" - -#define COL_MAP ((u16*)mario_world.BgMap) - -typedef struct{ - s32 x, y; - s32 vy; // used for jumping... - s32 flip; - s32 scrollx; // Scroll value... -} mariotype; - -mariotype mario; - -#define GRAVITY 48 -#define MARIO_SPEED 512 - - -void MoveMario(void); -void CheckCollisions(void); -u8 GetTile(s16 x, s16 y); -u8 LeftCollision(void); -u8 RightCollision(void); -u8 DownCollision(void); -u8 TouchingGround(void); - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... - - PA_LoadBackground(0, 1, &mario_world); // platfroms... - PA_LoadBackground(0, 2, &hills); // hills - PA_LoadBackground(0, 3, &back); // back - - PA_InitParallaxX(0, 0, 256, 128, 64); - - mario.x = 0<<8; mario.y = (128-32)<<8; // bottom of the screen... fixed point - mario.vy = 0; // not jumping - mario.flip = 0; - mario.scrollx = 0; - PA_CreateSprite(0, 0,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, mario.x>>8, mario.y>>8); // Sprite - - while(1) - { - MoveMario(); - - if ((((mario.x-mario.scrollx)>>8) > 160) && ((mario.x>>8) < 1024-128)){ // Scroll more... - mario.scrollx = mario.x - (160<<8); - } - else if ((((mario.x-mario.scrollx)>>8) < 64) && ((mario.x>>8) > 64)){ - mario.scrollx = mario.x - (64<<8); - } - - PA_ParallaxScrollX(0, mario.scrollx>>8); - - PA_SetSpriteXY(0, 0, (mario.x-mario.scrollx)>>8, mario.y>>8); - - PA_OutputText(1, 2, 9, "X : %d ", mario.x >> 8); - PA_OutputText(1, 2, 10, "Y : %d ", mario.y >> 8); - PA_OutputText(1, 2, 11, "Scroll : %d ", mario.scrollx>>8); - - PA_WaitForVBL(); - } - - return 0; -} - - - -void MoveMario(void){ - if(Pad.Newpress.Right) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 0); - mario.flip = 0; - } - else if(Pad.Newpress.Left) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 1); - mario.flip = 1; - } - - if ((Pad.Newpress.A) && (TouchingGround())){ // If pressed A and not in the air - mario.vy = -1200; // Start jumping - } - - // Moving Code - mario.x += (Pad.Held.Right - Pad.Held.Left)*MARIO_SPEED; // in fixed point... - - // Add gravity - mario.vy += GRAVITY; - mario.y += mario.vy; - - CheckCollisions(); - - if (!TouchingGround()) PA_SetSpriteAnim(0, 0, 2); // Not on the ground - else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking -} - - - - - -u8 GetTile(s16 x, s16 y){ - if (x < 0) return 1; // Say it was a collision... - return COL_MAP[((y>>3)*128) + (x>>3)]; -} - -u8 LeftCollision(void){ - return GetTile((mario.x>>8)+2, (mario.y>>8)+8+(mario.flip*13)); -} - -u8 RightCollision(void){ - return (GetTile((mario.x>>8)+29, (mario.y>>8)+8 + ((!mario.flip)*13))); -} - -u8 DownCollision(void){ - return (mario.vy >= 0 && GetTile((mario.x>>8)+10 + (mario.flip*11), (mario.y>>8)+31)); -} - -u8 TouchingGround(void){ - return GetTile((mario.x>>8)+10 + (mario.flip*11), (mario.y>>8)+32); -} - -void CheckCollisions(void){ - - while(LeftCollision()){ // Collision on the left of the sprite... - mario.x+= 256; // Move by 1 pixel... - } - while(RightCollision()){ // Collision on the right of the sprite... - mario.x-= 256; // Move by 1 pixel... - } - - while(DownCollision()){ // Collision on the bottom of the sprite... - mario.y -= 128; // Move by 1/2 pixel... - mario.vy = 0; // TOuched the floor... - } - if(TouchingGround()) mario.vy = 0; - +// Includes, only one sprite +#include + +#include "all_gfx.h" + +#define COL_MAP ((u16*)mario_world.BgMap) + +typedef struct{ + s32 x, y; + s32 vy; // used for jumping... + s32 flip; + s32 scrollx; // Scroll value... +} mariotype; + +mariotype mario; + +#define GRAVITY 48 +#define MARIO_SPEED 512 + + +void MoveMario(void); +void CheckCollisions(void); +u8 GetTile(s16 x, s16 y); +u8 LeftCollision(void); +u8 RightCollision(void); +u8 DownCollision(void); +u8 TouchingGround(void); + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... + + PA_LoadBackground(0, 1, &mario_world); // platfroms... + PA_LoadBackground(0, 2, &hills); // hills + PA_LoadBackground(0, 3, &back); // back + + PA_InitParallaxX(0, 0, 256, 128, 64); + + mario.x = 0<<8; mario.y = (128-32)<<8; // bottom of the screen... fixed point + mario.vy = 0; // not jumping + mario.flip = 0; + mario.scrollx = 0; + PA_CreateSprite(0, 0,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, mario.x>>8, mario.y>>8); // Sprite + + while(1) + { + MoveMario(); + + if ((((mario.x-mario.scrollx)>>8) > 160) && ((mario.x>>8) < 1024-128)){ // Scroll more... + mario.scrollx = mario.x - (160<<8); + } + else if ((((mario.x-mario.scrollx)>>8) < 64) && ((mario.x>>8) > 64)){ + mario.scrollx = mario.x - (64<<8); + } + + PA_ParallaxScrollX(0, mario.scrollx>>8); + + PA_SetSpriteXY(0, 0, (mario.x-mario.scrollx)>>8, mario.y>>8); + + PA_OutputText(1, 2, 9, "X : %d ", mario.x >> 8); + PA_OutputText(1, 2, 10, "Y : %d ", mario.y >> 8); + PA_OutputText(1, 2, 11, "Scroll : %d ", mario.scrollx>>8); + + PA_WaitForVBL(); + } + + return 0; +} + + + +void MoveMario(void){ + if(Pad.Newpress.Right) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 0); + mario.flip = 0; + } + else if(Pad.Newpress.Left) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 1); + mario.flip = 1; + } + + if ((Pad.Newpress.A) && (TouchingGround())){ // If pressed A and not in the air + mario.vy = -1200; // Start jumping + } + + // Moving Code + mario.x += (Pad.Held.Right - Pad.Held.Left)*MARIO_SPEED; // in fixed point... + + // Add gravity + mario.vy += GRAVITY; + mario.y += mario.vy; + + CheckCollisions(); + + if (!TouchingGround()) PA_SetSpriteAnim(0, 0, 2); // Not on the ground + else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking +} + + + + + +u8 GetTile(s16 x, s16 y){ + if (x < 0) return 1; // Say it was a collision... + return COL_MAP[((y>>3)*128) + (x>>3)]; +} + +u8 LeftCollision(void){ + return GetTile((mario.x>>8)+2, (mario.y>>8)+8+(mario.flip*13)); +} + +u8 RightCollision(void){ + return (GetTile((mario.x>>8)+29, (mario.y>>8)+8 + ((!mario.flip)*13))); +} + +u8 DownCollision(void){ + return (mario.vy >= 0 && GetTile((mario.x>>8)+10 + (mario.flip*11), (mario.y>>8)+31)); +} + +u8 TouchingGround(void){ + return GetTile((mario.x>>8)+10 + (mario.flip*11), (mario.y>>8)+32); +} + +void CheckCollisions(void){ + + while(LeftCollision()){ // Collision on the left of the sprite... + mario.x+= 256; // Move by 1 pixel... + } + while(RightCollision()){ // Collision on the right of the sprite... + mario.x-= 256; // Move by 1 pixel... + } + + while(DownCollision()){ // Collision on the bottom of the sprite... + mario.y -= 128; // Move by 1/2 pixel... + mario.vy = 0; // TOuched the floor... + } + if(TouchingGround()) mario.vy = 0; + } \ No newline at end of file diff --git a/examples/Demos/PlatformGame/PlatformGame3bis/Makefile b/examples/Demos/PlatformGame/PlatformGame3bis/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/PlatformGame/PlatformGame3bis/Makefile +++ b/examples/Demos/PlatformGame/PlatformGame3bis/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/PlatformGame/PlatformGame3bis/gfx/all_gfx.h b/examples/Demos/PlatformGame/PlatformGame3bis/gfx/all_gfx.h index 5e14717..99526ee 100644 --- a/examples/Demos/PlatformGame/PlatformGame3bis/gfx/all_gfx.h +++ b/examples/Demos/PlatformGame/PlatformGame3bis/gfx/all_gfx.h @@ -1,24 +1,24 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal - -// Backgrounds: -extern const PA_BgStruct mario_world; -extern const PA_BgStruct hills; -extern const PA_BgStruct back; - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal + +// Backgrounds: +extern const PA_BgStruct mario_world; +extern const PA_BgStruct hills; +extern const PA_BgStruct back; + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/back.c b/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/back.c index 84d3b57..f6f7b60 100644 --- a/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/back.c +++ b/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/back.c @@ -1,17 +1,17 @@ -#include - -extern const char back_Tiles[]; -extern const char back_Map[]; -extern const char back_Pal[]; - -const PA_BgStruct back = { - PA_BgNormal, - 512, 256, - - back_Tiles, - back_Map, - {back_Pal}, - - 320, - {4096} -}; +#include + +extern const char back_Tiles[]; +extern const char back_Map[]; +extern const char back_Pal[]; + +const PA_BgStruct back = { + PA_BgNormal, + 512, 256, + + back_Tiles, + back_Map, + {back_Pal}, + + 320, + {4096} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/hills.c b/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/hills.c index 90435a3..3c02707 100644 --- a/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/hills.c +++ b/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/hills.c @@ -1,17 +1,17 @@ -#include - -extern const char hills_Tiles[]; -extern const char hills_Map[]; -extern const char hills_Pal[]; - -const PA_BgStruct hills = { - PA_BgLarge, - 768, 256, - - hills_Tiles, - hills_Map, - {hills_Pal}, - - 2432, - {6144} -}; +#include + +extern const char hills_Tiles[]; +extern const char hills_Map[]; +extern const char hills_Pal[]; + +const PA_BgStruct hills = { + PA_BgLarge, + 768, 256, + + hills_Tiles, + hills_Map, + {hills_Pal}, + + 2432, + {6144} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/mario_world.c b/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/mario_world.c index d4c5f01..146b860 100644 --- a/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/mario_world.c +++ b/examples/Demos/PlatformGame/PlatformGame3bis/gfx/bin/mario_world.c @@ -1,17 +1,17 @@ -#include - -extern const char mario_world_Tiles[]; -extern const char mario_world_Map[]; -extern const char mario_world_Pal[]; - -const PA_BgStruct mario_world = { - PA_BgLarge, - 1024, 256, - - mario_world_Tiles, - mario_world_Map, - {mario_world_Pal}, - - 1536, - {8192} -}; +#include + +extern const char mario_world_Tiles[]; +extern const char mario_world_Map[]; +extern const char mario_world_Pal[]; + +const PA_BgStruct mario_world = { + PA_BgLarge, + 1024, 256, + + mario_world_Tiles, + mario_world_Map, + {mario_world_Pal}, + + 1536, + {8192} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame3bis/source/main.c b/examples/Demos/PlatformGame/PlatformGame3bis/source/main.c index 7bf8402..15f4dcb 100644 --- a/examples/Demos/PlatformGame/PlatformGame3bis/source/main.c +++ b/examples/Demos/PlatformGame/PlatformGame3bis/source/main.c @@ -1,143 +1,143 @@ -// Includes -#include - -#include "all_gfx.h" - -typedef struct{ - s32 x, y; - s16 screenx, screeny; // sprite position on the screen - s32 vy; // used for jumping... - s32 flip; - s32 scrollx; // Scroll value... -} mariotype; - -mariotype mario; - -#define GRAVITY 48 -#define MARIO_SPEED 512 - - -void MoveMario(void); -void CheckCollisions(void); -u8 GetTile(s16 x, s16 y); -u8 LeftCollision(void); -u8 RightCollision(void); -u8 DownCollision(void); -u8 TouchingGround(void); - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... - - PA_LoadBackground(0, 1, &mario_world); // platfroms... - PA_LoadBackground(0, 2, &hills); // hills - PA_LoadBackground(0, 3, &back); // back - - PA_InitParallaxX(0, 0, 256, 128, 64); - - mario.x = 0<<8; mario.y = (128-32)<<8; // bottom of the screen... fixed point - mario.vy = 0; // not jumping - mario.flip = 0; - mario.scrollx = 0; - PA_CreateSprite(0, 0,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, mario.x>>8, mario.y>>8); // Sprite - - while(1) - { - MoveMario(); - - if ((((mario.x-mario.scrollx)>>8) > 160) && ((mario.x>>8) < 1024-128)){ // Scroll more... - mario.scrollx = mario.x - (160<<8); - } - else if ((((mario.x-mario.scrollx)>>8) < 64) && ((mario.x>>8) > 64)){ - mario.scrollx = mario.x - (64<<8); - } - - PA_ParallaxScrollX(0, mario.scrollx>>8); - - PA_SetSpriteXY(0, 0, mario.screenx, mario.screeny); - - PA_OutputText(1, 2, 9, "X : %d ", mario.x >> 8); - PA_OutputText(1, 2, 10, "Y : %d ", mario.y >> 8); - PA_OutputText(1, 2, 11, "Scroll : %d ", mario.scrollx>>8); - - PA_WaitForVBL(); - } - - return 0; -} - - - -void MoveMario(void){ - if(Pad.Newpress.Right) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 0); - mario.flip = 0; - } - else if(Pad.Newpress.Left) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 1); - mario.flip = 1; - } - - if ((Pad.Newpress.A) && (TouchingGround())){ // If pressed A and not in the air - mario.vy = -1200; // Start jumping - } - - // Moving Code - mario.x += (Pad.Held.Right - Pad.Held.Left)*MARIO_SPEED; // in fixed point... - - // Add gravity - mario.vy += GRAVITY; - mario.y += mario.vy; - - mario.screenx = (mario.x-mario.scrollx)>>8; // Position on the screen - mario.screeny = mario.y>>8; - - CheckCollisions(); - - if (!TouchingGround()) PA_SetSpriteAnim(0, 0, 2); // Not on the ground - else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking -} - -u8 LeftCollision(void){ - return PA_EasyBgGetPixel(0, 1,mario.screenx+10, mario.screeny+2+(mario.flip*13)); -} - -u8 RightCollision(void){ - return (PA_EasyBgGetPixel(0, 1,mario.screenx+22, mario.screeny+2 + ((!mario.flip)*13))); -} - -u8 DownCollision(void){ - return (mario.vy >= 0 && PA_EasyBgGetPixel(0, 1, mario.screenx+10 + (mario.flip*11), mario.screeny+31)); -} - -u8 TouchingGround(void){ - return PA_EasyBgGetPixel(0, 1, mario.screenx+10 + (mario.flip*11), mario.screeny+32); -} - -void CheckCollisions(void){ - - while(LeftCollision()){ // Collision on the left of the sprite... - mario.x+= 256; // Move by 1 pixel... - mario.screenx++; // Move by 1 pixel... - } - while(RightCollision()){ // Collision on the right of the sprite... - mario.x-= 256; // Move by 1 pixel... - mario.screenx--; // Move by 1 pixel... - } - - while(DownCollision()){ // Collision on the bottom of the sprite... - mario.y -= 128; // Move by 1/2 pixel... - mario.screeny = mario.y>>8; // adjust screen position - mario.vy = 0; // TOuched the floor... - } - if(TouchingGround()) mario.vy = 0; - +// Includes +#include + +#include "all_gfx.h" + +typedef struct{ + s32 x, y; + s16 screenx, screeny; // sprite position on the screen + s32 vy; // used for jumping... + s32 flip; + s32 scrollx; // Scroll value... +} mariotype; + +mariotype mario; + +#define GRAVITY 48 +#define MARIO_SPEED 512 + + +void MoveMario(void); +void CheckCollisions(void); +u8 GetTile(s16 x, s16 y); +u8 LeftCollision(void); +u8 RightCollision(void); +u8 DownCollision(void); +u8 TouchingGround(void); + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... + + PA_LoadBackground(0, 1, &mario_world); // platfroms... + PA_LoadBackground(0, 2, &hills); // hills + PA_LoadBackground(0, 3, &back); // back + + PA_InitParallaxX(0, 0, 256, 128, 64); + + mario.x = 0<<8; mario.y = (128-32)<<8; // bottom of the screen... fixed point + mario.vy = 0; // not jumping + mario.flip = 0; + mario.scrollx = 0; + PA_CreateSprite(0, 0,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, mario.x>>8, mario.y>>8); // Sprite + + while(1) + { + MoveMario(); + + if ((((mario.x-mario.scrollx)>>8) > 160) && ((mario.x>>8) < 1024-128)){ // Scroll more... + mario.scrollx = mario.x - (160<<8); + } + else if ((((mario.x-mario.scrollx)>>8) < 64) && ((mario.x>>8) > 64)){ + mario.scrollx = mario.x - (64<<8); + } + + PA_ParallaxScrollX(0, mario.scrollx>>8); + + PA_SetSpriteXY(0, 0, mario.screenx, mario.screeny); + + PA_OutputText(1, 2, 9, "X : %d ", mario.x >> 8); + PA_OutputText(1, 2, 10, "Y : %d ", mario.y >> 8); + PA_OutputText(1, 2, 11, "Scroll : %d ", mario.scrollx>>8); + + PA_WaitForVBL(); + } + + return 0; +} + + + +void MoveMario(void){ + if(Pad.Newpress.Right) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 0); + mario.flip = 0; + } + else if(Pad.Newpress.Left) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 1); + mario.flip = 1; + } + + if ((Pad.Newpress.A) && (TouchingGround())){ // If pressed A and not in the air + mario.vy = -1200; // Start jumping + } + + // Moving Code + mario.x += (Pad.Held.Right - Pad.Held.Left)*MARIO_SPEED; // in fixed point... + + // Add gravity + mario.vy += GRAVITY; + mario.y += mario.vy; + + mario.screenx = (mario.x-mario.scrollx)>>8; // Position on the screen + mario.screeny = mario.y>>8; + + CheckCollisions(); + + if (!TouchingGround()) PA_SetSpriteAnim(0, 0, 2); // Not on the ground + else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking +} + +u8 LeftCollision(void){ + return PA_EasyBgGetPixel(0, 1,mario.screenx+10, mario.screeny+2+(mario.flip*13)); +} + +u8 RightCollision(void){ + return (PA_EasyBgGetPixel(0, 1,mario.screenx+22, mario.screeny+2 + ((!mario.flip)*13))); +} + +u8 DownCollision(void){ + return (mario.vy >= 0 && PA_EasyBgGetPixel(0, 1, mario.screenx+10 + (mario.flip*11), mario.screeny+31)); +} + +u8 TouchingGround(void){ + return PA_EasyBgGetPixel(0, 1, mario.screenx+10 + (mario.flip*11), mario.screeny+32); +} + +void CheckCollisions(void){ + + while(LeftCollision()){ // Collision on the left of the sprite... + mario.x+= 256; // Move by 1 pixel... + mario.screenx++; // Move by 1 pixel... + } + while(RightCollision()){ // Collision on the right of the sprite... + mario.x-= 256; // Move by 1 pixel... + mario.screenx--; // Move by 1 pixel... + } + + while(DownCollision()){ // Collision on the bottom of the sprite... + mario.y -= 128; // Move by 1/2 pixel... + mario.screeny = mario.y>>8; // adjust screen position + mario.vy = 0; // TOuched the floor... + } + if(TouchingGround()) mario.vy = 0; + } \ No newline at end of file diff --git a/examples/Demos/PlatformGame/PlatformGame4/Makefile b/examples/Demos/PlatformGame/PlatformGame4/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/PlatformGame/PlatformGame4/Makefile +++ b/examples/Demos/PlatformGame/PlatformGame4/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/PlatformGame/PlatformGame4/gfx/all_gfx.h b/examples/Demos/PlatformGame/PlatformGame4/gfx/all_gfx.h index 749f847..69471f4 100644 --- a/examples/Demos/PlatformGame/PlatformGame4/gfx/all_gfx.h +++ b/examples/Demos/PlatformGame/PlatformGame4/gfx/all_gfx.h @@ -1,26 +1,26 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal -extern const unsigned char coin_Sprite[64] _GFX_ALIGN; // Palette: sprite0_Pal - -// Backgrounds: -extern const PA_BgStruct mario_world; -extern const PA_BgStruct hills; -extern const PA_BgStruct back; -extern const PA_BgStruct platformcollisionmap2; - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal +extern const unsigned char coin_Sprite[64] _GFX_ALIGN; // Palette: sprite0_Pal + +// Backgrounds: +extern const PA_BgStruct mario_world; +extern const PA_BgStruct hills; +extern const PA_BgStruct back; +extern const PA_BgStruct platformcollisionmap2; + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/back.c b/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/back.c index 6446f35..22c231a 100644 --- a/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/back.c +++ b/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/back.c @@ -1,17 +1,17 @@ -#include - -extern const char back_Tiles[]; -extern const char back_Map[]; -extern const char back_Pal[]; - -const PA_BgStruct back = { - PA_BgNormal, - 512, 256, - - back_Tiles, - back_Map, - {back_Pal}, - - 256, - {4096} -}; +#include + +extern const char back_Tiles[]; +extern const char back_Map[]; +extern const char back_Pal[]; + +const PA_BgStruct back = { + PA_BgNormal, + 512, 256, + + back_Tiles, + back_Map, + {back_Pal}, + + 256, + {4096} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/hills.c b/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/hills.c index 63d5436..bfbbfd9 100644 --- a/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/hills.c +++ b/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/hills.c @@ -1,17 +1,17 @@ -#include - -extern const char hills_Tiles[]; -extern const char hills_Map[]; -extern const char hills_Pal[]; - -const PA_BgStruct hills = { - PA_BgLarge, - 768, 256, - - hills_Tiles, - hills_Map, - {hills_Pal}, - - 2496, - {6144} -}; +#include + +extern const char hills_Tiles[]; +extern const char hills_Map[]; +extern const char hills_Pal[]; + +const PA_BgStruct hills = { + PA_BgLarge, + 768, 256, + + hills_Tiles, + hills_Map, + {hills_Pal}, + + 2496, + {6144} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/mario_world.c b/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/mario_world.c index 052a85c..d6fa1f5 100644 --- a/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/mario_world.c +++ b/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/mario_world.c @@ -1,17 +1,17 @@ -#include - -extern const char mario_world_Tiles[]; -extern const char mario_world_Map[]; -extern const char mario_world_Pal[]; - -const PA_BgStruct mario_world = { - PA_BgLarge, - 1024, 256, - - mario_world_Tiles, - mario_world_Map, - {mario_world_Pal}, - - 1024, - {8192} -}; +#include + +extern const char mario_world_Tiles[]; +extern const char mario_world_Map[]; +extern const char mario_world_Pal[]; + +const PA_BgStruct mario_world = { + PA_BgLarge, + 1024, 256, + + mario_world_Tiles, + mario_world_Map, + {mario_world_Pal}, + + 1024, + {8192} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/platformcollisionmap2.c b/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/platformcollisionmap2.c index 94dc667..11a95db 100644 --- a/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/platformcollisionmap2.c +++ b/examples/Demos/PlatformGame/PlatformGame4/gfx/bin/platformcollisionmap2.c @@ -1,17 +1,17 @@ -#include - -extern const char platformcollisionmap2_Tiles[]; -extern const char platformcollisionmap2_Map[]; -extern const char platformcollisionmap2_Pal[]; - -const PA_BgStruct platformcollisionmap2 = { - PA_BgLarge, - 1024, 256, - - platformcollisionmap2_Tiles, - platformcollisionmap2_Map, - {platformcollisionmap2_Pal}, - - 192, - {8192} -}; +#include + +extern const char platformcollisionmap2_Tiles[]; +extern const char platformcollisionmap2_Map[]; +extern const char platformcollisionmap2_Pal[]; + +const PA_BgStruct platformcollisionmap2 = { + PA_BgLarge, + 1024, 256, + + platformcollisionmap2_Tiles, + platformcollisionmap2_Map, + {platformcollisionmap2_Pal}, + + 192, + {8192} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame4/source/main.c b/examples/Demos/PlatformGame/PlatformGame4/source/main.c index c9ab1f9..a0fc54d 100644 --- a/examples/Demos/PlatformGame/PlatformGame4/source/main.c +++ b/examples/Demos/PlatformGame/PlatformGame4/source/main.c @@ -1,239 +1,239 @@ -// Includes -#include -#include - -#include "all_gfx.h" - -#define levellength 128 -#define levelheight 24 - -#define norm_fix(x) ((x)<<8) -#define fix_norm(x) ((x)>>8) //xxx truncates instead of rounds -#define fix_mult(x,y) (((x)*(y))>>8) -#define ratio_fix(x,y) ((256*(x))/(y)) -#define fixed_fraction(x) ((x)&&0xff) - -#define COL_MAP ((u16*)platformcollisionmap2.BgMap) - -#define GRAVITY 48 -#define MARIO_SPEED 512 -#define maxcoins 30 -#define maxenemies 20 - -void MoveMario(void); -void scroll(); -void CheckCollisions(void); -void placecoins(); -u8 GetTile(s16 x, s16 y); -u8 LeftCollision(void); -u8 RightCollision(void); -u8 DownCollision(void); -u8 TouchingGround(void); -u8 tilecollsion(s32,s32,u8,u8); -u8 allcollision(); -u8 getsprite(); -void deletesprite(u8); - - -typedef struct{ - s8 x, y, flipx; -}pointinfo; - -typedef struct{ - pointinfo left, right, up, down; - u8 flipped; -}hitboxinfo; - - -typedef struct{ - - s32 x, y; - s32 vy; // used for jumping... - s32 scrollx, scrolly; // Scroll value... - u8 sprite; //the sprite number - u8 jumping; - hitboxinfo hitbox; -}mariotype; - - -mariotype mario; -//pointer to items -//pointer to enemies -u8 sprite[128]; - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... - - PA_LoadBackground(0, 1, &mario_world); // platfroms... - PA_LoadBackground(0, 2, &hills); // hills - PA_LoadBackground(0, 3, &back); // back - - PA_InitParallaxX(0, 0, 256, 128, 64); - PA_InitParallaxY(0,0,256,128,64); - - - mario.x = norm_fix(60); mario.y = norm_fix(128-32); // bottom of the screen... fixed point - mario.vy = 0; // not jumping - mario.hitbox.flipped=0; - mario.scrollx = 0; - mario.sprite=getsprite(); - - mario.hitbox.left.x=2; mario.hitbox.left.y=8; mario.hitbox.right.x=29; mario.hitbox.right.y=8; mario.hitbox.down.x=10; mario.hitbox.down.y=31; mario.hitbox.up.x=5; mario.hitbox.up.y=0; - - mario.hitbox.left.flipx=0; mario.hitbox.right.flipx=0; mario.hitbox.up.flipx=10; mario.hitbox.down.flipx=11; - - PA_CreateSprite(0, mario.sprite,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, fix_norm(mario.x), fix_norm(mario.y)); // Sprite - - - while(1) - { - MoveMario(); - scroll(); - printf("hello world\n"); - PA_WaitForVBL(); - } - - return 0; -} - - - -void MoveMario(void){ - if(Pad.Newpress.Right) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 0); - mario.hitbox.flipped = 0; - } - else if(Pad.Newpress.Left) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 1); - mario.hitbox.flipped = 1; - } - - if ((Pad.Newpress.A) && (TouchingGround())){ // If pressed A and not in the air - mario.vy = -1500; // Start jumping - mario.jumping=true; - } - - if(mario.jumping && !Pad.Held.A && mario.vy<-400){ - mario.vy=-400; - } - - // Moving Code - mario.x += (Pad.Held.Right - Pad.Held.Left)*MARIO_SPEED; // in fixed point... - - // Add gravity - if(!TouchingGround()){ - mario.vy += GRAVITY; - } - mario.y += mario.vy; - - - CheckCollisions(); - - if (!TouchingGround()) PA_SetSpriteAnim(0, 0, 2); // Not on the ground - else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking -} - -void scroll(){ - - - if (((fix_norm(mario.x-mario.scrollx)) > 160) && (fix_norm(mario.x) < 1024-128)){ // Scroll more... - mario.scrollx = mario.x - norm_fix(160); - } - else if ((((mario.x-mario.scrollx)>>8) < 64) && ((mario.x>>8) > 64)){ - mario.scrollx = mario.x - norm_fix(64); - } - - - //automatic scrolling -// mario.scrollx+=ratio_fix(1,2); -// mario.scrolly+=ratio_fix(1,2); - - PA_ParallaxScrollXY(0, fix_norm(mario.scrollx),fix_norm(mario.scrolly)); - - //move player - PA_SetSpriteXY(0, mario.sprite, fix_norm(mario.x-mario.scrollx), fix_norm(mario.y-mario.scrolly)); - - - //PA_OutputText(1, 2, 11, "X : %d ", fix_norm(mario.x)); - //PA_OutputText(1, 2, 10, "Y : %d ", mario.y); - //PA_OutputText(1, 2, 12, "Scroll : %d ", fix_norm(mario.scrollx)); -} - - -u8 GetTile(s16 x, s16 y){ - //if (y > fix_norm(mario.scrolly)+192) return 1; //collide with bottom - if (y < fix_norm(mario.scrolly)) return 1; //collide with top - return COL_MAP[((y>>3)*levellength) + (x>>3)]; -} - -//check for a collision with a tile at pointx, pointy, and adding in flipx if the sprite is flipped -u8 TileCollision(pointinfo point, u8 flipped){ - return (GetTile(fix_norm(mario.x)+point.x + (flipped*point.flipx), fix_norm(mario.y)+point.y)); -} - -//checks if mario is on the ground -u8 TouchingGround(void){ - return GetTile((fix_norm(mario.x))+10 + (mario.hitbox.flipped*11), (fix_norm(mario.y))+32); -} - -//checks if any of the collisions are true for that tile and returns what side -u8 anycollision(u8 tile, hitboxinfo hitbox){ - if(TileCollision(hitbox.left, hitbox.flipped)==tile)return 1; - if(TileCollision(hitbox.right, hitbox.flipped)==tile)return 2; - if(TileCollision(hitbox.up, hitbox.flipped)==tile)return 3; - if(TileCollision(hitbox.down, hitbox.flipped)==tile)return 4; - else return 0; -} - -//checks if anything has collided with the player -// tile 1 is solid ground tile 2 is ground that you can stand on but go through -void CheckCollisions(void){ - - while(anycollision(1, mario.hitbox)==1){ // Collision on the left of the sprite... - mario.x+= norm_fix(1); // Move by 1 pixel... - } - while(anycollision(1, mario.hitbox)==2){ // Collision on the right of the sprite... - mario.x-= norm_fix(1); // Move by 1 pixel... - } - while(anycollision(1,mario.hitbox)==3){ // Collision with the something on top - mario.y+=norm_fix(1); - mario.vy=0; - } - while(anycollision(1,mario.hitbox)==4 || anycollision(2,mario.hitbox)==4){ // Collision on the bottom of the sprite... - mario.y -= norm_fix(1); // Move by 1/2 pixel... - } - - - if( (TouchingGround()==1 || TouchingGround()==2) && mario.vy>0){ //if he's touching the ground and moving down he can't hit ground while moving up - mario.vy = 0; - mario.jumping=0; - } - - - -} - -u8 getsprite(){ - int i; - for(i=0;i<128;i++){ - if(sprite[i]==0){ - sprite[i]=1; - return i; - } - } - return -1; -} - -void deletesprite(u8 spritenumber){ - sprite[spritenumber]=0; - PA_DeleteSprite(0,spritenumber); -} +// Includes +#include +#include + +#include "all_gfx.h" + +#define levellength 128 +#define levelheight 24 + +#define norm_fix(x) ((x)<<8) +#define fix_norm(x) ((x)>>8) //xxx truncates instead of rounds +#define fix_mult(x,y) (((x)*(y))>>8) +#define ratio_fix(x,y) ((256*(x))/(y)) +#define fixed_fraction(x) ((x)&&0xff) + +#define COL_MAP ((u16*)platformcollisionmap2.BgMap) + +#define GRAVITY 48 +#define MARIO_SPEED 512 +#define maxcoins 30 +#define maxenemies 20 + +void MoveMario(void); +void scroll(); +void CheckCollisions(void); +void placecoins(); +u8 GetTile(s16 x, s16 y); +u8 LeftCollision(void); +u8 RightCollision(void); +u8 DownCollision(void); +u8 TouchingGround(void); +u8 tilecollsion(s32,s32,u8,u8); +u8 allcollision(); +u8 getsprite(); +void deletesprite(u8); + + +typedef struct{ + s8 x, y, flipx; +}pointinfo; + +typedef struct{ + pointinfo left, right, up, down; + u8 flipped; +}hitboxinfo; + + +typedef struct{ + + s32 x, y; + s32 vy; // used for jumping... + s32 scrollx, scrolly; // Scroll value... + u8 sprite; //the sprite number + u8 jumping; + hitboxinfo hitbox; +}mariotype; + + +mariotype mario; +//pointer to items +//pointer to enemies +u8 sprite[128]; + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... + + PA_LoadBackground(0, 1, &mario_world); // platfroms... + PA_LoadBackground(0, 2, &hills); // hills + PA_LoadBackground(0, 3, &back); // back + + PA_InitParallaxX(0, 0, 256, 128, 64); + PA_InitParallaxY(0,0,256,128,64); + + + mario.x = norm_fix(60); mario.y = norm_fix(128-32); // bottom of the screen... fixed point + mario.vy = 0; // not jumping + mario.hitbox.flipped=0; + mario.scrollx = 0; + mario.sprite=getsprite(); + + mario.hitbox.left.x=2; mario.hitbox.left.y=8; mario.hitbox.right.x=29; mario.hitbox.right.y=8; mario.hitbox.down.x=10; mario.hitbox.down.y=31; mario.hitbox.up.x=5; mario.hitbox.up.y=0; + + mario.hitbox.left.flipx=0; mario.hitbox.right.flipx=0; mario.hitbox.up.flipx=10; mario.hitbox.down.flipx=11; + + PA_CreateSprite(0, mario.sprite,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, fix_norm(mario.x), fix_norm(mario.y)); // Sprite + + + while(1) + { + MoveMario(); + scroll(); + printf("hello world\n"); + PA_WaitForVBL(); + } + + return 0; +} + + + +void MoveMario(void){ + if(Pad.Newpress.Right) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 0); + mario.hitbox.flipped = 0; + } + else if(Pad.Newpress.Left) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 1); + mario.hitbox.flipped = 1; + } + + if ((Pad.Newpress.A) && (TouchingGround())){ // If pressed A and not in the air + mario.vy = -1500; // Start jumping + mario.jumping=true; + } + + if(mario.jumping && !Pad.Held.A && mario.vy<-400){ + mario.vy=-400; + } + + // Moving Code + mario.x += (Pad.Held.Right - Pad.Held.Left)*MARIO_SPEED; // in fixed point... + + // Add gravity + if(!TouchingGround()){ + mario.vy += GRAVITY; + } + mario.y += mario.vy; + + + CheckCollisions(); + + if (!TouchingGround()) PA_SetSpriteAnim(0, 0, 2); // Not on the ground + else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking +} + +void scroll(){ + + + if (((fix_norm(mario.x-mario.scrollx)) > 160) && (fix_norm(mario.x) < 1024-128)){ // Scroll more... + mario.scrollx = mario.x - norm_fix(160); + } + else if ((((mario.x-mario.scrollx)>>8) < 64) && ((mario.x>>8) > 64)){ + mario.scrollx = mario.x - norm_fix(64); + } + + + //automatic scrolling +// mario.scrollx+=ratio_fix(1,2); +// mario.scrolly+=ratio_fix(1,2); + + PA_ParallaxScrollXY(0, fix_norm(mario.scrollx),fix_norm(mario.scrolly)); + + //move player + PA_SetSpriteXY(0, mario.sprite, fix_norm(mario.x-mario.scrollx), fix_norm(mario.y-mario.scrolly)); + + + //PA_OutputText(1, 2, 11, "X : %d ", fix_norm(mario.x)); + //PA_OutputText(1, 2, 10, "Y : %d ", mario.y); + //PA_OutputText(1, 2, 12, "Scroll : %d ", fix_norm(mario.scrollx)); +} + + +u8 GetTile(s16 x, s16 y){ + //if (y > fix_norm(mario.scrolly)+192) return 1; //collide with bottom + if (y < fix_norm(mario.scrolly)) return 1; //collide with top + return COL_MAP[((y>>3)*levellength) + (x>>3)]; +} + +//check for a collision with a tile at pointx, pointy, and adding in flipx if the sprite is flipped +u8 TileCollision(pointinfo point, u8 flipped){ + return (GetTile(fix_norm(mario.x)+point.x + (flipped*point.flipx), fix_norm(mario.y)+point.y)); +} + +//checks if mario is on the ground +u8 TouchingGround(void){ + return GetTile((fix_norm(mario.x))+10 + (mario.hitbox.flipped*11), (fix_norm(mario.y))+32); +} + +//checks if any of the collisions are true for that tile and returns what side +u8 anycollision(u8 tile, hitboxinfo hitbox){ + if(TileCollision(hitbox.left, hitbox.flipped)==tile)return 1; + if(TileCollision(hitbox.right, hitbox.flipped)==tile)return 2; + if(TileCollision(hitbox.up, hitbox.flipped)==tile)return 3; + if(TileCollision(hitbox.down, hitbox.flipped)==tile)return 4; + else return 0; +} + +//checks if anything has collided with the player +// tile 1 is solid ground tile 2 is ground that you can stand on but go through +void CheckCollisions(void){ + + while(anycollision(1, mario.hitbox)==1){ // Collision on the left of the sprite... + mario.x+= norm_fix(1); // Move by 1 pixel... + } + while(anycollision(1, mario.hitbox)==2){ // Collision on the right of the sprite... + mario.x-= norm_fix(1); // Move by 1 pixel... + } + while(anycollision(1,mario.hitbox)==3){ // Collision with the something on top + mario.y+=norm_fix(1); + mario.vy=0; + } + while(anycollision(1,mario.hitbox)==4 || anycollision(2,mario.hitbox)==4){ // Collision on the bottom of the sprite... + mario.y -= norm_fix(1); // Move by 1/2 pixel... + } + + + if( (TouchingGround()==1 || TouchingGround()==2) && mario.vy>0){ //if he's touching the ground and moving down he can't hit ground while moving up + mario.vy = 0; + mario.jumping=0; + } + + + +} + +u8 getsprite(){ + int i; + for(i=0;i<128;i++){ + if(sprite[i]==0){ + sprite[i]=1; + return i; + } + } + return -1; +} + +void deletesprite(u8 spritenumber){ + sprite[spritenumber]=0; + PA_DeleteSprite(0,spritenumber); +} \ No newline at end of file diff --git a/examples/Demos/PlatformGame/PlatformGame5/Makefile b/examples/Demos/PlatformGame/PlatformGame5/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Demos/PlatformGame/PlatformGame5/Makefile +++ b/examples/Demos/PlatformGame/PlatformGame5/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Demos/PlatformGame/PlatformGame5/gfx/all_gfx.h b/examples/Demos/PlatformGame/PlatformGame5/gfx/all_gfx.h index 148abe7..3c0745d 100644 --- a/examples/Demos/PlatformGame/PlatformGame5/gfx/all_gfx.h +++ b/examples/Demos/PlatformGame/PlatformGame5/gfx/all_gfx.h @@ -1,26 +1,26 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal -extern const unsigned char coin_Sprite[64] _GFX_ALIGN; // Palette: sprite0_Pal - -// Backgrounds: -extern const PA_BgStruct mario_world; -extern const PA_BgStruct hills; -extern const PA_BgStruct back; -extern const PA_BgStruct platformcollisionmap3; - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mario_Sprite[3072] _GFX_ALIGN; // Palette: sprite0_Pal +extern const unsigned char coin_Sprite[64] _GFX_ALIGN; // Palette: sprite0_Pal + +// Backgrounds: +extern const PA_BgStruct mario_world; +extern const PA_BgStruct hills; +extern const PA_BgStruct back; +extern const PA_BgStruct platformcollisionmap3; + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/back.c b/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/back.c index 6446f35..22c231a 100644 --- a/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/back.c +++ b/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/back.c @@ -1,17 +1,17 @@ -#include - -extern const char back_Tiles[]; -extern const char back_Map[]; -extern const char back_Pal[]; - -const PA_BgStruct back = { - PA_BgNormal, - 512, 256, - - back_Tiles, - back_Map, - {back_Pal}, - - 256, - {4096} -}; +#include + +extern const char back_Tiles[]; +extern const char back_Map[]; +extern const char back_Pal[]; + +const PA_BgStruct back = { + PA_BgNormal, + 512, 256, + + back_Tiles, + back_Map, + {back_Pal}, + + 256, + {4096} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/hills.c b/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/hills.c index 63d5436..bfbbfd9 100644 --- a/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/hills.c +++ b/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/hills.c @@ -1,17 +1,17 @@ -#include - -extern const char hills_Tiles[]; -extern const char hills_Map[]; -extern const char hills_Pal[]; - -const PA_BgStruct hills = { - PA_BgLarge, - 768, 256, - - hills_Tiles, - hills_Map, - {hills_Pal}, - - 2496, - {6144} -}; +#include + +extern const char hills_Tiles[]; +extern const char hills_Map[]; +extern const char hills_Pal[]; + +const PA_BgStruct hills = { + PA_BgLarge, + 768, 256, + + hills_Tiles, + hills_Map, + {hills_Pal}, + + 2496, + {6144} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/mario_world.c b/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/mario_world.c index 052a85c..d6fa1f5 100644 --- a/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/mario_world.c +++ b/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/mario_world.c @@ -1,17 +1,17 @@ -#include - -extern const char mario_world_Tiles[]; -extern const char mario_world_Map[]; -extern const char mario_world_Pal[]; - -const PA_BgStruct mario_world = { - PA_BgLarge, - 1024, 256, - - mario_world_Tiles, - mario_world_Map, - {mario_world_Pal}, - - 1024, - {8192} -}; +#include + +extern const char mario_world_Tiles[]; +extern const char mario_world_Map[]; +extern const char mario_world_Pal[]; + +const PA_BgStruct mario_world = { + PA_BgLarge, + 1024, 256, + + mario_world_Tiles, + mario_world_Map, + {mario_world_Pal}, + + 1024, + {8192} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/platformcollisionmap3.c b/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/platformcollisionmap3.c index e18400b..6bba25c 100644 --- a/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/platformcollisionmap3.c +++ b/examples/Demos/PlatformGame/PlatformGame5/gfx/bin/platformcollisionmap3.c @@ -1,17 +1,17 @@ -#include - -extern const char platformcollisionmap3_Tiles[]; -extern const char platformcollisionmap3_Map[]; -extern const char platformcollisionmap3_Pal[]; - -const PA_BgStruct platformcollisionmap3 = { - PA_BgLarge, - 1024, 256, - - platformcollisionmap3_Tiles, - platformcollisionmap3_Map, - {platformcollisionmap3_Pal}, - - 256, - {8192} -}; +#include + +extern const char platformcollisionmap3_Tiles[]; +extern const char platformcollisionmap3_Map[]; +extern const char platformcollisionmap3_Pal[]; + +const PA_BgStruct platformcollisionmap3 = { + PA_BgLarge, + 1024, 256, + + platformcollisionmap3_Tiles, + platformcollisionmap3_Map, + {platformcollisionmap3_Pal}, + + 256, + {8192} +}; diff --git a/examples/Demos/PlatformGame/PlatformGame5/source/main.c b/examples/Demos/PlatformGame/PlatformGame5/source/main.c index cca2ac3..894184d 100644 --- a/examples/Demos/PlatformGame/PlatformGame5/source/main.c +++ b/examples/Demos/PlatformGame/PlatformGame5/source/main.c @@ -1,316 +1,316 @@ -// Includes -#include -#include - -#include "all_gfx.h" - -#define levellength 128 -#define levelheight 24 - -#define norm_fix(x) ((x)<<8) -#define fix_norm(x) ((x)>>8) //xxx truncates instead of rounds -#define fix_mult(x,y) (((x)*(y))>>8) -#define ratio_fix(x,y) ((256*(x))/(y)) -#define fixed_fraction(x) ((x)&&0xff) - -#define COL_MAP ((u16*)platformcollisionmap3.BgMap) - -#define GRAVITY 48 -#define MARIO_SPEED 512 -#define maxcoins 50 -#define maxenemies 20 - -void MoveMario(void); -void scroll(); -void CheckCollisions(void); -void placecoins(); -u8 GetTile(s16 x, s16 y); -u8 LeftCollision(void); -u8 RightCollision(void); -u8 DownCollision(void); -u8 TouchingGround(void); -u8 tilecollsion(s32,s32,u8,u8); -u8 allcollision(); -u8 collision(s32,s32,u8,u8); -u8 getsprite(); -void deletesprite(u8); - - -typedef struct{ - s8 x, y, flipx; -}pointinfo; - -typedef struct{ - pointinfo left, right, up, down; - u8 flipped; -}hitboxinfo; - -typedef struct { - s32 x,y; - u8 alive; - u8 sprite; -} coininfo; - -typedef struct{ - - s32 x, y; - s32 vy; // used for jumping... - s32 scrollx, scrolly; // Scroll value... - u8 sprite; //the sprite number - u8 jumping; - hitboxinfo hitbox; -}mariotype; - - -mariotype mario; -//pointer to items -//pointer to enemies -u8 sprite[128]; - -coininfo coin[maxcoins]; - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... - - PA_LoadBackground(0, 1, &mario_world); // platfroms... - PA_LoadBackground(0, 2, &hills); // hills - PA_LoadBackground(0, 3, &back); // back - - PA_InitParallaxX(0, 0, 256, 128, 64); - - - mario.x = norm_fix(60); mario.y = norm_fix(128-32); // bottom of the screen... fixed point - mario.vy = 0; // not jumping - mario.hitbox.flipped=0; - mario.scrollx = 0; - mario.sprite=getsprite(); - - mario.hitbox.left.x=2; mario.hitbox.left.y=8; mario.hitbox.right.x=29; mario.hitbox.right.y=8; mario.hitbox.down.x=10; mario.hitbox.down.y=31; mario.hitbox.up.x=5; mario.hitbox.up.y=0; - - mario.hitbox.left.flipx=0; mario.hitbox.right.flipx=0; mario.hitbox.up.flipx=10; mario.hitbox.down.flipx=11; - - PA_CreateSprite(0, mario.sprite,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, fix_norm(mario.x), fix_norm(mario.y)); // Sprite - - - placecoins(); - while(1) - { - - MoveMario(); - scroll(); - PA_WaitForVBL(); - } - - return 0; -} - - - -void MoveMario(void){ - if(Pad.Newpress.Right) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 0); - mario.hitbox.flipped = 0; - } - else if(Pad.Newpress.Left) { - PA_StartSpriteAnim(0, 0, 0, 1, 6); - PA_SetSpriteHflip(0, 0, 1); - mario.hitbox.flipped = 1; - } - - if ((Pad.Newpress.A) && (TouchingGround())){ // If pressed A and not in the air - mario.vy = -1500; // Start jumping - mario.jumping=true; - } - - if(mario.jumping && !Pad.Held.A && mario.vy<-400){ - mario.vy=-400; - } - - // Moving Code - mario.x += (Pad.Held.Right - Pad.Held.Left)*MARIO_SPEED; // in fixed point... - - // Add gravity - if(!TouchingGround()){ - mario.vy += GRAVITY; - } - mario.y += mario.vy; - - - CheckCollisions(); - - if (!TouchingGround()) PA_SetSpriteAnim(0, 0, 2); // Not on the ground - else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking -} - -void scroll(){ - - - if (((fix_norm(mario.x-mario.scrollx)) > 160) && (fix_norm(mario.x) < 1024-128)){ // Scroll more... - mario.scrollx = mario.x - norm_fix(160); - } - else if ((((mario.x-mario.scrollx)>>8) < 64) && ((mario.x>>8) > 64)){ - mario.scrollx = mario.x - norm_fix(64); - } - - - //automatic scrolling -// mario.scrollx+=ratio_fix(1,2); -// mario.scrolly+=ratio_fix(1,2); - - PA_ParallaxScrollXY(0, fix_norm(mario.scrollx),fix_norm(mario.scrolly)); - - //move player - PA_SetSpriteXY(0, mario.sprite, fix_norm(mario.x-mario.scrollx), fix_norm(mario.y-mario.scrolly)); - - - int i; - for(i=0;i=fix_norm(mario.scrollx)-8){ - //if it is then move it to the correct position - if(coin[i].sprite!=0){ - PA_SetSpriteXY(0,coin[i].sprite,coin[i].x-fix_norm(mario.scrollx),coin[i].y-fix_norm(mario.scrolly)); - } - //if it's not then create a sprite for it - else{ - coin[i].sprite=getsprite(); - PA_CreateSprite(0, coin[i].sprite,(void*)coin_Sprite, OBJ_SIZE_8X8,1, 0, coin[i].x-fix_norm(mario.scrollx), coin[i].y-fix_norm(mario.scrolly)); - } - } - //if the coin is offscren delete it - else{ - //don't delete already gone stuff - if(coin[i].sprite!=0){ - deletesprite(coin[i].sprite); - coin[i].sprite=0; - } - } - } - } - - //PA_OutputText(1, 2, 11, "X : %d ", fix_norm(mario.x)); - //PA_OutputText(1, 2, 10, "Y : %d ", mario.y); - //PA_OutputText(1, 2, 12, "Scroll : %d ", fix_norm(mario.scrollx)); -} - - -u8 GetTile(s16 x, s16 y){ - //if (y > fix_norm(mario.scrolly)+192) return 1; //collide with bottom - if (y < fix_norm(mario.scrolly)) return 1; //collide with top - return COL_MAP[((y>>3)*levellength) + (x>>3)]; -} - -//check for a collision with a tile at pointx, pointy, and adding in flipx if the sprite is flipped -u8 TileCollision(pointinfo point, u8 flipped){ - return (GetTile(fix_norm(mario.x)+point.x + (flipped*point.flipx), fix_norm(mario.y)+point.y)); -} - -//checks if mario is on the ground -u8 TouchingGround(void){ - return GetTile((fix_norm(mario.x))+10 + (mario.hitbox.flipped*11), (fix_norm(mario.y))+32); -} - -//checks if any of the collisions are true for that tile and returns what side -u8 anycollision(u8 tile, hitboxinfo hitbox){ - if(TileCollision(hitbox.left, hitbox.flipped)==tile)return 1; - if(TileCollision(hitbox.right, hitbox.flipped)==tile)return 2; - if(TileCollision(hitbox.up, hitbox.flipped)==tile)return 3; - if(TileCollision(hitbox.down, hitbox.flipped)==tile)return 4; - else return 0; -} - -u8 collision(s32 x2, s32 y2, u8 h2, u8 w2){ - if ( (fix_norm(mario.x)>x2+w2) || (fix_norm(mario.x)+30y2+h2) || (fix_norm(mario.y)+300){ //if he's touching the ground and moving down he can't hit ground while moving up - mario.vy = 0; - mario.jumping=0; - } - - //coin collisions - int i; - for(i=0;i=fix_norm(mario.scrollx)){ - coin[coinnumber].sprite=getsprite(); - PA_CreateSprite(0, coin[coinnumber].sprite,(void*)coin_Sprite, OBJ_SIZE_8X8,1, 0, coin[coinnumber].x, coin[coinnumber].y); - } - coinnumber++; - } - } - } -} - - -u8 getsprite(){ - int i; - for(i=0;i<128;i++){ - if(sprite[i]==0){ - sprite[i]=1; - return i; - } - } - return -1; -} - -void deletesprite(u8 spritenumber){ - sprite[spritenumber]=0; - PA_DeleteSprite(0,spritenumber); -} +// Includes +#include +#include + +#include "all_gfx.h" + +#define levellength 128 +#define levelheight 24 + +#define norm_fix(x) ((x)<<8) +#define fix_norm(x) ((x)>>8) //xxx truncates instead of rounds +#define fix_mult(x,y) (((x)*(y))>>8) +#define ratio_fix(x,y) ((256*(x))/(y)) +#define fixed_fraction(x) ((x)&&0xff) + +#define COL_MAP ((u16*)platformcollisionmap3.BgMap) + +#define GRAVITY 48 +#define MARIO_SPEED 512 +#define maxcoins 50 +#define maxenemies 20 + +void MoveMario(void); +void scroll(); +void CheckCollisions(void); +void placecoins(); +u8 GetTile(s16 x, s16 y); +u8 LeftCollision(void); +u8 RightCollision(void); +u8 DownCollision(void); +u8 TouchingGround(void); +u8 tilecollsion(s32,s32,u8,u8); +u8 allcollision(); +u8 collision(s32,s32,u8,u8); +u8 getsprite(); +void deletesprite(u8); + + +typedef struct{ + s8 x, y, flipx; +}pointinfo; + +typedef struct{ + pointinfo left, right, up, down; + u8 flipped; +}hitboxinfo; + +typedef struct { + s32 x,y; + u8 alive; + u8 sprite; +} coininfo; + +typedef struct{ + + s32 x, y; + s32 vy; // used for jumping... + s32 scrollx, scrolly; // Scroll value... + u8 sprite; //the sprite number + u8 jumping; + hitboxinfo hitbox; +}mariotype; + + +mariotype mario; +//pointer to items +//pointer to enemies +u8 sprite[128]; + +coininfo coin[maxcoins]; + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... + + PA_LoadBackground(0, 1, &mario_world); // platfroms... + PA_LoadBackground(0, 2, &hills); // hills + PA_LoadBackground(0, 3, &back); // back + + PA_InitParallaxX(0, 0, 256, 128, 64); + + + mario.x = norm_fix(60); mario.y = norm_fix(128-32); // bottom of the screen... fixed point + mario.vy = 0; // not jumping + mario.hitbox.flipped=0; + mario.scrollx = 0; + mario.sprite=getsprite(); + + mario.hitbox.left.x=2; mario.hitbox.left.y=8; mario.hitbox.right.x=29; mario.hitbox.right.y=8; mario.hitbox.down.x=10; mario.hitbox.down.y=31; mario.hitbox.up.x=5; mario.hitbox.up.y=0; + + mario.hitbox.left.flipx=0; mario.hitbox.right.flipx=0; mario.hitbox.up.flipx=10; mario.hitbox.down.flipx=11; + + PA_CreateSprite(0, mario.sprite,(void*)mario_Sprite, OBJ_SIZE_32X32,1, 0, fix_norm(mario.x), fix_norm(mario.y)); // Sprite + + + placecoins(); + while(1) + { + + MoveMario(); + scroll(); + PA_WaitForVBL(); + } + + return 0; +} + + + +void MoveMario(void){ + if(Pad.Newpress.Right) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 0); + mario.hitbox.flipped = 0; + } + else if(Pad.Newpress.Left) { + PA_StartSpriteAnim(0, 0, 0, 1, 6); + PA_SetSpriteHflip(0, 0, 1); + mario.hitbox.flipped = 1; + } + + if ((Pad.Newpress.A) && (TouchingGround())){ // If pressed A and not in the air + mario.vy = -1500; // Start jumping + mario.jumping=true; + } + + if(mario.jumping && !Pad.Held.A && mario.vy<-400){ + mario.vy=-400; + } + + // Moving Code + mario.x += (Pad.Held.Right - Pad.Held.Left)*MARIO_SPEED; // in fixed point... + + // Add gravity + if(!TouchingGround()){ + mario.vy += GRAVITY; + } + mario.y += mario.vy; + + + CheckCollisions(); + + if (!TouchingGround()) PA_SetSpriteAnim(0, 0, 2); // Not on the ground + else if(!((Pad.Held.Left)||(Pad.Held.Right))) PA_SetSpriteAnim(0, 0, 0);// Image if not in the air and not walking +} + +void scroll(){ + + + if (((fix_norm(mario.x-mario.scrollx)) > 160) && (fix_norm(mario.x) < 1024-128)){ // Scroll more... + mario.scrollx = mario.x - norm_fix(160); + } + else if ((((mario.x-mario.scrollx)>>8) < 64) && ((mario.x>>8) > 64)){ + mario.scrollx = mario.x - norm_fix(64); + } + + + //automatic scrolling +// mario.scrollx+=ratio_fix(1,2); +// mario.scrolly+=ratio_fix(1,2); + + PA_ParallaxScrollXY(0, fix_norm(mario.scrollx),fix_norm(mario.scrolly)); + + //move player + PA_SetSpriteXY(0, mario.sprite, fix_norm(mario.x-mario.scrollx), fix_norm(mario.y-mario.scrolly)); + + + int i; + for(i=0;i=fix_norm(mario.scrollx)-8){ + //if it is then move it to the correct position + if(coin[i].sprite!=0){ + PA_SetSpriteXY(0,coin[i].sprite,coin[i].x-fix_norm(mario.scrollx),coin[i].y-fix_norm(mario.scrolly)); + } + //if it's not then create a sprite for it + else{ + coin[i].sprite=getsprite(); + PA_CreateSprite(0, coin[i].sprite,(void*)coin_Sprite, OBJ_SIZE_8X8,1, 0, coin[i].x-fix_norm(mario.scrollx), coin[i].y-fix_norm(mario.scrolly)); + } + } + //if the coin is offscren delete it + else{ + //don't delete already gone stuff + if(coin[i].sprite!=0){ + deletesprite(coin[i].sprite); + coin[i].sprite=0; + } + } + } + } + + //PA_OutputText(1, 2, 11, "X : %d ", fix_norm(mario.x)); + //PA_OutputText(1, 2, 10, "Y : %d ", mario.y); + //PA_OutputText(1, 2, 12, "Scroll : %d ", fix_norm(mario.scrollx)); +} + + +u8 GetTile(s16 x, s16 y){ + //if (y > fix_norm(mario.scrolly)+192) return 1; //collide with bottom + if (y < fix_norm(mario.scrolly)) return 1; //collide with top + return COL_MAP[((y>>3)*levellength) + (x>>3)]; +} + +//check for a collision with a tile at pointx, pointy, and adding in flipx if the sprite is flipped +u8 TileCollision(pointinfo point, u8 flipped){ + return (GetTile(fix_norm(mario.x)+point.x + (flipped*point.flipx), fix_norm(mario.y)+point.y)); +} + +//checks if mario is on the ground +u8 TouchingGround(void){ + return GetTile((fix_norm(mario.x))+10 + (mario.hitbox.flipped*11), (fix_norm(mario.y))+32); +} + +//checks if any of the collisions are true for that tile and returns what side +u8 anycollision(u8 tile, hitboxinfo hitbox){ + if(TileCollision(hitbox.left, hitbox.flipped)==tile)return 1; + if(TileCollision(hitbox.right, hitbox.flipped)==tile)return 2; + if(TileCollision(hitbox.up, hitbox.flipped)==tile)return 3; + if(TileCollision(hitbox.down, hitbox.flipped)==tile)return 4; + else return 0; +} + +u8 collision(s32 x2, s32 y2, u8 h2, u8 w2){ + if ( (fix_norm(mario.x)>x2+w2) || (fix_norm(mario.x)+30y2+h2) || (fix_norm(mario.y)+300){ //if he's touching the ground and moving down he can't hit ground while moving up + mario.vy = 0; + mario.jumping=0; + } + + //coin collisions + int i; + for(i=0;i=fix_norm(mario.scrollx)){ + coin[coinnumber].sprite=getsprite(); + PA_CreateSprite(0, coin[coinnumber].sprite,(void*)coin_Sprite, OBJ_SIZE_8X8,1, 0, coin[coinnumber].x, coin[coinnumber].y); + } + coinnumber++; + } + } + } +} + + +u8 getsprite(){ + int i; + for(i=0;i<128;i++){ + if(sprite[i]==0){ + sprite[i]=1; + return i; + } + } + return -1; +} + +void deletesprite(u8 spritenumber){ + sprite[spritenumber]=0; + PA_DeleteSprite(0,spritenumber); +} \ No newline at end of file diff --git a/examples/Demos/PuckHit/Makefile b/examples/Demos/PuckHit/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Demos/PuckHit/Makefile +++ b/examples/Demos/PuckHit/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Demos/PuckHit/gfx/all_gfx.h b/examples/Demos/PuckHit/gfx/all_gfx.h index 3f82848..fd212f1 100644 --- a/examples/Demos/PuckHit/gfx/all_gfx.h +++ b/examples/Demos/PuckHit/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char circle_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char circle_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/PuckHit/source/main.c b/examples/Demos/PuckHit/source/main.c index 4954871..13cbee0 100644 --- a/examples/Demos/PuckHit/source/main.c +++ b/examples/Demos/PuckHit/source/main.c @@ -1,68 +1,68 @@ - -// Includes -#include - -// PAGfxConverter Include -#include "all_gfx.h" -typedef struct{ - s16 x, y; // position - s16 vx, vy; // speed -}puckinfos; - -puckinfos puck; - -#define SCREENHOLE 48 - -int main(void){ - - PA_Init(); - - PA_LoadDefaultText(1,0); // On the top screen - - PA_DualLoadSpritePal(0, (void*)sprite0_Pal); - - // This'll be the movable sprite... - PA_CreateSprite(0, 0,(void*)circle_Sprite, OBJ_SIZE_32X32,1, 0, 16, 16); - s32 x = 16; s32 y = 16; // Sprite's center position - - // This will be the hit circle - PA_DualCreateSprite(1,(void*)circle_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); - puck.x = 128; puck.y = 96+192+SCREENHOLE; // central position on bottom screen - puck.vx = 0; puck.vy = 0; // No speed - - - while(1) - { - if (PA_MoveSprite(0)){ - x = PA_MovedSprite.X; - y = PA_MovedSprite.Y; - } - - // Collision ? - if (PA_Distance(x, y, puck.x, puck.y-192-SCREENHOLE) < 32*32) { - // Collision, so we'l change the pucks speed to move it out of our 'raquette' - u16 angle = PA_GetAngle(x, y, puck.x, puck.y-192-SCREENHOLE); // New direction angle - u16 speed = (32*32-PA_Distance(x, y, puck.x, puck.y-192-SCREENHOLE))/32; // The closer they are, the harder the hit was... - puck.vx = (PA_Cos(angle)*speed)>>8; - puck.vy = -(PA_Sin(angle)*speed)>>8; - } - - puck.x += puck.vx; - puck.y += puck.vy; - - // If the sprite touches the left or right border, flip the horizontal speed - if ((puck.x -16 <= 0) && (puck.vx < 0)) puck.vx = -puck.vx; - else if ((puck.x + 16 >= 256)&&(puck.vx > 0)) puck.vx = - puck.vx; - - // Same thing, for top and bottom limits... - if ((puck.y -16 <= 0) && (puck.vy < 0)) puck.vy = -puck.vy; - else if ((puck.y + 16 >= 192 + 192 + SCREENHOLE)&& (puck.vy > 0)) puck.vy = - puck.vy; - // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... - PA_DualSetSpriteXY(1, puck.x-16, puck.y-16); - - - - PA_WaitForVBL(); - } - return 0; + +// Includes +#include + +// PAGfxConverter Include +#include "all_gfx.h" +typedef struct{ + s16 x, y; // position + s16 vx, vy; // speed +}puckinfos; + +puckinfos puck; + +#define SCREENHOLE 48 + +int main(void){ + + PA_Init(); + + PA_LoadDefaultText(1,0); // On the top screen + + PA_DualLoadSpritePal(0, (void*)sprite0_Pal); + + // This'll be the movable sprite... + PA_CreateSprite(0, 0,(void*)circle_Sprite, OBJ_SIZE_32X32,1, 0, 16, 16); + s32 x = 16; s32 y = 16; // Sprite's center position + + // This will be the hit circle + PA_DualCreateSprite(1,(void*)circle_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); + puck.x = 128; puck.y = 96+192+SCREENHOLE; // central position on bottom screen + puck.vx = 0; puck.vy = 0; // No speed + + + while(1) + { + if (PA_MoveSprite(0)){ + x = PA_MovedSprite.X; + y = PA_MovedSprite.Y; + } + + // Collision ? + if (PA_Distance(x, y, puck.x, puck.y-192-SCREENHOLE) < 32*32) { + // Collision, so we'l change the pucks speed to move it out of our 'raquette' + u16 angle = PA_GetAngle(x, y, puck.x, puck.y-192-SCREENHOLE); // New direction angle + u16 speed = (32*32-PA_Distance(x, y, puck.x, puck.y-192-SCREENHOLE))/32; // The closer they are, the harder the hit was... + puck.vx = (PA_Cos(angle)*speed)>>8; + puck.vy = -(PA_Sin(angle)*speed)>>8; + } + + puck.x += puck.vx; + puck.y += puck.vy; + + // If the sprite touches the left or right border, flip the horizontal speed + if ((puck.x -16 <= 0) && (puck.vx < 0)) puck.vx = -puck.vx; + else if ((puck.x + 16 >= 256)&&(puck.vx > 0)) puck.vx = - puck.vx; + + // Same thing, for top and bottom limits... + if ((puck.y -16 <= 0) && (puck.vy < 0)) puck.vy = -puck.vy; + else if ((puck.y + 16 >= 192 + 192 + SCREENHOLE)&& (puck.vy > 0)) puck.vy = - puck.vy; + // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... + PA_DualSetSpriteXY(1, puck.x-16, puck.y-16); + + + + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Demos/TypeWriter/Makefile b/examples/Demos/TypeWriter/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Demos/TypeWriter/Makefile +++ b/examples/Demos/TypeWriter/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Demos/TypeWriter/gfx/all_gfx.h b/examples/Demos/TypeWriter/gfx/all_gfx.h index 0a32064..c607a08 100644 --- a/examples/Demos/TypeWriter/gfx/all_gfx.h +++ b/examples/Demos/TypeWriter/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char Thingy_Sprite[128] _GFX_ALIGN; // Palette: Thingy_Pal - -// Palettes: -extern const unsigned short Thingy_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char Thingy_Sprite[128] _GFX_ALIGN; // Palette: Thingy_Pal + +// Palettes: +extern const unsigned short Thingy_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Demos/TypeWriter/source/main.c b/examples/Demos/TypeWriter/source/main.c index 76a4a4a..a056b87 100644 --- a/examples/Demos/TypeWriter/source/main.c +++ b/examples/Demos/TypeWriter/source/main.c @@ -1,93 +1,93 @@ -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - - -char text[2000]; - -s16 nletter = 0; // no text yet... -s16 maxletters = 0; // numbers of letter in the text... -char letter; // letter given by the keyboard presses... -s8 textsize = 2; // text size.... - - -void KeyBoardType(void); // Function that types the text nicely... - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - PA_Init16cBg(0, 3); // 16 color background init with default colors for text - PA_Init16cBg(1, 3); - - - PA_16cText(0, 10, 10, 245, 181, "Press Up/Down to change font size\nPress Left/Right to move cursor", 1, 3, 2048); - - - PA_LoadDefaultKeyboard(2); // Load the keyboard on background 2...screen 0... - - PA_KeyboardIn(20, 100); // Make it come in - - PA_LoadDefaultText(0, 0); - - - PA_LoadSpritePal(1, 0, (void*)Thingy_Pal); - PA_CreateSprite(1, 0, (void*)Thingy_Sprite, OBJ_SIZE_8X16, 1, 0, 0, 0); // Cursor that shows where you are typing... - - // Infinite loop to keep the program running - while (1) - { - - KeyBoardType(); // Use the keyboard if on bottom screen... - - - - PA_WaitForVBL(); - } - - return 0; -} // End of main() - - - - - -void KeyBoardType(void){ -s16 i; - // Change text size... - u8 oldtextsize = textsize; - textsize += Pad.Newpress.Up - Pad.Newpress.Down; // Change text size - if (textsize < 0) textsize = 0; - else if (textsize > 4) textsize = 4; // Limit textsize range to 0-4 - - // Adjust cursor position according to keys... - nletter += Pad.Newpress.Right - Pad.Newpress.Left; - if (nletter > maxletters) nletter--; - if (nletter < 0) nletter = 0; - - letter = PA_CheckKeyboard(); // Check PA Keyboard - - if ((letter)||(oldtextsize != textsize)){ // If new press or size changed... - if ((letter > 31)||(letter == '\n')) { // there is a new letter - for(i = maxletters; i >= nletter; i--) text[i+1] = text[i]; // Save following letters - text[nletter] = letter; - nletter++; - } - else if ((letter == PA_BACKSPACE)&&nletter) { // Backspace pressed - for(i = nletter-1; i // Include for PA_Lib + +#include "all_gfx.h" + + +char text[2000]; + +s16 nletter = 0; // no text yet... +s16 maxletters = 0; // numbers of letter in the text... +char letter; // letter given by the keyboard presses... +s8 textsize = 2; // text size.... + + +void KeyBoardType(void); // Function that types the text nicely... + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + PA_Init16cBg(0, 3); // 16 color background init with default colors for text + PA_Init16cBg(1, 3); + + + PA_16cText(0, 10, 10, 245, 181, "Press Up/Down to change font size\nPress Left/Right to move cursor", 1, 3, 2048); + + + PA_LoadDefaultKeyboard(2); // Load the keyboard on background 2...screen 0... + + PA_KeyboardIn(20, 100); // Make it come in + + PA_LoadDefaultText(0, 0); + + + PA_LoadSpritePal(1, 0, (void*)Thingy_Pal); + PA_CreateSprite(1, 0, (void*)Thingy_Sprite, OBJ_SIZE_8X16, 1, 0, 0, 0); // Cursor that shows where you are typing... + + // Infinite loop to keep the program running + while (1) + { + + KeyBoardType(); // Use the keyboard if on bottom screen... + + + + PA_WaitForVBL(); + } + + return 0; +} // End of main() + + + + + +void KeyBoardType(void){ +s16 i; + // Change text size... + u8 oldtextsize = textsize; + textsize += Pad.Newpress.Up - Pad.Newpress.Down; // Change text size + if (textsize < 0) textsize = 0; + else if (textsize > 4) textsize = 4; // Limit textsize range to 0-4 + + // Adjust cursor position according to keys... + nletter += Pad.Newpress.Right - Pad.Newpress.Left; + if (nletter > maxletters) nletter--; + if (nletter < 0) nletter = 0; + + letter = PA_CheckKeyboard(); // Check PA Keyboard + + if ((letter)||(oldtextsize != textsize)){ // If new press or size changed... + if ((letter > 31)||(letter == '\n')) { // there is a new letter + for(i = maxletters; i >= nletter; i--) text[i+1] = text[i]; // Save following letters + text[nletter] = letter; + nletter++; + } + else if ((letter == PA_BACKSPACE)&&nletter) { // Backspace pressed + for(i = nletter-1; i // Include for PA_Lib -#include -#include - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(0, 0); // Initialise the text system on the bottom screen - - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - PA_WaitForVBL(); PA_WaitForVBL(); PA_WaitForVBL(); // wait a few VBLs - - fatInitDefault(); //Initialise fat library - - // The following code was pulled from - // http://chishm.drunkencoders.com/libfat/index.html - // It has been slightly modified... - int linenumber =0; - int screen = 1; - - struct stat st; - char filename[256]; // to hold a full filename and string terminator - DIR_ITER* dir = diropen("/"); - - if (dir == NULL) - { - PA_OutputText(1,2,2,"Unable to open the directory."); - } - else - while (dirnext(dir, filename, &st) == 0) - { - if (linenumber ==24) //if we hit this twice we are overwriting on the bottom screen :( - { - screen=0; //Output on bottom if we filled the top screen - linenumber = 0; //reset line number... - } - // st.st_mode & S_IFDIR indicates a directory - PA_OutputText(screen,0,linenumber, "%02d%s: %s\n", linenumber, (st.st_mode & S_IFDIR ? "D" : "-"), filename); - linenumber++;//next line - } - //nothing to do but wait.... - while (1) - { - - PA_WaitForVBL(); - } - - return 0; -} // End of main() - - - - - - - - +/* FAT functions.... +*/ + +// Includes +#include // Include for PA_Lib +#include +#include + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(0, 0); // Initialise the text system on the bottom screen + + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + PA_WaitForVBL(); PA_WaitForVBL(); PA_WaitForVBL(); // wait a few VBLs + + fatInitDefault(); //Initialise fat library + + // The following code was pulled from + // http://chishm.drunkencoders.com/libfat/index.html + // It has been slightly modified... + int linenumber =0; + int screen = 1; + + struct stat st; + char filename[256]; // to hold a full filename and string terminator + DIR_ITER* dir = diropen("/"); + + if (dir == NULL) + { + PA_OutputText(1,2,2,"Unable to open the directory."); + } + else + while (dirnext(dir, filename, &st) == 0) + { + if (linenumber ==24) //if we hit this twice we are overwriting on the bottom screen :( + { + screen=0; //Output on bottom if we filled the top screen + linenumber = 0; //reset line number... + } + // st.st_mode & S_IFDIR indicates a directory + PA_OutputText(screen,0,linenumber, "%02d%s: %s\n", linenumber, (st.st_mode & S_IFDIR ? "D" : "-"), filename); + linenumber++;//next line + } + //nothing to do but wait.... + while (1) + { + + PA_WaitForVBL(); + } + + return 0; +} // End of main() + + + + + + + + diff --git a/examples/Filesystem/FATReadWrite/Makefile b/examples/Filesystem/FATReadWrite/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Filesystem/FATReadWrite/Makefile +++ b/examples/Filesystem/FATReadWrite/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Filesystem/FATReadWrite/source/main.c b/examples/Filesystem/FATReadWrite/source/main.c index aff2fd6..07836c8 100644 --- a/examples/Filesystem/FATReadWrite/source/main.c +++ b/examples/Filesystem/FATReadWrite/source/main.c @@ -1,63 +1,63 @@ -/* FAT functions.... - * Read / Write -*/ - -// Includes -#include // Include for PA_Lib -#include - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - PA_WaitForVBL(); PA_WaitForVBL(); PA_WaitForVBL(); // wait a few VBLs - - fatInitDefault(); //Initialise fat library - - PA_OutputSimpleText(1, 1, 1, "FAT Test - Do not power off"); - PA_OutputSimpleText(1, 1, 3, "Opening File for Write"); - - FILE* testWrite = fopen ("FATTest.txt", "wb"); //wb = create/truncate & write - fwrite("Just writing text to a file :)", 30, 1, testWrite); - fclose(testWrite); - - - PA_OutputSimpleText(1, 1, 4, "Writing complete."); - - PA_OutputSimpleText(1, 1, 6, "Opening File for Read"); - FILE* testRead = fopen ("FATTest.txt", "rb"); //rb = read - char filetext[30]; - fread(filetext, 30, 1, testRead); - fclose(testRead); - - - PA_OutputSimpleText(1, 1, 7, "FATTest.txt contains:"); - PA_OutputText(1, 2, 8, "%s", filetext); - PA_OutputSimpleText(1, 1, 10, "Read Complete."); - - PA_OutputSimpleText(1, 1, 13, "Safe to power off."); - - - - - //nothing to do but wait.... - while (1) - { - - PA_WaitForVBL(); - } - - return 0; -} // End of main() - - - - - - - - +/* FAT functions.... + * Read / Write +*/ + +// Includes +#include // Include for PA_Lib +#include + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + PA_WaitForVBL(); PA_WaitForVBL(); PA_WaitForVBL(); // wait a few VBLs + + fatInitDefault(); //Initialise fat library + + PA_OutputSimpleText(1, 1, 1, "FAT Test - Do not power off"); + PA_OutputSimpleText(1, 1, 3, "Opening File for Write"); + + FILE* testWrite = fopen ("FATTest.txt", "wb"); //wb = create/truncate & write + fwrite("Just writing text to a file :)", 30, 1, testWrite); + fclose(testWrite); + + + PA_OutputSimpleText(1, 1, 4, "Writing complete."); + + PA_OutputSimpleText(1, 1, 6, "Opening File for Read"); + FILE* testRead = fopen ("FATTest.txt", "rb"); //rb = read + char filetext[30]; + fread(filetext, 30, 1, testRead); + fclose(testRead); + + + PA_OutputSimpleText(1, 1, 7, "FATTest.txt contains:"); + PA_OutputText(1, 2, 8, "%s", filetext); + PA_OutputSimpleText(1, 1, 10, "Read Complete."); + + PA_OutputSimpleText(1, 1, 13, "Safe to power off."); + + + + + //nothing to do but wait.... + while (1) + { + + PA_WaitForVBL(); + } + + return 0; +} // End of main() + + + + + + + + diff --git a/examples/Filesystem/Filesystem/Makefile b/examples/Filesystem/Filesystem/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Filesystem/Filesystem/Makefile +++ b/examples/Filesystem/Filesystem/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Filesystem/Filesystem/source/main.c b/examples/Filesystem/Filesystem/source/main.c index 91ab627..8cdced0 100644 --- a/examples/Filesystem/Filesystem/source/main.c +++ b/examples/Filesystem/Filesystem/source/main.c @@ -1,84 +1,84 @@ -#include -#include - -int main(int argc, char* argv[]) { - - // init PAlib - PA_Init(); - - PA_LoadDefaultText(1, 0); - PA_LoadDefaultText(0, 0); - - if(nitroFSInit()) { - PA_OutputSimpleText(1, 0, 0, "Filesystem init ok"); - PA_OutputText(1, 0, 1, "NDS path: %s", argv[0]); - - struct stat st; - FILE* file; - u8* buffer; - int i = 0, size; - - // open a text file and read its contents - file = fopen("/test.txt", "rb"); - if(file != NULL) { - // get file size using stat - stat("/test.txt", &st); - size = st.st_size; - - buffer = (u8*)malloc(size); - fread(buffer, 1, size, file); - buffer[size-1] = '\0'; - PA_OutputText(1, 0, 4, "/test.txt content: '%s'", buffer); - PA_OutputText(1, 10, 5, "size: %d bytes", size); - free(buffer); - fclose(file); - } - - // open another file, read its content - file = fopen("/folder/test.txt", "rb"); - if(file != NULL) { - // get file size - fseek(file, 0, SEEK_END); - size = ftell(file); - fseek(file, 0, SEEK_SET); - - buffer = (u8*)malloc(size); - fread(buffer, 1, size, file); - buffer[size-1] = '\0'; - PA_OutputText(1, 0, 7, "/folder/test.txt content:\n%s", buffer); - free(buffer); - fclose(file); - } - - // reopen another file, read its content again, 1 byte at a time - file = fopen("/folder/dummy/.././test.txt", "rb"); // funky path to test relative path parsing - if(file != NULL) { - // get file size - fseek(file, 0, SEEK_END); - size = ftell(file); - fseek(file, 0, SEEK_SET); - - buffer = (u8*)malloc(size); - - i = 0; - while(i < size) { - fread(&buffer[i], 1, 1, file); - i++; - } - - buffer[size-1] = '\0'; - PA_OutputText(1, 0, 12, "/folder/test.txt new content:\n%s", buffer); - free(buffer); - fclose(file); - } - - } else { - PA_OutputSimpleText(1, 0, 0, "Filesystem init error!"); - } - - while(1) { - PA_WaitForVBL(); - } - - return 0; +#include +#include + +int main(int argc, char* argv[]) { + + // init PAlib + PA_Init(); + + PA_LoadDefaultText(1, 0); + PA_LoadDefaultText(0, 0); + + if(nitroFSInit()) { + PA_OutputSimpleText(1, 0, 0, "Filesystem init ok"); + PA_OutputText(1, 0, 1, "NDS path: %s", argv[0]); + + struct stat st; + FILE* file; + u8* buffer; + int i = 0, size; + + // open a text file and read its contents + file = fopen("/test.txt", "rb"); + if(file != NULL) { + // get file size using stat + stat("/test.txt", &st); + size = st.st_size; + + buffer = (u8*)malloc(size); + fread(buffer, 1, size, file); + buffer[size-1] = '\0'; + PA_OutputText(1, 0, 4, "/test.txt content: '%s'", buffer); + PA_OutputText(1, 10, 5, "size: %d bytes", size); + free(buffer); + fclose(file); + } + + // open another file, read its content + file = fopen("/folder/test.txt", "rb"); + if(file != NULL) { + // get file size + fseek(file, 0, SEEK_END); + size = ftell(file); + fseek(file, 0, SEEK_SET); + + buffer = (u8*)malloc(size); + fread(buffer, 1, size, file); + buffer[size-1] = '\0'; + PA_OutputText(1, 0, 7, "/folder/test.txt content:\n%s", buffer); + free(buffer); + fclose(file); + } + + // reopen another file, read its content again, 1 byte at a time + file = fopen("/folder/dummy/.././test.txt", "rb"); // funky path to test relative path parsing + if(file != NULL) { + // get file size + fseek(file, 0, SEEK_END); + size = ftell(file); + fseek(file, 0, SEEK_SET); + + buffer = (u8*)malloc(size); + + i = 0; + while(i < size) { + fread(&buffer[i], 1, 1, file); + i++; + } + + buffer[size-1] = '\0'; + PA_OutputText(1, 0, 12, "/folder/test.txt new content:\n%s", buffer); + free(buffer); + fclose(file); + } + + } else { + PA_OutputSimpleText(1, 0, 0, "Filesystem init error!"); + } + + while(1) { + PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Gif/GifAnim/Makefile b/examples/Gif/GifAnim/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Gif/GifAnim/Makefile +++ b/examples/Gif/GifAnim/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Gif/GifAnim/source/main.c b/examples/Gif/GifAnim/source/main.c index 343afed..0702839 100644 --- a/examples/Gif/GifAnim/source/main.c +++ b/examples/Gif/GifAnim/source/main.c @@ -1,63 +1,63 @@ -// Gif animation example - -// Includes -#include // Include for PA_Lib - -#include "bartman.h" // gif to include - - - float speed = 1; // gif speed, normal speed by default... - u8 pause = 0; // pause/unpause - - -void MyCustomVBL(void) { // VBL function to play while gif is on... - - if(Pad.Newpress.Start){ - pause = !pause; // if 1 returns 0, if 0 returns 1 - if (pause == 1) { - PA_GifAnimPause(); // pause animation - PA_OutputSimpleText(0, 10, 11, "PAUSE !"); - } - else { - PA_GifAnimPlay(); // unpause... - PA_OutputSimpleText(0, 10, 11, " "); - } - } - - // Change speed according to keys - if (Pad.Held.Up) speed += 0.02; - if (Pad.Held.Down && (speed > 0.02)) speed -= 0.02; - - PA_GifAnimSpeed(speed); // Gif speed command :) - - PA_OutputText(0, 10, 12, "Speed : %f2 ", speed); - -} - - - - -// Function: main() -int main(){ - - PA_Init(); // PA Init... - - PA_Init8bitBg(1, 3); // Init a 8 bit Bg on screen 1 - - - PA_LoadDefaultText(0, 0); // Text on bottom screen - - - - PA_OutputSimpleText(0, 2, 8, "Press Start to pause/unpause"); - PA_OutputSimpleText(0, 2, 9, "Press Up/Down to change speed"); - - PA_VBLFunctionInit(MyCustomVBL); // start the function to play during gif file ! - - while(1) { - PA_LoadGif( 1, (void*)bartman); // Gif File to play over and over again - PA_WaitForVBL(); - } - - return 0; -} // End of main() +// Gif animation example + +// Includes +#include // Include for PA_Lib + +#include "bartman.h" // gif to include + + + float speed = 1; // gif speed, normal speed by default... + u8 pause = 0; // pause/unpause + + +void MyCustomVBL(void) { // VBL function to play while gif is on... + + if(Pad.Newpress.Start){ + pause = !pause; // if 1 returns 0, if 0 returns 1 + if (pause == 1) { + PA_GifAnimPause(); // pause animation + PA_OutputSimpleText(0, 10, 11, "PAUSE !"); + } + else { + PA_GifAnimPlay(); // unpause... + PA_OutputSimpleText(0, 10, 11, " "); + } + } + + // Change speed according to keys + if (Pad.Held.Up) speed += 0.02; + if (Pad.Held.Down && (speed > 0.02)) speed -= 0.02; + + PA_GifAnimSpeed(speed); // Gif speed command :) + + PA_OutputText(0, 10, 12, "Speed : %f2 ", speed); + +} + + + + +// Function: main() +int main(){ + + PA_Init(); // PA Init... + + PA_Init8bitBg(1, 3); // Init a 8 bit Bg on screen 1 + + + PA_LoadDefaultText(0, 0); // Text on bottom screen + + + + PA_OutputSimpleText(0, 2, 8, "Press Start to pause/unpause"); + PA_OutputSimpleText(0, 2, 9, "Press Up/Down to change speed"); + + PA_VBLFunctionInit(MyCustomVBL); // start the function to play during gif file ! + + while(1) { + PA_LoadGif( 1, (void*)bartman); // Gif File to play over and over again + PA_WaitForVBL(); + } + + return 0; +} // End of main() diff --git a/examples/Gif/GifAnim2/Makefile b/examples/Gif/GifAnim2/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Gif/GifAnim2/Makefile +++ b/examples/Gif/GifAnim2/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Gif/GifAnim2/source/main.c b/examples/Gif/GifAnim2/source/main.c index 28b4d69..254a14f 100644 --- a/examples/Gif/GifAnim2/source/main.c +++ b/examples/Gif/GifAnim2/source/main.c @@ -1,82 +1,82 @@ -// Advanced gif animation example - -// Includes -#include // Include for PA_Lib - -#include "bartman.h" // gif to include - - - float speed = 1; // gif speed, normal speed by default... - u8 pause = 0; // pause/unpause - - s32 StartFrame = 0; // frame from which to start - s32 EndFrame = 20; // frame from which to end - - - - -void MyCustomVBL(void) { // VBL function to play while gif is on... - - if(Pad.Newpress.Start){ - pause = !pause; // if 1 returns 0, if 0 returns 1 - if (pause == 1) { - PA_GifAnimPause(); // pause animation - PA_OutputSimpleText(0, 10, 11, "PAUSE !"); - } - else { - PA_GifAnimPlay(); // unpause... - PA_OutputSimpleText(0, 10, 11, " "); - } - } - - // Change speed according to keys - if (Pad.Held.Up) speed += 0.02; - if (Pad.Held.Down && (speed > 0.02)) speed -= 0.02; - - PA_GifAnimSpeed(speed); // Gif speed command :) - - PA_OutputText(0, 10, 11, "Speed : %f2 ", speed); - -// Change starting frame... - if (Pad.Newpress.B) StartFrame += 1; - if (Pad.Newpress.A && (StartFrame > 0)) StartFrame -= 1; - PA_OutputText(0, 2, 13, "Start Frame : %d ", StartFrame); - PA_GifSetStartFrame(StartFrame); // Set the starting frame number... - -// Change ending frame... - if (Pad.Newpress.Y) EndFrame += 1; - if (Pad.Newpress.X && (EndFrame > 0)) EndFrame -= 1; - PA_OutputText(0, 2, 14, "End Frame : %d ", EndFrame); - PA_GifSetEndFrame(EndFrame); // Set the ending frame number... - - PA_OutputText(0, 4, 16, "Current Frame : %d ", PA_GifGetFrame()); - -} - - - - -// Function: main() -int main(){ - - PA_Init(); // PA Init... - - PA_Init8bitBg(1, 3); // Init a 8 bit Bg on screen 1 - - - PA_LoadDefaultText(0, 0); // Text on bottom screen - - PA_OutputSimpleText(0, 1, 6, "Press Start to pause/unpause"); - PA_OutputSimpleText(0, 1, 7, "Press Up/Down to change speed"); - PA_OutputSimpleText(0, 1, 8, "Press A/B to change StartFrame"); - PA_OutputSimpleText(0, 1, 9, "Press X/Y to change EndFrame"); - PA_VBLFunctionInit(MyCustomVBL); // start the function to play during gif file ! - - while(1) { - PA_LoadGif( 1, (void*)bartman); // Gif File to play over and over again - PA_Clear8bitBg(1); // Clear the screen after use - PA_WaitForVBL(); - } - - return 0; -} // End of main() +// Advanced gif animation example + +// Includes +#include // Include for PA_Lib + +#include "bartman.h" // gif to include + + + float speed = 1; // gif speed, normal speed by default... + u8 pause = 0; // pause/unpause + + s32 StartFrame = 0; // frame from which to start + s32 EndFrame = 20; // frame from which to end + + + + +void MyCustomVBL(void) { // VBL function to play while gif is on... + + if(Pad.Newpress.Start){ + pause = !pause; // if 1 returns 0, if 0 returns 1 + if (pause == 1) { + PA_GifAnimPause(); // pause animation + PA_OutputSimpleText(0, 10, 11, "PAUSE !"); + } + else { + PA_GifAnimPlay(); // unpause... + PA_OutputSimpleText(0, 10, 11, " "); + } + } + + // Change speed according to keys + if (Pad.Held.Up) speed += 0.02; + if (Pad.Held.Down && (speed > 0.02)) speed -= 0.02; + + PA_GifAnimSpeed(speed); // Gif speed command :) + + PA_OutputText(0, 10, 11, "Speed : %f2 ", speed); + +// Change starting frame... + if (Pad.Newpress.B) StartFrame += 1; + if (Pad.Newpress.A && (StartFrame > 0)) StartFrame -= 1; + PA_OutputText(0, 2, 13, "Start Frame : %d ", StartFrame); + PA_GifSetStartFrame(StartFrame); // Set the starting frame number... + +// Change ending frame... + if (Pad.Newpress.Y) EndFrame += 1; + if (Pad.Newpress.X && (EndFrame > 0)) EndFrame -= 1; + PA_OutputText(0, 2, 14, "End Frame : %d ", EndFrame); + PA_GifSetEndFrame(EndFrame); // Set the ending frame number... + + PA_OutputText(0, 4, 16, "Current Frame : %d ", PA_GifGetFrame()); + +} + + + + +// Function: main() +int main(){ + + PA_Init(); // PA Init... + + PA_Init8bitBg(1, 3); // Init a 8 bit Bg on screen 1 + + + PA_LoadDefaultText(0, 0); // Text on bottom screen + + PA_OutputSimpleText(0, 1, 6, "Press Start to pause/unpause"); + PA_OutputSimpleText(0, 1, 7, "Press Up/Down to change speed"); + PA_OutputSimpleText(0, 1, 8, "Press A/B to change StartFrame"); + PA_OutputSimpleText(0, 1, 9, "Press X/Y to change EndFrame"); + PA_VBLFunctionInit(MyCustomVBL); // start the function to play during gif file ! + + while(1) { + PA_LoadGif( 1, (void*)bartman); // Gif File to play over and over again + PA_Clear8bitBg(1); // Clear the screen after use + PA_WaitForVBL(); + } + + return 0; +} // End of main() diff --git a/examples/Gif/LoadGif/Makefile b/examples/Gif/LoadGif/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Gif/LoadGif/Makefile +++ b/examples/Gif/LoadGif/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Gif/LoadGif/source/main.c b/examples/Gif/LoadGif/source/main.c index 24365b9..05f3783 100644 --- a/examples/Gif/LoadGif/source/main.c +++ b/examples/Gif/LoadGif/source/main.c @@ -1,30 +1,30 @@ -// Include any GIF file and output it on an 8bit or 16bit screen ! - -// Includes -#include // Include for PA_Lib - -#include "Mollusk.h" // gif to include -#include "trans.h" // gif to include - -// Function: main() -int main(){ - - PA_Init(); // PA Init... - - PA_Init8bitBg(0, 3); // Init a 16 bit Bg on screen 0 - PA_Init8bitBg(1, 3); // Init a 8 bit Bg on screen 1 - - PA_LoadGif( 1, // Screen, which is 8 bit... - (void*)Mollusk); // Gif File - - PA_LoadGifXY( 0, 100, 60, // Screen, which is 16 bit, and at position 100, 60 - (void*)trans); // Gif File - - - - while(1) { - PA_WaitForVBL(); - } - - return 0; -} // End of main() +// Include any GIF file and output it on an 8bit or 16bit screen ! + +// Includes +#include // Include for PA_Lib + +#include "Mollusk.h" // gif to include +#include "trans.h" // gif to include + +// Function: main() +int main(){ + + PA_Init(); // PA Init... + + PA_Init8bitBg(0, 3); // Init a 16 bit Bg on screen 0 + PA_Init8bitBg(1, 3); // Init a 8 bit Bg on screen 1 + + PA_LoadGif( 1, // Screen, which is 8 bit... + (void*)Mollusk); // Gif File + + PA_LoadGifXY( 0, 100, 60, // Screen, which is 16 bit, and at position 100, 60 + (void*)trans); // Gif File + + + + while(1) { + PA_WaitForVBL(); + } + + return 0; +} // End of main() diff --git a/examples/Input/DSMotion/Motion/Makefile b/examples/Input/DSMotion/Motion/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Input/DSMotion/Motion/Makefile +++ b/examples/Input/DSMotion/Motion/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Input/DSMotion/Motion/source/main.c b/examples/Input/DSMotion/Motion/source/main.c index 66604b1..fc296d1 100644 --- a/examples/Input/DSMotion/Motion/source/main.c +++ b/examples/Input/DSMotion/Motion/source/main.c @@ -1,75 +1,75 @@ -/* DS Motion Example !! -*/ - - -// Includes -#include // Include for PA_Lib - - - - -// global variable indicating whether DS Motion Card is plugged in -int ndsmotion = 0; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(0, 0); // Initialise the text system on the top screen - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 0, 5, "Please insert your DS Motion and press any key"); // Ask to insert the DS Motion... - - PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... - PA_ClearTextBg(1); // Erase text screen... - - // Turn on the DS Motion... - PA_MotionInit(); - - while ( !PA_CheckDSMotion()) { // Checks for the DS Motion, continues looking for it until it actually finds it... - PA_WaitForVBL(); - - // If no DSMotion found... - PA_OutputText(1, 0, 5, " DS Motion not found ! \nPlease insert your DS Motion and press any key"); // Ask to insert the DS Motion... again... - - PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... - PA_MotionInit(); - } - - PA_ClearTextBg(1); // erase the text... - - // Infinite loop to keep the program running - while (1) - { - - while(!PA_CheckDSMotion()){ // Function that checks if the DS Motion is still present... - PA_OutputText(1, 0, 5, "Please reinsert DSMotion..."); // Ask to insert the DS Motion... again... - PA_WaitForVBL(); - } - PA_ClearTextBg(1); // Clear bottom screen... - - PA_OutputText(1, 3, 5, "Motion.X : %d ", Motion.X); - PA_OutputText(1, 3, 6, "Motion.Vx : %d ", Motion.Vx); - PA_OutputText(1, 3, 7, "Motion.Y : %d ", Motion.Y); - PA_OutputText(1, 3, 8, "Motion.Vy : %d ", Motion.Vy); - PA_OutputText(1, 3, 9, "Motion.Z : %d ", Motion.Z); - PA_OutputText(1, 3, 10, "Motion.Vz : %d ", Motion.Vz); - PA_OutputText(1, 3, 11, "Motion.Zrot : %d ", Motion.Zrot); - PA_OutputText(1, 3, 12, "Motion.Vzrot : %d ", Motion.Vzrot); - - PA_OutputText(1, 3, 14, "Motion.Angle : %d ", Motion.Angle); - PA_OutputText(1, 3, 15, "Motion.Force : %d ", Motion.Force); - - PA_OutputText(0, 3, 7, "Up : %d-%d-%d", Motion.Newpress.Up, Motion.Held.Up, Motion.Released.Up); - PA_OutputText(0, 3, 8, "Down : %d-%d-%d", Motion.Newpress.Down, Motion.Held.Down, Motion.Released.Down); - PA_OutputText(0, 3, 9, "Left : %d-%d-%d", Motion.Newpress.Left, Motion.Held.Left, Motion.Released.Left); - PA_OutputText(0, 3, 10, "Right : %d-%d-%d", Motion.Newpress.Right, Motion.Held.Right, Motion.Released.Right); - - - PA_WaitForVBL(); - } - - return 0; +/* DS Motion Example !! +*/ + + +// Includes +#include // Include for PA_Lib + + + + +// global variable indicating whether DS Motion Card is plugged in +int ndsmotion = 0; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(0, 0); // Initialise the text system on the top screen + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 0, 5, "Please insert your DS Motion and press any key"); // Ask to insert the DS Motion... + + PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... + PA_ClearTextBg(1); // Erase text screen... + + // Turn on the DS Motion... + PA_MotionInit(); + + while ( !PA_CheckDSMotion()) { // Checks for the DS Motion, continues looking for it until it actually finds it... + PA_WaitForVBL(); + + // If no DSMotion found... + PA_OutputText(1, 0, 5, " DS Motion not found ! \nPlease insert your DS Motion and press any key"); // Ask to insert the DS Motion... again... + + PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... + PA_MotionInit(); + } + + PA_ClearTextBg(1); // erase the text... + + // Infinite loop to keep the program running + while (1) + { + + while(!PA_CheckDSMotion()){ // Function that checks if the DS Motion is still present... + PA_OutputText(1, 0, 5, "Please reinsert DSMotion..."); // Ask to insert the DS Motion... again... + PA_WaitForVBL(); + } + PA_ClearTextBg(1); // Clear bottom screen... + + PA_OutputText(1, 3, 5, "Motion.X : %d ", Motion.X); + PA_OutputText(1, 3, 6, "Motion.Vx : %d ", Motion.Vx); + PA_OutputText(1, 3, 7, "Motion.Y : %d ", Motion.Y); + PA_OutputText(1, 3, 8, "Motion.Vy : %d ", Motion.Vy); + PA_OutputText(1, 3, 9, "Motion.Z : %d ", Motion.Z); + PA_OutputText(1, 3, 10, "Motion.Vz : %d ", Motion.Vz); + PA_OutputText(1, 3, 11, "Motion.Zrot : %d ", Motion.Zrot); + PA_OutputText(1, 3, 12, "Motion.Vzrot : %d ", Motion.Vzrot); + + PA_OutputText(1, 3, 14, "Motion.Angle : %d ", Motion.Angle); + PA_OutputText(1, 3, 15, "Motion.Force : %d ", Motion.Force); + + PA_OutputText(0, 3, 7, "Up : %d-%d-%d", Motion.Newpress.Up, Motion.Held.Up, Motion.Released.Up); + PA_OutputText(0, 3, 8, "Down : %d-%d-%d", Motion.Newpress.Down, Motion.Held.Down, Motion.Released.Down); + PA_OutputText(0, 3, 9, "Left : %d-%d-%d", Motion.Newpress.Left, Motion.Held.Left, Motion.Released.Left); + PA_OutputText(0, 3, 10, "Right : %d-%d-%d", Motion.Newpress.Right, Motion.Held.Right, Motion.Released.Right); + + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Input/DSMotion/MotionToPad/Makefile b/examples/Input/DSMotion/MotionToPad/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Input/DSMotion/MotionToPad/Makefile +++ b/examples/Input/DSMotion/MotionToPad/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Input/DSMotion/MotionToPad/gfx/all_gfx.h b/examples/Input/DSMotion/MotionToPad/gfx/all_gfx.h index d676e08..1928a61 100644 --- a/examples/Input/DSMotion/MotionToPad/gfx/all_gfx.h +++ b/examples/Input/DSMotion/MotionToPad/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char som_Sprite[6144] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char som_Sprite[6144] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Input/DSMotion/MotionToPad/source/main.c b/examples/Input/DSMotion/MotionToPad/source/main.c index e99d1a3..0e0b468 100644 --- a/examples/Input/DSMotion/MotionToPad/source/main.c +++ b/examples/Input/DSMotion/MotionToPad/source/main.c @@ -1,85 +1,85 @@ -/* This will show the new sprite animation functions !! Yay ! -Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) -*/ - - -// Includes, only one sprite -#include - - -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount; //Frame count... - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(0, 0); // Initialise the text system on the top screen - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - PA_OutputSimpleText(1, 0, 5, "Please insert your DS Motion and press any key"); // Ask to insert the DS Motion... - - PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... - PA_ClearTextBg(1); // Erase text screen... - - // Turn on the DS Motion... - PA_MotionInit(); - - while ( !PA_CheckDSMotion()) { // Checks for the DS Motion, continues looking for it until it actually finds it... - PA_WaitForVBL(); - - // If no DSMotion found... - PA_OutputText(1, 0, 5, " DS Motion not found ! \nPlease insert your DS Motion and press any key"); // Ask to insert the DS Motion... again... - - PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... - PA_MotionInit(); - } - - PA_ClearTextBg(1); // erase the text... - - PA_MotionToPad(1); // Overrides the pad keys and puts the DS Motion instead - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... - - s32 x = 120; s32 y = 64; - - PA_CreateSprite(0, 0,(void*)som_Sprite, OBJ_SIZE_16X32,1, 0, x, y); // Sprite - - while(1) - { - // Animation code... - if(Pad.Newpress.Up) PA_StartSpriteAnim(0, 0, 0, 3, 6); - if(Pad.Newpress.Down) PA_StartSpriteAnim(0, 0, 8, 11, 6); - - if(Pad.Newpress.Right) { - PA_StartSpriteAnim(0, 0, 4, 7, 6); - PA_SetSpriteHflip(0, 0, 0); - } - if(Pad.Newpress.Left) { - PA_StartSpriteAnim(0, 0, 4, 7, 6); - PA_SetSpriteHflip(0, 0, 1); - } - - - if(!((Pad.Held.Left)||(Pad.Held.Up)||(Pad.Held.Down)||(Pad.Held.Right))) PA_SpriteAnimPause(0, 0, 1); - - - // Moving Code - y += Pad.Held.Down - Pad.Held.Up; - x += Pad.Held.Right - Pad.Held.Left; - PA_SetSpriteXY(0, 0, x, y); - - PA_OutputText(1, 3, 7, "Up : %d-%d-%d", Pad.Newpress.Up, Pad.Held.Up, Pad.Released.Up); - PA_OutputText(1, 3, 8, "Down : %d-%d-%d", Pad.Newpress.Down, Pad.Held.Down, Pad.Released.Down); - PA_OutputText(1, 3, 9, "Left : %d-%d-%d", Pad.Newpress.Left, Pad.Held.Left, Pad.Released.Left); - PA_OutputText(1, 3, 10, "Right : %d-%d-%d", Pad.Newpress.Right, Pad.Held.Right, Pad.Released.Right); - - PA_WaitForVBL(); - } - - return 0; +/* This will show the new sprite animation functions !! Yay ! +Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) +*/ + + +// Includes, only one sprite +#include + + +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount; //Frame count... + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(0, 0); // Initialise the text system on the top screen + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + PA_OutputSimpleText(1, 0, 5, "Please insert your DS Motion and press any key"); // Ask to insert the DS Motion... + + PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... + PA_ClearTextBg(1); // Erase text screen... + + // Turn on the DS Motion... + PA_MotionInit(); + + while ( !PA_CheckDSMotion()) { // Checks for the DS Motion, continues looking for it until it actually finds it... + PA_WaitForVBL(); + + // If no DSMotion found... + PA_OutputText(1, 0, 5, " DS Motion not found ! \nPlease insert your DS Motion and press any key"); // Ask to insert the DS Motion... again... + + PA_WaitFor(Pad.Newpress.Anykey); // Wait for any key to be pressed before continuing... + PA_MotionInit(); + } + + PA_ClearTextBg(1); // erase the text... + + PA_MotionToPad(1); // Overrides the pad keys and puts the DS Motion instead + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... + + s32 x = 120; s32 y = 64; + + PA_CreateSprite(0, 0,(void*)som_Sprite, OBJ_SIZE_16X32,1, 0, x, y); // Sprite + + while(1) + { + // Animation code... + if(Pad.Newpress.Up) PA_StartSpriteAnim(0, 0, 0, 3, 6); + if(Pad.Newpress.Down) PA_StartSpriteAnim(0, 0, 8, 11, 6); + + if(Pad.Newpress.Right) { + PA_StartSpriteAnim(0, 0, 4, 7, 6); + PA_SetSpriteHflip(0, 0, 0); + } + if(Pad.Newpress.Left) { + PA_StartSpriteAnim(0, 0, 4, 7, 6); + PA_SetSpriteHflip(0, 0, 1); + } + + + if(!((Pad.Held.Left)||(Pad.Held.Up)||(Pad.Held.Down)||(Pad.Held.Right))) PA_SpriteAnimPause(0, 0, 1); + + + // Moving Code + y += Pad.Held.Down - Pad.Held.Up; + x += Pad.Held.Right - Pad.Held.Left; + PA_SetSpriteXY(0, 0, x, y); + + PA_OutputText(1, 3, 7, "Up : %d-%d-%d", Pad.Newpress.Up, Pad.Held.Up, Pad.Released.Up); + PA_OutputText(1, 3, 8, "Down : %d-%d-%d", Pad.Newpress.Down, Pad.Held.Down, Pad.Released.Down); + PA_OutputText(1, 3, 9, "Left : %d-%d-%d", Pad.Newpress.Left, Pad.Held.Left, Pad.Released.Left); + PA_OutputText(1, 3, 10, "Right : %d-%d-%d", Pad.Newpress.Right, Pad.Held.Right, Pad.Released.Right); + + PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Input/GHController/Makefile b/examples/Input/GHController/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Input/GHController/Makefile +++ b/examples/Input/GHController/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Input/GHController/source/main.c b/examples/Input/GHController/source/main.c index 10dba73..aefdd56 100644 --- a/examples/Input/GHController/source/main.c +++ b/examples/Input/GHController/source/main.c @@ -1,42 +1,42 @@ -// A simple demo of using the Guitar Hero Grip with PAlib -// by BassAceGold - - -// Includes -#include // Include for PA_Lib - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1,0); - - PA_OutputSimpleText(1, 0, 0, "GH Button Test"); - PA_OutputSimpleText(1, 0, 1, "by BassAceGold"); - PA_OutputSimpleText(1, 0, 3, "For each key, we'll show\n Newpress, Held, and Released"); - - PA_InitGHPad(); // Call this first before using other GH controller functions - - // Infinite loop to keep the program running - while (1) - { - - PA_OutputText(1, 3, 7, "Green : %d-%d-%d", GHPad.Newpress.Green, GHPad.Held.Green, GHPad.Released.Green); - PA_OutputText(1, 3, 8, "Red : %d-%d-%d", GHPad.Newpress.Red, GHPad.Held.Red, GHPad.Released.Red); - PA_OutputText(1, 3, 9, "Yellow : %d-%d-%d", GHPad.Newpress.Yellow, GHPad.Held.Yellow, GHPad.Released.Yellow); - PA_OutputText(1, 3, 10, "Blue : %d-%d-%d", GHPad.Newpress.Blue, GHPad.Held.Blue, GHPad.Released.Blue); - - if(GHPad.Held.Anykey) PA_OutputText(1, 3, 15, "anykeyworks"); - else PA_OutputText(1, 3, 15, " "); - - if(PA_DetectGHPad()) PA_OutputText(1, 3, 17, "Grip is inserted"); - else PA_OutputText(1, 3, 17, " "); - - - PA_WaitForVBL(); // PA_WaitForVBL automatically updates GHPad values - } - - return 0; +// A simple demo of using the Guitar Hero Grip with PAlib +// by BassAceGold + + +// Includes +#include // Include for PA_Lib + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1,0); + + PA_OutputSimpleText(1, 0, 0, "GH Button Test"); + PA_OutputSimpleText(1, 0, 1, "by BassAceGold"); + PA_OutputSimpleText(1, 0, 3, "For each key, we'll show\n Newpress, Held, and Released"); + + PA_InitGHPad(); // Call this first before using other GH controller functions + + // Infinite loop to keep the program running + while (1) + { + + PA_OutputText(1, 3, 7, "Green : %d-%d-%d", GHPad.Newpress.Green, GHPad.Held.Green, GHPad.Released.Green); + PA_OutputText(1, 3, 8, "Red : %d-%d-%d", GHPad.Newpress.Red, GHPad.Held.Red, GHPad.Released.Red); + PA_OutputText(1, 3, 9, "Yellow : %d-%d-%d", GHPad.Newpress.Yellow, GHPad.Held.Yellow, GHPad.Released.Yellow); + PA_OutputText(1, 3, 10, "Blue : %d-%d-%d", GHPad.Newpress.Blue, GHPad.Held.Blue, GHPad.Released.Blue); + + if(GHPad.Held.Anykey) PA_OutputText(1, 3, 15, "anykeyworks"); + else PA_OutputText(1, 3, 15, " "); + + if(PA_DetectGHPad()) PA_OutputText(1, 3, 17, "Grip is inserted"); + else PA_OutputText(1, 3, 17, " "); + + + PA_WaitForVBL(); // PA_WaitForVBL automatically updates GHPad values + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Input/Keyboard/Keyboard/Makefile b/examples/Input/Keyboard/Keyboard/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Input/Keyboard/Keyboard/Makefile +++ b/examples/Input/Keyboard/Keyboard/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Input/Keyboard/Keyboard/source/main.c b/examples/Input/Keyboard/Keyboard/source/main.c index b27a308..38d3468 100644 --- a/examples/Input/Keyboard/Keyboard/source/main.c +++ b/examples/Input/Keyboard/Keyboard/source/main.c @@ -1,65 +1,65 @@ -// Includes -#include // Include for PA_Lib - - -char text[200]; // This will be our text... - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1, 0); // Initialise the text system - - PA_LoadDefaultKeyboard(2); // Load the keyboard on background 2... - - PA_KeyboardIn(20, 95); // This scrolls the keyboard from the bottom, until it's at the right position - // PA_KeyboardOut() can be used to scroll the Keyboard out - // PA_ScrollKeyboardXY(x, y) can be used to set the keyboards position - - - PA_OutputSimpleText(1, 7, 10, "Text : "); - - s32 nletter = 0; // Next letter to right. 0 since no letters are there yet - char letter = 0; // New letter to write. - - // Infinite loop to keep the program running - while (1) - { - // We'll check first for color changes, with A, B, and X - if (Pad.Newpress.A) PA_SetKeyboardColor(0, 1); // Blue and Red - if (Pad.Newpress.B) PA_SetKeyboardColor(1, 0); // Red and Blue - if (Pad.Newpress.X) PA_SetKeyboardColor(2, 1); // Green and Red - if (Pad.Newpress.Y) PA_SetKeyboardColor(0, 2); // Blue and Green - - letter = PA_CheckKeyboard(); - - if (letter > 31) { // there is a new letter - text[nletter] = letter; - nletter++; - } - else if(letter == PA_TAB){// TAB Pressed... - u8 i; - for (i = 0; i < 4; i++){ // put 4 spaces... - text[nletter] = ' '; - nletter++; - } - - } - else if ((letter == PA_BACKSPACE)&&nletter) { // Backspace pressed - nletter--; - text[nletter] = ' '; // Erase the last letter - } - else if (letter == '\n'){ // Enter pressed - text[nletter] = letter; - nletter++; - } - - PA_OutputSimpleText(1, 8, 11, text); // Write the text - PA_WaitForVBL(); - } - - return 0; -} // End of main() +// Includes +#include // Include for PA_Lib + + +char text[200]; // This will be our text... + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1, 0); // Initialise the text system + + PA_LoadDefaultKeyboard(2); // Load the keyboard on background 2... + + PA_KeyboardIn(20, 95); // This scrolls the keyboard from the bottom, until it's at the right position + // PA_KeyboardOut() can be used to scroll the Keyboard out + // PA_ScrollKeyboardXY(x, y) can be used to set the keyboards position + + + PA_OutputSimpleText(1, 7, 10, "Text : "); + + s32 nletter = 0; // Next letter to right. 0 since no letters are there yet + char letter = 0; // New letter to write. + + // Infinite loop to keep the program running + while (1) + { + // We'll check first for color changes, with A, B, and X + if (Pad.Newpress.A) PA_SetKeyboardColor(0, 1); // Blue and Red + if (Pad.Newpress.B) PA_SetKeyboardColor(1, 0); // Red and Blue + if (Pad.Newpress.X) PA_SetKeyboardColor(2, 1); // Green and Red + if (Pad.Newpress.Y) PA_SetKeyboardColor(0, 2); // Blue and Green + + letter = PA_CheckKeyboard(); + + if (letter > 31) { // there is a new letter + text[nletter] = letter; + nletter++; + } + else if(letter == PA_TAB){// TAB Pressed... + u8 i; + for (i = 0; i < 4; i++){ // put 4 spaces... + text[nletter] = ' '; + nletter++; + } + + } + else if ((letter == PA_BACKSPACE)&&nletter) { // Backspace pressed + nletter--; + text[nletter] = ' '; // Erase the last letter + } + else if (letter == '\n'){ // Enter pressed + text[nletter] = letter; + nletter++; + } + + PA_OutputSimpleText(1, 8, 11, text); // Write the text + PA_WaitForVBL(); + } + + return 0; +} // End of main() diff --git a/examples/Input/Keyboard/KeyboardCustom/Makefile b/examples/Input/Keyboard/KeyboardCustom/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Input/Keyboard/KeyboardCustom/Makefile +++ b/examples/Input/Keyboard/KeyboardCustom/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Input/Keyboard/KeyboardCustom/gfx/all_gfx.h b/examples/Input/Keyboard/KeyboardCustom/gfx/all_gfx.h index d0e2918..47de847 100644 --- a/examples/Input/Keyboard/KeyboardCustom/gfx/all_gfx.h +++ b/examples/Input/Keyboard/KeyboardCustom/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct keyboardcustom; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct keyboardcustom; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Input/Keyboard/KeyboardCustom/gfx/bin/keyboardcustom.c b/examples/Input/Keyboard/KeyboardCustom/gfx/bin/keyboardcustom.c index 3d58b66..12a329d 100644 --- a/examples/Input/Keyboard/KeyboardCustom/gfx/bin/keyboardcustom.c +++ b/examples/Input/Keyboard/KeyboardCustom/gfx/bin/keyboardcustom.c @@ -1,17 +1,17 @@ -#include - -extern const char keyboardcustom_Tiles[]; -extern const char keyboardcustom_Map[]; -extern const char keyboardcustom_Pal[]; - -const PA_BgStruct keyboardcustom = { - PA_BgLarge, - 256, 1024, - - keyboardcustom_Tiles, - keyboardcustom_Map, - {keyboardcustom_Pal}, - - 30016, - {8192} -}; +#include + +extern const char keyboardcustom_Tiles[]; +extern const char keyboardcustom_Map[]; +extern const char keyboardcustom_Pal[]; + +const PA_BgStruct keyboardcustom = { + PA_BgLarge, + 256, 1024, + + keyboardcustom_Tiles, + keyboardcustom_Map, + {keyboardcustom_Pal}, + + 30016, + {8192} +}; diff --git a/examples/Input/Keyboard/KeyboardCustom/source/main.c b/examples/Input/Keyboard/KeyboardCustom/source/main.c index 2219e51..ff5ae03 100644 --- a/examples/Input/Keyboard/KeyboardCustom/source/main.c +++ b/examples/Input/Keyboard/KeyboardCustom/source/main.c @@ -1,69 +1,69 @@ -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - -char text[200]; // This will be our text... - - - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(1, 0); // Initialise the text system - - PA_LoadKeyboard(2, &keyboardcustom); // Load the keyboard on background 2... - - PA_KeyboardIn(20, 95); // This scrolls the keyboard from the bottom, until it's at the right position - // PA_KeyboardOut() can be used to scroll the Keyboard out - // PA_ScrollKeyboardXY(x, y) can be used to set the keyboards position - - - PA_OutputSimpleText(1, 7, 10, "Text : "); - - s32 nletter = 0; // Next letter to right. 0 since no letters are there yet - char letter = 0; // New letter to write. - - // Infinite loop to keep the program running - while (1) - { - // We'll check first for color changes, with A, B, and X - if (Pad.Newpress.A) PA_SetKeyboardColor(0, 1); // Blue and Red - if (Pad.Newpress.B) PA_SetKeyboardColor(1, 0); // Red and Blue - if (Pad.Newpress.X) PA_SetKeyboardColor(2, 1); // Green and Red - if (Pad.Newpress.Y) PA_SetKeyboardColor(0, 2); // Blue and Green - - letter = PA_CheckKeyboard(); - - if (letter > 31) { // there is a new letter - text[nletter] = letter; - nletter++; - } - else if(letter == PA_TAB){// TAB Pressed... - u8 i; - for (i = 0; i < 4; i++){ // put 4 spaces... - text[nletter] = ' '; - nletter++; - } - - } - else if ((letter == PA_BACKSPACE)&&nletter) { // Backspace pressed - nletter--; - text[nletter] = ' '; // Erase the last letter - } - else if (letter == '\n'){ // Enter pressed - text[nletter] = letter; - nletter++; - } - - PA_OutputSimpleText(1, 8, 11, text); // Write the text - PA_WaitForVBL(); - } - - return 0; +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + +char text[200]; // This will be our text... + + + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(1, 0); // Initialise the text system + + PA_LoadKeyboard(2, &keyboardcustom); // Load the keyboard on background 2... + + PA_KeyboardIn(20, 95); // This scrolls the keyboard from the bottom, until it's at the right position + // PA_KeyboardOut() can be used to scroll the Keyboard out + // PA_ScrollKeyboardXY(x, y) can be used to set the keyboards position + + + PA_OutputSimpleText(1, 7, 10, "Text : "); + + s32 nletter = 0; // Next letter to right. 0 since no letters are there yet + char letter = 0; // New letter to write. + + // Infinite loop to keep the program running + while (1) + { + // We'll check first for color changes, with A, B, and X + if (Pad.Newpress.A) PA_SetKeyboardColor(0, 1); // Blue and Red + if (Pad.Newpress.B) PA_SetKeyboardColor(1, 0); // Red and Blue + if (Pad.Newpress.X) PA_SetKeyboardColor(2, 1); // Green and Red + if (Pad.Newpress.Y) PA_SetKeyboardColor(0, 2); // Blue and Green + + letter = PA_CheckKeyboard(); + + if (letter > 31) { // there is a new letter + text[nletter] = letter; + nletter++; + } + else if(letter == PA_TAB){// TAB Pressed... + u8 i; + for (i = 0; i < 4; i++){ // put 4 spaces... + text[nletter] = ' '; + nletter++; + } + + } + else if ((letter == PA_BACKSPACE)&&nletter) { // Backspace pressed + nletter--; + text[nletter] = ' '; // Erase the last letter + } + else if (letter == '\n'){ // Enter pressed + text[nletter] = letter; + nletter++; + } + + PA_OutputSimpleText(1, 8, 11, text); // Write the text + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Input/Pad/Makefile b/examples/Input/Pad/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Input/Pad/Makefile +++ b/examples/Input/Pad/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Input/Pad/source/main.c b/examples/Input/Pad/source/main.c index 70704d2..efd351e 100644 --- a/examples/Input/Pad/source/main.c +++ b/examples/Input/Pad/source/main.c @@ -1,50 +1,50 @@ -/* Here you'll see all the pad information, which is really not much : -- Each key has 3 variables : Newpress, Held, and Released -*/ - - -// Includes -#include // Include for PA_Lib - - -char text[200]; // This will be our text... - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - - PA_OutputSimpleText(1, 0, 3, "For each key, we'll show Newpress, Held, and Released"); - - - - // Infinite loop to keep the program running - while (1) - { - // For each key, we'll show Newpress, Held, and Released - PA_OutputText(1, 3, 7, "Up: %d-%d-%d", Pad.Newpress.Up, Pad.Held.Up, Pad.Released.Up); - PA_OutputText(1, 3, 8, "Down: %d-%d-%d", Pad.Newpress.Down, Pad.Held.Down, Pad.Released.Down); - PA_OutputText(1, 3, 9, "Left: %d-%d-%d", Pad.Newpress.Left, Pad.Held.Left, Pad.Released.Left); - PA_OutputText(1, 3, 10, "Right: %d-%d-%d", Pad.Newpress.Right, Pad.Held.Right, Pad.Released.Right); - PA_OutputText(1, 3, 11, "A: %d-%d-%d", Pad.Newpress.A, Pad.Held.A, Pad.Released.A); - PA_OutputText(1, 3, 12, "B: %d-%d-%d", Pad.Newpress.B, Pad.Held.B, Pad.Released.B); - PA_OutputText(1, 3, 13, "X: %d-%d-%d", Pad.Newpress.X, Pad.Held.X, Pad.Released.X); - PA_OutputText(1, 3, 14, "Y: %d-%d-%d", Pad.Newpress.Y, Pad.Held.Y, Pad.Released.Y); - PA_OutputText(1, 3, 15, "L: %d-%d-%d", Pad.Newpress.L, Pad.Held.L, Pad.Released.L); - PA_OutputText(1, 3, 16, "R: %d-%d-%d", Pad.Newpress.R, Pad.Held.R, Pad.Released.R); - PA_OutputText(1, 3, 17, "Start: %d-%d-%d", Pad.Newpress.Start, Pad.Held.Start, Pad.Released.Start); - PA_OutputText(1, 3, 18, "Select: %d-%d-%d", Pad.Newpress.Select, Pad.Held.Select, Pad.Released.Select); - PA_OutputText(1, 3, 20, "Anykey: %d-%d-%d", Pad.Newpress.Anykey, Pad.Held.Anykey, Pad.Released.Anykey); - - - PA_WaitForVBL(); - } - - return 0; +/* Here you'll see all the pad information, which is really not much : +- Each key has 3 variables : Newpress, Held, and Released +*/ + + +// Includes +#include // Include for PA_Lib + + +char text[200]; // This will be our text... + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + + PA_OutputSimpleText(1, 0, 3, "For each key, we'll show Newpress, Held, and Released"); + + + + // Infinite loop to keep the program running + while (1) + { + // For each key, we'll show Newpress, Held, and Released + PA_OutputText(1, 3, 7, "Up: %d-%d-%d", Pad.Newpress.Up, Pad.Held.Up, Pad.Released.Up); + PA_OutputText(1, 3, 8, "Down: %d-%d-%d", Pad.Newpress.Down, Pad.Held.Down, Pad.Released.Down); + PA_OutputText(1, 3, 9, "Left: %d-%d-%d", Pad.Newpress.Left, Pad.Held.Left, Pad.Released.Left); + PA_OutputText(1, 3, 10, "Right: %d-%d-%d", Pad.Newpress.Right, Pad.Held.Right, Pad.Released.Right); + PA_OutputText(1, 3, 11, "A: %d-%d-%d", Pad.Newpress.A, Pad.Held.A, Pad.Released.A); + PA_OutputText(1, 3, 12, "B: %d-%d-%d", Pad.Newpress.B, Pad.Held.B, Pad.Released.B); + PA_OutputText(1, 3, 13, "X: %d-%d-%d", Pad.Newpress.X, Pad.Held.X, Pad.Released.X); + PA_OutputText(1, 3, 14, "Y: %d-%d-%d", Pad.Newpress.Y, Pad.Held.Y, Pad.Released.Y); + PA_OutputText(1, 3, 15, "L: %d-%d-%d", Pad.Newpress.L, Pad.Held.L, Pad.Released.L); + PA_OutputText(1, 3, 16, "R: %d-%d-%d", Pad.Newpress.R, Pad.Held.R, Pad.Released.R); + PA_OutputText(1, 3, 17, "Start: %d-%d-%d", Pad.Newpress.Start, Pad.Held.Start, Pad.Released.Start); + PA_OutputText(1, 3, 18, "Select: %d-%d-%d", Pad.Newpress.Select, Pad.Held.Select, Pad.Released.Select); + PA_OutputText(1, 3, 20, "Anykey: %d-%d-%d", Pad.Newpress.Anykey, Pad.Held.Anykey, Pad.Released.Anykey); + + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Input/Stylus/RecoAddShape/Makefile b/examples/Input/Stylus/RecoAddShape/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Input/Stylus/RecoAddShape/Makefile +++ b/examples/Input/Stylus/RecoAddShape/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Input/Stylus/RecoAddShape/source/main.c b/examples/Input/Stylus/RecoAddShape/source/main.c index f6ee74c..0262028 100644 --- a/examples/Input/Stylus/RecoAddShape/source/main.c +++ b/examples/Input/Stylus/RecoAddShape/source/main.c @@ -1,55 +1,55 @@ - -// Includes -#include // Include for PA_Lib - - -char text[1000]; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - PA_Init8bitBg(0, 0); // We'll draw the characters on the screen... - - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); // Set the writing color to white - - PA_UsePAGraffiti(0); // Do not use the provided Graffiti shapes... - - PA_RecoAddShape('a', "AAAAAAAAAAAAAAA"); // Straight right-going line - PA_RecoAddShape('b', "111111111111111"); // Straight left-going line - PA_RecoAddShape('c', "IIIIIIIIIIIIIII"); // Straight up-going line - PA_RecoAddShape('d', "999999999999999"); // Straight down-going line - - PA_WaitForVBL(); - - - // Infinite loop to keep the program running - while (1) - { - - if(Stylus.Newpress) PA_Clear8bitBg(0); // Reset the screen when we start a new character - - PA_8bitDraw(0, 1); - - - char letter[2]; letter[1] = 0; - letter[0] = PA_CheckLetter(); // Returns the letter !!! - - if (Stylus.Released){ // only show if released - PA_OutputText(1, 2, 7, "Shape Recognized : %s", letter); // Letter recognized - PA_OutputText(1, 0, 1, "A for right, B for left, C for up, D for down"); - } - - PA_OutputText(1, 4, 22, "Shape : %s", PA_RecoShape); // Write the shape string - - PA_OutputSimpleText(1, 0, 10, "Draw a PAGraffiti letter to have it recognized by the system..."); - - PA_WaitForVBL(); - } - - return 0; + +// Includes +#include // Include for PA_Lib + + +char text[1000]; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + PA_Init8bitBg(0, 0); // We'll draw the characters on the screen... + + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); // Set the writing color to white + + PA_UsePAGraffiti(0); // Do not use the provided Graffiti shapes... + + PA_RecoAddShape('a', "AAAAAAAAAAAAAAA"); // Straight right-going line + PA_RecoAddShape('b', "111111111111111"); // Straight left-going line + PA_RecoAddShape('c', "IIIIIIIIIIIIIII"); // Straight up-going line + PA_RecoAddShape('d', "999999999999999"); // Straight down-going line + + PA_WaitForVBL(); + + + // Infinite loop to keep the program running + while (1) + { + + if(Stylus.Newpress) PA_Clear8bitBg(0); // Reset the screen when we start a new character + + PA_8bitDraw(0, 1); + + + char letter[2]; letter[1] = 0; + letter[0] = PA_CheckLetter(); // Returns the letter !!! + + if (Stylus.Released){ // only show if released + PA_OutputText(1, 2, 7, "Shape Recognized : %s", letter); // Letter recognized + PA_OutputText(1, 0, 1, "A for right, B for left, C for up, D for down"); + } + + PA_OutputText(1, 4, 22, "Shape : %s", PA_RecoShape); // Write the shape string + + PA_OutputSimpleText(1, 0, 10, "Draw a PAGraffiti letter to have it recognized by the system..."); + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Input/Stylus/RecoGraffiti/Makefile b/examples/Input/Stylus/RecoGraffiti/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Input/Stylus/RecoGraffiti/Makefile +++ b/examples/Input/Stylus/RecoGraffiti/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Input/Stylus/RecoGraffiti/source/main.c b/examples/Input/Stylus/RecoGraffiti/source/main.c index 2d27cfb..94e43d3 100644 --- a/examples/Input/Stylus/RecoGraffiti/source/main.c +++ b/examples/Input/Stylus/RecoGraffiti/source/main.c @@ -1,60 +1,60 @@ -/* Here you'll see all the stylus information, which is really not much : -- Stylus location -- Stylus newly pressed, held, or released... -*/ - - -// Includes -#include // Include for PA_Lib - - -char text[1000]; - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - PA_Init8bitBg(0, 0); // We'll draw the characters on the screen... - - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); // Set the writing color to white - - PA_WaitForVBL(); - - u8 nletter = 0; - - // Infinite loop to keep the program running - while (1) - { - - if(Stylus.Newpress) PA_Clear8bitBg(0); // Reset the screen when we start a new character - - PA_8bitDraw(0, 1); - - char letter = PA_CheckLetter(); // Returns the letter !!! - - if (letter > 31) { // there is a new letter - text[nletter] = letter; - nletter++; - } - else if ((letter == PA_BACKSPACE)&&nletter) { // Backspace pressed - nletter--; - text[nletter] = ' '; // Erase the last letter - } - else if (letter == '\n'){ // Enter pressed - text[nletter] = letter; - nletter++; - } - - PA_OutputText(1, 2, 2, text); // Write the text - - PA_OutputSimpleText(1, 0, 10, "Draw a PAGraffiti letter to have it recognized by the system..."); - - PA_WaitForVBL(); - } - - return 0; +/* Here you'll see all the stylus information, which is really not much : +- Stylus location +- Stylus newly pressed, held, or released... +*/ + + +// Includes +#include // Include for PA_Lib + + +char text[1000]; + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + PA_Init8bitBg(0, 0); // We'll draw the characters on the screen... + + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); // Set the writing color to white + + PA_WaitForVBL(); + + u8 nletter = 0; + + // Infinite loop to keep the program running + while (1) + { + + if(Stylus.Newpress) PA_Clear8bitBg(0); // Reset the screen when we start a new character + + PA_8bitDraw(0, 1); + + char letter = PA_CheckLetter(); // Returns the letter !!! + + if (letter > 31) { // there is a new letter + text[nletter] = letter; + nletter++; + } + else if ((letter == PA_BACKSPACE)&&nletter) { // Backspace pressed + nletter--; + text[nletter] = ' '; // Erase the last letter + } + else if (letter == '\n'){ // Enter pressed + text[nletter] = letter; + nletter++; + } + + PA_OutputText(1, 2, 2, text); // Write the text + + PA_OutputSimpleText(1, 0, 10, "Draw a PAGraffiti letter to have it recognized by the system..."); + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Input/Stylus/RecoShapeInfo/Makefile b/examples/Input/Stylus/RecoShapeInfo/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Input/Stylus/RecoShapeInfo/Makefile +++ b/examples/Input/Stylus/RecoShapeInfo/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Input/Stylus/RecoShapeInfo/source/main.c b/examples/Input/Stylus/RecoShapeInfo/source/main.c index 7d662d7..6dc901e 100644 --- a/examples/Input/Stylus/RecoShapeInfo/source/main.c +++ b/examples/Input/Stylus/RecoShapeInfo/source/main.c @@ -1,71 +1,71 @@ - -// Includes -#include // Include for PA_Lib - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - PA_Init8bitBg(0, 0); // We'll draw the characters on the screen... - - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); // Set the writing color to white - PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); // Another color to Red - - PA_UsePAGraffiti(0); // Do not use the provided Graffiti shapes... - - PA_RecoAddShape('a', "AAAAAAAAAAAAAAA"); // Straight right-going line - PA_RecoAddShape('b', "111111111111111"); // Straight left-going line - PA_RecoAddShape('c', "IIIIIIIIIIIIIII"); // Straight up-going line - PA_RecoAddShape('d', "999999999999999"); // Straight down-going line - - PA_WaitForVBL(); - - - // Infinite loop to keep the program running - while (1) - { - - if(Stylus.Newpress) PA_Clear8bitBg(0); // Reset the screen when we start a new character - - PA_8bitDraw(0, 1); - - - char letter[2]; letter[1] = 0; - letter[0] = PA_CheckLetter(); // Returns the letter !!! - - if (Stylus.Released){ // only show if released - PA_OutputText(1, 2, 7, "Shape Recognized : %s", letter); // Letter recognized - PA_OutputText(1, 0, 1, "A for right, B for left, C for up, D for down"); - - // Use all the info to draw the shape outline, start and end... - // Rectangle around the drawing zone - PA_Draw8bitLine(0, PA_RecoInfo.minX, PA_RecoInfo.minY, PA_RecoInfo.maxX, PA_RecoInfo.minY, 2); - PA_Draw8bitLine(0, PA_RecoInfo.minX, PA_RecoInfo.maxY, PA_RecoInfo.maxX, PA_RecoInfo.maxY, 2); - PA_Draw8bitLine(0, PA_RecoInfo.minX, PA_RecoInfo.minY, PA_RecoInfo.minX, PA_RecoInfo.maxY, 2); - PA_Draw8bitLine(0, PA_RecoInfo.maxX, PA_RecoInfo.minY, PA_RecoInfo.maxX, PA_RecoInfo.maxY, 2); - - // Plot points on the start and end : - PA_Put8bitPixel(0, PA_RecoInfo.startX, PA_RecoInfo.startY, 2); - PA_Put8bitPixel(0, PA_RecoInfo.endX, PA_RecoInfo.endY, 2); - } - - PA_OutputText(1, 4, 22, "Shape : %s", PA_RecoShape); // Write the shape string - PA_OutputText(1, 4, 23, "Length : %d pixels ", PA_RecoInfo.Length); // Length in pixels - - PA_OutputSimpleText(1, 0, 10, "Draw a PAGraffiti letter to have it recognized by the system..."); - - - - - - PA_WaitForVBL(); - } - - return 0; + +// Includes +#include // Include for PA_Lib + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + PA_Init8bitBg(0, 0); // We'll draw the characters on the screen... + + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); // Set the writing color to white + PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); // Another color to Red + + PA_UsePAGraffiti(0); // Do not use the provided Graffiti shapes... + + PA_RecoAddShape('a', "AAAAAAAAAAAAAAA"); // Straight right-going line + PA_RecoAddShape('b', "111111111111111"); // Straight left-going line + PA_RecoAddShape('c', "IIIIIIIIIIIIIII"); // Straight up-going line + PA_RecoAddShape('d', "999999999999999"); // Straight down-going line + + PA_WaitForVBL(); + + + // Infinite loop to keep the program running + while (1) + { + + if(Stylus.Newpress) PA_Clear8bitBg(0); // Reset the screen when we start a new character + + PA_8bitDraw(0, 1); + + + char letter[2]; letter[1] = 0; + letter[0] = PA_CheckLetter(); // Returns the letter !!! + + if (Stylus.Released){ // only show if released + PA_OutputText(1, 2, 7, "Shape Recognized : %s", letter); // Letter recognized + PA_OutputText(1, 0, 1, "A for right, B for left, C for up, D for down"); + + // Use all the info to draw the shape outline, start and end... + // Rectangle around the drawing zone + PA_Draw8bitLine(0, PA_RecoInfo.minX, PA_RecoInfo.minY, PA_RecoInfo.maxX, PA_RecoInfo.minY, 2); + PA_Draw8bitLine(0, PA_RecoInfo.minX, PA_RecoInfo.maxY, PA_RecoInfo.maxX, PA_RecoInfo.maxY, 2); + PA_Draw8bitLine(0, PA_RecoInfo.minX, PA_RecoInfo.minY, PA_RecoInfo.minX, PA_RecoInfo.maxY, 2); + PA_Draw8bitLine(0, PA_RecoInfo.maxX, PA_RecoInfo.minY, PA_RecoInfo.maxX, PA_RecoInfo.maxY, 2); + + // Plot points on the start and end : + PA_Put8bitPixel(0, PA_RecoInfo.startX, PA_RecoInfo.startY, 2); + PA_Put8bitPixel(0, PA_RecoInfo.endX, PA_RecoInfo.endY, 2); + } + + PA_OutputText(1, 4, 22, "Shape : %s", PA_RecoShape); // Write the shape string + PA_OutputText(1, 4, 23, "Length : %d pixels ", PA_RecoInfo.Length); // Length in pixels + + PA_OutputSimpleText(1, 0, 10, "Draw a PAGraffiti letter to have it recognized by the system..."); + + + + + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Input/Stylus/Stylus/Makefile b/examples/Input/Stylus/Stylus/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Input/Stylus/Stylus/Makefile +++ b/examples/Input/Stylus/Stylus/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Input/Stylus/Stylus/source/main.c b/examples/Input/Stylus/Stylus/source/main.c index 795e975..236b6e0 100644 --- a/examples/Input/Stylus/Stylus/source/main.c +++ b/examples/Input/Stylus/Stylus/source/main.c @@ -1,29 +1,29 @@ -/* Here you'll learn how to read the stylus, - which is what makes the DS special! -*/ - -// Includes -#include - -int main(){ - PA_Init(); - PA_LoadDefaultText(1, 0); - - int i; - - // Infinite loop to keep the program running - while(true){ - // Erase the text on the screen... - for(i = 0; i < 10; i++) PA_OutputSimpleText(1, 0, 7+i, " "); - - // Check the stylus presses - if (Stylus.Held) PA_OutputSimpleText(1, 0, 7, "The stylus is on the screen"); - if (Stylus.Newpress) PA_OutputSimpleText(1, 0, 8, "The stylus has just been pressed"); - if (Stylus.Released) PA_OutputSimpleText(1, 0, 9, "The stylus has been released"); - - // Get the stylus position and show it on screen - PA_OutputText(1, 1, 11, "Stylus Position: %d, %d ", Stylus.X, Stylus.Y); - - PA_WaitForVBL(); - } +/* Here you'll learn how to read the stylus, + which is what makes the DS special! +*/ + +// Includes +#include + +int main(){ + PA_Init(); + PA_LoadDefaultText(1, 0); + + int i; + + // Infinite loop to keep the program running + while(true){ + // Erase the text on the screen... + for(i = 0; i < 10; i++) PA_OutputSimpleText(1, 0, 7+i, " "); + + // Check the stylus presses + if (Stylus.Held) PA_OutputSimpleText(1, 0, 7, "The stylus is on the screen"); + if (Stylus.Newpress) PA_OutputSimpleText(1, 0, 8, "The stylus has just been pressed"); + if (Stylus.Released) PA_OutputSimpleText(1, 0, 9, "The stylus has been released"); + + // Get the stylus position and show it on screen + PA_OutputText(1, 1, 11, "Stylus Position: %d, %d ", Stylus.X, Stylus.Y); + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Input/Stylus/StylusExtra/Makefile b/examples/Input/Stylus/StylusExtra/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Input/Stylus/StylusExtra/Makefile +++ b/examples/Input/Stylus/StylusExtra/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Input/Stylus/StylusExtra/source/main.c b/examples/Input/Stylus/StylusExtra/source/main.c index 471eb79..76da5de 100644 --- a/examples/Input/Stylus/StylusExtra/source/main.c +++ b/examples/Input/Stylus/StylusExtra/source/main.c @@ -1,33 +1,33 @@ -/* PAlib has a couple handy variables to detect special - stylus movements, here we will learn how to read them! -*/ - -// Includes -#include - -int main(){ - PA_Init(); - PA_LoadDefaultText(1, 0); - - int i; - - // Infinite loop to keep the program running - while(true){ - // Erase the text on the screen... - for(i = 0; i < 10; i++) PA_OutputSimpleText(1, 0, 7+i, " "); - - // Check the stylus presses - if (Stylus.Held) PA_OutputSimpleText(1, 0, 7, "The stylus is on the screen"); - if (Stylus.Newpress) PA_OutputSimpleText(1, 0, 8, "The stylus has just been pressed"); - if (Stylus.Released) PA_OutputSimpleText(1, 0, 9, "The stylus has been released"); - if (Stylus.DblClick) PA_OutputSimpleText(1, 0, 10, "The stylus has been double- clicked"); - - PA_OutputText(1, 1, 12, "Stylus held down for %d seconds ", Stylus.Downtime/60); // Stylus.Downtime/Uptime in VBL time, 60/second - PA_OutputText(1, 1, 13, "Stylus kept up for %d seconds ", Stylus.Uptime/60); - - // Get the stylus position and show it on screen - PA_OutputText(1, 1, 15, "Stylus Position: %d, %d ", Stylus.X, Stylus.Y); - - PA_WaitForVBL(); - } +/* PAlib has a couple handy variables to detect special + stylus movements, here we will learn how to read them! +*/ + +// Includes +#include + +int main(){ + PA_Init(); + PA_LoadDefaultText(1, 0); + + int i; + + // Infinite loop to keep the program running + while(true){ + // Erase the text on the screen... + for(i = 0; i < 10; i++) PA_OutputSimpleText(1, 0, 7+i, " "); + + // Check the stylus presses + if (Stylus.Held) PA_OutputSimpleText(1, 0, 7, "The stylus is on the screen"); + if (Stylus.Newpress) PA_OutputSimpleText(1, 0, 8, "The stylus has just been pressed"); + if (Stylus.Released) PA_OutputSimpleText(1, 0, 9, "The stylus has been released"); + if (Stylus.DblClick) PA_OutputSimpleText(1, 0, 10, "The stylus has been double- clicked"); + + PA_OutputText(1, 1, 12, "Stylus held down for %d seconds ", Stylus.Downtime/60); // Stylus.Downtime/Uptime in VBL time, 60/second + PA_OutputText(1, 1, 13, "Stylus kept up for %d seconds ", Stylus.Uptime/60); + + // Get the stylus position and show it on screen + PA_OutputText(1, 1, 15, "Stylus Position: %d, %d ", Stylus.X, Stylus.Y); + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Input/TaitoPaddle/Makefile b/examples/Input/TaitoPaddle/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Input/TaitoPaddle/Makefile +++ b/examples/Input/TaitoPaddle/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Input/TaitoPaddle/gfx/all_gfx.h b/examples/Input/TaitoPaddle/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Input/TaitoPaddle/gfx/all_gfx.h +++ b/examples/Input/TaitoPaddle/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Input/TaitoPaddle/source/main.c b/examples/Input/TaitoPaddle/source/main.c index 91b681b..7192d90 100644 --- a/examples/Input/TaitoPaddle/source/main.c +++ b/examples/Input/TaitoPaddle/source/main.c @@ -1,46 +1,46 @@ -#include - -#include "all_gfx.h" -int main() -{ - PA_Init(); - - PA_LoadDefaultText(0, 0); - PA_LoadDefaultText(1, 0); - - PA_OutputSimpleText(1, 2, 1, "Taito Paddle demo for PAlib!"); - -// let's load some sprites to play with! - u8 xPos = 127; - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); - PA_CreateSprite(0, 0, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1, 0, xPos, 80); - - u16 angle = 0; - PA_LoadSpritePal(1, 0, (void*)sprite0_Pal); - PA_CreateSprite(1, 0, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1, 0, 110, 80); - PA_SetSpriteRotEnable(1, 0, 0); // because it's going to be rotated... - - PA_InitPaddle(); // call this first before trying to use the paddle - - while(1) - { - PA_OutputText(0, 1, 1, "Paddle : High Byte : %d ", Paddle.High); // the high byte of the whole 12-bit value (0-15) - PA_OutputText(0, 1, 2, "Paddle : Low Byte : %d ", Paddle.Low); // the low byte of the whole 12-bit value (0-255) - PA_OutputText(0, 1, 3, "Paddle : 12-Bit Value : %d ", Paddle.Count); // the calculated 12-bit value (0-4095) - PA_OutputText(0, 1, 3, "Paddle : Velocity : %d ", Paddle.Speed); // the difference between successive values - - if(Paddle.Speed > 16) Paddle.Speed = 16; // you can limit values beyond a given threshhold for smoother movement... - else if(Paddle.Speed < -16) Paddle.Speed = -16; // ...try experimenting with different threshold numbers - - xPos += Paddle.Speed; // you can change a position based on the speed of paddle rotation... - PA_SetSpriteX(0, 0, xPos); - - angle -= Paddle.Speed; // ...you can also change an angle - angle &= 511; // limit the angle range to 0-511. (works only with 1, 3, 7, 15, 31, etc... (2^n - 1)) - PA_SetRotsetNoZoom(1, 0, angle); - - PA_WaitForVBL(); // PA_WaitForVBL automatically updates the Paddle values - } - - return 0; +#include + +#include "all_gfx.h" +int main() +{ + PA_Init(); + + PA_LoadDefaultText(0, 0); + PA_LoadDefaultText(1, 0); + + PA_OutputSimpleText(1, 2, 1, "Taito Paddle demo for PAlib!"); + +// let's load some sprites to play with! + u8 xPos = 127; + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); + PA_CreateSprite(0, 0, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1, 0, xPos, 80); + + u16 angle = 0; + PA_LoadSpritePal(1, 0, (void*)sprite0_Pal); + PA_CreateSprite(1, 0, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1, 0, 110, 80); + PA_SetSpriteRotEnable(1, 0, 0); // because it's going to be rotated... + + PA_InitPaddle(); // call this first before trying to use the paddle + + while(1) + { + PA_OutputText(0, 1, 1, "Paddle : High Byte : %d ", Paddle.High); // the high byte of the whole 12-bit value (0-15) + PA_OutputText(0, 1, 2, "Paddle : Low Byte : %d ", Paddle.Low); // the low byte of the whole 12-bit value (0-255) + PA_OutputText(0, 1, 3, "Paddle : 12-Bit Value : %d ", Paddle.Count); // the calculated 12-bit value (0-4095) + PA_OutputText(0, 1, 3, "Paddle : Velocity : %d ", Paddle.Speed); // the difference between successive values + + if(Paddle.Speed > 16) Paddle.Speed = 16; // you can limit values beyond a given threshhold for smoother movement... + else if(Paddle.Speed < -16) Paddle.Speed = -16; // ...try experimenting with different threshold numbers + + xPos += Paddle.Speed; // you can change a position based on the speed of paddle rotation... + PA_SetSpriteX(0, 0, xPos); + + angle -= Paddle.Speed; // ...you can also change an angle + angle &= 511; // limit the angle range to 0-511. (works only with 1, 3, 7, 15, 31, etc... (2^n - 1)) + PA_SetRotsetNoZoom(1, 0, angle); + + PA_WaitForVBL(); // PA_WaitForVBL automatically updates the Paddle values + } + + return 0; } \ No newline at end of file diff --git a/examples/Makefile_example b/examples/Makefile_example index 9f46863..4edb814 100644 --- a/examples/Makefile_example +++ b/examples/Makefile_example @@ -1,363 +1,363 @@ -# SPDX-License-Identifier: CC0-1.0 -# -# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024 - -export BLOCKSDS ?= /opt/blocksds/core -export BLOCKSDSEXT ?= /opt/blocksds/external - -export WONDERFUL_TOOLCHAIN ?= /opt/wonderful -ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/ - -# User config -# =========== - -NAME ?= $(shell basename $(CURDIR)) - -GAME_TITLE ?= PAlib Project -GAME_SUBTITLE ?= Change this text -GAME_AUTHOR ?= for your project! -GAME_ICON ?= $(BLOCKSDSEXT)/palib/defaultlogo.bmp - -ARM7ELF ?= $(BLOCKSDSEXT)/palib/sys/arm7_maxmod_dswifi.elf - -# DLDI and internal SD slot of DSi -# -------------------------------- - -# Root folder of the SD image -SDROOT ?= sdroot -# Name of the generated image it "DSi-1.sd" for no$gba in DSi mode -SDIMAGE := image.bin - -# Source code paths -# ----------------- - -SOURCEDIRS ?= source gfx/bin -INCLUDEDIRS ?= gfx -GFXDIRS ?= -BINDIRS ?= gfx/bin -AUDIODIRS ?= -NITROFSDIR ?= - -# Defines passed to all files -# --------------------------- - -DEFINES := -DPA_NO_DEPRECATION - -# Libraries -# --------- - -LIBS := -lmm9 -lnds9 -ldswifi9 -lpa9 -LIBDIRS := $(BLOCKSDS)/libs/maxmod \ - $(BLOCKSDS)/libs/dswifi \ - $(BLOCKSDS)/libs/libnds \ - $(BLOCKSDSEXT)/palib - -# Build artifacts -# --------------- - -BUILDDIR := build/$(NAME) -ELF := build/$(NAME).elf -DUMP := build/$(NAME).dump -MAP := build/$(NAME).map -ROM := $(NAME).nds - -# If NITROFSDIR is set, the soundbank created by mmutil will be saved to NitroFS -SOUNDBANKINFODIR := $(BUILDDIR)/maxmod -ifeq ($(strip $(NITROFSDIR)),) - SOUNDBANKDIR := $(BUILDDIR)/maxmod -else - SOUNDBANKDIR := $(BUILDDIR)/maxmod_nitrofs -endif - -# Tools -# ----- - -PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi- -CC := $(PREFIX)gcc -CXX := $(PREFIX)g++ -LD := $(PREFIX)gcc -OBJDUMP := $(PREFIX)objdump -MKDIR := mkdir -RM := rm -rf - -# Verbose flag -# ------------ - -ifeq ($(VERBOSE),1) -V := -else -V := @ -endif - -# Source files -# ------------ - -ifneq ($(BINDIRS),) - SOURCES_BIN_BIN := $(shell find -L $(BINDIRS) -name "*.bin") - SOURCES_BIN_BMP := $(shell find -L $(BINDIRS) -name "*.bmp") - SOURCES_BIN_JPG := $(shell find -L $(BINDIRS) -name "*.jpg") - SOURCES_BIN_PNG := $(shell find -L $(BINDIRS) -name "*.png") - SOURCES_BIN_GIF := $(shell find -L $(BINDIRS) -name "*.gif") - SOURCES_BIN_RAW := $(shell find -L $(BINDIRS) -name "*.raw") - SOURCES_BIN_MP3 := $(shell find -L $(BINDIRS) -name "*.mp3") - SOURCES_BIN_MOD := $(shell find -L $(BINDIRS) -name "*.mod") - INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(BINDIRS)) -endif -ifneq ($(GFXDIRS),) - SOURCES_PNG := $(shell find -L $(GFXDIRS) -name "*.png") - INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(GFXDIRS)) -endif -ifneq ($(AUDIODIRS),) - SOURCES_AUDIO := $(shell find -L $(AUDIODIRS) -regex '.*\.\(it\|mod\|s3m\|wav\|xm\)') - ifneq ($(SOURCES_AUDIO),) - INCLUDEDIRS += $(SOUNDBANKINFODIR) - endif -endif - -SOURCES_S := $(shell find -L $(SOURCEDIRS) -name "*.s") -SOURCES_C := $(shell find -L $(SOURCEDIRS) -name "*.c") -SOURCES_CPP := $(shell find -L $(SOURCEDIRS) -name "*.cpp") - -# Compiler and linker flags -# ------------------------- - -ARCH := -mthumb -mcpu=arm946e-s+nofp - -SPECS := $(BLOCKSDS)/sys/crts/ds_arm9.specs - -WARNFLAGS := -Wall - -ifeq ($(SOURCES_CPP),) - LIBS += -lc -else - LIBS += -lstdc++ -lc -endif - -INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \ - $(foreach path,$(LIBDIRS),-I$(path)/include) - -LIBDIRSFLAGS := $(foreach path,$(LIBDIRS),-L$(path)/lib) - -ASFLAGS += -x assembler-with-cpp $(INCLUDEFLAGS) $(DEFINES) \ - $(ARCH) -ffunction-sections -fdata-sections \ - -specs=$(SPECS) - -CFLAGS += -std=gnu17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \ - $(ARCH) -O2 -ffunction-sections -fdata-sections \ - -specs=$(SPECS) - -CXXFLAGS += -std=gnu++17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \ - $(ARCH) -O2 -ffunction-sections -fdata-sections \ - -fno-exceptions -fno-rtti \ - -specs=$(SPECS) - -LDFLAGS := $(ARCH) $(LIBDIRSFLAGS) -Wl,-Map,$(MAP) $(DEFINES) \ - -Wl,--start-group $(LIBS) -Wl,--end-group -specs=$(SPECS) - -# Intermediate build files -# ------------------------ - -OBJS_ASSETS := $(patsubst %.bin,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BIN))) \ - $(patsubst %.bmp,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BMP))) \ - $(patsubst %.jpg,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_JPG))) \ - $(patsubst %.png,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_PNG))) \ - $(patsubst %.gif,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_GIF))) \ - $(patsubst %.raw,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_RAW))) \ - $(patsubst %.mp3,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MP3))) \ - $(patsubst %.mod,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MOD))) \ - $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG))) - -HEADERS_ASSETS := $(patsubst %.bin,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BIN))) \ - $(patsubst %.bmp,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BMP))) \ - $(patsubst %.jpg,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_JPG))) \ - $(patsubst %.png,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_PNG))) \ - $(patsubst %.gif,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_GIF))) \ - $(patsubst %.raw,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_RAW))) \ - $(patsubst %.mp3,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MP3))) \ - $(patsubst %.mod,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MOD))) \ - $(patsubst %.png,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG))) - -ifneq ($(SOURCES_AUDIO),) - ifeq ($(strip $(NITROFSDIR)),) - OBJS_ASSETS += $(SOUNDBANKDIR)/soundbank.c.o - endif - HEADERS_ASSETS += $(SOUNDBANKINFODIR)/soundbank.h -endif - -OBJS_SOURCES := $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_S))) \ - $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_C))) \ - $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_CPP))) - -OBJS := $(OBJS_ASSETS) $(OBJS_SOURCES) - -DEPS := $(OBJS:.o=.d) - -# Targets -# ------- - -.PHONY: all clean dump dldipatch sdimage - -all: $(ROM) - -ifneq ($(strip $(NITROFSDIR)),) -# Additional arguments for ndstool -NDSTOOL_ARGS := -d $(NITROFSDIR) - -ifneq ($(SOURCES_AUDIO),) - NDSTOOL_ARGS += -d $(SOUNDBANKDIR) -endif - -# Make the NDS ROM depend on the filesystem only if it is needed -$(ROM): $(NITROFSDIR) -endif - -# Combine the title strings -ifeq ($(strip $(GAME_SUBTITLE)),) - GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_AUTHOR) -else - GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_SUBTITLE);$(GAME_AUTHOR) -endif - -$(ROM): $(ELF) - @echo " NDSTOOL $@" - $(V)$(BLOCKSDS)/tools/ndstool/ndstool -c $@ \ - -7 $(ARM7ELF) -9 $(ELF) \ - -b $(GAME_ICON) "$(GAME_FULL_TITLE)" \ - $(NDSTOOL_ARGS) - -$(ELF): $(OBJS) - @echo " LD $@" - $(V)$(LD) -o $@ $(OBJS) $(LDFLAGS) - -$(DUMP): $(ELF) - @echo " OBJDUMP $@" - $(V)$(OBJDUMP) -h -C -S $< > $@ - -dump: $(DUMP) - -clean: - @echo " CLEAN" - $(V)$(RM) $(ROM) $(DUMP) build $(SDIMAGE) - -sdimage: - @echo " MKFATIMG $(SDIMAGE) $(SDROOT)" - $(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(SDROOT) $(SDIMAGE) - -dldipatch: $(ROM) - @echo " DLDIPATCH $(ROM)" - $(V)$(BLOCKSDS)/tools/dldipatch/dldipatch patch \ - $(BLOCKSDS)/sys/dldi_r4/r4tf.dldi $(ROM) - -# Rules -# ----- - -$(BUILDDIR)/%.s.o : %.s - @echo " AS $<" - @$(MKDIR) -p $(@D) - $(V)$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $< - -$(BUILDDIR)/%.c.o : %.c - @echo " CC $<" - @$(MKDIR) -p $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $@ $< - -$(BUILDDIR)/%.arm.c.o : %.arm.c - @echo " CC $<" - @$(MKDIR) -p $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $< - -$(BUILDDIR)/%.cpp.o : %.cpp - @echo " CXX $<" - @$(MKDIR) -p $(@D) - $(V)$(CXX) $(CXXFLAGS) -MMD -MP -c -o $@ $< - -$(BUILDDIR)/%.arm.cpp.o : %.arm.cpp - @echo " CXX $<" - @$(MKDIR) -p $(@D) - $(V)$(CXX) $(CXXFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $< - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.bin - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.bmp - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.jpg - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.gif - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.raw - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.mp3 - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.mod - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.png - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.png.o $(BUILDDIR)/%.h : %.png %.grit - @echo " GRIT $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/grit/grit $< -ftc -W1 -o$(BUILDDIR)/$* - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.c - $(V)touch $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.h - -ifneq ($(SOURCES_AUDIO),) - -$(SOUNDBANKINFODIR)/soundbank.h: $(SOURCES_AUDIO) - @echo " MMUTIL $^" - @$(MKDIR) -p $(SOUNDBANKDIR) - @$(MKDIR) -p $(SOUNDBANKINFODIR) - @$(BLOCKSDS)/tools/mmutil/mmutil $^ -d \ - -o$(SOUNDBANKDIR)/soundbank.bin -h$(SOUNDBANKINFODIR)/soundbank.h - -ifeq ($(strip $(NITROFSDIR)),) -$(SOUNDBANKDIR)/soundbank.c.o: $(SOUNDBANKINFODIR)/soundbank.h - @echo " BIN2C soundbank.bin" - $(V)$(BLOCKSDS)/tools/bin2c/bin2c $(SOUNDBANKDIR)/soundbank.bin \ - $(SOUNDBANKDIR) - @echo " CC.9 soundbank_bin.c" - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(SOUNDBANKDIR)/soundbank.c.o \ - $(SOUNDBANKDIR)/soundbank_bin.c -endif - -endif - -# All assets must be built before the source code -# ----------------------------------------------- - -$(SOURCES_S) $(SOURCES_C) $(SOURCES_CPP): $(HEADERS_ASSETS) - -# Include dependency files if they exist -# -------------------------------------- - --include $(DEPS) +# SPDX-License-Identifier: CC0-1.0 +# +# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024 + +export BLOCKSDS ?= /opt/blocksds/core +export BLOCKSDSEXT ?= /opt/blocksds/external + +export WONDERFUL_TOOLCHAIN ?= /opt/wonderful +ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/ + +# User config +# =========== + +NAME ?= $(shell basename $(CURDIR)) + +GAME_TITLE ?= PAlib Project +GAME_SUBTITLE ?= Change this text +GAME_AUTHOR ?= for your project! +GAME_ICON ?= $(BLOCKSDSEXT)/palib/defaultlogo.bmp + +ARM7ELF ?= $(BLOCKSDSEXT)/palib/sys/arm7_maxmod_dswifi.elf + +# DLDI and internal SD slot of DSi +# -------------------------------- + +# Root folder of the SD image +SDROOT ?= sdroot +# Name of the generated image it "DSi-1.sd" for no$gba in DSi mode +SDIMAGE := image.bin + +# Source code paths +# ----------------- + +SOURCEDIRS ?= source gfx/bin +INCLUDEDIRS ?= gfx +GFXDIRS ?= +BINDIRS ?= gfx/bin +AUDIODIRS ?= +NITROFSDIR ?= + +# Defines passed to all files +# --------------------------- + +DEFINES := -DPA_NO_DEPRECATION + +# Libraries +# --------- + +LIBS := -lmm9 -lnds9 -ldswifi9 -lpa9 +LIBDIRS := $(BLOCKSDS)/libs/maxmod \ + $(BLOCKSDS)/libs/dswifi \ + $(BLOCKSDS)/libs/libnds \ + $(BLOCKSDSEXT)/palib + +# Build artifacts +# --------------- + +BUILDDIR := build/$(NAME) +ELF := build/$(NAME).elf +DUMP := build/$(NAME).dump +MAP := build/$(NAME).map +ROM := $(NAME).nds + +# If NITROFSDIR is set, the soundbank created by mmutil will be saved to NitroFS +SOUNDBANKINFODIR := $(BUILDDIR)/maxmod +ifeq ($(strip $(NITROFSDIR)),) + SOUNDBANKDIR := $(BUILDDIR)/maxmod +else + SOUNDBANKDIR := $(BUILDDIR)/maxmod_nitrofs +endif + +# Tools +# ----- + +PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi- +CC := $(PREFIX)gcc +CXX := $(PREFIX)g++ +LD := $(PREFIX)gcc +OBJDUMP := $(PREFIX)objdump +MKDIR := mkdir +RM := rm -rf + +# Verbose flag +# ------------ + +ifeq ($(VERBOSE),1) +V := +else +V := @ +endif + +# Source files +# ------------ + +ifneq ($(BINDIRS),) + SOURCES_BIN_BIN := $(shell find -L $(BINDIRS) -name "*.bin") + SOURCES_BIN_BMP := $(shell find -L $(BINDIRS) -name "*.bmp") + SOURCES_BIN_JPG := $(shell find -L $(BINDIRS) -name "*.jpg") + SOURCES_BIN_PNG := $(shell find -L $(BINDIRS) -name "*.png") + SOURCES_BIN_GIF := $(shell find -L $(BINDIRS) -name "*.gif") + SOURCES_BIN_RAW := $(shell find -L $(BINDIRS) -name "*.raw") + SOURCES_BIN_MP3 := $(shell find -L $(BINDIRS) -name "*.mp3") + SOURCES_BIN_MOD := $(shell find -L $(BINDIRS) -name "*.mod") + INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(BINDIRS)) +endif +ifneq ($(GFXDIRS),) + SOURCES_PNG := $(shell find -L $(GFXDIRS) -name "*.png") + INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(GFXDIRS)) +endif +ifneq ($(AUDIODIRS),) + SOURCES_AUDIO := $(shell find -L $(AUDIODIRS) -regex '.*\.\(it\|mod\|s3m\|wav\|xm\)') + ifneq ($(SOURCES_AUDIO),) + INCLUDEDIRS += $(SOUNDBANKINFODIR) + endif +endif + +SOURCES_S := $(shell find -L $(SOURCEDIRS) -name "*.s") +SOURCES_C := $(shell find -L $(SOURCEDIRS) -name "*.c") +SOURCES_CPP := $(shell find -L $(SOURCEDIRS) -name "*.cpp") + +# Compiler and linker flags +# ------------------------- + +ARCH := -mthumb -mcpu=arm946e-s+nofp + +SPECS := $(BLOCKSDS)/sys/crts/ds_arm9.specs + +WARNFLAGS := -Wall + +ifeq ($(SOURCES_CPP),) + LIBS += -lc +else + LIBS += -lstdc++ -lc +endif + +INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \ + $(foreach path,$(LIBDIRS),-I$(path)/include) + +LIBDIRSFLAGS := $(foreach path,$(LIBDIRS),-L$(path)/lib) + +ASFLAGS += -x assembler-with-cpp $(INCLUDEFLAGS) $(DEFINES) \ + $(ARCH) -ffunction-sections -fdata-sections \ + -specs=$(SPECS) + +CFLAGS += -std=gnu17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \ + $(ARCH) -O2 -ffunction-sections -fdata-sections \ + -specs=$(SPECS) + +CXXFLAGS += -std=gnu++17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \ + $(ARCH) -O2 -ffunction-sections -fdata-sections \ + -fno-exceptions -fno-rtti \ + -specs=$(SPECS) + +LDFLAGS := $(ARCH) $(LIBDIRSFLAGS) -Wl,-Map,$(MAP) $(DEFINES) \ + -Wl,--start-group $(LIBS) -Wl,--end-group -specs=$(SPECS) + +# Intermediate build files +# ------------------------ + +OBJS_ASSETS := $(patsubst %.bin,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BIN))) \ + $(patsubst %.bmp,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BMP))) \ + $(patsubst %.jpg,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_JPG))) \ + $(patsubst %.png,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_PNG))) \ + $(patsubst %.gif,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_GIF))) \ + $(patsubst %.raw,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_RAW))) \ + $(patsubst %.mp3,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MP3))) \ + $(patsubst %.mod,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MOD))) \ + $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG))) + +HEADERS_ASSETS := $(patsubst %.bin,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BIN))) \ + $(patsubst %.bmp,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BMP))) \ + $(patsubst %.jpg,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_JPG))) \ + $(patsubst %.png,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_PNG))) \ + $(patsubst %.gif,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_GIF))) \ + $(patsubst %.raw,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_RAW))) \ + $(patsubst %.mp3,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MP3))) \ + $(patsubst %.mod,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MOD))) \ + $(patsubst %.png,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG))) + +ifneq ($(SOURCES_AUDIO),) + ifeq ($(strip $(NITROFSDIR)),) + OBJS_ASSETS += $(SOUNDBANKDIR)/soundbank.c.o + endif + HEADERS_ASSETS += $(SOUNDBANKINFODIR)/soundbank.h +endif + +OBJS_SOURCES := $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_S))) \ + $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_C))) \ + $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_CPP))) + +OBJS := $(OBJS_ASSETS) $(OBJS_SOURCES) + +DEPS := $(OBJS:.o=.d) + +# Targets +# ------- + +.PHONY: all clean dump dldipatch sdimage + +all: $(ROM) + +ifneq ($(strip $(NITROFSDIR)),) +# Additional arguments for ndstool +NDSTOOL_ARGS := -d $(NITROFSDIR) + +ifneq ($(SOURCES_AUDIO),) + NDSTOOL_ARGS += -d $(SOUNDBANKDIR) +endif + +# Make the NDS ROM depend on the filesystem only if it is needed +$(ROM): $(NITROFSDIR) +endif + +# Combine the title strings +ifeq ($(strip $(GAME_SUBTITLE)),) + GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_AUTHOR) +else + GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_SUBTITLE);$(GAME_AUTHOR) +endif + +$(ROM): $(ELF) + @echo " NDSTOOL $@" + $(V)$(BLOCKSDS)/tools/ndstool/ndstool -c $@ \ + -7 $(ARM7ELF) -9 $(ELF) \ + -b $(GAME_ICON) "$(GAME_FULL_TITLE)" \ + $(NDSTOOL_ARGS) + +$(ELF): $(OBJS) + @echo " LD $@" + $(V)$(LD) -o $@ $(OBJS) $(LDFLAGS) + +$(DUMP): $(ELF) + @echo " OBJDUMP $@" + $(V)$(OBJDUMP) -h -C -S $< > $@ + +dump: $(DUMP) + +clean: + @echo " CLEAN" + $(V)$(RM) $(ROM) $(DUMP) build $(SDIMAGE) + +sdimage: + @echo " MKFATIMG $(SDIMAGE) $(SDROOT)" + $(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(SDROOT) $(SDIMAGE) + +dldipatch: $(ROM) + @echo " DLDIPATCH $(ROM)" + $(V)$(BLOCKSDS)/tools/dldipatch/dldipatch patch \ + $(BLOCKSDS)/sys/dldi_r4/r4tf.dldi $(ROM) + +# Rules +# ----- + +$(BUILDDIR)/%.s.o : %.s + @echo " AS $<" + @$(MKDIR) -p $(@D) + $(V)$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $< + +$(BUILDDIR)/%.c.o : %.c + @echo " CC $<" + @$(MKDIR) -p $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $@ $< + +$(BUILDDIR)/%.arm.c.o : %.arm.c + @echo " CC $<" + @$(MKDIR) -p $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $< + +$(BUILDDIR)/%.cpp.o : %.cpp + @echo " CXX $<" + @$(MKDIR) -p $(@D) + $(V)$(CXX) $(CXXFLAGS) -MMD -MP -c -o $@ $< + +$(BUILDDIR)/%.arm.cpp.o : %.arm.cpp + @echo " CXX $<" + @$(MKDIR) -p $(@D) + $(V)$(CXX) $(CXXFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $< + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.bin + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.bmp + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.jpg + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.gif + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.raw + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.mp3 + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.mod + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.png + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.png.o $(BUILDDIR)/%.h : %.png %.grit + @echo " GRIT $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/grit/grit $< -ftc -W1 -o$(BUILDDIR)/$* + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.c + $(V)touch $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.h + +ifneq ($(SOURCES_AUDIO),) + +$(SOUNDBANKINFODIR)/soundbank.h: $(SOURCES_AUDIO) + @echo " MMUTIL $^" + @$(MKDIR) -p $(SOUNDBANKDIR) + @$(MKDIR) -p $(SOUNDBANKINFODIR) + @$(BLOCKSDS)/tools/mmutil/mmutil $^ -d \ + -o$(SOUNDBANKDIR)/soundbank.bin -h$(SOUNDBANKINFODIR)/soundbank.h + +ifeq ($(strip $(NITROFSDIR)),) +$(SOUNDBANKDIR)/soundbank.c.o: $(SOUNDBANKINFODIR)/soundbank.h + @echo " BIN2C soundbank.bin" + $(V)$(BLOCKSDS)/tools/bin2c/bin2c $(SOUNDBANKDIR)/soundbank.bin \ + $(SOUNDBANKDIR) + @echo " CC.9 soundbank_bin.c" + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(SOUNDBANKDIR)/soundbank.c.o \ + $(SOUNDBANKDIR)/soundbank_bin.c +endif + +endif + +# All assets must be built before the source code +# ----------------------------------------------- + +$(SOURCES_S) $(SOURCES_C) $(SOURCES_CPP): $(HEADERS_ASSETS) + +# Include dependency files if they exist +# -------------------------------------- + +-include $(DEPS) diff --git a/examples/Math/AngleSinCos/Makefile b/examples/Math/AngleSinCos/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Math/AngleSinCos/Makefile +++ b/examples/Math/AngleSinCos/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Math/AngleSinCos/gfx/all_gfx.h b/examples/Math/AngleSinCos/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Math/AngleSinCos/gfx/all_gfx.h +++ b/examples/Math/AngleSinCos/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Math/AngleSinCos/source/main.c b/examples/Math/AngleSinCos/source/main.c index 67296b9..78d756a 100644 --- a/examples/Math/AngleSinCos/source/main.c +++ b/examples/Math/AngleSinCos/source/main.c @@ -1,46 +1,46 @@ - -// Includes -#include - -// PAGfxConverter Include -#include "all_gfx.h" -int main(void){ - - PA_Init(); - - PA_LoadDefaultText(1,0); // On the top screen - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); - - PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); // Create the ship in the center... - PA_SetSpriteRotEnable(0,0,0);// Enable rotations and use Rotset 0... - - s32 x = (128-16) << 8; // ship x position in 8bit fixed point - s32 y = (96-16) << 8; // Y - u16 angle = 0; // direction in which to move ! - - - - while(1) - { - angle += Pad.Held.Left - Pad.Held.Right; - PA_SetRotsetNoZoom(0, 0, angle); // Turn the ship in the correct direction - - if (Pad.Held.Up){ // Move forward - x += PA_Cos(angle); - y -= PA_Sin(angle); - } - if (Pad.Held.Down){ // Move backwards - x += -PA_Cos(angle); - y -= -PA_Sin(angle); - } - - PA_OutputText(1, 5, 10, "Angle : %d ", angle); - - PA_SetSpriteXY(0, 0, x>>8, y>>8); // Sprite position converted to normal... - - PA_WaitForVBL(); - - } - return 0; + +// Includes +#include + +// PAGfxConverter Include +#include "all_gfx.h" +int main(void){ + + PA_Init(); + + PA_LoadDefaultText(1,0); // On the top screen + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); + + PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); // Create the ship in the center... + PA_SetSpriteRotEnable(0,0,0);// Enable rotations and use Rotset 0... + + s32 x = (128-16) << 8; // ship x position in 8bit fixed point + s32 y = (96-16) << 8; // Y + u16 angle = 0; // direction in which to move ! + + + + while(1) + { + angle += Pad.Held.Left - Pad.Held.Right; + PA_SetRotsetNoZoom(0, 0, angle); // Turn the ship in the correct direction + + if (Pad.Held.Up){ // Move forward + x += PA_Cos(angle); + y -= PA_Sin(angle); + } + if (Pad.Held.Down){ // Move backwards + x += -PA_Cos(angle); + y -= -PA_Sin(angle); + } + + PA_OutputText(1, 5, 10, "Angle : %d ", angle); + + PA_SetSpriteXY(0, 0, x>>8, y>>8); // Sprite position converted to normal... + + PA_WaitForVBL(); + + } + return 0; } \ No newline at end of file diff --git a/examples/Math/CollisionRect/Makefile b/examples/Math/CollisionRect/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Math/CollisionRect/Makefile +++ b/examples/Math/CollisionRect/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Math/CollisionRect/gfx/all_gfx.h b/examples/Math/CollisionRect/gfx/all_gfx.h index 4895331..962d551 100644 --- a/examples/Math/CollisionRect/gfx/all_gfx.h +++ b/examples/Math/CollisionRect/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char rect_Sprite[512] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char rect_Sprite[512] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Math/CollisionRect/source/main.c b/examples/Math/CollisionRect/source/main.c index 28b7d4f..4874bac 100644 --- a/examples/Math/CollisionRect/source/main.c +++ b/examples/Math/CollisionRect/source/main.c @@ -1,39 +1,39 @@ - -// Includes -#include - -// PAGfxConverter Include -#include "all_gfx.h" -int main(void){ - - PA_Init(); - - PA_LoadDefaultText(1,0); // On the top screen - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); - - // This'll be the movable sprite... - PA_CreateSprite(0, 0,(void*)rect_Sprite, OBJ_SIZE_32X16,1, 0, 0, 0); - s32 x1 = 16; s32 y1 = 8; // Sprite's center position - s8 w1 = 32; s8 h1 = 16; // width and height... - - // This will be the fixed circle - PA_CreateSprite(0, 1,(void*)rect_Sprite, OBJ_SIZE_16X32,1, 0, 128-8, 96-16); - s32 x2 = 128; s32 y2 = 96; // Sprite's center position - s8 w2 = 16; s8 h2 = 32; // width and height... - - while(1) - { - if (PA_MoveSprite(0)){ - x1 = PA_MovedSprite.X; - y1 = PA_MovedSprite.Y; - } - - // Collision ? - if ((x2 >= x1 - (w1 + w2)/2) && (x2 <= x1 + (w1 + w2)/2) && (y2 >= y1 - (h1 + h2)/2) && (y2 <= y1 + (h1 + h2)/2)) PA_OutputText(1, 2, 10, "Collision !!"); - else PA_OutputText(1, 2, 10, " "); - - PA_WaitForVBL(); - } - return 0; + +// Includes +#include + +// PAGfxConverter Include +#include "all_gfx.h" +int main(void){ + + PA_Init(); + + PA_LoadDefaultText(1,0); // On the top screen + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); + + // This'll be the movable sprite... + PA_CreateSprite(0, 0,(void*)rect_Sprite, OBJ_SIZE_32X16,1, 0, 0, 0); + s32 x1 = 16; s32 y1 = 8; // Sprite's center position + s8 w1 = 32; s8 h1 = 16; // width and height... + + // This will be the fixed circle + PA_CreateSprite(0, 1,(void*)rect_Sprite, OBJ_SIZE_16X32,1, 0, 128-8, 96-16); + s32 x2 = 128; s32 y2 = 96; // Sprite's center position + s8 w2 = 16; s8 h2 = 32; // width and height... + + while(1) + { + if (PA_MoveSprite(0)){ + x1 = PA_MovedSprite.X; + y1 = PA_MovedSprite.Y; + } + + // Collision ? + if ((x2 >= x1 - (w1 + w2)/2) && (x2 <= x1 + (w1 + w2)/2) && (y2 >= y1 - (h1 + h2)/2) && (y2 <= y1 + (h1 + h2)/2)) PA_OutputText(1, 2, 10, "Collision !!"); + else PA_OutputText(1, 2, 10, " "); + + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Math/CollisionRound/Makefile b/examples/Math/CollisionRound/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Math/CollisionRound/Makefile +++ b/examples/Math/CollisionRound/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Math/CollisionRound/gfx/all_gfx.h b/examples/Math/CollisionRound/gfx/all_gfx.h index 3f82848..fd212f1 100644 --- a/examples/Math/CollisionRound/gfx/all_gfx.h +++ b/examples/Math/CollisionRound/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char circle_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char circle_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Math/CollisionRound/source/main.c b/examples/Math/CollisionRound/source/main.c index 78b5b98..2f0a450 100644 --- a/examples/Math/CollisionRound/source/main.c +++ b/examples/Math/CollisionRound/source/main.c @@ -1,36 +1,36 @@ - -// Includes -#include - -// PAGfxConverter Include -#include "all_gfx.h" -int main(void){ - - PA_Init(); - - PA_LoadDefaultText(1,0); // On the top screen - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); - - // This'll be the movable sprite... - PA_CreateSprite(0, 0,(void*)circle_Sprite, OBJ_SIZE_32X32,1, 0, 16, 16); - s32 x = 16; s32 y = 16; // Sprite's center position - - // This will be the fixed circle - PA_CreateSprite(0, 1,(void*)circle_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); - - while(1) - { - if (PA_MoveSprite(0)){ - x = PA_MovedSprite.X; - y = PA_MovedSprite.Y; - } - - // Collision ? - if (PA_Distance(x, y, 128, 96) < 32*32) PA_OutputText(1, 2, 10, "Collision !!"); - else PA_OutputText(1, 2, 10, " "); - - PA_WaitForVBL(); - } - return 0; + +// Includes +#include + +// PAGfxConverter Include +#include "all_gfx.h" +int main(void){ + + PA_Init(); + + PA_LoadDefaultText(1,0); // On the top screen + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); + + // This'll be the movable sprite... + PA_CreateSprite(0, 0,(void*)circle_Sprite, OBJ_SIZE_32X32,1, 0, 16, 16); + s32 x = 16; s32 y = 16; // Sprite's center position + + // This will be the fixed circle + PA_CreateSprite(0, 1,(void*)circle_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); + + while(1) + { + if (PA_MoveSprite(0)){ + x = PA_MovedSprite.X; + y = PA_MovedSprite.Y; + } + + // Collision ? + if (PA_Distance(x, y, 128, 96) < 32*32) PA_OutputText(1, 2, 10, "Collision !!"); + else PA_OutputText(1, 2, 10, " "); + + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Math/FixedPoint/Makefile b/examples/Math/FixedPoint/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Math/FixedPoint/Makefile +++ b/examples/Math/FixedPoint/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Math/FixedPoint/gfx/all_gfx.h b/examples/Math/FixedPoint/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Math/FixedPoint/gfx/all_gfx.h +++ b/examples/Math/FixedPoint/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Math/FixedPoint/source/main.c b/examples/Math/FixedPoint/source/main.c index 7c377af..7a82418 100644 --- a/examples/Math/FixedPoint/source/main.c +++ b/examples/Math/FixedPoint/source/main.c @@ -1,45 +1,45 @@ -#include - -// PAGfxConverter Include -#include "all_gfx.h" - -int main(void){ - - PA_Init(); //PAlib inits - - PA_LoadDefaultText(0, 0); - - s32 speed1 = 256; // first speed...0 - PA_OutputText(0, 15, 2, " 1 pixel/frame"); - - s32 speed2 = 128; - PA_OutputText(0, 15, 10, "0.5 pixel/frame"); - - s32 speed3 = 64; - PA_OutputText(0, 15, 18, "0.25 pixel/frame"); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette name - - PA_CreateSprite(0, 0, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 0); - PA_CreateSprite(0, 1, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 64); - PA_CreateSprite(0, 2, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 128); - - // all sprites stick to the left - s32 spritex1 = 0; s32 spritex2 = 0; s32 spritex3 = 0; - - - while(1) // Infinite loops - { - // Move all the sprites by their corresponding speed - spritex1 += speed1; spritex2 += speed2; spritex3 += speed3; - - // Positionne all the sprites, >>8 to return to normal position - PA_SetSpriteX(0, 0, spritex1>>8); - PA_SetSpriteX(0, 1, spritex2>>8); - PA_SetSpriteX(0, 2, spritex3>>8); - - PA_WaitForVBL(); - } - -return 0; +#include + +// PAGfxConverter Include +#include "all_gfx.h" + +int main(void){ + + PA_Init(); //PAlib inits + + PA_LoadDefaultText(0, 0); + + s32 speed1 = 256; // first speed...0 + PA_OutputText(0, 15, 2, " 1 pixel/frame"); + + s32 speed2 = 128; + PA_OutputText(0, 15, 10, "0.5 pixel/frame"); + + s32 speed3 = 64; + PA_OutputText(0, 15, 18, "0.25 pixel/frame"); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette name + + PA_CreateSprite(0, 0, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 0); + PA_CreateSprite(0, 1, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 64); + PA_CreateSprite(0, 2, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 128); + + // all sprites stick to the left + s32 spritex1 = 0; s32 spritex2 = 0; s32 spritex3 = 0; + + + while(1) // Infinite loops + { + // Move all the sprites by their corresponding speed + spritex1 += speed1; spritex2 += speed2; spritex3 += speed3; + + // Positionne all the sprites, >>8 to return to normal position + PA_SetSpriteX(0, 0, spritex1>>8); + PA_SetSpriteX(0, 1, spritex2>>8); + PA_SetSpriteX(0, 2, spritex3>>8); + + PA_WaitForVBL(); + } + +return 0; } \ No newline at end of file diff --git a/examples/Math/GetAngle/Makefile b/examples/Math/GetAngle/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Math/GetAngle/Makefile +++ b/examples/Math/GetAngle/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Math/GetAngle/gfx/bin/master.pal.c b/examples/Math/GetAngle/gfx/bin/master.pal.c index 998edc6..b9083fc 100644 --- a/examples/Math/GetAngle/gfx/bin/master.pal.c +++ b/examples/Math/GetAngle/gfx/bin/master.pal.c @@ -1,35 +1,35 @@ -const unsigned short master_Palette[256] = { -0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, -0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - +const unsigned short master_Palette[256] = { +0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, +0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + diff --git a/examples/Math/GetAngle/gfx/bin/vaisseau.raw.c b/examples/Math/GetAngle/gfx/bin/vaisseau.raw.c index 443eeda..eb981ac 100644 --- a/examples/Math/GetAngle/gfx/bin/vaisseau.raw.c +++ b/examples/Math/GetAngle/gfx/bin/vaisseau.raw.c @@ -1,70 +1,70 @@ -// -// vaisseau (1024 uncompressed bytes) -// -const unsigned char vaisseau_Bitmap[1024] = { -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, -0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, -0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, -0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, -0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, -0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, -0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, -0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, -0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, -0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, -0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, -0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, -0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, -0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, -0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, -0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, -0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, -0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, -0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, -0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - +// +// vaisseau (1024 uncompressed bytes) +// +const unsigned char vaisseau_Bitmap[1024] = { +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, +0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, +0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, +0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, +0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, +0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, +0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, +0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, +0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, +0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, +0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, +0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, +0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, +0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, +0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, +0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, +0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, +0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, +0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, +0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + diff --git a/examples/Math/GetAngle/source/main.c b/examples/Math/GetAngle/source/main.c index 4dd3485..c4cc1f2 100644 --- a/examples/Math/GetAngle/source/main.c +++ b/examples/Math/GetAngle/source/main.c @@ -1,28 +1,28 @@ - -// Includes -#include - -extern const unsigned short master_Palette[256]; -extern const unsigned char vaisseau_Bitmap[1024]; - -int main(void){ - - PA_Init(); - - PA_LoadDefaultText(1,0); // On the top screen - - PA_LoadSpritePal(0, 0, (void*)master_Palette); - - PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); - - while(1) - { - - PA_OutputText(1, 5, 10, "Angle : %d ", PA_GetAngle(128, 96, Stylus.X, Stylus.Y)); - - - PA_WaitForVBL(); - - } - return 0; + +// Includes +#include + +extern const unsigned short master_Palette[256]; +extern const unsigned char vaisseau_Bitmap[1024]; + +int main(void){ + + PA_Init(); + + PA_LoadDefaultText(1,0); // On the top screen + + PA_LoadSpritePal(0, 0, (void*)master_Palette); + + PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); + + while(1) + { + + PA_OutputText(1, 5, 10, "Angle : %d ", PA_GetAngle(128, 96, Stylus.X, Stylus.Y)); + + + PA_WaitForVBL(); + + } + return 0; } \ No newline at end of file diff --git a/examples/Math/Gravity/Makefile b/examples/Math/Gravity/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Math/Gravity/Makefile +++ b/examples/Math/Gravity/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Math/Gravity/gfx/all_gfx.h b/examples/Math/Gravity/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Math/Gravity/gfx/all_gfx.h +++ b/examples/Math/Gravity/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Math/Gravity/source/main.c b/examples/Math/Gravity/source/main.c index 90b370e..063cb08 100644 --- a/examples/Math/Gravity/source/main.c +++ b/examples/Math/Gravity/source/main.c @@ -1,70 +1,70 @@ -#include - -// PAGfxConverter Include -#include "all_gfx.h" - -#define FLOOR (160<<8) // Floor y level - - - -int main(void){ - - PA_Init(); //PAlib inits - - PA_LoadDefaultText(1, 0); - - PA_OutputText(1, 2, 4, "Press A to take off !"); - PA_OutputText(1, 2, 5, "Gravity change : Left/Right"); - PA_OutputText(1, 2, 7, "Takeoff Speed change : Up/Down"); - - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - PA_CreateSprite(0, // Screen - 0, // Sprite number - (void*)vaisseau_Sprite, // Sprite name - OBJ_SIZE_32X32, // Sprite size - 1, // 256 color mode - 0, // Sprite palette number - 50, 50); // X and Y position on the screen - - - s32 gravity = 32; // change the gravity and check the result :) - s32 velocity_y = 0; - s32 spritey = 190<<8; // at the bottom - s32 takeoffspeed = 1000; // Takeoff speed... - - while(1) // Infinite loops - { - - takeoffspeed += (Pad.Held.Up - Pad.Held.Down)*8; // Change takeoff speed... - gravity += (Pad.Held.Right - Pad.Held.Left)*2; // Change gravity speed... - - PA_OutputText(1, 4, 8, "Takeoff speed : %d ", takeoffspeed); - PA_OutputText(1, 4, 6, "Gravity : %d ", gravity); - - if((spritey <= FLOOR) && Pad.Newpress.A) { // YOu can jump if not in the air... - velocity_y = -takeoffspeed; // Change the base speed to see the result... - } - - // Moves all the time... - velocity_y += gravity; // Gravity... - spritey += velocity_y; // Speed... - - if(spritey >= FLOOR) // Gets to the floor ! - { - velocity_y = 0; - spritey = FLOOR; - } - - PA_OutputText(1, 0, 0, "Y : %d \nVY : %d ", spritey, velocity_y); - - if (spritey>>8 > -32) PA_SetSpriteY(0, 0, spritey>>8); // show if on screen - else PA_SetSpriteY(0, 0, 192); - - PA_WaitForVBL(); - } - -return 0; +#include + +// PAGfxConverter Include +#include "all_gfx.h" + +#define FLOOR (160<<8) // Floor y level + + + +int main(void){ + + PA_Init(); //PAlib inits + + PA_LoadDefaultText(1, 0); + + PA_OutputText(1, 2, 4, "Press A to take off !"); + PA_OutputText(1, 2, 5, "Gravity change : Left/Right"); + PA_OutputText(1, 2, 7, "Takeoff Speed change : Up/Down"); + + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + PA_CreateSprite(0, // Screen + 0, // Sprite number + (void*)vaisseau_Sprite, // Sprite name + OBJ_SIZE_32X32, // Sprite size + 1, // 256 color mode + 0, // Sprite palette number + 50, 50); // X and Y position on the screen + + + s32 gravity = 32; // change the gravity and check the result :) + s32 velocity_y = 0; + s32 spritey = 190<<8; // at the bottom + s32 takeoffspeed = 1000; // Takeoff speed... + + while(1) // Infinite loops + { + + takeoffspeed += (Pad.Held.Up - Pad.Held.Down)*8; // Change takeoff speed... + gravity += (Pad.Held.Right - Pad.Held.Left)*2; // Change gravity speed... + + PA_OutputText(1, 4, 8, "Takeoff speed : %d ", takeoffspeed); + PA_OutputText(1, 4, 6, "Gravity : %d ", gravity); + + if((spritey <= FLOOR) && Pad.Newpress.A) { // YOu can jump if not in the air... + velocity_y = -takeoffspeed; // Change the base speed to see the result... + } + + // Moves all the time... + velocity_y += gravity; // Gravity... + spritey += velocity_y; // Speed... + + if(spritey >= FLOOR) // Gets to the floor ! + { + velocity_y = 0; + spritey = FLOOR; + } + + PA_OutputText(1, 0, 0, "Y : %d \nVY : %d ", spritey, velocity_y); + + if (spritey>>8 > -32) PA_SetSpriteY(0, 0, spritey>>8); // show if on screen + else PA_SetSpriteY(0, 0, 192); + + PA_WaitForVBL(); + } + +return 0; } \ No newline at end of file diff --git a/examples/Math/Gravity2/Makefile b/examples/Math/Gravity2/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Math/Gravity2/Makefile +++ b/examples/Math/Gravity2/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Math/Gravity2/gfx/all_gfx.h b/examples/Math/Gravity2/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Math/Gravity2/gfx/all_gfx.h +++ b/examples/Math/Gravity2/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Math/Gravity2/source/main.c b/examples/Math/Gravity2/source/main.c index e85978d..0f97291 100644 --- a/examples/Math/Gravity2/source/main.c +++ b/examples/Math/Gravity2/source/main.c @@ -1,72 +1,72 @@ -#include - -// PAGfxConverter Include -#include "all_gfx.h" - -#define FLOOR (160<<8) // Floor y level - - - -int main(void){ - - PA_Init(); //PAlib inits - - PA_LoadDefaultText(1, 0); - - PA_OutputText(1, 2, 4, "Press A to take off !"); - PA_OutputText(1, 2, 5, "Gravity change : Left/Right"); - PA_OutputText(1, 2, 7, "Takeoff Speed change : Up/Down"); - - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - PA_CreateSprite(0, // Screen - 0, // Sprite number - (void*)vaisseau_Sprite, // Sprite name - OBJ_SIZE_32X32, // Sprite size - 1, // 256 color mode - 0, // Sprite palette number - 50, 50); // X and Y position on the screen - - - s32 gravity = 32; // change the gravity and check the result :) - s32 velocity_y = 0; - s32 spritey = 190<<8; // at the bottom - s32 jumpheight = 1024; // Takeoff speed... - - while(1) // Infinite loops - { - - jumpheight += (Pad.Held.Up - Pad.Held.Down); // Change takeoff speed... - gravity += (Pad.Held.Right - Pad.Held.Left); // Change gravity speed... - - PA_OutputText(1, 4, 8, "Jump height: %d ", jumpheight); - PA_OutputText(1, 4, 6, "Gravity: %d ", gravity); - - if((spritey <= FLOOR) && Pad.Newpress.A) { // YOu can jump if not in the air... - velocity_y = -jumpheight; // Change the base speed to see the result... - } - - // Moves all the time... - velocity_y += gravity; // Gravity... - spritey += velocity_y; // Speed... - - - if(spritey >= FLOOR) // Gets to the floor ! - { - velocity_y = 0; - spritey = FLOOR; - } - - - PA_OutputText(1, 0, 0, "Y : %d \nVY : %d ", spritey>>8, velocity_y); - - if (spritey>>8 > -32) PA_SetSpriteY(0, 0, spritey>>8); // show if on screen - else PA_SetSpriteY(0, 0, 192); - - PA_WaitForVBL(); - } - -return 0; +#include + +// PAGfxConverter Include +#include "all_gfx.h" + +#define FLOOR (160<<8) // Floor y level + + + +int main(void){ + + PA_Init(); //PAlib inits + + PA_LoadDefaultText(1, 0); + + PA_OutputText(1, 2, 4, "Press A to take off !"); + PA_OutputText(1, 2, 5, "Gravity change : Left/Right"); + PA_OutputText(1, 2, 7, "Takeoff Speed change : Up/Down"); + + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + PA_CreateSprite(0, // Screen + 0, // Sprite number + (void*)vaisseau_Sprite, // Sprite name + OBJ_SIZE_32X32, // Sprite size + 1, // 256 color mode + 0, // Sprite palette number + 50, 50); // X and Y position on the screen + + + s32 gravity = 32; // change the gravity and check the result :) + s32 velocity_y = 0; + s32 spritey = 190<<8; // at the bottom + s32 jumpheight = 1024; // Takeoff speed... + + while(1) // Infinite loops + { + + jumpheight += (Pad.Held.Up - Pad.Held.Down); // Change takeoff speed... + gravity += (Pad.Held.Right - Pad.Held.Left); // Change gravity speed... + + PA_OutputText(1, 4, 8, "Jump height: %d ", jumpheight); + PA_OutputText(1, 4, 6, "Gravity: %d ", gravity); + + if((spritey <= FLOOR) && Pad.Newpress.A) { // YOu can jump if not in the air... + velocity_y = -jumpheight; // Change the base speed to see the result... + } + + // Moves all the time... + velocity_y += gravity; // Gravity... + spritey += velocity_y; // Speed... + + + if(spritey >= FLOOR) // Gets to the floor ! + { + velocity_y = 0; + spritey = FLOOR; + } + + + PA_OutputText(1, 0, 0, "Y : %d \nVY : %d ", spritey>>8, velocity_y); + + if (spritey>>8 > -32) PA_SetSpriteY(0, 0, spritey>>8); // show if on screen + else PA_SetSpriteY(0, 0, 192); + + PA_WaitForVBL(); + } + +return 0; } \ No newline at end of file diff --git a/examples/Math/PathFinding2/Makefile b/examples/Math/PathFinding2/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Math/PathFinding2/Makefile +++ b/examples/Math/PathFinding2/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Math/PathFinding2/source/main.c b/examples/Math/PathFinding2/source/main.c index 75cbd9f..80c5378 100644 --- a/examples/Math/PathFinding2/source/main.c +++ b/examples/Math/PathFinding2/source/main.c @@ -1,86 +1,86 @@ -#include - -#define PA_DrawBigPixel(screen,x,y,zoom,color) PA_Draw16bitRect(screen, x*a-(a/2), y*a-(a/2),x*a+(a/2), y*a+(a/2), color) - -int main(void){ - PA_Init();//init PAlib - int x = 0,y = 0,width=32,height=32,i,j, arriveex = 24, arriveey = 24, a=8; - - PA_LoadDefaultText(1,2);//init the text in the up screen - PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); // Set the bottom screen color to white - PA_Init16bitBg(0, 3);//init the 16bit mode in bottom screen - PA_InitAstar(width, height);//init the Astar function - for(j=0;j + +#define PA_DrawBigPixel(screen,x,y,zoom,color) PA_Draw16bitRect(screen, x*a-(a/2), y*a-(a/2),x*a+(a/2), y*a+(a/2), color) + +int main(void){ + PA_Init();//init PAlib + int x = 0,y = 0,width=32,height=32,i,j, arriveex = 24, arriveey = 24, a=8; + + PA_LoadDefaultText(1,2);//init the text in the up screen + PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); // Set the bottom screen color to white + PA_Init16bitBg(0, 3);//init the 16bit mode in bottom screen + PA_InitAstar(width, height);//init the Astar function + for(j=0;j -const unsigned short master_Palette[256]; -const unsigned char vaisseau_Bitmap[1024]; - -//Fonction principale du code -int main(void){ - //Initialision de PAlib - PA_Init(); - PA_LoadDefaultText(0,0); - PA_LoadPal(PAL_SPRITE0, master_Palette); - PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 0, 0); - int x = 0,y = 0,a=1,i,j, arriveex = 4, arriveey = 4; - - PA_LoadDefaultText(1,2); - PA_LoadDefaultText(0,2); - - while(1){ - if(Pad.Held.Up) a++; - - if(x == arriveex && y == arriveey){ - x=0; - y=0; - } - for(j=0;j<5+a;j++) - for(i=0;i<5+a;i++){ - PA_OutputText(1,i*2,j,"0"); - } - - PA_OutputText(1,x*2,y,"1"); - PA_OutputText(1,1*2,0,"5"); - PA_OutputText(1,1*2,1,"5"); - PA_OutputText(1,2*2,2,"5"); - PA_OutputText(1,2*2,3,"5"); - PA_OutputText(1,arriveex*2,arriveey,"2"); - - PA_InitAstar(5+a, 5+a); // Initialise to the size of the mase you want... - for(j=0;j<5+a;j++) - for(i=0;i<5+a;i++) - maze[i][j]=0; - - maze[x][y]=1; - maze[arriveex][arriveey]=2; - maze[1][0]=5; - maze[1][1]=5; - maze[2][2]=5; - maze[2][3]=5; - - PA_OutputText(0,1,1," "); - PA_OutputText(0,1,2,"%d",a); - - switch(PA_Astar(5+a,5+a)){ - case 1: { - PA_OutputText(0,1,1,"Left "); - x--; - break; - } - case 2: { - PA_OutputText(0,1,1,"Right "); - x++; - break; - } - case 3:{ - PA_OutputText(0,1,1,"Up "); - y--; - break; - } - case 4:{ - PA_OutputText(0,1,1,"Down "); - y++; - break; - } - } - PA_SetSpriteXY(0,0,x*10,y*10); - for(i=0;i<30; i++) PA_WaitForVBL(); // wait half a second - - - } - return 0; +//copyright smealum http://jvteamds.free.fr +// Les Includes +#include +const unsigned short master_Palette[256]; +const unsigned char vaisseau_Bitmap[1024]; + +//Fonction principale du code +int main(void){ + //Initialision de PAlib + PA_Init(); + PA_LoadDefaultText(0,0); + PA_LoadPal(PAL_SPRITE0, master_Palette); + PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 0, 0); + int x = 0,y = 0,a=1,i,j, arriveex = 4, arriveey = 4; + + PA_LoadDefaultText(1,2); + PA_LoadDefaultText(0,2); + + while(1){ + if(Pad.Held.Up) a++; + + if(x == arriveex && y == arriveey){ + x=0; + y=0; + } + for(j=0;j<5+a;j++) + for(i=0;i<5+a;i++){ + PA_OutputText(1,i*2,j,"0"); + } + + PA_OutputText(1,x*2,y,"1"); + PA_OutputText(1,1*2,0,"5"); + PA_OutputText(1,1*2,1,"5"); + PA_OutputText(1,2*2,2,"5"); + PA_OutputText(1,2*2,3,"5"); + PA_OutputText(1,arriveex*2,arriveey,"2"); + + PA_InitAstar(5+a, 5+a); // Initialise to the size of the mase you want... + for(j=0;j<5+a;j++) + for(i=0;i<5+a;i++) + maze[i][j]=0; + + maze[x][y]=1; + maze[arriveex][arriveey]=2; + maze[1][0]=5; + maze[1][1]=5; + maze[2][2]=5; + maze[2][3]=5; + + PA_OutputText(0,1,1," "); + PA_OutputText(0,1,2,"%d",a); + + switch(PA_Astar(5+a,5+a)){ + case 1: { + PA_OutputText(0,1,1,"Left "); + x--; + break; + } + case 2: { + PA_OutputText(0,1,1,"Right "); + x++; + break; + } + case 3:{ + PA_OutputText(0,1,1,"Up "); + y--; + break; + } + case 4:{ + PA_OutputText(0,1,1,"Down "); + y++; + break; + } + } + PA_SetSpriteXY(0,0,x*10,y*10); + for(i=0;i<30; i++) PA_WaitForVBL(); // wait half a second + + + } + return 0; } \ No newline at end of file diff --git a/examples/Math/Pathfinding1/Makefile b/examples/Math/Pathfinding1/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Math/Pathfinding1/Makefile +++ b/examples/Math/Pathfinding1/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Math/Pathfinding1/gfx/bin/Readme.txt b/examples/Math/Pathfinding1/gfx/bin/Readme.txt index e6ba050..8b80ebf 100644 --- a/examples/Math/Pathfinding1/gfx/bin/Readme.txt +++ b/examples/Math/Pathfinding1/gfx/bin/Readme.txt @@ -1,5 +1,5 @@ -Space Ship sprite found here: -http://www.reinerstileset.4players.de:1059/englisch.htm - -Stars / Space texture found here: +Space Ship sprite found here: +http://www.reinerstileset.4players.de:1059/englisch.htm + +Stars / Space texture found here: http://www.grsites.com/textures/ \ No newline at end of file diff --git a/examples/Math/Pathfinding1/gfx/bin/master.pal.c b/examples/Math/Pathfinding1/gfx/bin/master.pal.c index 998edc6..b9083fc 100644 --- a/examples/Math/Pathfinding1/gfx/bin/master.pal.c +++ b/examples/Math/Pathfinding1/gfx/bin/master.pal.c @@ -1,35 +1,35 @@ -const unsigned short master_Palette[256] = { -0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, -0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - +const unsigned short master_Palette[256] = { +0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, +0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + diff --git a/examples/Math/Pathfinding1/gfx/bin/vaisseau.raw.c b/examples/Math/Pathfinding1/gfx/bin/vaisseau.raw.c index 443eeda..eb981ac 100644 --- a/examples/Math/Pathfinding1/gfx/bin/vaisseau.raw.c +++ b/examples/Math/Pathfinding1/gfx/bin/vaisseau.raw.c @@ -1,70 +1,70 @@ -// -// vaisseau (1024 uncompressed bytes) -// -const unsigned char vaisseau_Bitmap[1024] = { -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, -0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, -0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, -0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, -0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, -0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, -0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, -0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, -0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, -0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, -0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, -0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, -0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, -0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, -0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, -0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, -0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, -0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, -0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, -0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - +// +// vaisseau (1024 uncompressed bytes) +// +const unsigned char vaisseau_Bitmap[1024] = { +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, +0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, +0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, +0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, +0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, +0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, +0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, +0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, +0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, +0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, +0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, +0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, +0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, +0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, +0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, +0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, +0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, +0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, +0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, +0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + diff --git a/examples/Math/Pathfinding1/source/main.c b/examples/Math/Pathfinding1/source/main.c index 12edbfc..f0ec82c 100644 --- a/examples/Math/Pathfinding1/source/main.c +++ b/examples/Math/Pathfinding1/source/main.c @@ -1,81 +1,81 @@ -//copyright smealum http://jvteamds.free.fr -// Les Includes -#include -const unsigned short master_Palette[256]; -const unsigned char vaisseau_Bitmap[1024]; - -//Fonction principale du code -int main(void){ - //Initialision de PAlib - PA_Init(); - PA_LoadDefaultText(0,0); - PA_LoadPal(PAL_SPRITE0, master_Palette); - PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 0, 0); - int x = 0,y = 0,a=1,i,j, arriveex = 4, arriveey = 4; - - PA_LoadDefaultText(1,2); - PA_LoadDefaultText(0,2); - - while(1){ - if(Pad.Held.Up) a++; - - if(x == arriveex && y == arriveey){ - x=0; - y=0; - } - for(j=0;j<5+a;j++) - for(i=0;i<5+a;i++){ - PA_OutputText(1,i*2,j,"0"); - } - - PA_OutputText(1,x*2,y,"1"); - PA_OutputText(1,1*2,0,"5"); - PA_OutputText(1,1*2,1,"5"); - PA_OutputText(1,2*2,2,"5"); - PA_OutputText(1,2*2,3,"5"); - PA_OutputText(1,arriveex*2,arriveey,"2"); - - PA_InitAstar(5+a, 5+a); // Initialise to the size of the mase you want... - for(j=0;j<5+a;j++) - for(i=0;i<5+a;i++) - maze[i][j]=0; - - maze[x][y]=1; - maze[arriveex][arriveey]=2; - maze[1][0]=5; - maze[1][1]=5; - maze[2][2]=5; - maze[2][3]=5; - - PA_OutputText(0,1,1," "); - PA_OutputText(0,1,2,"%d",a); - - switch(PA_Astar(5+a,5+a)){ - case 1: { - PA_OutputText(0,1,1,"Left "); - x--; - break; - } - case 2: { - PA_OutputText(0,1,1,"Right "); - x++; - break; - } - case 3:{ - PA_OutputText(0,1,1,"Up "); - y--; - break; - } - case 4:{ - PA_OutputText(0,1,1,"Down "); - y++; - break; - } - } - PA_SetSpriteXY(0,0,x*10,y*10); - for(i=0;i<30; i++) PA_WaitForVBL(); // wait half a second - - - } - return 0; +//copyright smealum http://jvteamds.free.fr +// Les Includes +#include +const unsigned short master_Palette[256]; +const unsigned char vaisseau_Bitmap[1024]; + +//Fonction principale du code +int main(void){ + //Initialision de PAlib + PA_Init(); + PA_LoadDefaultText(0,0); + PA_LoadPal(PAL_SPRITE0, master_Palette); + PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 0, 0); + int x = 0,y = 0,a=1,i,j, arriveex = 4, arriveey = 4; + + PA_LoadDefaultText(1,2); + PA_LoadDefaultText(0,2); + + while(1){ + if(Pad.Held.Up) a++; + + if(x == arriveex && y == arriveey){ + x=0; + y=0; + } + for(j=0;j<5+a;j++) + for(i=0;i<5+a;i++){ + PA_OutputText(1,i*2,j,"0"); + } + + PA_OutputText(1,x*2,y,"1"); + PA_OutputText(1,1*2,0,"5"); + PA_OutputText(1,1*2,1,"5"); + PA_OutputText(1,2*2,2,"5"); + PA_OutputText(1,2*2,3,"5"); + PA_OutputText(1,arriveex*2,arriveey,"2"); + + PA_InitAstar(5+a, 5+a); // Initialise to the size of the mase you want... + for(j=0;j<5+a;j++) + for(i=0;i<5+a;i++) + maze[i][j]=0; + + maze[x][y]=1; + maze[arriveex][arriveey]=2; + maze[1][0]=5; + maze[1][1]=5; + maze[2][2]=5; + maze[2][3]=5; + + PA_OutputText(0,1,1," "); + PA_OutputText(0,1,2,"%d",a); + + switch(PA_Astar(5+a,5+a)){ + case 1: { + PA_OutputText(0,1,1,"Left "); + x--; + break; + } + case 2: { + PA_OutputText(0,1,1,"Right "); + x++; + break; + } + case 3:{ + PA_OutputText(0,1,1,"Up "); + y--; + break; + } + case 4:{ + PA_OutputText(0,1,1,"Down "); + y++; + break; + } + } + PA_SetSpriteXY(0,0,x*10,y*10); + for(i=0;i<30; i++) PA_WaitForVBL(); // wait half a second + + + } + return 0; } \ No newline at end of file diff --git a/examples/Other/CloseLidSound/Makefile b/examples/Other/CloseLidSound/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Other/CloseLidSound/Makefile +++ b/examples/Other/CloseLidSound/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Other/CloseLidSound/source/main.c b/examples/Other/CloseLidSound/source/main.c index 9ce1e85..a42bc05 100644 --- a/examples/Other/CloseLidSound/source/main.c +++ b/examples/Other/CloseLidSound/source/main.c @@ -1,32 +1,32 @@ -// Plays a sound on lid close/open - -// Includes -#include // Include for PA_Lib -#include "Babye.h" // Include the sound (found in the data folder in .raw format) -#include "HereWeGo.h" // Include the sound (found in the data folder in .raw format) - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - PA_LoadDefaultText(0, 0); - PA_SetAutoCheckLid(0); - - - // Init the sound system - AS_Init(AS_MODE_SURROUND | AS_MODE_16CH); - AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); - - PA_OutputSimpleText(0, 1, 10, "Close the lid and see what happens..."); - - // Infinite loop to keep the program running - while (1) - { - PA_CloseLidSound2(Babye, HereWeGo); // Sound to play when lid closes and opens - - PA_WaitForVBL(); - } - - return 0; +// Plays a sound on lid close/open + +// Includes +#include // Include for PA_Lib +#include "Babye.h" // Include the sound (found in the data folder in .raw format) +#include "HereWeGo.h" // Include the sound (found in the data folder in .raw format) + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + PA_LoadDefaultText(0, 0); + PA_SetAutoCheckLid(0); + + + // Init the sound system + AS_Init(AS_MODE_SURROUND | AS_MODE_16CH); + AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); + + PA_OutputSimpleText(0, 1, 10, "Close the lid and see what happens..."); + + // Infinite loop to keep the program running + while (1) + { + PA_CloseLidSound2(Babye, HereWeGo); // Sound to play when lid closes and opens + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Other/Counters/Makefile b/examples/Other/Counters/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Other/Counters/Makefile +++ b/examples/Other/Counters/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Other/Counters/source/main.c b/examples/Other/Counters/source/main.c index 87a9421..c104e7a 100644 --- a/examples/Other/Counters/source/main.c +++ b/examples/Other/Counters/source/main.c @@ -1,39 +1,39 @@ -#include - - - - -///Main function... -int main(void){ - - - //PAlib Init - PA_Init(); - - PA_LoadDefaultText(1,0); // On the top screen - PA_LoadDefaultText(0,0); // On the bottom screen - - u8 ncounters = 1; // Number of counters active ! - - PA_OutputSimpleText(1, 2, 10, "Press Start to start a new counter"); // Text - PA_OutputSimpleText(0, 2, 0, "Counters :"); // Text - u8 i; - - PA_VBLCounterStart(0); // Start the first counter :) - - while(1){ - - if(Pad.Newpress.Start&&(ncounters<16)){ // When Start pressed, max 16 counters - PA_VBLCounterStart(ncounters); // Start a new counter with the latest number - ncounters++; - } - - for (i = 0; i < ncounters; i++){ // Thing to do every time for each counter active : - PA_OutputText(0, 0, 2+i, "%02d : %d VBLs, %d seconds", i, PA_VBLCounter[i], PA_VBLCounter[i]/60); // /60 to get seconds - } - - PA_WaitForVBL(); - //La boucle infinie du programme - } - return 0; +#include + + + + +///Main function... +int main(void){ + + + //PAlib Init + PA_Init(); + + PA_LoadDefaultText(1,0); // On the top screen + PA_LoadDefaultText(0,0); // On the bottom screen + + u8 ncounters = 1; // Number of counters active ! + + PA_OutputSimpleText(1, 2, 10, "Press Start to start a new counter"); // Text + PA_OutputSimpleText(0, 2, 0, "Counters :"); // Text + u8 i; + + PA_VBLCounterStart(0); // Start the first counter :) + + while(1){ + + if(Pad.Newpress.Start&&(ncounters<16)){ // When Start pressed, max 16 counters + PA_VBLCounterStart(ncounters); // Start a new counter with the latest number + ncounters++; + } + + for (i = 0; i < ncounters; i++){ // Thing to do every time for each counter active : + PA_OutputText(0, 0, 2+i, "%02d : %d VBLs, %d seconds", i, PA_VBLCounter[i], PA_VBLCounter[i]/60); // /60 to get seconds + } + + PA_WaitForVBL(); + //La boucle infinie du programme + } + return 0; } \ No newline at end of file diff --git a/examples/Other/GetAngle/Makefile b/examples/Other/GetAngle/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Other/GetAngle/Makefile +++ b/examples/Other/GetAngle/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Other/GetAngle/gfx/bin/master.pal.c b/examples/Other/GetAngle/gfx/bin/master.pal.c index 998edc6..b9083fc 100644 --- a/examples/Other/GetAngle/gfx/bin/master.pal.c +++ b/examples/Other/GetAngle/gfx/bin/master.pal.c @@ -1,35 +1,35 @@ -const unsigned short master_Palette[256] = { -0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, -0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - +const unsigned short master_Palette[256] = { +0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, +0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + diff --git a/examples/Other/GetAngle/gfx/bin/vaisseau.raw.c b/examples/Other/GetAngle/gfx/bin/vaisseau.raw.c index 443eeda..eb981ac 100644 --- a/examples/Other/GetAngle/gfx/bin/vaisseau.raw.c +++ b/examples/Other/GetAngle/gfx/bin/vaisseau.raw.c @@ -1,70 +1,70 @@ -// -// vaisseau (1024 uncompressed bytes) -// -const unsigned char vaisseau_Bitmap[1024] = { -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, -0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, -0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, -0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, -0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, -0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, -0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, -0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, -0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, -0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, -0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, -0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, -0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, -0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, -0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, -0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, -0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, -0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, -0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, -0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - +// +// vaisseau (1024 uncompressed bytes) +// +const unsigned char vaisseau_Bitmap[1024] = { +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, +0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, +0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, +0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, +0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, +0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, +0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, +0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, +0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, +0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, +0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, +0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, +0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, +0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, +0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, +0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, +0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, +0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, +0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, +0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + diff --git a/examples/Other/GetAngle/source/main.c b/examples/Other/GetAngle/source/main.c index 02de9bb..587827f 100644 --- a/examples/Other/GetAngle/source/main.c +++ b/examples/Other/GetAngle/source/main.c @@ -1,36 +1,36 @@ - -// Les Includes -#include -const unsigned short master_Palette[256]; -const unsigned char vaisseau_Bitmap[1024]; - -//Fonction principale du code -int main(void) - -{ -//Initialision de PAlib -PA_Init(); - -PA_LoadDefaultText(1,0); // On the top screen - -// Load de sprite palette -PA_LoadPal(PAL_SPRITE0, master_Palette); - -// Load a sprite... centerd -PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); - - -// Now we'll get the angle between the sprite, the stlyus, and a horizontal line... This can be useful in games ! -while(1) -{ - -PA_OutputText(1, 5, 10, "Angle : %d ", PA_GetAngle(128, 96, Stylus.X, Stylus.Y)); -// To get the angle, just give the coordinates of 2 points (here, the sprite's center and the stlyus) -// Detail : the angle is counterclock wise, and goes from 0 to 511... - - -PA_WaitForVBL(); -//La boucle infinie du programme -} -return 0; + +// Les Includes +#include +const unsigned short master_Palette[256]; +const unsigned char vaisseau_Bitmap[1024]; + +//Fonction principale du code +int main(void) + +{ +//Initialision de PAlib +PA_Init(); + +PA_LoadDefaultText(1,0); // On the top screen + +// Load de sprite palette +PA_LoadPal(PAL_SPRITE0, master_Palette); + +// Load a sprite... centerd +PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); + + +// Now we'll get the angle between the sprite, the stlyus, and a horizontal line... This can be useful in games ! +while(1) +{ + +PA_OutputText(1, 5, 10, "Angle : %d ", PA_GetAngle(128, 96, Stylus.X, Stylus.Y)); +// To get the angle, just give the coordinates of 2 points (here, the sprite's center and the stlyus) +// Detail : the angle is counterclock wise, and goes from 0 to 511... + + +PA_WaitForVBL(); +//La boucle infinie du programme +} +return 0; } \ No newline at end of file diff --git a/examples/Other/Pathfinding/Makefile b/examples/Other/Pathfinding/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Other/Pathfinding/Makefile +++ b/examples/Other/Pathfinding/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Other/Pathfinding/gfx/bin/master.pal.c b/examples/Other/Pathfinding/gfx/bin/master.pal.c index 998edc6..b9083fc 100644 --- a/examples/Other/Pathfinding/gfx/bin/master.pal.c +++ b/examples/Other/Pathfinding/gfx/bin/master.pal.c @@ -1,35 +1,35 @@ -const unsigned short master_Palette[256] = { -0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, -0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - +const unsigned short master_Palette[256] = { +0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, +0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + diff --git a/examples/Other/Pathfinding/gfx/bin/vaisseau.raw.c b/examples/Other/Pathfinding/gfx/bin/vaisseau.raw.c index 443eeda..eb981ac 100644 --- a/examples/Other/Pathfinding/gfx/bin/vaisseau.raw.c +++ b/examples/Other/Pathfinding/gfx/bin/vaisseau.raw.c @@ -1,70 +1,70 @@ -// -// vaisseau (1024 uncompressed bytes) -// -const unsigned char vaisseau_Bitmap[1024] = { -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, -0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, -0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, -0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, -0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, -0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, -0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, -0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, -0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, -0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, -0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, -0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, -0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, -0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, -0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, -0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, -0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, -0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, -0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, -0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - +// +// vaisseau (1024 uncompressed bytes) +// +const unsigned char vaisseau_Bitmap[1024] = { +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, +0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, +0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, +0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, +0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, +0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, +0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, +0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, +0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, +0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, +0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, +0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, +0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, +0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, +0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, +0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, +0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, +0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, +0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, +0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + diff --git a/examples/Other/Pathfinding/source/main.c b/examples/Other/Pathfinding/source/main.c index 12edbfc..f0ec82c 100644 --- a/examples/Other/Pathfinding/source/main.c +++ b/examples/Other/Pathfinding/source/main.c @@ -1,81 +1,81 @@ -//copyright smealum http://jvteamds.free.fr -// Les Includes -#include -const unsigned short master_Palette[256]; -const unsigned char vaisseau_Bitmap[1024]; - -//Fonction principale du code -int main(void){ - //Initialision de PAlib - PA_Init(); - PA_LoadDefaultText(0,0); - PA_LoadPal(PAL_SPRITE0, master_Palette); - PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 0, 0); - int x = 0,y = 0,a=1,i,j, arriveex = 4, arriveey = 4; - - PA_LoadDefaultText(1,2); - PA_LoadDefaultText(0,2); - - while(1){ - if(Pad.Held.Up) a++; - - if(x == arriveex && y == arriveey){ - x=0; - y=0; - } - for(j=0;j<5+a;j++) - for(i=0;i<5+a;i++){ - PA_OutputText(1,i*2,j,"0"); - } - - PA_OutputText(1,x*2,y,"1"); - PA_OutputText(1,1*2,0,"5"); - PA_OutputText(1,1*2,1,"5"); - PA_OutputText(1,2*2,2,"5"); - PA_OutputText(1,2*2,3,"5"); - PA_OutputText(1,arriveex*2,arriveey,"2"); - - PA_InitAstar(5+a, 5+a); // Initialise to the size of the mase you want... - for(j=0;j<5+a;j++) - for(i=0;i<5+a;i++) - maze[i][j]=0; - - maze[x][y]=1; - maze[arriveex][arriveey]=2; - maze[1][0]=5; - maze[1][1]=5; - maze[2][2]=5; - maze[2][3]=5; - - PA_OutputText(0,1,1," "); - PA_OutputText(0,1,2,"%d",a); - - switch(PA_Astar(5+a,5+a)){ - case 1: { - PA_OutputText(0,1,1,"Left "); - x--; - break; - } - case 2: { - PA_OutputText(0,1,1,"Right "); - x++; - break; - } - case 3:{ - PA_OutputText(0,1,1,"Up "); - y--; - break; - } - case 4:{ - PA_OutputText(0,1,1,"Down "); - y++; - break; - } - } - PA_SetSpriteXY(0,0,x*10,y*10); - for(i=0;i<30; i++) PA_WaitForVBL(); // wait half a second - - - } - return 0; +//copyright smealum http://jvteamds.free.fr +// Les Includes +#include +const unsigned short master_Palette[256]; +const unsigned char vaisseau_Bitmap[1024]; + +//Fonction principale du code +int main(void){ + //Initialision de PAlib + PA_Init(); + PA_LoadDefaultText(0,0); + PA_LoadPal(PAL_SPRITE0, master_Palette); + PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 0, 0); + int x = 0,y = 0,a=1,i,j, arriveex = 4, arriveey = 4; + + PA_LoadDefaultText(1,2); + PA_LoadDefaultText(0,2); + + while(1){ + if(Pad.Held.Up) a++; + + if(x == arriveex && y == arriveey){ + x=0; + y=0; + } + for(j=0;j<5+a;j++) + for(i=0;i<5+a;i++){ + PA_OutputText(1,i*2,j,"0"); + } + + PA_OutputText(1,x*2,y,"1"); + PA_OutputText(1,1*2,0,"5"); + PA_OutputText(1,1*2,1,"5"); + PA_OutputText(1,2*2,2,"5"); + PA_OutputText(1,2*2,3,"5"); + PA_OutputText(1,arriveex*2,arriveey,"2"); + + PA_InitAstar(5+a, 5+a); // Initialise to the size of the mase you want... + for(j=0;j<5+a;j++) + for(i=0;i<5+a;i++) + maze[i][j]=0; + + maze[x][y]=1; + maze[arriveex][arriveey]=2; + maze[1][0]=5; + maze[1][1]=5; + maze[2][2]=5; + maze[2][3]=5; + + PA_OutputText(0,1,1," "); + PA_OutputText(0,1,2,"%d",a); + + switch(PA_Astar(5+a,5+a)){ + case 1: { + PA_OutputText(0,1,1,"Left "); + x--; + break; + } + case 2: { + PA_OutputText(0,1,1,"Right "); + x++; + break; + } + case 3:{ + PA_OutputText(0,1,1,"Up "); + y--; + break; + } + case 4:{ + PA_OutputText(0,1,1,"Down "); + y++; + break; + } + } + PA_SetSpriteXY(0,0,x*10,y*10); + for(i=0;i<30; i++) PA_WaitForVBL(); // wait half a second + + + } + return 0; } \ No newline at end of file diff --git a/examples/Other/Pathfinding1/Makefile b/examples/Other/Pathfinding1/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Other/Pathfinding1/Makefile +++ b/examples/Other/Pathfinding1/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Other/Pathfinding1/gfx/bin/master.pal.c b/examples/Other/Pathfinding1/gfx/bin/master.pal.c index 998edc6..b9083fc 100644 --- a/examples/Other/Pathfinding1/gfx/bin/master.pal.c +++ b/examples/Other/Pathfinding1/gfx/bin/master.pal.c @@ -1,35 +1,35 @@ -const unsigned short master_Palette[256] = { -0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, -0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - +const unsigned short master_Palette[256] = { +0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, +0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + diff --git a/examples/Other/Pathfinding1/gfx/bin/vaisseau.raw.c b/examples/Other/Pathfinding1/gfx/bin/vaisseau.raw.c index 443eeda..eb981ac 100644 --- a/examples/Other/Pathfinding1/gfx/bin/vaisseau.raw.c +++ b/examples/Other/Pathfinding1/gfx/bin/vaisseau.raw.c @@ -1,70 +1,70 @@ -// -// vaisseau (1024 uncompressed bytes) -// -const unsigned char vaisseau_Bitmap[1024] = { -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, -0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, -0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, -0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, -0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, -0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, -0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, -0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, -0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, -0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, -0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, -0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, -0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, -0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, -0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, -0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, -0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, -0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, -0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, -0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - +// +// vaisseau (1024 uncompressed bytes) +// +const unsigned char vaisseau_Bitmap[1024] = { +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, +0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, +0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, +0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, +0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, +0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, +0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, +0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, +0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, +0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, +0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, +0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, +0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, +0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, +0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, +0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, +0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, +0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, +0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, +0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + diff --git a/examples/Other/Pathfinding1/source/main.c b/examples/Other/Pathfinding1/source/main.c index 12edbfc..f0ec82c 100644 --- a/examples/Other/Pathfinding1/source/main.c +++ b/examples/Other/Pathfinding1/source/main.c @@ -1,81 +1,81 @@ -//copyright smealum http://jvteamds.free.fr -// Les Includes -#include -const unsigned short master_Palette[256]; -const unsigned char vaisseau_Bitmap[1024]; - -//Fonction principale du code -int main(void){ - //Initialision de PAlib - PA_Init(); - PA_LoadDefaultText(0,0); - PA_LoadPal(PAL_SPRITE0, master_Palette); - PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 0, 0); - int x = 0,y = 0,a=1,i,j, arriveex = 4, arriveey = 4; - - PA_LoadDefaultText(1,2); - PA_LoadDefaultText(0,2); - - while(1){ - if(Pad.Held.Up) a++; - - if(x == arriveex && y == arriveey){ - x=0; - y=0; - } - for(j=0;j<5+a;j++) - for(i=0;i<5+a;i++){ - PA_OutputText(1,i*2,j,"0"); - } - - PA_OutputText(1,x*2,y,"1"); - PA_OutputText(1,1*2,0,"5"); - PA_OutputText(1,1*2,1,"5"); - PA_OutputText(1,2*2,2,"5"); - PA_OutputText(1,2*2,3,"5"); - PA_OutputText(1,arriveex*2,arriveey,"2"); - - PA_InitAstar(5+a, 5+a); // Initialise to the size of the mase you want... - for(j=0;j<5+a;j++) - for(i=0;i<5+a;i++) - maze[i][j]=0; - - maze[x][y]=1; - maze[arriveex][arriveey]=2; - maze[1][0]=5; - maze[1][1]=5; - maze[2][2]=5; - maze[2][3]=5; - - PA_OutputText(0,1,1," "); - PA_OutputText(0,1,2,"%d",a); - - switch(PA_Astar(5+a,5+a)){ - case 1: { - PA_OutputText(0,1,1,"Left "); - x--; - break; - } - case 2: { - PA_OutputText(0,1,1,"Right "); - x++; - break; - } - case 3:{ - PA_OutputText(0,1,1,"Up "); - y--; - break; - } - case 4:{ - PA_OutputText(0,1,1,"Down "); - y++; - break; - } - } - PA_SetSpriteXY(0,0,x*10,y*10); - for(i=0;i<30; i++) PA_WaitForVBL(); // wait half a second - - - } - return 0; +//copyright smealum http://jvteamds.free.fr +// Les Includes +#include +const unsigned short master_Palette[256]; +const unsigned char vaisseau_Bitmap[1024]; + +//Fonction principale du code +int main(void){ + //Initialision de PAlib + PA_Init(); + PA_LoadDefaultText(0,0); + PA_LoadPal(PAL_SPRITE0, master_Palette); + PA_CreateSprite(0, 0,(void*)vaisseau_Bitmap, OBJ_SIZE_32X32,1, 0, 0, 0); + int x = 0,y = 0,a=1,i,j, arriveex = 4, arriveey = 4; + + PA_LoadDefaultText(1,2); + PA_LoadDefaultText(0,2); + + while(1){ + if(Pad.Held.Up) a++; + + if(x == arriveex && y == arriveey){ + x=0; + y=0; + } + for(j=0;j<5+a;j++) + for(i=0;i<5+a;i++){ + PA_OutputText(1,i*2,j,"0"); + } + + PA_OutputText(1,x*2,y,"1"); + PA_OutputText(1,1*2,0,"5"); + PA_OutputText(1,1*2,1,"5"); + PA_OutputText(1,2*2,2,"5"); + PA_OutputText(1,2*2,3,"5"); + PA_OutputText(1,arriveex*2,arriveey,"2"); + + PA_InitAstar(5+a, 5+a); // Initialise to the size of the mase you want... + for(j=0;j<5+a;j++) + for(i=0;i<5+a;i++) + maze[i][j]=0; + + maze[x][y]=1; + maze[arriveex][arriveey]=2; + maze[1][0]=5; + maze[1][1]=5; + maze[2][2]=5; + maze[2][3]=5; + + PA_OutputText(0,1,1," "); + PA_OutputText(0,1,2,"%d",a); + + switch(PA_Astar(5+a,5+a)){ + case 1: { + PA_OutputText(0,1,1,"Left "); + x--; + break; + } + case 2: { + PA_OutputText(0,1,1,"Right "); + x++; + break; + } + case 3:{ + PA_OutputText(0,1,1,"Up "); + y--; + break; + } + case 4:{ + PA_OutputText(0,1,1,"Down "); + y++; + break; + } + } + PA_SetSpriteXY(0,0,x*10,y*10); + for(i=0;i<30; i++) PA_WaitForVBL(); // wait half a second + + + } + return 0; } \ No newline at end of file diff --git a/examples/Other/Pathfinding2/Makefile b/examples/Other/Pathfinding2/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Other/Pathfinding2/Makefile +++ b/examples/Other/Pathfinding2/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Other/Pathfinding2/source/main.c b/examples/Other/Pathfinding2/source/main.c index 52b9286..e77c7e1 100644 --- a/examples/Other/Pathfinding2/source/main.c +++ b/examples/Other/Pathfinding2/source/main.c @@ -1,93 +1,93 @@ -#include - -#define PA_DrawBigPixel(screen,x,y,zoom,color) PA_Draw16bitRect(screen, x*a-(a/2), y*a-(a/2),x*a+(a/2), y*a+(a/2), color) - -int main(void){ - start: - PA_Init();//init PAlib - int x = 0,y = 0,width=32,height=32,i,j, arriveex = 24, arriveey = 24, a=8; - - PA_LoadDefaultText(1,2);//init the text in the up screen - PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); // Set the bottom screen color to white - PA_Init16bitBg(0, 3);//init the 16bit mode in bottom screen - PA_InitAstar(width, height);//init the Astar function - for(j=0;j + +#define PA_DrawBigPixel(screen,x,y,zoom,color) PA_Draw16bitRect(screen, x*a-(a/2), y*a-(a/2),x*a+(a/2), y*a+(a/2), color) + +int main(void){ + start: + PA_Init();//init PAlib + int x = 0,y = 0,width=32,height=32,i,j, arriveex = 24, arriveey = 24, a=8; + + PA_LoadDefaultText(1,2);//init the text in the up screen + PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); // Set the bottom screen color to white + PA_Init16bitBg(0, 3);//init the 16bit mode in bottom screen + PA_InitAstar(width, height);//init the Astar function + for(j=0;j - - - -// Main function -int main(void) - -{ -// PAlib init -PA_Init(); - -// Initialise the background text function -PA_LoadDefaultText(1, 0); - - -// Main loop -while(1) -{ - - // Day, Month, and Year - PA_OutputText(1, 2, 10, "%02d/%02d/%04d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); - - // And the time... - PA_OutputText(1, 2, 12, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds); - - PA_WaitForVBL(); - - -} -return 0; +/* Check out the date and the time +*/ + + +#include + + + +// Main function +int main(void) + +{ +// PAlib init +PA_Init(); + +// Initialise the background text function +PA_LoadDefaultText(1, 0); + + +// Main loop +while(1) +{ + + // Day, Month, and Year + PA_OutputText(1, 2, 10, "%02d/%02d/%04d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); + + // And the time... + PA_OutputText(1, 2, 12, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds); + + PA_WaitForVBL(); + + +} +return 0; } \ No newline at end of file diff --git a/examples/Other/ScreenLight/Makefile b/examples/Other/ScreenLight/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Other/ScreenLight/Makefile +++ b/examples/Other/ScreenLight/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Other/ScreenLight/source/main.c b/examples/Other/ScreenLight/source/main.c index e72c4fa..1c5dfa3 100644 --- a/examples/Other/ScreenLight/source/main.c +++ b/examples/Other/ScreenLight/source/main.c @@ -1,29 +1,29 @@ -// Includes -#include // Include for PA_Lib - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(0,0); - PA_LoadDefaultText(1,0); - - PA_OutputText(0, 4, 1, "Text on the bottom screen!"); - PA_OutputText(1, 5, 1, "Text on the top screen!"); - - // Infinite loop to keep the program running - while (1) - { - if (Pad.Newpress.A) PA_SetScreenLight(0, // screen - 1); // Turn on bottom light - if (Pad.Newpress.B) PA_SetScreenLight(0, 0); - if (Pad.Newpress.X) PA_SetScreenLight(1, 1);// Turn on top light - if (Pad.Newpress.Y) PA_SetScreenLight(1, 0); - - PA_WaitForVBL(); - } - - return 0; +// Includes +#include // Include for PA_Lib + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(0,0); + PA_LoadDefaultText(1,0); + + PA_OutputText(0, 4, 1, "Text on the bottom screen!"); + PA_OutputText(1, 5, 1, "Text on the top screen!"); + + // Infinite loop to keep the program running + while (1) + { + if (Pad.Newpress.A) PA_SetScreenLight(0, // screen + 1); // Turn on bottom light + if (Pad.Newpress.B) PA_SetScreenLight(0, 0); + if (Pad.Newpress.X) PA_SetScreenLight(1, 1);// Turn on top light + if (Pad.Newpress.Y) PA_SetScreenLight(1, 0); + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Other/UserInfo/Makefile b/examples/Other/UserInfo/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Other/UserInfo/Makefile +++ b/examples/Other/UserInfo/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Other/UserInfo/source/main.c b/examples/Other/UserInfo/source/main.c index aca4285..cdd8eda 100644 --- a/examples/Other/UserInfo/source/main.c +++ b/examples/Other/UserInfo/source/main.c @@ -1,42 +1,42 @@ -/* Check out the user infos... -*/ - - -#include - - -// Main function -int main(void) - -{ -// PAlib init -PA_Init(); - -// Initialise the background text function -PA_LoadDefaultText(1, 0); - - -// Main loop -while(1) -{ - // User name, and birthday (Day/Month) - PA_OutputText(1, 2, 10, "User name : %s, %02d/%02d", PA_UserInfo.Name, PA_UserInfo.BdayDay, PA_UserInfo.BdayMonth); - - // Alarm Time - PA_OutputText(1, 2, 12, "Alarm : %02d:%02d", PA_UserInfo.AlarmHour, PA_UserInfo.AlarmMinute); - - // DS Language... 0 si japonese, 1 is english, 2 is french... - PA_OutputText(1, 2, 14, "Language : %d", PA_UserInfo.Language); - - // Special message - PA_OutputText(1, 2, 16, "Message : %s", PA_UserInfo.Message); - - -// In Pa_OutputText, %s is for strings, %d for numbers, and %02d means 'write the number, and if has less than -// 2 digits, complete with zeros... Example : 5 -> 05 - - PA_WaitForVBL(); - -} -return 0; +/* Check out the user infos... +*/ + + +#include + + +// Main function +int main(void) + +{ +// PAlib init +PA_Init(); + +// Initialise the background text function +PA_LoadDefaultText(1, 0); + + +// Main loop +while(1) +{ + // User name, and birthday (Day/Month) + PA_OutputText(1, 2, 10, "User name : %s, %02d/%02d", PA_UserInfo.Name, PA_UserInfo.BdayDay, PA_UserInfo.BdayMonth); + + // Alarm Time + PA_OutputText(1, 2, 12, "Alarm : %02d:%02d", PA_UserInfo.AlarmHour, PA_UserInfo.AlarmMinute); + + // DS Language... 0 si japonese, 1 is english, 2 is french... + PA_OutputText(1, 2, 14, "Language : %d", PA_UserInfo.Language); + + // Special message + PA_OutputText(1, 2, 16, "Message : %s", PA_UserInfo.Message); + + +// In Pa_OutputText, %s is for strings, %d for numbers, and %02d means 'write the number, and if has less than +// 2 digits, complete with zeros... Example : 5 -> 05 + + PA_WaitForVBL(); + +} +return 0; } \ No newline at end of file diff --git a/examples/Other/VBLFunction/Makefile b/examples/Other/VBLFunction/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Other/VBLFunction/Makefile +++ b/examples/Other/VBLFunction/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Other/VBLFunction/source/main.c b/examples/Other/VBLFunction/source/main.c index 7193ce2..8c8b903 100644 --- a/examples/Other/VBLFunction/source/main.c +++ b/examples/Other/VBLFunction/source/main.c @@ -1,40 +1,40 @@ -/* This example shows you how you can have a code run every VBL without notice of CPU time and all. -Be aware that if your function is too long, it might slow down the DS or hang :/ -This can be used to have your own counters, or some strict important code running on its own */ - - -#include - - -s32 MyCounter = 0; - - -// Custom function we'll use, with just a single counter for the sake of the example -void MyVBLFunction(void){ - - MyCounter++; - -} - - -///Main function... -int main(void){ - - - //PAlib Init - PA_Init(); - - PA_LoadDefaultText(0,0); // On the bottom screen - - PA_VBLFunctionInit(MyVBLFunction); // Init the function to be executed every frame... You can remove it by using PA_VBLFunctionReset(); - - while(1){ // No code beside the text output in the main loop, everything will be done in the VBL for once :) - - PA_OutputText(0, 2, 10, "Counter : %d", MyCounter); // /60 to get seconds - - - PA_WaitForVBL(); - //La boucle infinie du programme - } - return 0; +/* This example shows you how you can have a code run every VBL without notice of CPU time and all. +Be aware that if your function is too long, it might slow down the DS or hang :/ +This can be used to have your own counters, or some strict important code running on its own */ + + +#include + + +s32 MyCounter = 0; + + +// Custom function we'll use, with just a single counter for the sake of the example +void MyVBLFunction(void){ + + MyCounter++; + +} + + +///Main function... +int main(void){ + + + //PAlib Init + PA_Init(); + + PA_LoadDefaultText(0,0); // On the bottom screen + + PA_VBLFunctionInit(MyVBLFunction); // Init the function to be executed every frame... You can remove it by using PA_VBLFunctionReset(); + + while(1){ // No code beside the text output in the main loop, everything will be done in the VBL for once :) + + PA_OutputText(0, 2, 10, "Counter : %d", MyCounter); // /60 to get seconds + + + PA_WaitForVBL(); + //La boucle infinie du programme + } + return 0; } \ No newline at end of file diff --git a/examples/Other/WaitFor/Makefile b/examples/Other/WaitFor/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Other/WaitFor/Makefile +++ b/examples/Other/WaitFor/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Other/WaitFor/source/main.c b/examples/Other/WaitFor/source/main.c index 638cb83..64e111f 100644 --- a/examples/Other/WaitFor/source/main.c +++ b/examples/Other/WaitFor/source/main.c @@ -1,34 +1,34 @@ -#include - - - - -///Main function... -int main(void){ - - - //PAlib Init - PA_Init(); - - PA_LoadDefaultText(1,0); // On the top screen - - PA_OutputSimpleText(1, 0, 10, "Waiting for Start to be pressed"); // Text - - PA_WaitFor(Pad.Newpress.Start); // Wait for a specific thing... - - PA_OutputSimpleText(1, 0, 10, "Waiting for Stylus to be pressed"); // Text - - PA_WaitFor(Stylus.Newpress); // Wait for a specific thing... - - PA_OutputSimpleText(1, 0, 10, " All done ! "); // Text - - - while(1){ - - - - PA_WaitForVBL(); - //La boucle infinie du programme - } - return 0; +#include + + + + +///Main function... +int main(void){ + + + //PAlib Init + PA_Init(); + + PA_LoadDefaultText(1,0); // On the top screen + + PA_OutputSimpleText(1, 0, 10, "Waiting for Start to be pressed"); // Text + + PA_WaitFor(Pad.Newpress.Start); // Wait for a specific thing... + + PA_OutputSimpleText(1, 0, 10, "Waiting for Stylus to be pressed"); // Text + + PA_WaitFor(Stylus.Newpress); // Wait for a specific thing... + + PA_OutputSimpleText(1, 0, 10, " All done ! "); // Text + + + while(1){ + + + + PA_WaitForVBL(); + //La boucle infinie du programme + } + return 0; } \ No newline at end of file diff --git a/examples/Sound/ASlib/ASlib_General/Makefile b/examples/Sound/ASlib/ASlib_General/Makefile index 1215f32..9613cb7 100644 --- a/examples/Sound/ASlib/ASlib_General/Makefile +++ b/examples/Sound/ASlib/ASlib_General/Makefile @@ -1,6 +1,6 @@ -export BLOCKSDSEXT ?= /opt/blocksds/external - -ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_mp3.elf -BINDIRS := data - -include ../../../Makefile_example +export BLOCKSDSEXT ?= /opt/blocksds/external + +ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_mp3.elf +BINDIRS := data + +include ../../../Makefile_example diff --git a/examples/Sound/ASlib/ASlib_General/source/main.c b/examples/Sound/ASlib/ASlib_General/source/main.c index a0e6642..39b372d 100644 --- a/examples/Sound/ASlib/ASlib_General/source/main.c +++ b/examples/Sound/ASlib/ASlib_General/source/main.c @@ -1,196 +1,196 @@ -// ASLib example - by Noda -// PALib version by Tom - -// use libfat with a "test.mp3" file at the root, else load default mp3 from ram -//#define USE_FAT_TEST - -// Includes -#include - -// the sounds -#include "test.h" -#include "sfxa.h" -#include "sfxb.h" - -int main() -{ - // variables - int i, rate = 0, newrate = 0; - bool mp3_mode = true, autopan = false; - u8 lastsfx = 0, usage = 0, pan = 0, fx_mode = AS_SURROUND; - - // PALib Initialization - PA_Init(); - PA_LoadDefaultText(0, 0); - - // Initialize FAT if selected -#ifdef USE_FAT_TEST - if(!fatInitDefault()) { - PA_OutputText(0, 1, 1, "Fat init error !!!"); - return 1; - } -#endif - - // Init AS_Lib for mp3 - PA_VBLFunctionInit(AS_SoundVBL); - if (!AS_Init(AS_MODE_MP3 | AS_MODE_SURROUND | AS_MODE_16CH)) { - PA_OutputText(0, 1, 1, "ASlib init error !!!"); - return 1; - } - AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); - - // Infinite loop to keep the program running - while (1) - { - // display info text - PA_OutputText(0, 0, 0, " ASlib example - by Noda\n -----------------------"); - - if (mp3_mode) { - - // show some infos - PA_OutputText(0, 0, 3, " MP3 Testing mode\n\n\n" - "A: play MP3 B: pause MP3\n\n" - "X: stop MP3 Y: surround ON/OFF\n\n" - "Stylus : < > pan ^ v pitch\n\n" - "--------------------------------\n"); - - PA_OutputText(0, 0, 22, " [press select for SFX mode]\n"); - - // show sample rate & panning - PA_OutputText(0, 0, 14, "Sample rate : %d pan : %d \n", newrate, IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan); - - // show surround status - PA_OutputText(0, 0, 16, "Surround : %s\n", (IPC_Sound->mp3.delay ? "on " : "off")); - PA_OutputText(0, 0, 17, "(restart play to take effect)"); - - // show playback status - PA_OutputText(0, 0, 19, "MP3 Status : "); // clear status field - switch (AS_GetMP3Status()) { - case (MP3ST_STOPPED) : PA_OutputText(0, 13, 19, "stopped "); break; - case (MP3ST_PAUSED) : PA_OutputText(0, 13, 19, "paused "); break; - case (MP3ST_PLAYING) : PA_OutputText(0, 13, 19, "playing "); break; - case (MP3ST_OUT_OF_DATA) : PA_OutputText(0, 13, 19, "out of data "); break; - case (MP3ST_DECODE_ERROR) : PA_OutputText(0, 13, 19, "decoding error"); break; - case (MP3ST_INITFAILED) : PA_OutputText(0, 13, 19, "init failed "); break; - } - - // controls - if (Pad.Newpress.A) { - - if (AS_GetMP3Status() & MP3ST_PAUSED) { - - AS_MP3Unpause(); - - } else { - -#ifdef USE_FAT_TEST - AS_MP3StreamPlay("test.mp3"); -#else - AS_MP3DirectPlay((u8*)test, (u32)test_size); -#endif - AS_SetMP3Loop(true); - rate = 0; - newrate = 0; - } - } - if (Pad.Newpress.B) { - - AS_MP3Pause(); - } - if (Pad.Newpress.X) { - - AS_MP3Stop(); - } - if (Pad.Newpress.Y) { - - if(IPC_Sound->mp3.delay) - AS_SetMP3Delay(AS_NO_DELAY); - else - AS_SetMP3Delay(AS_SURROUND); - } - - // change panning & sample rate using the stylus - if((Stylus.Held) && rate && (AS_GetMP3Status() & MP3ST_PLAYING)) { - - newrate = (rate + rate/4) - (rate * Stylus.Y / 96 / 4); - AS_SetMP3Rate(newrate); - AS_SetMP3Pan(Stylus.X / 2); - } - // set sample rate - if(rate == 0 && IPC_Sound->mp3.rate && (AS_GetMP3Status() & MP3ST_PLAYING)) { - - rate = IPC_Sound->mp3.rate; - newrate = rate; - } - - } else { - - // show some infos - PA_OutputText(0, 0, 3, " SFX Testing mode\n\n\n" - "A: play SFX_A B: play SFX_B\n\n" - "X: autopan ON/OFF Y: FX mode\n\n" - "--------------------------------\n"); - PA_OutputText(0, 0, 22, " [press select for MP3 mode]\n"); - - // show channels usage, autopan status & panning of last sound played - PA_OutputText(0, 0, 12, "Chan usage : %d / %d \n\n", usage, IPC_Sound->num_chan - 1); - PA_OutputText(0, 0, 14, "Autopan : %s\n\n", (autopan ? "on " : "off")); - PA_OutputText(0, 0, 16, "Last SFX pan : %d \n", IPC_Sound->chan[lastsfx].snd.pan); - - // show fx mode - PA_OutputText(0, 0, 18, "SFX effect : %s\n", (fx_mode == AS_SURROUND ? "surround" : ( fx_mode == AS_REVERB ? "reverb " : "no fx "))); - PA_OutputText(0, 0, 19, "(start new SFX to take effect)"); - - // controls - if (Pad.Newpress.A) { - - lastsfx = AS_SoundQuickPlay(sfxa); - } - if (Pad.Newpress.B) { - - lastsfx = AS_SoundQuickPlay(sfxb); - } - if (Pad.Newpress.X) { - autopan = !autopan; - } - if (Pad.Newpress.Y) { - - if(fx_mode == AS_SURROUND) - fx_mode = AS_REVERB; - else if(fx_mode == AS_REVERB) - fx_mode = AS_NO_DELAY; - else - fx_mode = AS_SURROUND; - - // set new default sound settings - AS_SetDefaultSettings(AS_PCM_8BIT, 11025, fx_mode); - } - - // autopan - if(autopan) - AS_SetSoundPan(lastsfx, (++pan > 127 ? 255 - pan : pan)); - - // get the number of busy channels - usage = 0; - for(i = 1; i < IPC_Sound->num_chan; i++) - if(IPC_Sound->chan[i].busy) - usage++; - - } - - // switch testing mode - if ((Pad.Newpress.Select)) { - - if(mp3_mode) - AS_MP3Stop(); - - PA_ClearTextBg(0); - - mp3_mode = !mp3_mode; - } - - PA_WaitForVBL(); - } - - return 0; -} +// ASLib example - by Noda +// PALib version by Tom + +// use libfat with a "test.mp3" file at the root, else load default mp3 from ram +//#define USE_FAT_TEST + +// Includes +#include + +// the sounds +#include "test.h" +#include "sfxa.h" +#include "sfxb.h" + +int main() +{ + // variables + int i, rate = 0, newrate = 0; + bool mp3_mode = true, autopan = false; + u8 lastsfx = 0, usage = 0, pan = 0, fx_mode = AS_SURROUND; + + // PALib Initialization + PA_Init(); + PA_LoadDefaultText(0, 0); + + // Initialize FAT if selected +#ifdef USE_FAT_TEST + if(!fatInitDefault()) { + PA_OutputText(0, 1, 1, "Fat init error !!!"); + return 1; + } +#endif + + // Init AS_Lib for mp3 + PA_VBLFunctionInit(AS_SoundVBL); + if (!AS_Init(AS_MODE_MP3 | AS_MODE_SURROUND | AS_MODE_16CH)) { + PA_OutputText(0, 1, 1, "ASlib init error !!!"); + return 1; + } + AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); + + // Infinite loop to keep the program running + while (1) + { + // display info text + PA_OutputText(0, 0, 0, " ASlib example - by Noda\n -----------------------"); + + if (mp3_mode) { + + // show some infos + PA_OutputText(0, 0, 3, " MP3 Testing mode\n\n\n" + "A: play MP3 B: pause MP3\n\n" + "X: stop MP3 Y: surround ON/OFF\n\n" + "Stylus : < > pan ^ v pitch\n\n" + "--------------------------------\n"); + + PA_OutputText(0, 0, 22, " [press select for SFX mode]\n"); + + // show sample rate & panning + PA_OutputText(0, 0, 14, "Sample rate : %d pan : %d \n", newrate, IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan); + + // show surround status + PA_OutputText(0, 0, 16, "Surround : %s\n", (IPC_Sound->mp3.delay ? "on " : "off")); + PA_OutputText(0, 0, 17, "(restart play to take effect)"); + + // show playback status + PA_OutputText(0, 0, 19, "MP3 Status : "); // clear status field + switch (AS_GetMP3Status()) { + case (MP3ST_STOPPED) : PA_OutputText(0, 13, 19, "stopped "); break; + case (MP3ST_PAUSED) : PA_OutputText(0, 13, 19, "paused "); break; + case (MP3ST_PLAYING) : PA_OutputText(0, 13, 19, "playing "); break; + case (MP3ST_OUT_OF_DATA) : PA_OutputText(0, 13, 19, "out of data "); break; + case (MP3ST_DECODE_ERROR) : PA_OutputText(0, 13, 19, "decoding error"); break; + case (MP3ST_INITFAILED) : PA_OutputText(0, 13, 19, "init failed "); break; + } + + // controls + if (Pad.Newpress.A) { + + if (AS_GetMP3Status() & MP3ST_PAUSED) { + + AS_MP3Unpause(); + + } else { + +#ifdef USE_FAT_TEST + AS_MP3StreamPlay("test.mp3"); +#else + AS_MP3DirectPlay((u8*)test, (u32)test_size); +#endif + AS_SetMP3Loop(true); + rate = 0; + newrate = 0; + } + } + if (Pad.Newpress.B) { + + AS_MP3Pause(); + } + if (Pad.Newpress.X) { + + AS_MP3Stop(); + } + if (Pad.Newpress.Y) { + + if(IPC_Sound->mp3.delay) + AS_SetMP3Delay(AS_NO_DELAY); + else + AS_SetMP3Delay(AS_SURROUND); + } + + // change panning & sample rate using the stylus + if((Stylus.Held) && rate && (AS_GetMP3Status() & MP3ST_PLAYING)) { + + newrate = (rate + rate/4) - (rate * Stylus.Y / 96 / 4); + AS_SetMP3Rate(newrate); + AS_SetMP3Pan(Stylus.X / 2); + } + // set sample rate + if(rate == 0 && IPC_Sound->mp3.rate && (AS_GetMP3Status() & MP3ST_PLAYING)) { + + rate = IPC_Sound->mp3.rate; + newrate = rate; + } + + } else { + + // show some infos + PA_OutputText(0, 0, 3, " SFX Testing mode\n\n\n" + "A: play SFX_A B: play SFX_B\n\n" + "X: autopan ON/OFF Y: FX mode\n\n" + "--------------------------------\n"); + PA_OutputText(0, 0, 22, " [press select for MP3 mode]\n"); + + // show channels usage, autopan status & panning of last sound played + PA_OutputText(0, 0, 12, "Chan usage : %d / %d \n\n", usage, IPC_Sound->num_chan - 1); + PA_OutputText(0, 0, 14, "Autopan : %s\n\n", (autopan ? "on " : "off")); + PA_OutputText(0, 0, 16, "Last SFX pan : %d \n", IPC_Sound->chan[lastsfx].snd.pan); + + // show fx mode + PA_OutputText(0, 0, 18, "SFX effect : %s\n", (fx_mode == AS_SURROUND ? "surround" : ( fx_mode == AS_REVERB ? "reverb " : "no fx "))); + PA_OutputText(0, 0, 19, "(start new SFX to take effect)"); + + // controls + if (Pad.Newpress.A) { + + lastsfx = AS_SoundQuickPlay(sfxa); + } + if (Pad.Newpress.B) { + + lastsfx = AS_SoundQuickPlay(sfxb); + } + if (Pad.Newpress.X) { + autopan = !autopan; + } + if (Pad.Newpress.Y) { + + if(fx_mode == AS_SURROUND) + fx_mode = AS_REVERB; + else if(fx_mode == AS_REVERB) + fx_mode = AS_NO_DELAY; + else + fx_mode = AS_SURROUND; + + // set new default sound settings + AS_SetDefaultSettings(AS_PCM_8BIT, 11025, fx_mode); + } + + // autopan + if(autopan) + AS_SetSoundPan(lastsfx, (++pan > 127 ? 255 - pan : pan)); + + // get the number of busy channels + usage = 0; + for(i = 1; i < IPC_Sound->num_chan; i++) + if(IPC_Sound->chan[i].busy) + usage++; + + } + + // switch testing mode + if ((Pad.Newpress.Select)) { + + if(mp3_mode) + AS_MP3Stop(); + + PA_ClearTextBg(0); + + mp3_mode = !mp3_mode; + } + + PA_WaitForVBL(); + } + + return 0; +} diff --git a/examples/Sound/ASlib/ASlib_with_filesystem/Makefile b/examples/Sound/ASlib/ASlib_with_filesystem/Makefile index 9eac187..88c84a3 100644 --- a/examples/Sound/ASlib/ASlib_with_filesystem/Makefile +++ b/examples/Sound/ASlib/ASlib_with_filesystem/Makefile @@ -1,9 +1,9 @@ -export BLOCKSDSEXT ?= /opt/blocksds/external - -ARM7ELF ?= $(BLOCKSDSEXT)/palib/sys/arm7_maxmod_dswifi.elf - -ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_mp3.elf -BINDIRS := data -NITROFSDIR := filesystem - -include ../../../Makefile_example +export BLOCKSDSEXT ?= /opt/blocksds/external + +ARM7ELF ?= $(BLOCKSDSEXT)/palib/sys/arm7_maxmod_dswifi.elf + +ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_mp3.elf +BINDIRS := data +NITROFSDIR := filesystem + +include ../../../Makefile_example diff --git a/examples/Sound/ASlib/ASlib_with_filesystem/source/main.c b/examples/Sound/ASlib/ASlib_with_filesystem/source/main.c index ce0f36e..d57b380 100644 --- a/examples/Sound/ASlib/ASlib_with_filesystem/source/main.c +++ b/examples/Sound/ASlib/ASlib_with_filesystem/source/main.c @@ -1,198 +1,198 @@ -/* ASLib example - by Noda - PAlib version by Tom - Streaming an MP3 with EFSv2 -*/ - - -// Includes -#include - -// the sounds -#include "sfxa.h" -#include "sfxb.h" - -int main() -{ - // variables - int i, rate = 0, newrate = 0; - bool mp3_mode = true, autopan = false; - u8 lastsfx = 0, usage = 0, pan = 0, fx_mode = AS_SURROUND; - - // PALib Initialization - PA_Init(); - PA_LoadDefaultText(0, 0); - - // Initialize EFS - if (!nitroFSInit(NULL)) { - PA_OutputText(0, 1, 1, "Filesystem init error !!!"); - for(;;) PA_WaitForVBL(); - } - - // Check if test.mp3 is there, regardless if libfat or EFS_Lib is used - MP3FILE* file = FILE_OPEN("test.mp3"); - if (!file) { - PA_OutputText(0, 1, 1, "test.mp3 not found !!!"); - for(;;) PA_WaitForVBL(); - } - FILE_CLOSE(file); - - // Init AS_Lib for mp3 - PA_VBLFunctionInit(AS_SoundVBL); - if (!AS_Init(AS_MODE_MP3 | AS_MODE_SURROUND | AS_MODE_16CH)) { - PA_OutputText(0, 1, 1, "ASlib init error !!!"); - return 1; - } - AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); - - // Infinite loop to keep the program running - while (1) - { - // display info text - PA_OutputText(0, 0, 0, " ASlib example - by Noda\n -----------------------"); - - if (mp3_mode) { - - // show some infos - PA_OutputText(0, 0, 3, " MP3 Testing mode\n\n\n" - "A: play MP3 B: pause MP3\n\n" - "X: stop MP3 Y: surround ON/OFF\n\n" - "Stylus : < > pan ^ v pitch\n\n" - "--------------------------------\n"); - - PA_OutputText(0, 0, 22, " [press select for SFX mode]\n"); - - // show sample rate & panning - PA_OutputText(0, 0, 14, "Sample rate : %d pan : %d \n", newrate, IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan); - - // show surround status - PA_OutputText(0, 0, 16, "Surround : %s\n", (IPC_Sound->mp3.delay ? "on " : "off")); - PA_OutputText(0, 0, 17, "(restart play to take effect)"); - - // show playback status - PA_OutputText(0, 0, 19, "MP3 Status : "); // clear status field - switch (AS_GetMP3Status()) { - case (MP3ST_STOPPED) : PA_OutputText(0, 13, 19, "stopped "); break; - case (MP3ST_PAUSED) : PA_OutputText(0, 13, 19, "paused "); break; - case (MP3ST_PLAYING) : PA_OutputText(0, 13, 19, "playing "); break; - case (MP3ST_OUT_OF_DATA) : PA_OutputText(0, 13, 19, "out of data "); break; - case (MP3ST_DECODE_ERROR) : PA_OutputText(0, 13, 19, "decoding error"); break; - case (MP3ST_INITFAILED) : PA_OutputText(0, 13, 19, "init failed "); break; - } - - // controls - if (Pad.Newpress.A) { - - if (AS_GetMP3Status() & MP3ST_PAUSED) { - - AS_MP3Unpause(); - - } else { - - AS_MP3StreamPlay("test.mp3"); - - AS_SetMP3Loop(true); - rate = 0; - newrate = 0; - } - } - if (Pad.Newpress.B) { - - AS_MP3Pause(); - } - if (Pad.Newpress.X) { - - AS_MP3Stop(); - } - if (Pad.Newpress.Y) { - - if(IPC_Sound->mp3.delay) - AS_SetMP3Delay(AS_NO_DELAY); - else - AS_SetMP3Delay(AS_SURROUND); - } - - // change panning & sample rate using the stylus - if((Stylus.Held) && rate && (AS_GetMP3Status() & MP3ST_PLAYING)) { - - newrate = (rate + rate/4) - (rate * Stylus.Y / 96 / 4); - AS_SetMP3Rate(newrate); - AS_SetMP3Pan(Stylus.X / 2); - } - // set sample rate - if(rate == 0 && IPC_Sound->mp3.rate && (AS_GetMP3Status() & MP3ST_PLAYING)) { - - rate = IPC_Sound->mp3.rate; - newrate = rate; - } - - } else { - - // show some infos - PA_OutputText(0, 0, 3, " SFX Testing mode\n\n\n" - "A: play SFX_A B: play SFX_B\n\n" - "X: autopan ON/OFF Y: FX mode\n\n" - "--------------------------------\n"); - PA_OutputText(0, 0, 22, " [press select for MP3 mode]\n"); - - // show channels usage, autopan status & panning of last sound played - PA_OutputText(0, 0, 12, "Chan usage : %d / %d \n\n", usage, IPC_Sound->num_chan - 1); - PA_OutputText(0, 0, 14, "Autopan : %s\n\n", (autopan ? "on " : "off")); - PA_OutputText(0, 0, 16, "Last SFX pan : %d \n", IPC_Sound->chan[lastsfx].snd.pan); - - // show fx mode - PA_OutputText(0, 0, 18, "SFX effect : %s\n", (fx_mode == AS_SURROUND ? "surround" : ( fx_mode == AS_REVERB ? "reverb " : "no fx "))); - PA_OutputText(0, 0, 19, "(start new SFX to take effect)"); - - // controls - if (Pad.Newpress.A) { - - lastsfx = AS_SoundQuickPlay(sfxa); - } - if (Pad.Newpress.B) { - - lastsfx = AS_SoundQuickPlay(sfxb); - } - if (Pad.Newpress.X) { - autopan = !autopan; - } - if (Pad.Newpress.Y) { - - if(fx_mode == AS_SURROUND) - fx_mode = AS_REVERB; - else if(fx_mode == AS_REVERB) - fx_mode = AS_NO_DELAY; - else - fx_mode = AS_SURROUND; - - // set new default sound settings - AS_SetDefaultSettings(AS_PCM_8BIT, 11025, fx_mode); - } - - // autopan - if(autopan) - AS_SetSoundPan(lastsfx, (++pan > 127 ? 255 - pan : pan)); - - // get the number of busy channels - usage = 0; - for(i = 1; i < IPC_Sound->num_chan; i++) - if(IPC_Sound->chan[i].busy) - usage++; - - } - - // switch testing mode - if ((Pad.Newpress.Select)) { - - if(mp3_mode) - AS_MP3Stop(); - - PA_ClearTextBg(0); - - mp3_mode = !mp3_mode; - } - - PA_WaitForVBL(); - } - - return 0; -} +/* ASLib example - by Noda + PAlib version by Tom + Streaming an MP3 with EFSv2 +*/ + + +// Includes +#include + +// the sounds +#include "sfxa.h" +#include "sfxb.h" + +int main() +{ + // variables + int i, rate = 0, newrate = 0; + bool mp3_mode = true, autopan = false; + u8 lastsfx = 0, usage = 0, pan = 0, fx_mode = AS_SURROUND; + + // PALib Initialization + PA_Init(); + PA_LoadDefaultText(0, 0); + + // Initialize EFS + if (!nitroFSInit(NULL)) { + PA_OutputText(0, 1, 1, "Filesystem init error !!!"); + for(;;) PA_WaitForVBL(); + } + + // Check if test.mp3 is there, regardless if libfat or EFS_Lib is used + MP3FILE* file = FILE_OPEN("test.mp3"); + if (!file) { + PA_OutputText(0, 1, 1, "test.mp3 not found !!!"); + for(;;) PA_WaitForVBL(); + } + FILE_CLOSE(file); + + // Init AS_Lib for mp3 + PA_VBLFunctionInit(AS_SoundVBL); + if (!AS_Init(AS_MODE_MP3 | AS_MODE_SURROUND | AS_MODE_16CH)) { + PA_OutputText(0, 1, 1, "ASlib init error !!!"); + return 1; + } + AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); + + // Infinite loop to keep the program running + while (1) + { + // display info text + PA_OutputText(0, 0, 0, " ASlib example - by Noda\n -----------------------"); + + if (mp3_mode) { + + // show some infos + PA_OutputText(0, 0, 3, " MP3 Testing mode\n\n\n" + "A: play MP3 B: pause MP3\n\n" + "X: stop MP3 Y: surround ON/OFF\n\n" + "Stylus : < > pan ^ v pitch\n\n" + "--------------------------------\n"); + + PA_OutputText(0, 0, 22, " [press select for SFX mode]\n"); + + // show sample rate & panning + PA_OutputText(0, 0, 14, "Sample rate : %d pan : %d \n", newrate, IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan); + + // show surround status + PA_OutputText(0, 0, 16, "Surround : %s\n", (IPC_Sound->mp3.delay ? "on " : "off")); + PA_OutputText(0, 0, 17, "(restart play to take effect)"); + + // show playback status + PA_OutputText(0, 0, 19, "MP3 Status : "); // clear status field + switch (AS_GetMP3Status()) { + case (MP3ST_STOPPED) : PA_OutputText(0, 13, 19, "stopped "); break; + case (MP3ST_PAUSED) : PA_OutputText(0, 13, 19, "paused "); break; + case (MP3ST_PLAYING) : PA_OutputText(0, 13, 19, "playing "); break; + case (MP3ST_OUT_OF_DATA) : PA_OutputText(0, 13, 19, "out of data "); break; + case (MP3ST_DECODE_ERROR) : PA_OutputText(0, 13, 19, "decoding error"); break; + case (MP3ST_INITFAILED) : PA_OutputText(0, 13, 19, "init failed "); break; + } + + // controls + if (Pad.Newpress.A) { + + if (AS_GetMP3Status() & MP3ST_PAUSED) { + + AS_MP3Unpause(); + + } else { + + AS_MP3StreamPlay("test.mp3"); + + AS_SetMP3Loop(true); + rate = 0; + newrate = 0; + } + } + if (Pad.Newpress.B) { + + AS_MP3Pause(); + } + if (Pad.Newpress.X) { + + AS_MP3Stop(); + } + if (Pad.Newpress.Y) { + + if(IPC_Sound->mp3.delay) + AS_SetMP3Delay(AS_NO_DELAY); + else + AS_SetMP3Delay(AS_SURROUND); + } + + // change panning & sample rate using the stylus + if((Stylus.Held) && rate && (AS_GetMP3Status() & MP3ST_PLAYING)) { + + newrate = (rate + rate/4) - (rate * Stylus.Y / 96 / 4); + AS_SetMP3Rate(newrate); + AS_SetMP3Pan(Stylus.X / 2); + } + // set sample rate + if(rate == 0 && IPC_Sound->mp3.rate && (AS_GetMP3Status() & MP3ST_PLAYING)) { + + rate = IPC_Sound->mp3.rate; + newrate = rate; + } + + } else { + + // show some infos + PA_OutputText(0, 0, 3, " SFX Testing mode\n\n\n" + "A: play SFX_A B: play SFX_B\n\n" + "X: autopan ON/OFF Y: FX mode\n\n" + "--------------------------------\n"); + PA_OutputText(0, 0, 22, " [press select for MP3 mode]\n"); + + // show channels usage, autopan status & panning of last sound played + PA_OutputText(0, 0, 12, "Chan usage : %d / %d \n\n", usage, IPC_Sound->num_chan - 1); + PA_OutputText(0, 0, 14, "Autopan : %s\n\n", (autopan ? "on " : "off")); + PA_OutputText(0, 0, 16, "Last SFX pan : %d \n", IPC_Sound->chan[lastsfx].snd.pan); + + // show fx mode + PA_OutputText(0, 0, 18, "SFX effect : %s\n", (fx_mode == AS_SURROUND ? "surround" : ( fx_mode == AS_REVERB ? "reverb " : "no fx "))); + PA_OutputText(0, 0, 19, "(start new SFX to take effect)"); + + // controls + if (Pad.Newpress.A) { + + lastsfx = AS_SoundQuickPlay(sfxa); + } + if (Pad.Newpress.B) { + + lastsfx = AS_SoundQuickPlay(sfxb); + } + if (Pad.Newpress.X) { + autopan = !autopan; + } + if (Pad.Newpress.Y) { + + if(fx_mode == AS_SURROUND) + fx_mode = AS_REVERB; + else if(fx_mode == AS_REVERB) + fx_mode = AS_NO_DELAY; + else + fx_mode = AS_SURROUND; + + // set new default sound settings + AS_SetDefaultSettings(AS_PCM_8BIT, 11025, fx_mode); + } + + // autopan + if(autopan) + AS_SetSoundPan(lastsfx, (++pan > 127 ? 255 - pan : pan)); + + // get the number of busy channels + usage = 0; + for(i = 1; i < IPC_Sound->num_chan; i++) + if(IPC_Sound->chan[i].busy) + usage++; + + } + + // switch testing mode + if ((Pad.Newpress.Select)) { + + if(mp3_mode) + AS_MP3Stop(); + + PA_ClearTextBg(0); + + mp3_mode = !mp3_mode; + } + + PA_WaitForVBL(); + } + + return 0; +} diff --git a/examples/Sound/ASlib/PSG/Makefile b/examples/Sound/ASlib/PSG/Makefile index 3972b76..16b7489 100644 --- a/examples/Sound/ASlib/PSG/Makefile +++ b/examples/Sound/ASlib/PSG/Makefile @@ -1,5 +1,5 @@ -export BLOCKSDSEXT ?= /opt/blocksds/external - -ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_mp3.elf - -include ../../../Makefile_example +export BLOCKSDSEXT ?= /opt/blocksds/external + +ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_mp3.elf + +include ../../../Makefile_example diff --git a/examples/Sound/ASlib/PSG/source/main.c b/examples/Sound/ASlib/PSG/source/main.c index 61e1dd9..92164a6 100644 --- a/examples/Sound/ASlib/PSG/source/main.c +++ b/examples/Sound/ASlib/PSG/source/main.c @@ -1,55 +1,55 @@ -// Includes -#include // Include for PA_Lib - - -int C_scale[8] = {33,37,41,44,49,55,62,65}; // Scale for notes in C major scale - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Init the sound system - if (!AS_Init(AS_MODE_SURROUND | AS_MODE_16CH)) { - PA_OutputText(0, 1, 1, "ASlib init error !!!"); - return 1; - } - AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); - - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - u8 pan; - s32 note; - u8 duty; - - pan = 64; - - PA_OutputText(1, 1, 9,"Use stylus to change note/duty, and keys to change pan"); - - // Infinite loop to keep the program running - while (1) - { - note = C_scale[(Stylus.X>>5)]<<4; - pan += Pad.Held.Right-Pad.Held.Left; // Change pan with pad - duty = Stylus.Y/24; // 0-7 - - // Check the stylus presses : - if (Stylus.Held){ - PA_PlayPSG(8, 127, pan, note, duty); - PA_PlayPSG(9, 127, pan, note*2, duty);//octave - } - else { - PA_PlayPSG(8, 0, 0, 0, 0); // Blank sound - PA_PlayPSG(9, 0, 0, 0, 0); // Blank sound - } - - // Get the stylus position and show it on screen - PA_OutputText(1, 1, 11, "Stylus Position : %d, %d ", Stylus.X, Stylus.Y); - PA_OutputText(1, 1, 12, "Note : %d Pan : %d Duty : %d ", note, pan, duty); - - - PA_WaitForVBL(); - } - - return 0; -} // End of main() +// Includes +#include // Include for PA_Lib + + +int C_scale[8] = {33,37,41,44,49,55,62,65}; // Scale for notes in C major scale + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Init the sound system + if (!AS_Init(AS_MODE_SURROUND | AS_MODE_16CH)) { + PA_OutputText(0, 1, 1, "ASlib init error !!!"); + return 1; + } + AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); + + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + u8 pan; + s32 note; + u8 duty; + + pan = 64; + + PA_OutputText(1, 1, 9,"Use stylus to change note/duty, and keys to change pan"); + + // Infinite loop to keep the program running + while (1) + { + note = C_scale[(Stylus.X>>5)]<<4; + pan += Pad.Held.Right-Pad.Held.Left; // Change pan with pad + duty = Stylus.Y/24; // 0-7 + + // Check the stylus presses : + if (Stylus.Held){ + PA_PlayPSG(8, 127, pan, note, duty); + PA_PlayPSG(9, 127, pan, note*2, duty);//octave + } + else { + PA_PlayPSG(8, 0, 0, 0, 0); // Blank sound + PA_PlayPSG(9, 0, 0, 0, 0); // Blank sound + } + + // Get the stylus position and show it on screen + PA_OutputText(1, 1, 11, "Stylus Position : %d, %d ", Stylus.X, Stylus.Y); + PA_OutputText(1, 1, 12, "Note : %d Pan : %d Duty : %d ", note, pan, duty); + + + PA_WaitForVBL(); + } + + return 0; +} // End of main() diff --git a/examples/Sound/ASlib/SoundChanBusy/Makefile b/examples/Sound/ASlib/SoundChanBusy/Makefile index 1215f32..9613cb7 100644 --- a/examples/Sound/ASlib/SoundChanBusy/Makefile +++ b/examples/Sound/ASlib/SoundChanBusy/Makefile @@ -1,6 +1,6 @@ -export BLOCKSDSEXT ?= /opt/blocksds/external - -ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_mp3.elf -BINDIRS := data - -include ../../../Makefile_example +export BLOCKSDSEXT ?= /opt/blocksds/external + +ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_mp3.elf +BINDIRS := data + +include ../../../Makefile_example diff --git a/examples/Sound/ASlib/SoundChanBusy/source/main.c b/examples/Sound/ASlib/SoundChanBusy/source/main.c index a9ee8d6..2bfdb74 100644 --- a/examples/Sound/ASlib/SoundChanBusy/source/main.c +++ b/examples/Sound/ASlib/SoundChanBusy/source/main.c @@ -1,36 +1,36 @@ -// Test to see if a channel is free or not - -// Includes -#include // Include for PA_Lib -#include "saberoff.h" // Include the sound (found in the data folder in .raw format) - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - PA_LoadDefaultText(0, 0); - - // Init the sound system - if (!AS_Init(AS_MODE_SURROUND | AS_MODE_16CH)) { - PA_OutputText(0, 1, 1, "ASlib init error !!!"); - return 1; - } - AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); - - u8 i; - - // Infinite loop to keep the program running - while (1) - { - if (Pad.Newpress.A) { - PA_PlaySimpleSound(saberoff); - } - - for (i = 0; i < 16; i++) - PA_OutputText(0, 0, i, "Channel %d busy : %d ", i, PA_SoundChannelIsBusy(i)); // 0 for free, 1 for busy - - PA_WaitForVBL(); - } - - return 0; -} // End of main() +// Test to see if a channel is free or not + +// Includes +#include // Include for PA_Lib +#include "saberoff.h" // Include the sound (found in the data folder in .raw format) + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + PA_LoadDefaultText(0, 0); + + // Init the sound system + if (!AS_Init(AS_MODE_SURROUND | AS_MODE_16CH)) { + PA_OutputText(0, 1, 1, "ASlib init error !!!"); + return 1; + } + AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); + + u8 i; + + // Infinite loop to keep the program running + while (1) + { + if (Pad.Newpress.A) { + PA_PlaySimpleSound(saberoff); + } + + for (i = 0; i < 16; i++) + PA_OutputText(0, 0, i, "Channel %d busy : %d ", i, PA_SoundChannelIsBusy(i)); // 0 for free, 1 for busy + + PA_WaitForVBL(); + } + + return 0; +} // End of main() diff --git a/examples/Sound/ASlib/SoundPlayback/Makefile b/examples/Sound/ASlib/SoundPlayback/Makefile index 1215f32..9613cb7 100644 --- a/examples/Sound/ASlib/SoundPlayback/Makefile +++ b/examples/Sound/ASlib/SoundPlayback/Makefile @@ -1,6 +1,6 @@ -export BLOCKSDSEXT ?= /opt/blocksds/external - -ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_mp3.elf -BINDIRS := data - -include ../../../Makefile_example +export BLOCKSDSEXT ?= /opt/blocksds/external + +ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_mp3.elf +BINDIRS := data + +include ../../../Makefile_example diff --git a/examples/Sound/ASlib/SoundPlayback/source/main.c b/examples/Sound/ASlib/SoundPlayback/source/main.c index 25bf74b..0c7b2a2 100644 --- a/examples/Sound/ASlib/SoundPlayback/source/main.c +++ b/examples/Sound/ASlib/SoundPlayback/source/main.c @@ -1,36 +1,36 @@ -// Includes -#include - -// Include the sound -#include "sfx.h" - -int main() -{ - // PALib Initialization - PA_Init(); - PA_LoadDefaultText(0, 0); - - // Init AS_Lib for normal sound playback only - if (!AS_Init(AS_MODE_SURROUND | AS_MODE_16CH)) { - PA_OutputText(0, 1, 1, "ASlib init error !!!"); - return 1; - } - AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); - - // Display info text - PA_OutputText(0, 1, 1, "Simple sound playback example\n\nUse A to start the sound"); - - // Infinite loop to keep the program running - while (1) - { - // Play sound when the user presses A - if (Pad.Newpress.A) - { - AS_SoundQuickPlay(sfx); // This returns the channel the sound is played on so you can apply effects like changing the pan or volume afterwards. - } - - PA_WaitForVBL(); - } - - return 0; -} +// Includes +#include + +// Include the sound +#include "sfx.h" + +int main() +{ + // PALib Initialization + PA_Init(); + PA_LoadDefaultText(0, 0); + + // Init AS_Lib for normal sound playback only + if (!AS_Init(AS_MODE_SURROUND | AS_MODE_16CH)) { + PA_OutputText(0, 1, 1, "ASlib init error !!!"); + return 1; + } + AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); + + // Display info text + PA_OutputText(0, 1, 1, "Simple sound playback example\n\nUse A to start the sound"); + + // Infinite loop to keep the program running + while (1) + { + // Play sound when the user presses A + if (Pad.Newpress.A) + { + AS_SoundQuickPlay(sfx); // This returns the channel the sound is played on so you can apply effects like changing the pan or volume afterwards. + } + + PA_WaitForVBL(); + } + + return 0; +} diff --git a/examples/Sound/Maxmod/BasicModPlayback/Makefile b/examples/Sound/Maxmod/BasicModPlayback/Makefile index 8653950..41beb6f 100644 --- a/examples/Sound/Maxmod/BasicModPlayback/Makefile +++ b/examples/Sound/Maxmod/BasicModPlayback/Makefile @@ -1,3 +1,3 @@ -AUDIODIRS := audio - -include ../../../Makefile_example +AUDIODIRS := audio + +include ../../../Makefile_example diff --git a/examples/Sound/Maxmod/BasicModPlayback/source/main.c b/examples/Sound/Maxmod/BasicModPlayback/source/main.c index aadcad6..64556ae 100644 --- a/examples/Sound/Maxmod/BasicModPlayback/source/main.c +++ b/examples/Sound/Maxmod/BasicModPlayback/source/main.c @@ -1,42 +1,42 @@ -/* -This example shows the basic usage of the Maxmod library by eKid. - -It comes with libnds, so using it doesn't require any installation. - -Just be sure the Makefile for your project has ARM7_MAXMOD_DSWIFI -as the selected ARM7 binary. -*/ - -// Includes -#include -#include // Include Maxmod - -// Include the soundbank -#include "soundbank_bin.h" -#include "soundbank.h" - -int main(){ - // PAlib Initialization - PA_Init(); - PA_LoadDefaultText(0, 0); - - // Initialize Maxmod - mmInitDefaultMem((mm_addr)soundbank_bin); - - // Load the music - mmLoad(MOD_MUSIC); - - // Display info text - PA_OutputText(0, 1, 1, "Simple Maxmod example\n\nUse A to start the music,\nB to stop it"); - - // Infinite loop to keep the program running - while(true){ - // Play the module when the user presses A - if(Pad.Newpress.A) - mmStart(MOD_MUSIC, MM_PLAY_LOOP); - else if(Pad.Newpress.B) - mmStop(); - - PA_WaitForVBL(); - } +/* +This example shows the basic usage of the Maxmod library by eKid. + +It comes with libnds, so using it doesn't require any installation. + +Just be sure the Makefile for your project has ARM7_MAXMOD_DSWIFI +as the selected ARM7 binary. +*/ + +// Includes +#include +#include // Include Maxmod + +// Include the soundbank +#include "soundbank_bin.h" +#include "soundbank.h" + +int main(){ + // PAlib Initialization + PA_Init(); + PA_LoadDefaultText(0, 0); + + // Initialize Maxmod + mmInitDefaultMem((mm_addr)soundbank_bin); + + // Load the music + mmLoad(MOD_MUSIC); + + // Display info text + PA_OutputText(0, 1, 1, "Simple Maxmod example\n\nUse A to start the music,\nB to stop it"); + + // Infinite loop to keep the program running + while(true){ + // Play the module when the user presses A + if(Pad.Newpress.A) + mmStart(MOD_MUSIC, MM_PLAY_LOOP); + else if(Pad.Newpress.B) + mmStop(); + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Sound/Maxmod/ModAndSounds/Makefile b/examples/Sound/Maxmod/ModAndSounds/Makefile index 8653950..41beb6f 100644 --- a/examples/Sound/Maxmod/ModAndSounds/Makefile +++ b/examples/Sound/Maxmod/ModAndSounds/Makefile @@ -1,3 +1,3 @@ -AUDIODIRS := audio - -include ../../../Makefile_example +AUDIODIRS := audio + +include ../../../Makefile_example diff --git a/examples/Sound/Maxmod/ModAndSounds/source/main.c b/examples/Sound/Maxmod/ModAndSounds/source/main.c index 705afc4..1d99c85 100644 --- a/examples/Sound/Maxmod/ModAndSounds/source/main.c +++ b/examples/Sound/Maxmod/ModAndSounds/source/main.c @@ -1,49 +1,49 @@ -/* -This example shows the basic usage of the Maxmod library by eKid. - -It comes with libnds, so using it doesn't require any installation. - -Just be sure the Makefile for your project has ARM7_MAXMOD_DSWIFI -as the selected ARM7 binary. -*/ - -// Includes -#include -#include // Maxmod include - -// Include the soundbank -#include "soundbank_bin.h" -#include "soundbank.h" - -int main(){ - // PAlib Initialization - PA_Init(); - PA_LoadDefaultText(0, 0); - - // Initialize Maxmod - mmInitDefaultMem((mm_addr)soundbank_bin); - - // Load and play the music - mmLoad(MOD_MUSIC); - mmStart(MOD_MUSIC, MM_PLAY_LOOP); - - // Load the sounds - // Please note that they are regular .wav - // files put into the audio folder - mmLoadEffect(SFX_SFXA); - mmLoadEffect(SFX_SFXB); - - // Display info text - PA_OutputText(0, 1, 1, "Maxmod example:\nplaying music and sounds\n\nA - play sound effect #1\nB - play sound effect #2"); - - // Infinite loop to keep the program running - while(true){ - // Play the sounds when the user presses A or B - if(Pad.Newpress.A) - mmEffect(SFX_SFXA); - if(Pad.Newpress.B) - mmEffect(SFX_SFXB); - - PA_WaitForVBL(); - } +/* +This example shows the basic usage of the Maxmod library by eKid. + +It comes with libnds, so using it doesn't require any installation. + +Just be sure the Makefile for your project has ARM7_MAXMOD_DSWIFI +as the selected ARM7 binary. +*/ + +// Includes +#include +#include // Maxmod include + +// Include the soundbank +#include "soundbank_bin.h" +#include "soundbank.h" + +int main(){ + // PAlib Initialization + PA_Init(); + PA_LoadDefaultText(0, 0); + + // Initialize Maxmod + mmInitDefaultMem((mm_addr)soundbank_bin); + + // Load and play the music + mmLoad(MOD_MUSIC); + mmStart(MOD_MUSIC, MM_PLAY_LOOP); + + // Load the sounds + // Please note that they are regular .wav + // files put into the audio folder + mmLoadEffect(SFX_SFXA); + mmLoadEffect(SFX_SFXB); + + // Display info text + PA_OutputText(0, 1, 1, "Maxmod example:\nplaying music and sounds\n\nA - play sound effect #1\nB - play sound effect #2"); + + // Infinite loop to keep the program running + while(true){ + // Play the sounds when the user presses A or B + if(Pad.Newpress.A) + mmEffect(SFX_SFXA); + if(Pad.Newpress.B) + mmEffect(SFX_SFXB); + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Sound/Maxmod/Reverb/Makefile b/examples/Sound/Maxmod/Reverb/Makefile index 8653950..41beb6f 100644 --- a/examples/Sound/Maxmod/Reverb/Makefile +++ b/examples/Sound/Maxmod/Reverb/Makefile @@ -1,3 +1,3 @@ -AUDIODIRS := audio - -include ../../../Makefile_example +AUDIODIRS := audio + +include ../../../Makefile_example diff --git a/examples/Sound/Maxmod/Reverb/source/main.c b/examples/Sound/Maxmod/Reverb/source/main.c index 3752c3b..87afaaa 100644 --- a/examples/Sound/Maxmod/Reverb/source/main.c +++ b/examples/Sound/Maxmod/Reverb/source/main.c @@ -1,115 +1,115 @@ -/* -This example shows the basic usage of the Maxmod library by eKid. - -It comes with libnds, so using it doesn't require any installation. - -Just be sure the Makefile for your project has ARM7_MAXMOD_DSWIFI -as the selected ARM7 binary. -*/ - -/////////////////////////////////////////////////// -// This example was translated to PAlib by fincs // -// from the libnds Maxmod examples // -/////////////////////////////////////////////////// - -// Includes -#include -#include // MaxmMod include - -// Include the soundbank -#include "soundbank_bin.h" -#include "soundbank.h" - -// Settings for the reverb engine -enum{ - rv_delay_left = 500, // milliseconds - rv_delay_right = 520, - rv_rate = 32768, // Hertz - rv_format = 16 // 16-bit -}; - -void setupReverb(){ - // Enable reverb system - mmReverbEnable(); - - // Calculate amount required and allocate memory - // for both reverb channels - void* rv_buffer_left; - void* rv_buffer_right; - - int rv_size_left; - int rv_size_right; - rv_size_left = mmReverbBufferSize(rv_format, rv_rate, rv_delay_left); - rv_size_right = mmReverbBufferSize(rv_format, rv_rate, rv_delay_right); - - rv_buffer_left = malloc(rv_size_left * 4); - rv_buffer_right = malloc(rv_size_right * 4); - - // Configure reverb settings - mm_reverb_cfg config; - - config.flags = MMRF_MEMORY | MMRF_DELAY | MMRF_FEEDBACK | - MMRF_PANNING | MMRF_DRYLEFT | MMRF_DRYRIGHT | - MMRF_RATE | MMRF_16BITLEFT | MMRF_16BITRIGHT | - MMRF_INVERSEPAN | MMRF_BOTH; - - config.memory = rv_buffer_left; // Set memory target (for left) - config.delay = rv_size_left; // Set delay (for left) - config.feedback = 1024; // Set feedback to 50% (for both) - config.panning = 0; // Set panning to 0% (and inversed (100%) for right channel) - config.rate = 16777216 / rv_rate; // Set sampling rate for both channels - mmReverbConfigure(&config); // Run configuration... - - // Configure remaining parameters (right channel memory and delay) - config.flags = MMRF_MEMORY | MMRF_DELAY | MMRF_RIGHT; - - config.delay = rv_size_right; - config.memory = rv_buffer_right; - - mmReverbConfigure(&config); -} - -int main(){ - // PAlib Initialization - PA_Init(); - PA_LoadDefaultText(0, 0); - - // Initialize Maxmod - mmInitDefaultMem((mm_addr)soundbank_bin); - - // Setup the reverb engine - setupReverb(); - - // Load and play the music - mmLoad(MOD_MUSIC); - mmStart(MOD_MUSIC, MM_PLAY_LOOP); - - // Display info text - PA_OutputText(0, 1, 1, "Maxmod reverb example\nTranslated to PAlib by fincs\n\nPress A to toggle reverb"); - - bool reverb_active = false; - - // Infinite loop to keep the program running - while(true){ - // Toggle reverb - if(Pad.Newpress.A){ - reverb_active = !reverb_active; - if(reverb_active){ - // start reverb - mmReverbStart(MMRC_BOTH); - - // lower module volume & tempo - // this creates a cool atmosphere - mmSetModuleVolume(550); - mmSetModuleTempo(800); - }else{ - // stop reverb and restore volume and tempo - mmReverbStop(MMRC_BOTH); - mmSetModuleVolume(0x400); - mmSetModuleTempo(0x400); - } - } - - PA_WaitForVBL(); - } +/* +This example shows the basic usage of the Maxmod library by eKid. + +It comes with libnds, so using it doesn't require any installation. + +Just be sure the Makefile for your project has ARM7_MAXMOD_DSWIFI +as the selected ARM7 binary. +*/ + +/////////////////////////////////////////////////// +// This example was translated to PAlib by fincs // +// from the libnds Maxmod examples // +/////////////////////////////////////////////////// + +// Includes +#include +#include // MaxmMod include + +// Include the soundbank +#include "soundbank_bin.h" +#include "soundbank.h" + +// Settings for the reverb engine +enum{ + rv_delay_left = 500, // milliseconds + rv_delay_right = 520, + rv_rate = 32768, // Hertz + rv_format = 16 // 16-bit +}; + +void setupReverb(){ + // Enable reverb system + mmReverbEnable(); + + // Calculate amount required and allocate memory + // for both reverb channels + void* rv_buffer_left; + void* rv_buffer_right; + + int rv_size_left; + int rv_size_right; + rv_size_left = mmReverbBufferSize(rv_format, rv_rate, rv_delay_left); + rv_size_right = mmReverbBufferSize(rv_format, rv_rate, rv_delay_right); + + rv_buffer_left = malloc(rv_size_left * 4); + rv_buffer_right = malloc(rv_size_right * 4); + + // Configure reverb settings + mm_reverb_cfg config; + + config.flags = MMRF_MEMORY | MMRF_DELAY | MMRF_FEEDBACK | + MMRF_PANNING | MMRF_DRYLEFT | MMRF_DRYRIGHT | + MMRF_RATE | MMRF_16BITLEFT | MMRF_16BITRIGHT | + MMRF_INVERSEPAN | MMRF_BOTH; + + config.memory = rv_buffer_left; // Set memory target (for left) + config.delay = rv_size_left; // Set delay (for left) + config.feedback = 1024; // Set feedback to 50% (for both) + config.panning = 0; // Set panning to 0% (and inversed (100%) for right channel) + config.rate = 16777216 / rv_rate; // Set sampling rate for both channels + mmReverbConfigure(&config); // Run configuration... + + // Configure remaining parameters (right channel memory and delay) + config.flags = MMRF_MEMORY | MMRF_DELAY | MMRF_RIGHT; + + config.delay = rv_size_right; + config.memory = rv_buffer_right; + + mmReverbConfigure(&config); +} + +int main(){ + // PAlib Initialization + PA_Init(); + PA_LoadDefaultText(0, 0); + + // Initialize Maxmod + mmInitDefaultMem((mm_addr)soundbank_bin); + + // Setup the reverb engine + setupReverb(); + + // Load and play the music + mmLoad(MOD_MUSIC); + mmStart(MOD_MUSIC, MM_PLAY_LOOP); + + // Display info text + PA_OutputText(0, 1, 1, "Maxmod reverb example\nTranslated to PAlib by fincs\n\nPress A to toggle reverb"); + + bool reverb_active = false; + + // Infinite loop to keep the program running + while(true){ + // Toggle reverb + if(Pad.Newpress.A){ + reverb_active = !reverb_active; + if(reverb_active){ + // start reverb + mmReverbStart(MMRC_BOTH); + + // lower module volume & tempo + // this creates a cool atmosphere + mmSetModuleVolume(550); + mmSetModuleTempo(800); + }else{ + // stop reverb and restore volume and tempo + mmReverbStop(MMRC_BOTH); + mmSetModuleVolume(0x400); + mmSetModuleTempo(0x400); + } + } + + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Sound/Microphone/Makefile b/examples/Sound/Microphone/Makefile index 21f133f..a49fbfb 100644 --- a/examples/Sound/Microphone/Makefile +++ b/examples/Sound/Microphone/Makefile @@ -1 +1 @@ -include ../../Makefile_example +include ../../Makefile_example diff --git a/examples/Sound/Microphone/source/main.c b/examples/Sound/Microphone/source/main.c index fc081f1..a954302 100644 --- a/examples/Sound/Microphone/source/main.c +++ b/examples/Sound/Microphone/source/main.c @@ -1,52 +1,52 @@ -// Microphone example - -// Includes -#include // Include for PA_Lib - -#define SEC_TO_LENGTH(sec) ((sec) * 16384) -#define BUF_SIZE SEC_TO_LENGTH(10) // ten seconds - -u8 MicData[BUF_SIZE]; // Array we will use to save the microphone... - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - PA_LoadDefaultText(0, 0); - - // Init the sound system - AS_Init(AS_MODE_SURROUND | AS_MODE_16CH); - AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); - - PA_OutputSimpleText(0, 4, 9, "Press A to start recording"); - PA_OutputSimpleText(0, 4, 10, "Press B to play sound"); - - // Infinite loop to keep the program running - while (1) - { - // Record if A pressed... - if (Pad.Newpress.A) - PA_MicStartRecording(MicData, BUF_SIZE); // Buffer, buffer length - - // If B, replay recorded sound - if(Pad.Newpress.B) - PA_MicReplay(MicData, BUF_SIZE); // Buffer used, buffer length - - // Get mic volume, even if not recording - // Notes about mic volume: - // It is calculated using a special algorithm made by fincs. - // He tested it on his NDS and discovered the following values: - // 0 - ~75 = background noise - // ~75 - ~150 = regular talking - // ~150 - 255 = blowing into the mic - // The algorithm: - // f(x) = (cnv(x) + old) / 2, old = cnv(x) - // cnv(x) = abs(x) * 2 - PA_OutputText(0, 2, 12, "Mic Volume: %d ", PA_MicGetVol()); - PA_OutputSimpleText(0, 2, 13, PA_MicGetVol() > 150 ? "Blowing!" : " "); - - PA_WaitForVBL(); - } - - return 0; +// Microphone example + +// Includes +#include // Include for PA_Lib + +#define SEC_TO_LENGTH(sec) ((sec) * 16384) +#define BUF_SIZE SEC_TO_LENGTH(10) // ten seconds + +u8 MicData[BUF_SIZE]; // Array we will use to save the microphone... + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + PA_LoadDefaultText(0, 0); + + // Init the sound system + AS_Init(AS_MODE_SURROUND | AS_MODE_16CH); + AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); + + PA_OutputSimpleText(0, 4, 9, "Press A to start recording"); + PA_OutputSimpleText(0, 4, 10, "Press B to play sound"); + + // Infinite loop to keep the program running + while (1) + { + // Record if A pressed... + if (Pad.Newpress.A) + PA_MicStartRecording(MicData, BUF_SIZE); // Buffer, buffer length + + // If B, replay recorded sound + if(Pad.Newpress.B) + PA_MicReplay(MicData, BUF_SIZE); // Buffer used, buffer length + + // Get mic volume, even if not recording + // Notes about mic volume: + // It is calculated using a special algorithm made by fincs. + // He tested it on his NDS and discovered the following values: + // 0 - ~75 = background noise + // ~75 - ~150 = regular talking + // ~150 - 255 = blowing into the mic + // The algorithm: + // f(x) = (cnv(x) + old) / 2, old = cnv(x) + // cnv(x) = abs(x) * 2 + PA_OutputText(0, 2, 12, "Mic Volume: %d ", PA_MicGetVol()); + PA_OutputSimpleText(0, 2, 13, PA_MicGetVol() > 150 ? "Blowing!" : " "); + + PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Animations/Frames/Makefile b/examples/Sprites/Animations/Frames/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Animations/Frames/Makefile +++ b/examples/Sprites/Animations/Frames/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Animations/Frames/gfx/all_gfx.h b/examples/Sprites/Animations/Frames/gfx/all_gfx.h index 6cab759..4661e55 100644 --- a/examples/Sprites/Animations/Frames/gfx/all_gfx.h +++ b/examples/Sprites/Animations/Frames/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char frames_Sprite[2048] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char frames_Sprite[2048] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Animations/Frames/source/main.c b/examples/Sprites/Animations/Frames/source/main.c index 70c9ef6..695fcac 100644 --- a/examples/Sprites/Animations/Frames/source/main.c +++ b/examples/Sprites/Animations/Frames/source/main.c @@ -1,40 +1,40 @@ -/* Sprite Frames... -*/ - - -// Includes, only one sprite -#include - - -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount; //Frame count... - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(1, 0); - - // Load the sprite palette, - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - PA_CreateSprite(0, 0,(void*)frames_Sprite, OBJ_SIZE_16X32,1, 0, 128-16, 64); - - while(1) - { - if (Pad.Held.Up) PA_SetSpriteAnim(0, 0, 0); // screen, sprite, frame - if (Pad.Held.Down) PA_SetSpriteAnim(0, 0, 2); // screen, sprite, frame - if (Pad.Held.Left) PA_SetSpriteAnim(0, 0, 3); // screen, sprite, frame - if (Pad.Held.Right) PA_SetSpriteAnim(0, 0, 1); // screen, sprite, frame - - PA_WaitForVBL(); - } - - return 0; +/* Sprite Frames... +*/ + + +// Includes, only one sprite +#include + + +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount; //Frame count... + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(1, 0); + + // Load the sprite palette, + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + PA_CreateSprite(0, 0,(void*)frames_Sprite, OBJ_SIZE_16X32,1, 0, 128-16, 64); + + while(1) + { + if (Pad.Held.Up) PA_SetSpriteAnim(0, 0, 0); // screen, sprite, frame + if (Pad.Held.Down) PA_SetSpriteAnim(0, 0, 2); // screen, sprite, frame + if (Pad.Held.Left) PA_SetSpriteAnim(0, 0, 3); // screen, sprite, frame + if (Pad.Held.Right) PA_SetSpriteAnim(0, 0, 1); // screen, sprite, frame + + PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Animations/SpriteAnim/Makefile b/examples/Sprites/Animations/SpriteAnim/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Animations/SpriteAnim/Makefile +++ b/examples/Sprites/Animations/SpriteAnim/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Animations/SpriteAnim/gfx/all_gfx.h b/examples/Sprites/Animations/SpriteAnim/gfx/all_gfx.h index d676e08..1928a61 100644 --- a/examples/Sprites/Animations/SpriteAnim/gfx/all_gfx.h +++ b/examples/Sprites/Animations/SpriteAnim/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char som_Sprite[6144] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char som_Sprite[6144] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Animations/SpriteAnim/source/main.c b/examples/Sprites/Animations/SpriteAnim/source/main.c index 8eef8c3..03937a7 100644 --- a/examples/Sprites/Animations/SpriteAnim/source/main.c +++ b/examples/Sprites/Animations/SpriteAnim/source/main.c @@ -1,57 +1,57 @@ -/* This will show the new sprite animation functions !! Yay ! -Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) -*/ - - -// Includes, only one sprite -#include - - -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount; //Frame count... - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... - - s32 x = 120; s32 y = 64; - - PA_CreateSprite(0, 0,(void*)som_Sprite, OBJ_SIZE_16X32,1, 0, x, y); // Sprite - - while(1) - { - // Animation code... - if(Pad.Newpress.Up) PA_StartSpriteAnim(0, 0, 0, 3, 4); - if(Pad.Newpress.Down) PA_StartSpriteAnim(0, 0, 8, 11, 4); - - if(Pad.Newpress.Right) { - PA_StartSpriteAnim(0, 0, 4, 7, 4); - PA_SetSpriteHflip(0, 0, 0); - } - if(Pad.Newpress.Left) { - PA_StartSpriteAnim(0, 0, 4, 7, 4); - PA_SetSpriteHflip(0, 0, 1); - } - - - if(!((Pad.Held.Left)||(Pad.Held.Up)||(Pad.Held.Down)||(Pad.Held.Right))) PA_SpriteAnimPause(0, 0, 1); - - - // Moving Code - y += Pad.Held.Down - Pad.Held.Up; - x += Pad.Held.Right - Pad.Held.Left; - PA_SetSpriteXY(0, 0, x, y); - - PA_WaitForVBL(); - } - - return 0; +/* This will show the new sprite animation functions !! Yay ! +Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) +*/ + + +// Includes, only one sprite +#include + + +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount; //Frame count... + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette.... + + s32 x = 120; s32 y = 64; + + PA_CreateSprite(0, 0,(void*)som_Sprite, OBJ_SIZE_16X32,1, 0, x, y); // Sprite + + while(1) + { + // Animation code... + if(Pad.Newpress.Up) PA_StartSpriteAnim(0, 0, 0, 3, 4); + if(Pad.Newpress.Down) PA_StartSpriteAnim(0, 0, 8, 11, 4); + + if(Pad.Newpress.Right) { + PA_StartSpriteAnim(0, 0, 4, 7, 4); + PA_SetSpriteHflip(0, 0, 0); + } + if(Pad.Newpress.Left) { + PA_StartSpriteAnim(0, 0, 4, 7, 4); + PA_SetSpriteHflip(0, 0, 1); + } + + + if(!((Pad.Held.Left)||(Pad.Held.Up)||(Pad.Held.Down)||(Pad.Held.Right))) PA_SpriteAnimPause(0, 0, 1); + + + // Moving Code + y += Pad.Held.Down - Pad.Held.Up; + x += Pad.Held.Right - Pad.Held.Left; + PA_SetSpriteXY(0, 0, x, y); + + PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Animations/SpriteAnim2/Makefile b/examples/Sprites/Animations/SpriteAnim2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Animations/SpriteAnim2/Makefile +++ b/examples/Sprites/Animations/SpriteAnim2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Animations/SpriteAnim2/gfx/all_gfx.h b/examples/Sprites/Animations/SpriteAnim2/gfx/all_gfx.h index 716ec96..8ad4784 100644 --- a/examples/Sprites/Animations/SpriteAnim2/gfx/all_gfx.h +++ b/examples/Sprites/Animations/SpriteAnim2/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char explosion_Sprite[28672] _GFX_ALIGN; // Palette: explosion_Pal - -// Palettes: -extern const unsigned short explosion_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char explosion_Sprite[28672] _GFX_ALIGN; // Palette: explosion_Pal + +// Palettes: +extern const unsigned short explosion_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Animations/SpriteAnim2/source/main.c b/examples/Sprites/Animations/SpriteAnim2/source/main.c index ea7f2f0..adfcab8 100644 --- a/examples/Sprites/Animations/SpriteAnim2/source/main.c +++ b/examples/Sprites/Animations/SpriteAnim2/source/main.c @@ -1,54 +1,54 @@ -/* This will show the new sprite animation functions !! Yay ! -Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) -*/ - - -// Includes, only one sprite -#include - - -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount; //Frame count... - - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(1, 0); - - // Load the sprite palette, - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)explosion_Pal); // Palette name - - // Here, we'll load a few similar sprites sprite to animate... at different speed - PA_CreateSprite(0, 0,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 0, 64); - PA_CreateSprite(0, 1,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 64, 64); - PA_CreateSprite(0, 2,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 128, 64); - PA_CreateSprite(0, 3,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 196, 64); - - // Start the animation. Once started, it works on its own ! - PA_StartSpriteAnim(0, // screen - 0, // sprite number - 0, // first frame is 0 - 6, // last frame is 3, since we have 4 frames... - 5); // Speed, set to 5 frames per second - PA_StartSpriteAnim(0, 1, 0, 6, 15); // for the second one, speed of 15 fps... - PA_StartSpriteAnim(0, 2, 0, 6, 30); // for the third one, speed of 30 fps... - PA_StartSpriteAnim(0, 3, 0, 6, 60); // for the last one, speed of 60 fps... - - u8 i; - - while(1) - { - // Display the frame number on the top screen - for(i = 0; i < 4; i++) PA_OutputText(1, 2, i, "Sprite %d Frame : %d ", i, PA_GetSpriteAnimFrame(0, i)); - PA_WaitForVBL(); - } - - return 0; +/* This will show the new sprite animation functions !! Yay ! +Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) +*/ + + +// Includes, only one sprite +#include + + +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount; //Frame count... + + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(1, 0); + + // Load the sprite palette, + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)explosion_Pal); // Palette name + + // Here, we'll load a few similar sprites sprite to animate... at different speed + PA_CreateSprite(0, 0,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 0, 64); + PA_CreateSprite(0, 1,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 64, 64); + PA_CreateSprite(0, 2,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 128, 64); + PA_CreateSprite(0, 3,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 196, 64); + + // Start the animation. Once started, it works on its own ! + PA_StartSpriteAnim(0, // screen + 0, // sprite number + 0, // first frame is 0 + 6, // last frame is 3, since we have 4 frames... + 5); // Speed, set to 5 frames per second + PA_StartSpriteAnim(0, 1, 0, 6, 15); // for the second one, speed of 15 fps... + PA_StartSpriteAnim(0, 2, 0, 6, 30); // for the third one, speed of 30 fps... + PA_StartSpriteAnim(0, 3, 0, 6, 60); // for the last one, speed of 60 fps... + + u8 i; + + while(1) + { + // Display the frame number on the top screen + for(i = 0; i < 4; i++) PA_OutputText(1, 2, i, "Sprite %d Frame : %d ", i, PA_GetSpriteAnimFrame(0, i)); + PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Animations/SpriteAnim3/Makefile b/examples/Sprites/Animations/SpriteAnim3/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Animations/SpriteAnim3/Makefile +++ b/examples/Sprites/Animations/SpriteAnim3/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Animations/SpriteAnim3/gfx/all_gfx.h b/examples/Sprites/Animations/SpriteAnim3/gfx/all_gfx.h index 716ec96..8ad4784 100644 --- a/examples/Sprites/Animations/SpriteAnim3/gfx/all_gfx.h +++ b/examples/Sprites/Animations/SpriteAnim3/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char explosion_Sprite[28672] _GFX_ALIGN; // Palette: explosion_Pal - -// Palettes: -extern const unsigned short explosion_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char explosion_Sprite[28672] _GFX_ALIGN; // Palette: explosion_Pal + +// Palettes: +extern const unsigned short explosion_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Animations/SpriteAnim3/source/main.c b/examples/Sprites/Animations/SpriteAnim3/source/main.c index e019c7e..cd469f8 100644 --- a/examples/Sprites/Animations/SpriteAnim3/source/main.c +++ b/examples/Sprites/Animations/SpriteAnim3/source/main.c @@ -1,57 +1,57 @@ -/* This will show the new sprite animation functions !! Yay ! -Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) -*/ - - -// Includes, only one sprite -#include - - -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount; //Frame count... -const unsigned char explosion[28672] __attribute__ ((aligned (4))); - -// Main function -int main(void) { - // PAlib init - PA_Init(); - - PA_LoadDefaultText(0, 0); - - // Load the sprite palette, - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)explosion_Pal); // Palette name - - // Here, we'll load a few similar sprites sprite to animate... at different speed - PA_CreateSprite(0, 0,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 0, 64); - PA_CreateSprite(0, 1,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 64, 64); - PA_CreateSprite(0, 2,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 128, 64); - PA_CreateSprite(0, 3,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 196, 64); - - // First animation will be normal - PA_StartSpriteAnim(0, // screen - 0, // sprite number - 0, // first frame is 0 - 6, // last frame is 3, since we have 4 frames... - 5); // Speed, set to 5 frames per second - - // Extended animations for the rest - PA_StartSpriteAnimEx(0, 1, 0, 6, 5, ANIM_ONESHOT); // just play it once... - PA_StartSpriteAnimEx(0, 2, 0, 6, 5, ANIM_UPDOWN, -1); // back and forth, infinite number of times - PA_StartSpriteAnimEx(0, 3, 0, 6, 5, ANIM_LOOP, 5); // Play it 5 times - - PA_OutputSimpleText(0, 0, 6, "Infinite"); - PA_OutputSimpleText(0, 8, 7, "OneShot"); - PA_OutputSimpleText(0, 16, 6, " UpDown"); - PA_OutputSimpleText(0, 24, 7, "5 Times"); - - while(1) - { - PA_WaitForVBL(); - } - - return 0; +/* This will show the new sprite animation functions !! Yay ! +Thanks to http://www.reinerstileset.4players.de:1059/englisch.htm and Arog for the sprite ;) +*/ + + +// Includes, only one sprite +#include + + +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount; //Frame count... +const unsigned char explosion[28672] __attribute__ ((aligned (4))); + +// Main function +int main(void) { + // PAlib init + PA_Init(); + + PA_LoadDefaultText(0, 0); + + // Load the sprite palette, + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)explosion_Pal); // Palette name + + // Here, we'll load a few similar sprites sprite to animate... at different speed + PA_CreateSprite(0, 0,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 0, 64); + PA_CreateSprite(0, 1,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 64, 64); + PA_CreateSprite(0, 2,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 128, 64); + PA_CreateSprite(0, 3,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 196, 64); + + // First animation will be normal + PA_StartSpriteAnim(0, // screen + 0, // sprite number + 0, // first frame is 0 + 6, // last frame is 3, since we have 4 frames... + 5); // Speed, set to 5 frames per second + + // Extended animations for the rest + PA_StartSpriteAnimEx(0, 1, 0, 6, 5, ANIM_ONESHOT); // just play it once... + PA_StartSpriteAnimEx(0, 2, 0, 6, 5, ANIM_UPDOWN, -1); // back and forth, infinite number of times + PA_StartSpriteAnimEx(0, 3, 0, 6, 5, ANIM_LOOP, 5); // Play it 5 times + + PA_OutputSimpleText(0, 0, 6, "Infinite"); + PA_OutputSimpleText(0, 8, 7, "OneShot"); + PA_OutputSimpleText(0, 16, 6, " UpDown"); + PA_OutputSimpleText(0, 24, 7, "5 Times"); + + while(1) + { + PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Animations/SpriteFrame/Makefile b/examples/Sprites/Animations/SpriteFrame/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Animations/SpriteFrame/Makefile +++ b/examples/Sprites/Animations/SpriteFrame/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Animations/SpriteFrame/source/main.c b/examples/Sprites/Animations/SpriteFrame/source/main.c index 35b8fbe..01a7694 100644 --- a/examples/Sprites/Animations/SpriteFrame/source/main.c +++ b/examples/Sprites/Animations/SpriteFrame/source/main.c @@ -1,42 +1,42 @@ -/* This shows how to change a sprite's frame... -*/ - - -// Includes, only one sprite -#include -// PAGfxConverter Include -#include "all_gfx.h" - -s16 framecount[4]; //Frame count for 4 different sprites... - - -// Main function -int main(void){ - - // PAlib init - PA_Init(); - - // Load the sprite palette - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - - // Load a sprites... We'll then change the frame... - PA_CreateSprite(0, 0,(void*)SpaceShipAnim_Sprite, OBJ_SIZE_64X64,1, 0, 64, 64); - - - while(1) - { - - if (Pad.Newpress.Left) PA_SetSpriteAnim(0, // Screen - 0, // Sprite to animate - 0); // frame 0, to test... - if (Pad.Newpress.Right) PA_SetSpriteAnim(0, 0, 1); // frame 1, to test... - if (Pad.Newpress.Up) PA_SetSpriteAnim(0, 0, 2); // frame 2, to test... - if (Pad.Newpress.Down) PA_SetSpriteAnim(0, 0, 3); // frame 3, to test... - - PA_WaitForVBL(); - } - return 0; +/* This shows how to change a sprite's frame... +*/ + + +// Includes, only one sprite +#include +// PAGfxConverter Include +#include "all_gfx.h" + +s16 framecount[4]; //Frame count for 4 different sprites... + + +// Main function +int main(void){ + + // PAlib init + PA_Init(); + + // Load the sprite palette + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + + // Load a sprites... We'll then change the frame... + PA_CreateSprite(0, 0,(void*)SpaceShipAnim_Sprite, OBJ_SIZE_64X64,1, 0, 64, 64); + + + while(1) + { + + if (Pad.Newpress.Left) PA_SetSpriteAnim(0, // Screen + 0, // Sprite to animate + 0); // frame 0, to test... + if (Pad.Newpress.Right) PA_SetSpriteAnim(0, 0, 1); // frame 1, to test... + if (Pad.Newpress.Up) PA_SetSpriteAnim(0, 0, 2); // frame 2, to test... + if (Pad.Newpress.Down) PA_SetSpriteAnim(0, 0, 3); // frame 3, to test... + + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Basics/16bitSprite/Makefile b/examples/Sprites/Basics/16bitSprite/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Basics/16bitSprite/Makefile +++ b/examples/Sprites/Basics/16bitSprite/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Basics/16bitSprite/gfx/all_gfx.h b/examples/Sprites/Basics/16bitSprite/gfx/all_gfx.h index 9889a86..c8f34f6 100644 --- a/examples/Sprites/Basics/16bitSprite/gfx/all_gfx.h +++ b/examples/Sprites/Basics/16bitSprite/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char ship_Sprite[1024] _GFX_ALIGN; // 16bit Sprite - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char ship_Sprite[1024] _GFX_ALIGN; // 16bit Sprite + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Basics/16bitSprite/source/main.c b/examples/Sprites/Basics/16bitSprite/source/main.c index 18599f8..914fde0 100644 --- a/examples/Sprites/Basics/16bitSprite/source/main.c +++ b/examples/Sprites/Basics/16bitSprite/source/main.c @@ -1,27 +1,27 @@ -// Use 16 bit sprites ! No palettes needed for them, but they use twice as much memory... - -#include -#include "all_gfx.h" - - - -//Main... -int main(void){ - - PA_Init(); //PAlib Init... - - - // No palettes ! - - PA_Create16bitSprite(0, // Screen - 0, // Sprite number - (void*)ship_Sprite, // image to load, 128 pixels wide ! - OBJ_SIZE_32X32, // sprite size - 0, // x - 50); //y - - while(1){ // Infinite loop - PA_WaitForVBL(); - } - return 0; +// Use 16 bit sprites ! No palettes needed for them, but they use twice as much memory... + +#include +#include "all_gfx.h" + + + +//Main... +int main(void){ + + PA_Init(); //PAlib Init... + + + // No palettes ! + + PA_Create16bitSprite(0, // Screen + 0, // Sprite number + (void*)ship_Sprite, // image to load, 128 pixels wide ! + OBJ_SIZE_32X32, // sprite size + 0, // x + 50); //y + + while(1){ // Infinite loop + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Basics/16colorSprite/Makefile b/examples/Sprites/Basics/16colorSprite/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Basics/16colorSprite/Makefile +++ b/examples/Sprites/Basics/16colorSprite/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Basics/16colorSprite/gfx/all_gfx.h b/examples/Sprites/Basics/16colorSprite/gfx/all_gfx.h index cb3d646..c1bf9e8 100644 --- a/examples/Sprites/Basics/16colorSprite/gfx/all_gfx.h +++ b/examples/Sprites/Basics/16colorSprite/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[512] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[512] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Basics/16colorSprite/source/main.c b/examples/Sprites/Basics/16colorSprite/source/main.c index 25f2367..7a781e9 100644 --- a/examples/Sprites/Basics/16colorSprite/source/main.c +++ b/examples/Sprites/Basics/16colorSprite/source/main.c @@ -1,29 +1,29 @@ -#include - -// PAGfx Include -#include "all_gfx.h" - -int main(void){ - - PA_Init(); //PAlib inits - - PA_LoadSprite16cPal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - PA_CreateSprite(0, // Screen - 0, // Sprite number - (void*)vaisseau_Sprite, // Sprite name - OBJ_SIZE_32X32, // Sprite size - 0, // 16 color mode - 0, // Sprite palette number - 50, 50); // X and Y position on the screen - - - while(1) // Infinite loops - { - - } - -return 0; +#include + +// PAGfx Include +#include "all_gfx.h" + +int main(void){ + + PA_Init(); //PAlib inits + + PA_LoadSprite16cPal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + PA_CreateSprite(0, // Screen + 0, // Sprite number + (void*)vaisseau_Sprite, // Sprite name + OBJ_SIZE_32X32, // Sprite size + 0, // 16 color mode + 0, // Sprite palette number + 50, 50); // X and Y position on the screen + + + while(1) // Infinite loops + { + + } + +return 0; } \ No newline at end of file diff --git a/examples/Sprites/Basics/CreateSprite/Makefile b/examples/Sprites/Basics/CreateSprite/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Basics/CreateSprite/Makefile +++ b/examples/Sprites/Basics/CreateSprite/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Basics/CreateSprite/gfx/all_gfx.h b/examples/Sprites/Basics/CreateSprite/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/Basics/CreateSprite/gfx/all_gfx.h +++ b/examples/Sprites/Basics/CreateSprite/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Basics/CreateSprite/source/main.c b/examples/Sprites/Basics/CreateSprite/source/main.c index 4868f98..1b9c54c 100644 --- a/examples/Sprites/Basics/CreateSprite/source/main.c +++ b/examples/Sprites/Basics/CreateSprite/source/main.c @@ -1,28 +1,28 @@ -#include - -// PAGfx Include -#include "all_gfx.h" -int main(void){ - - PA_Init(); //PAlib inits - - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - PA_CreateSprite(0, // Screen - 0, // Sprite number - (void*)vaisseau_Sprite, // Sprite name - OBJ_SIZE_32X32, // Sprite size - 1, // 256 color mode - 0, // Sprite palette number - 50, 50); // X and Y position on the screen - - - while(1) // Infinite loops - { - - } - -return 0; +#include + +// PAGfx Include +#include "all_gfx.h" +int main(void){ + + PA_Init(); //PAlib inits + + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + PA_CreateSprite(0, // Screen + 0, // Sprite number + (void*)vaisseau_Sprite, // Sprite name + OBJ_SIZE_32X32, // Sprite size + 1, // 256 color mode + 0, // Sprite palette number + 50, 50); // X and Y position on the screen + + + while(1) // Infinite loops + { + + } + +return 0; } \ No newline at end of file diff --git a/examples/Sprites/Basics/DualSprite/Makefile b/examples/Sprites/Basics/DualSprite/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Basics/DualSprite/Makefile +++ b/examples/Sprites/Basics/DualSprite/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Basics/DualSprite/gfx/all_gfx.h b/examples/Sprites/Basics/DualSprite/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/Basics/DualSprite/gfx/all_gfx.h +++ b/examples/Sprites/Basics/DualSprite/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Basics/DualSprite/source/main.c b/examples/Sprites/Basics/DualSprite/source/main.c index a505cdc..2e9413e 100644 --- a/examples/Sprites/Basics/DualSprite/source/main.c +++ b/examples/Sprites/Basics/DualSprite/source/main.c @@ -1,39 +1,39 @@ -//Move a sprite using the keys... - -#include - -// PAGfx Include -#include "all_gfx.h" -s32 x = 0; s32 y = 0; // sprite position... - -//Fonction principale du code -int main(void){ - - PA_Init(); //Initialision of PAlib - - PA_LoadDefaultText(0,0); - - PA_DualLoadSpritePal(0, // Palette number - (void*)sprite0_Pal); // Palette name - - //Create the sprite - PA_DualCreateSprite(0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 0, 0); // No need to choose the screen - - PA_OutputSimpleText(0, 2, 8, "Arrows to move the sprite and make it come on the other screen..."); - - while(1){ // Main loop - - // Update the position according to the keypad... - x += Pad.Held.Right - Pad.Held.Left; - y += Pad.Held.Down - Pad.Held.Up; - - // Set the sprite's position - PA_DualSetSpriteXY(0, // sprite - x, // x position - y); // y... - - PA_WaitForVBL(); - - } - return 0; +//Move a sprite using the keys... + +#include + +// PAGfx Include +#include "all_gfx.h" +s32 x = 0; s32 y = 0; // sprite position... + +//Fonction principale du code +int main(void){ + + PA_Init(); //Initialision of PAlib + + PA_LoadDefaultText(0,0); + + PA_DualLoadSpritePal(0, // Palette number + (void*)sprite0_Pal); // Palette name + + //Create the sprite + PA_DualCreateSprite(0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 0, 0); // No need to choose the screen + + PA_OutputSimpleText(0, 2, 8, "Arrows to move the sprite and make it come on the other screen..."); + + while(1){ // Main loop + + // Update the position according to the keypad... + x += Pad.Held.Right - Pad.Held.Left; + y += Pad.Held.Down - Pad.Held.Up; + + // Set the sprite's position + PA_DualSetSpriteXY(0, // sprite + x, // x position + y); // y... + + PA_WaitForVBL(); + + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Basics/GetSpritePixel/Makefile b/examples/Sprites/Basics/GetSpritePixel/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Basics/GetSpritePixel/Makefile +++ b/examples/Sprites/Basics/GetSpritePixel/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Basics/GetSpritePixel/gfx/all_gfx.h b/examples/Sprites/Basics/GetSpritePixel/gfx/all_gfx.h index 7b639ee..2542989 100644 --- a/examples/Sprites/Basics/GetSpritePixel/gfx/all_gfx.h +++ b/examples/Sprites/Basics/GetSpritePixel/gfx/all_gfx.h @@ -1,21 +1,21 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: vaisseau_Pal -extern const unsigned char vaisseau2_Sprite[512] _GFX_ALIGN; // Palette: vaisseau2_Pal - -// Palettes: -extern const unsigned short vaisseau_Pal[256] _GFX_ALIGN; -extern const unsigned short vaisseau2_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: vaisseau_Pal +extern const unsigned char vaisseau2_Sprite[512] _GFX_ALIGN; // Palette: vaisseau2_Pal + +// Palettes: +extern const unsigned short vaisseau_Pal[256] _GFX_ALIGN; +extern const unsigned short vaisseau2_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Basics/GetSpritePixel/source/main.c b/examples/Sprites/Basics/GetSpritePixel/source/main.c index df548fd..53ad156 100644 --- a/examples/Sprites/Basics/GetSpritePixel/source/main.c +++ b/examples/Sprites/Basics/GetSpritePixel/source/main.c @@ -1,52 +1,52 @@ -#include - -// PAGfx Include -#include "all_gfx.h" - - -int main(void){ - - PA_Init(); //PAlib inits - - PA_LoadDefaultText(0, 0); - PA_LoadDefaultText(1, 0); - - - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)vaisseau_Pal); // Palette name - - PA_LoadSprite16cPal(1, // Screen - 0, // Palette number - (void*)vaisseau2_Pal); // Palette name - - PA_CreateSprite(0, // Screen - 0, // Sprite number - (void*)vaisseau_Sprite, // Sprite name - OBJ_SIZE_32X32, // Sprite size - 1, // 256 color mode - 0, // Sprite palette number - 0, 0); // X and Y position on the screen - - PA_CreateSprite(1, // Screen - 0, // Sprite number - (void*)vaisseau2_Sprite, // Sprite name - OBJ_SIZE_32X32, // Sprite size - 0, // 16 color mode - 0, // Sprite palette number - 0, 0); // X and Y position on the screen - - PA_InitAllSpriteDraw(); // Inits the info to draw on sprite or retrieve pixel colors - - while(1) // Infinite loops - { - if((Stylus.X < 32)&&(Stylus.Y < 32)){ // If in sprite zone, check pixel color for both sprites - PA_OutputText(0, 10, 2, "Pixel : %03d", PA_GetSpritePixel(0, 0, Stylus.X, Stylus.Y)); - PA_OutputText(1, 10, 2, "Pixel : %03d", PA_GetSprite16cPixel(1, 0, Stylus.X, Stylus.Y)); - - } - PA_WaitForVBL(); - } - -return 0; +#include + +// PAGfx Include +#include "all_gfx.h" + + +int main(void){ + + PA_Init(); //PAlib inits + + PA_LoadDefaultText(0, 0); + PA_LoadDefaultText(1, 0); + + + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)vaisseau_Pal); // Palette name + + PA_LoadSprite16cPal(1, // Screen + 0, // Palette number + (void*)vaisseau2_Pal); // Palette name + + PA_CreateSprite(0, // Screen + 0, // Sprite number + (void*)vaisseau_Sprite, // Sprite name + OBJ_SIZE_32X32, // Sprite size + 1, // 256 color mode + 0, // Sprite palette number + 0, 0); // X and Y position on the screen + + PA_CreateSprite(1, // Screen + 0, // Sprite number + (void*)vaisseau2_Sprite, // Sprite name + OBJ_SIZE_32X32, // Sprite size + 0, // 16 color mode + 0, // Sprite palette number + 0, 0); // X and Y position on the screen + + PA_InitAllSpriteDraw(); // Inits the info to draw on sprite or retrieve pixel colors + + while(1) // Infinite loops + { + if((Stylus.X < 32)&&(Stylus.Y < 32)){ // If in sprite zone, check pixel color for both sprites + PA_OutputText(0, 10, 2, "Pixel : %03d", PA_GetSpritePixel(0, 0, Stylus.X, Stylus.Y)); + PA_OutputText(1, 10, 2, "Pixel : %03d", PA_GetSprite16cPixel(1, 0, Stylus.X, Stylus.Y)); + + } + PA_WaitForVBL(); + } + +return 0; } \ No newline at end of file diff --git a/examples/Sprites/Basics/MultiplePalettes/Makefile b/examples/Sprites/Basics/MultiplePalettes/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Basics/MultiplePalettes/Makefile +++ b/examples/Sprites/Basics/MultiplePalettes/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Basics/MultiplePalettes/gfx/all_gfx.h b/examples/Sprites/Basics/MultiplePalettes/gfx/all_gfx.h index c723273..35d0f2d 100644 --- a/examples/Sprites/Basics/MultiplePalettes/gfx/all_gfx.h +++ b/examples/Sprites/Basics/MultiplePalettes/gfx/all_gfx.h @@ -1,25 +1,25 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char ds_Sprite[4096] _GFX_ALIGN; // Palette: ds_Pal -extern const unsigned char gp_Sprite[4096] _GFX_ALIGN; // Palette: gp_Pal -extern const unsigned char psp_Sprite[4096] _GFX_ALIGN; // Palette: psp_Pal -extern const unsigned char giz_Sprite[4096] _GFX_ALIGN; // Palette: giz_Pal - -// Palettes: -extern const unsigned short ds_Pal[256] _GFX_ALIGN; -extern const unsigned short gp_Pal[256] _GFX_ALIGN; -extern const unsigned short psp_Pal[256] _GFX_ALIGN; -extern const unsigned short giz_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char ds_Sprite[4096] _GFX_ALIGN; // Palette: ds_Pal +extern const unsigned char gp_Sprite[4096] _GFX_ALIGN; // Palette: gp_Pal +extern const unsigned char psp_Sprite[4096] _GFX_ALIGN; // Palette: psp_Pal +extern const unsigned char giz_Sprite[4096] _GFX_ALIGN; // Palette: giz_Pal + +// Palettes: +extern const unsigned short ds_Pal[256] _GFX_ALIGN; +extern const unsigned short gp_Pal[256] _GFX_ALIGN; +extern const unsigned short psp_Pal[256] _GFX_ALIGN; +extern const unsigned short giz_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Basics/MultiplePalettes/source/main.c b/examples/Sprites/Basics/MultiplePalettes/source/main.c index 7a941b8..16d6aae 100644 --- a/examples/Sprites/Basics/MultiplePalettes/source/main.c +++ b/examples/Sprites/Basics/MultiplePalettes/source/main.c @@ -1,41 +1,41 @@ -//copyright birslip -// Includes -#include // Include for PA_Lib - - - -// Converted using PAGfxConverter -#include "all_gfx.h" -// Function: main() -int main() -{ - u8 i; - - PA_Init(); // Initializes PA_Lib - - - // Load 8bit palettes for sprites... - PA_LoadSpritePal(0,0,(void*)ds_Pal); - PA_LoadSpritePal(0,1,(void*)giz_Pal); - PA_LoadSpritePal(0,2,(void*)gp_Pal); - PA_LoadSpritePal(0,3,(void*)psp_Pal); - - // Create sprites - PA_CreateSprite(0,0,(void*)ds_Sprite,OBJ_SIZE_64X64,1,0,PA_Rand()%192,PA_Rand()%128); - PA_CreateSprite(0,1,(void*)giz_Sprite,OBJ_SIZE_64X64,1,1,PA_Rand()%192,PA_Rand()%128); - PA_CreateSprite(0,2,(void*)gp_Sprite,OBJ_SIZE_64X64,1,2,PA_Rand()%192,PA_Rand()%128); - PA_CreateSprite(0,3,(void*)psp_Sprite,OBJ_SIZE_64X64,1,3,PA_Rand()%192,PA_Rand()%128); - - //Set the main palette - BG_PALETTE[0] = PA_RGB(27,27,27); - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - - for(i=0;i<4;i++) PA_MoveSprite(i); - - } - - return 0; +//copyright birslip +// Includes +#include // Include for PA_Lib + + + +// Converted using PAGfxConverter +#include "all_gfx.h" +// Function: main() +int main() +{ + u8 i; + + PA_Init(); // Initializes PA_Lib + + + // Load 8bit palettes for sprites... + PA_LoadSpritePal(0,0,(void*)ds_Pal); + PA_LoadSpritePal(0,1,(void*)giz_Pal); + PA_LoadSpritePal(0,2,(void*)gp_Pal); + PA_LoadSpritePal(0,3,(void*)psp_Pal); + + // Create sprites + PA_CreateSprite(0,0,(void*)ds_Sprite,OBJ_SIZE_64X64,1,0,PA_Rand()%192,PA_Rand()%128); + PA_CreateSprite(0,1,(void*)giz_Sprite,OBJ_SIZE_64X64,1,1,PA_Rand()%192,PA_Rand()%128); + PA_CreateSprite(0,2,(void*)gp_Sprite,OBJ_SIZE_64X64,1,2,PA_Rand()%192,PA_Rand()%128); + PA_CreateSprite(0,3,(void*)psp_Sprite,OBJ_SIZE_64X64,1,3,PA_Rand()%192,PA_Rand()%128); + + //Set the main palette + BG_PALETTE[0] = PA_RGB(27,27,27); + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + + for(i=0;i<4;i++) PA_MoveSprite(i); + + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Sprites/Basics/SpriteTouched/Makefile b/examples/Sprites/Basics/SpriteTouched/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Basics/SpriteTouched/Makefile +++ b/examples/Sprites/Basics/SpriteTouched/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Basics/SpriteTouched/gfx/bin/Readme.txt b/examples/Sprites/Basics/SpriteTouched/gfx/bin/Readme.txt index e6ba050..8b80ebf 100644 --- a/examples/Sprites/Basics/SpriteTouched/gfx/bin/Readme.txt +++ b/examples/Sprites/Basics/SpriteTouched/gfx/bin/Readme.txt @@ -1,5 +1,5 @@ -Space Ship sprite found here: -http://www.reinerstileset.4players.de:1059/englisch.htm - -Stars / Space texture found here: +Space Ship sprite found here: +http://www.reinerstileset.4players.de:1059/englisch.htm + +Stars / Space texture found here: http://www.grsites.com/textures/ \ No newline at end of file diff --git a/examples/Sprites/Basics/SpriteTouched/gfx/bin/master.pal.c b/examples/Sprites/Basics/SpriteTouched/gfx/bin/master.pal.c index 998edc6..b9083fc 100644 --- a/examples/Sprites/Basics/SpriteTouched/gfx/bin/master.pal.c +++ b/examples/Sprites/Basics/SpriteTouched/gfx/bin/master.pal.c @@ -1,35 +1,35 @@ -const unsigned short master_Palette[256] = { -0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, -0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - +const unsigned short master_Palette[256] = { +0x0000, 0x03ff, 0x67ff, 0x675a, 0x033f, 0x001f, 0x77bd, 0x6739, +0x4e73, 0x4210, 0x318c, 0x2108, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + diff --git a/examples/Sprites/Basics/SpriteTouched/gfx/bin/vaisseau.raw.c b/examples/Sprites/Basics/SpriteTouched/gfx/bin/vaisseau.raw.c index 443eeda..eb981ac 100644 --- a/examples/Sprites/Basics/SpriteTouched/gfx/bin/vaisseau.raw.c +++ b/examples/Sprites/Basics/SpriteTouched/gfx/bin/vaisseau.raw.c @@ -1,70 +1,70 @@ -// -// vaisseau (1024 uncompressed bytes) -// -const unsigned char vaisseau_Bitmap[1024] = { -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, -0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, -0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, -0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, -0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, -0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, -0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, -0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, -0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, -0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, -0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, -0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, -0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, -0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, -0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, -0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, -0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, -0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, -0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, -0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, -0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, -0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, -0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, -0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, -0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - +// +// vaisseau (1024 uncompressed bytes) +// +const unsigned char vaisseau_Bitmap[1024] = { +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, +0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x07, 0x08, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x07, +0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x07, 0x0a, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x07, +0x06, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, +0x08, 0x07, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x08, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x00, +0x07, 0x0a, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x0a, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, +0x07, 0x07, 0x07, 0x07, 0x0a, 0x08, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x09, 0x08, 0x08, 0x08, 0x07, +0x00, 0x00, 0x07, 0x0a, 0x09, 0x0a, 0x08, 0x08, 0x00, 0x07, 0x0a, 0x0a, 0x0a, 0x09, 0x08, 0x07, +0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, +0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, +0x07, 0x0a, 0x08, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x09, 0x00, 0x00, 0x00, +0x08, 0x08, 0x0a, 0x09, 0x0a, 0x07, 0x00, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x00, +0x0a, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x09, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, +0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, +0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x09, 0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x07, 0x0a, 0x0a, 0x09, 0x0b, +0x00, 0x00, 0x07, 0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, +0x0b, 0x0b, 0x09, 0x0a, 0x07, 0x07, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, 0x07, +0x07, 0x07, 0x04, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x05, 0x05, 0x04, 0x01, 0x02, 0x01, 0x04, +0x00, 0x00, 0x05, 0x05, 0x04, 0x01, 0x04, 0x05, 0x00, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, +0x0a, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0a, 0x09, 0x0a, 0x0a, 0x09, 0x0a, 0x0a, 0x0a, +0x0a, 0x0a, 0x07, 0x07, 0x0a, 0x09, 0x0b, 0x0b, 0x07, 0x09, 0x09, 0x07, 0x07, 0x07, 0x09, 0x09, +0x01, 0x03, 0x03, 0x03, 0x01, 0x04, 0x07, 0x07, 0x04, 0x01, 0x02, 0x01, 0x04, 0x05, 0x05, 0x00, +0x05, 0x04, 0x01, 0x04, 0x05, 0x05, 0x00, 0x00, 0x05, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, +0x07, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x0a, 0x0a, 0x07, 0x00, 0x00, 0x00, +0x0b, 0x0b, 0x07, 0x0b, 0x0b, 0x07, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + diff --git a/examples/Sprites/Basics/SpriteTouched/source/main.c b/examples/Sprites/Basics/SpriteTouched/source/main.c index 91b313f..250ea57 100644 --- a/examples/Sprites/Basics/SpriteTouched/source/main.c +++ b/examples/Sprites/Basics/SpriteTouched/source/main.c @@ -1,34 +1,34 @@ -/* This is a very simple demo, just tells you which sprite you are touching ! -*/ - - -// Includes -#include -#include "all_gfx.h" -// Main function -int main(void) { - - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Load the sprite palette - - // Load a few sprites... - u8 i = 0; - for (i = 0; i < 8; i++) PA_CreateSprite(0, i,(void*)mollusk_Sprite, OBJ_SIZE_32X32,1, 0, i << 5, i << 4); - - PA_OutputSimpleText(1, 0, 10, "Please touch a sprite"); - - while(1) - { - // Now we'll test every sprite to see if we touch it... - for (i = 0; i < 8; i++) { - if (PA_SpriteTouched(i)) PA_OutputText(1, 0, 15, "Sprite %d ", i); - // If we touch the sprite, returns 1... - } - - PA_WaitForVBL(); - } - return 0; +/* This is a very simple demo, just tells you which sprite you are touching ! +*/ + + +// Includes +#include +#include "all_gfx.h" +// Main function +int main(void) { + + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Load the sprite palette + + // Load a few sprites... + u8 i = 0; + for (i = 0; i < 8; i++) PA_CreateSprite(0, i,(void*)mollusk_Sprite, OBJ_SIZE_32X32,1, 0, i << 5, i << 4); + + PA_OutputSimpleText(1, 0, 10, "Please touch a sprite"); + + while(1) + { + // Now we'll test every sprite to see if we touch it... + for (i = 0; i < 8; i++) { + if (PA_SpriteTouched(i)) PA_OutputText(1, 0, 15, "Sprite %d ", i); + // If we touch the sprite, returns 1... + } + + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Basics/SpriteTouchedPix/Makefile b/examples/Sprites/Basics/SpriteTouchedPix/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Basics/SpriteTouchedPix/Makefile +++ b/examples/Sprites/Basics/SpriteTouchedPix/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Basics/SpriteTouchedPix/gfx/all_gfx.h b/examples/Sprites/Basics/SpriteTouchedPix/gfx/all_gfx.h index 0db5322..07a6043 100644 --- a/examples/Sprites/Basics/SpriteTouchedPix/gfx/all_gfx.h +++ b/examples/Sprites/Basics/SpriteTouchedPix/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Basics/SpriteTouchedPix/source/main.c b/examples/Sprites/Basics/SpriteTouchedPix/source/main.c index 4113dab..20ef418 100644 --- a/examples/Sprites/Basics/SpriteTouchedPix/source/main.c +++ b/examples/Sprites/Basics/SpriteTouchedPix/source/main.c @@ -1,28 +1,28 @@ - -// Includes -#include -#include "all_gfx.h" -// Main function -int main(void) { - - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Load the sprite palette - - // Load a sprite... - PA_CreateSprite(0, 0,(void*)frisbee_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); //Create a sprites - PA_InitAllSpriteDraw(); // Inits the sprite draw mode, necessary for the pixel-perfect touch detection - - - while(1) - { - // If we touch the sprite's pixel, returns 1... - if (PA_SpriteTouchedPix(0)) PA_OutputText(1, 6, 15, "Touching... "); - else PA_OutputText(1, 6, 15, "Try again ! "); - - PA_WaitForVBL(); - } - return 0; + +// Includes +#include +#include "all_gfx.h" +// Main function +int main(void) { + + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Load the sprite palette + + // Load a sprite... + PA_CreateSprite(0, 0,(void*)frisbee_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); //Create a sprites + PA_InitAllSpriteDraw(); // Inits the sprite draw mode, necessary for the pixel-perfect touch detection + + + while(1) + { + // If we touch the sprite's pixel, returns 1... + if (PA_SpriteTouchedPix(0)) PA_OutputText(1, 6, 15, "Touching... "); + else PA_OutputText(1, 6, 15, "Try again ! "); + + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Effects/16bitSpriteAlpha/Makefile b/examples/Sprites/Effects/16bitSpriteAlpha/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Effects/16bitSpriteAlpha/Makefile +++ b/examples/Sprites/Effects/16bitSpriteAlpha/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Effects/16bitSpriteAlpha/gfx/all_gfx.h b/examples/Sprites/Effects/16bitSpriteAlpha/gfx/all_gfx.h index 9889a86..c8f34f6 100644 --- a/examples/Sprites/Effects/16bitSpriteAlpha/gfx/all_gfx.h +++ b/examples/Sprites/Effects/16bitSpriteAlpha/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char ship_Sprite[1024] _GFX_ALIGN; // 16bit Sprite - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char ship_Sprite[1024] _GFX_ALIGN; // 16bit Sprite + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Effects/16bitSpriteAlpha/source/main.c b/examples/Sprites/Effects/16bitSpriteAlpha/source/main.c index 3a7a4fd..a78b5fd 100644 --- a/examples/Sprites/Effects/16bitSpriteAlpha/source/main.c +++ b/examples/Sprites/Effects/16bitSpriteAlpha/source/main.c @@ -1,45 +1,45 @@ -// Use 16 bit sprites ! No palettes needed for them, but they use twice as much memory... - -#include -#include "all_gfx.h" - - - -//Main... -int main(void){ - - PA_Init(); //PAlib Init... - - - // No palettes ! - - PA_Create16bitSprite(0, // Screen - 0, // Sprite number - (void*)ship_Sprite, // image to load, 128 pixels wide ! - OBJ_SIZE_32X32, // sprite size - 0, // x - 50); //y - - // Enable the alpha-blending - PA_EnableSpecialFx(0, // Screen - SFX_ALPHA, // Alpha blending mode - 0, // Nothing - SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_BD); // Everything normal - - PA_LoadDefaultText(1, 0); - PA_OutputText(1, 1, 12, "Press Up/Down to change alpha"); - - - u8 alpha = 15; - - while(1){ // Infinite loop - alpha += Pad.Newpress.Up - Pad.Newpress.Down; - alpha &= 15; - - PA_OutputText(1, 10, 14, "Alpha : %02d", alpha); - - PA_Set16bitSpriteAlpha(0, 0, alpha); - PA_WaitForVBL(); - } - return 0; +// Use 16 bit sprites ! No palettes needed for them, but they use twice as much memory... + +#include +#include "all_gfx.h" + + + +//Main... +int main(void){ + + PA_Init(); //PAlib Init... + + + // No palettes ! + + PA_Create16bitSprite(0, // Screen + 0, // Sprite number + (void*)ship_Sprite, // image to load, 128 pixels wide ! + OBJ_SIZE_32X32, // sprite size + 0, // x + 50); //y + + // Enable the alpha-blending + PA_EnableSpecialFx(0, // Screen + SFX_ALPHA, // Alpha blending mode + 0, // Nothing + SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_BD); // Everything normal + + PA_LoadDefaultText(1, 0); + PA_OutputText(1, 1, 12, "Press Up/Down to change alpha"); + + + u8 alpha = 15; + + while(1){ // Infinite loop + alpha += Pad.Newpress.Up - Pad.Newpress.Down; + alpha &= 15; + + PA_OutputText(1, 10, 14, "Alpha : %02d", alpha); + + PA_Set16bitSpriteAlpha(0, 0, alpha); + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Effects/AlphaBlending/Makefile b/examples/Sprites/Effects/AlphaBlending/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Effects/AlphaBlending/Makefile +++ b/examples/Sprites/Effects/AlphaBlending/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Effects/AlphaBlending/gfx/all_gfx.h b/examples/Sprites/Effects/AlphaBlending/gfx/all_gfx.h index 9e0e58a..ed82d39 100644 --- a/examples/Sprites/Effects/AlphaBlending/gfx/all_gfx.h +++ b/examples/Sprites/Effects/AlphaBlending/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Effects/AlphaBlending/source/main.c b/examples/Sprites/Effects/AlphaBlending/source/main.c index ef00199..6276d66 100644 --- a/examples/Sprites/Effects/AlphaBlending/source/main.c +++ b/examples/Sprites/Effects/AlphaBlending/source/main.c @@ -1,41 +1,41 @@ -#include - -// PAGfxConverter Include -#include "all_gfx.h" -int main(void){ - - PA_Init(); //PAlib inits - - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - // We'll create 2 sprites - PA_CreateSprite(0, 0, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 50); - PA_CreateSprite(0, 1, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 64, 50); - - PA_SetSpriteMode(0, // Screen - 0, // Sprite - 1); // Alphablending - - s16 alpha = 7; // Transparency level - - // Enable the alpha-blending - PA_EnableSpecialFx(0, // Screen - SFX_ALPHA, // Alpha blending mode - 0, // Nothing - SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_BD); // Everything normal - - - while(1) // Infinite loops - { - alpha += Pad.Newpress.Up - Pad.Newpress.Down; - PA_SetSFXAlpha(0, // Screen - alpha, // Alpha level, 0-15 - 15); // Leave this to 15 - - PA_WaitForVBL(); - } - -return 0; +#include + +// PAGfxConverter Include +#include "all_gfx.h" +int main(void){ + + PA_Init(); //PAlib inits + + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + // We'll create 2 sprites + PA_CreateSprite(0, 0, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 50); + PA_CreateSprite(0, 1, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 64, 50); + + PA_SetSpriteMode(0, // Screen + 0, // Sprite + 1); // Alphablending + + s16 alpha = 7; // Transparency level + + // Enable the alpha-blending + PA_EnableSpecialFx(0, // Screen + SFX_ALPHA, // Alpha blending mode + 0, // Nothing + SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_BD); // Everything normal + + + while(1) // Infinite loops + { + alpha += Pad.Newpress.Up - Pad.Newpress.Down; + PA_SetSFXAlpha(0, // Screen + alpha, // Alpha level, 0-15 + 15); // Leave this to 15 + + PA_WaitForVBL(); + } + +return 0; } \ No newline at end of file diff --git a/examples/Sprites/Effects/DrawOnDblsize/Makefile b/examples/Sprites/Effects/DrawOnDblsize/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Effects/DrawOnDblsize/Makefile +++ b/examples/Sprites/Effects/DrawOnDblsize/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Effects/DrawOnDblsize/gfx/all_gfx.h b/examples/Sprites/Effects/DrawOnDblsize/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/Effects/DrawOnDblsize/gfx/all_gfx.h +++ b/examples/Sprites/Effects/DrawOnDblsize/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Effects/DrawOnDblsize/source/main.c b/examples/Sprites/Effects/DrawOnDblsize/source/main.c index 7617822..c5d4569 100644 --- a/examples/Sprites/Effects/DrawOnDblsize/source/main.c +++ b/examples/Sprites/Effects/DrawOnDblsize/source/main.c @@ -1,45 +1,45 @@ -#include - -// PAGfxConverter Include -#include "all_gfx.h" - - - -int main(void){ - - PA_Init(); //PAlib inits - - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - // Create a blank buffer. It's the same as saying u32 blankdata[1024], but you can free the memory later. - void* blankdata = calloc(1024, sizeof(u32)); // get the hint? calloc(size of array, sizeof(type)); - - PA_CreateSprite(0, 0, (void*)blankdata, // Blank sprite ! - OBJ_SIZE_64X64, // Sprite size - 1, 0, // Sprite palette number - 0, 0); // In the upper left corner - - // Free the buffer. - free(blankdata); - - PA_SetSpriteRotEnable(0, 0, 0); // enable rotation - PA_SetSpriteDblsize(0, 0, 1); // enable double size - PA_SetRotset(0, 0, 0, 128, 128); // zoom to fill the double size - - - PA_InitAllSpriteDraw(); // Init the draw system for all onscreen sprites - - - while(1) // Infinite loops - { - if ((Stylus.X < 128) && (Stylus.Y < 128)) PA_SetSpritePixel(0, 0, Stylus.X>>1, Stylus.Y>>1, 10); - // >> 1, meaning divided by 2, because our sprite is double sized using the zoom ! - PA_WaitForVBL(); - - - } - -return 0; +#include + +// PAGfxConverter Include +#include "all_gfx.h" + + + +int main(void){ + + PA_Init(); //PAlib inits + + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + // Create a blank buffer. It's the same as saying u32 blankdata[1024], but you can free the memory later. + void* blankdata = calloc(1024, sizeof(u32)); // get the hint? calloc(size of array, sizeof(type)); + + PA_CreateSprite(0, 0, (void*)blankdata, // Blank sprite ! + OBJ_SIZE_64X64, // Sprite size + 1, 0, // Sprite palette number + 0, 0); // In the upper left corner + + // Free the buffer. + free(blankdata); + + PA_SetSpriteRotEnable(0, 0, 0); // enable rotation + PA_SetSpriteDblsize(0, 0, 1); // enable double size + PA_SetRotset(0, 0, 0, 128, 128); // zoom to fill the double size + + + PA_InitAllSpriteDraw(); // Init the draw system for all onscreen sprites + + + while(1) // Infinite loops + { + if ((Stylus.X < 128) && (Stylus.Y < 128)) PA_SetSpritePixel(0, 0, Stylus.X>>1, Stylus.Y>>1, 10); + // >> 1, meaning divided by 2, because our sprite is double sized using the zoom ! + PA_WaitForVBL(); + + + } + +return 0; } \ No newline at end of file diff --git a/examples/Sprites/Effects/DrawOnSprite/Makefile b/examples/Sprites/Effects/DrawOnSprite/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Effects/DrawOnSprite/Makefile +++ b/examples/Sprites/Effects/DrawOnSprite/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Effects/DrawOnSprite/gfx/all_gfx.h b/examples/Sprites/Effects/DrawOnSprite/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/Effects/DrawOnSprite/gfx/all_gfx.h +++ b/examples/Sprites/Effects/DrawOnSprite/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Effects/DrawOnSprite/source/main.c b/examples/Sprites/Effects/DrawOnSprite/source/main.c index 5b2b98f..73dac8a 100644 --- a/examples/Sprites/Effects/DrawOnSprite/source/main.c +++ b/examples/Sprites/Effects/DrawOnSprite/source/main.c @@ -1,53 +1,53 @@ -#include - -// PAGfxConverter Include -#include "all_gfx.h" - - - -int main(void){ - - PA_Init(); //PAlib inits - - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - PA_LoadDefaultText(1, 0); - - // Create a blank buffer. It's the same as saying u32 blankdata[1024], but you can free the memory later. - void* blankdata = calloc(1024, sizeof(u32)); // get the hint? calloc(size of array, sizeof(type)); - - PA_CreateSprite(0, 0, (void*)blankdata, // Blank sprite ! - OBJ_SIZE_64X64, // Sprite size - 1, 0, // Sprite palette number - 0, 0); // In the upper left corner - PA_CreateSprite(0, 1, (void*)blankdata, // Blank sprite ! - OBJ_SIZE_64X64, // Sprite size - 1, 0, // Sprite palette number - 64, 0); // To the right - - // Free the buffer. - free(blankdata); - - u8 x = 32; u8 y = 32; // start at the center of the sprite - PA_InitAllSpriteDraw(); // Init the draw system for all onscreen sprites - - - while(1) // Infinite loops - { - x += Pad.Held.Right - Pad.Held.Left; - y += Pad.Held.Down - Pad.Held.Up; - - PA_SetSpritePixel(0, 0, x, y, 10); // draw on sprite 0 on the bottom screen, color 10 - PA_SetSpritePixel(0, 1, x, y, 10); // draw on sprite 1 on the bottom screen, color 10 - - PA_OutputText(1, 2, 10, "%02d, %02d ", x, y); - - PA_WaitForVBL(); - - - } - -return 0; +#include + +// PAGfxConverter Include +#include "all_gfx.h" + + + +int main(void){ + + PA_Init(); //PAlib inits + + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + PA_LoadDefaultText(1, 0); + + // Create a blank buffer. It's the same as saying u32 blankdata[1024], but you can free the memory later. + void* blankdata = calloc(1024, sizeof(u32)); // get the hint? calloc(size of array, sizeof(type)); + + PA_CreateSprite(0, 0, (void*)blankdata, // Blank sprite ! + OBJ_SIZE_64X64, // Sprite size + 1, 0, // Sprite palette number + 0, 0); // In the upper left corner + PA_CreateSprite(0, 1, (void*)blankdata, // Blank sprite ! + OBJ_SIZE_64X64, // Sprite size + 1, 0, // Sprite palette number + 64, 0); // To the right + + // Free the buffer. + free(blankdata); + + u8 x = 32; u8 y = 32; // start at the center of the sprite + PA_InitAllSpriteDraw(); // Init the draw system for all onscreen sprites + + + while(1) // Infinite loops + { + x += Pad.Held.Right - Pad.Held.Left; + y += Pad.Held.Down - Pad.Held.Up; + + PA_SetSpritePixel(0, 0, x, y, 10); // draw on sprite 0 on the bottom screen, color 10 + PA_SetSpritePixel(0, 1, x, y, 10); // draw on sprite 1 on the bottom screen, color 10 + + PA_OutputText(1, 2, 10, "%02d, %02d ", x, y); + + PA_WaitForVBL(); + + + } + +return 0; } \ No newline at end of file diff --git a/examples/Sprites/Effects/Flips/Makefile b/examples/Sprites/Effects/Flips/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Effects/Flips/Makefile +++ b/examples/Sprites/Effects/Flips/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Effects/Flips/gfx/all_gfx.h b/examples/Sprites/Effects/Flips/gfx/all_gfx.h index 9e0e58a..ed82d39 100644 --- a/examples/Sprites/Effects/Flips/gfx/all_gfx.h +++ b/examples/Sprites/Effects/Flips/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Effects/Flips/source/main.c b/examples/Sprites/Effects/Flips/source/main.c index 21c49d9..adbdfa9 100644 --- a/examples/Sprites/Effects/Flips/source/main.c +++ b/examples/Sprites/Effects/Flips/source/main.c @@ -1,30 +1,30 @@ -#include - -// PAGfxConverter Include -#include "all_gfx.h" -int main(void){ - - PA_Init(); //PAlib inits - - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - // We'll create 4 identical sprites, and flips them all differently... - PA_CreateSprite(0, 0, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 50); - PA_CreateSprite(0, 1, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 64, 50); - PA_CreateSprite(0, 2, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 128, 50); - PA_CreateSprite(0, 3, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 192, 50); - - // Flips for sprites 1 to 3 (lol, 1, 2, 3) - PA_SetSpriteHflip(0, 1, 1); // (screen, sprite, flip(1)/unflip(0)) HFlip -> Horizontal flip - PA_SetSpriteVflip(0, 2, 1); // (screen, sprite, flip(1)/unflip(0)) VFlip -> Vertical flip - PA_SetSpriteHflip(0, 3, 1); PA_SetSpriteVflip(0, 3, 1); // Horizontal and Vertical flips... - - while(1) // Infinite loops - { - - } - -return 0; +#include + +// PAGfxConverter Include +#include "all_gfx.h" +int main(void){ + + PA_Init(); //PAlib inits + + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + // We'll create 4 identical sprites, and flips them all differently... + PA_CreateSprite(0, 0, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 50); + PA_CreateSprite(0, 1, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 64, 50); + PA_CreateSprite(0, 2, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 128, 50); + PA_CreateSprite(0, 3, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 192, 50); + + // Flips for sprites 1 to 3 (lol, 1, 2, 3) + PA_SetSpriteHflip(0, 1, 1); // (screen, sprite, flip(1)/unflip(0)) HFlip -> Horizontal flip + PA_SetSpriteVflip(0, 2, 1); // (screen, sprite, flip(1)/unflip(0)) VFlip -> Vertical flip + PA_SetSpriteHflip(0, 3, 1); PA_SetSpriteVflip(0, 3, 1); // Horizontal and Vertical flips... + + while(1) // Infinite loops + { + + } + +return 0; } \ No newline at end of file diff --git a/examples/Sprites/Effects/Mosaic/Makefile b/examples/Sprites/Effects/Mosaic/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Effects/Mosaic/Makefile +++ b/examples/Sprites/Effects/Mosaic/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Effects/Mosaic/gfx/all_gfx.h b/examples/Sprites/Effects/Mosaic/gfx/all_gfx.h index 9e0e58a..ed82d39 100644 --- a/examples/Sprites/Effects/Mosaic/gfx/all_gfx.h +++ b/examples/Sprites/Effects/Mosaic/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char mollusk_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char mollusk_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Effects/Mosaic/source/main.c b/examples/Sprites/Effects/Mosaic/source/main.c index 6ae35e5..7733f43 100644 --- a/examples/Sprites/Effects/Mosaic/source/main.c +++ b/examples/Sprites/Effects/Mosaic/source/main.c @@ -1,35 +1,35 @@ -#include - -// PAGfxConverter Include -#include "all_gfx.h" -u8 Xmosaic = 0; -u8 Ymosaic = 0; - -int main(void){ - - PA_Init(); // Initializes PA_Lib - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette loading... - - PA_CreateSprite(0, 0, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 50); // Sprite... - - // Activate the mosaic effect for a given sprite ! - PA_SetSpriteMosaic(0, 0, 1); // Screen, Sprite, Mosaic on/off (1/0) - - - // Infinite loop to keep the program running - while (1) - { - // Change the mosaic effect according to keys... - Xmosaic = Xmosaic + Pad.Newpress.Right - Pad.Newpress.Left; - Ymosaic = Ymosaic + Pad.Newpress.Up - Pad.Newpress.Down; - - PA_SetSpriteMosaicXY(0, // screen - Xmosaic, // X Mosaic value, between 0 and 15. This is the mosaic base size, 1 for 1 pixel, etc... - Ymosaic); // Y Mosaic value, between 0 and 15. This is the mosaic base size, 1 for 1 pixel, etc... - - PA_WaitForVBL(); - } - -return 0; +#include + +// PAGfxConverter Include +#include "all_gfx.h" +u8 Xmosaic = 0; +u8 Ymosaic = 0; + +int main(void){ + + PA_Init(); // Initializes PA_Lib + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Palette loading... + + PA_CreateSprite(0, 0, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 50); // Sprite... + + // Activate the mosaic effect for a given sprite ! + PA_SetSpriteMosaic(0, 0, 1); // Screen, Sprite, Mosaic on/off (1/0) + + + // Infinite loop to keep the program running + while (1) + { + // Change the mosaic effect according to keys... + Xmosaic = Xmosaic + Pad.Newpress.Right - Pad.Newpress.Left; + Ymosaic = Ymosaic + Pad.Newpress.Up - Pad.Newpress.Down; + + PA_SetSpriteMosaicXY(0, // screen + Xmosaic, // X Mosaic value, between 0 and 15. This is the mosaic base size, 1 for 1 pixel, etc... + Ymosaic); // Y Mosaic value, between 0 and 15. This is the mosaic base size, 1 for 1 pixel, etc... + + PA_WaitForVBL(); + } + +return 0; } \ No newline at end of file diff --git a/examples/Sprites/Movement/MoveSpritePix/Makefile b/examples/Sprites/Movement/MoveSpritePix/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Movement/MoveSpritePix/Makefile +++ b/examples/Sprites/Movement/MoveSpritePix/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Movement/MoveSpritePix/gfx/all_gfx.h b/examples/Sprites/Movement/MoveSpritePix/gfx/all_gfx.h index 0db5322..07a6043 100644 --- a/examples/Sprites/Movement/MoveSpritePix/gfx/all_gfx.h +++ b/examples/Sprites/Movement/MoveSpritePix/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char frisbee_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Movement/MoveSpritePix/source/main.c b/examples/Sprites/Movement/MoveSpritePix/source/main.c index e4a0f6c..a9ce464 100644 --- a/examples/Sprites/Movement/MoveSpritePix/source/main.c +++ b/examples/Sprites/Movement/MoveSpritePix/source/main.c @@ -1,27 +1,27 @@ - -// Les Includes -#include -#include "all_gfx.h" - - -//Fonction principale du code -int main(void) { - - //Initialision de PAlib - PA_Init(); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Load the sprite palette - - // Load a sprite... - PA_CreateSprite(0, 0,(void*)frisbee_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); //Create a sprites - PA_InitAllSpriteDraw(); // Inits the sprite draw mode, necessary for the pixel-perfect touch detection - - while(1) - { - PA_MoveSpritePix(0); - - PA_WaitForVBL(); - } - - return 0; + +// Les Includes +#include +#include "all_gfx.h" + + +//Fonction principale du code +int main(void) { + + //Initialision de PAlib + PA_Init(); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Load the sprite palette + + // Load a sprite... + PA_CreateSprite(0, 0,(void*)frisbee_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); //Create a sprites + PA_InitAllSpriteDraw(); // Inits the sprite draw mode, necessary for the pixel-perfect touch detection + + while(1) + { + PA_MoveSpritePix(0); + + PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Movement/MoveSprites/Makefile b/examples/Sprites/Movement/MoveSprites/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Movement/MoveSprites/Makefile +++ b/examples/Sprites/Movement/MoveSprites/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Movement/MoveSprites/gfx/all_gfx.h b/examples/Sprites/Movement/MoveSprites/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/Movement/MoveSprites/gfx/all_gfx.h +++ b/examples/Sprites/Movement/MoveSprites/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Movement/MoveSprites/source/main.c b/examples/Sprites/Movement/MoveSprites/source/main.c index 436074a..eb5f259 100644 --- a/examples/Sprites/Movement/MoveSprites/source/main.c +++ b/examples/Sprites/Movement/MoveSprites/source/main.c @@ -1,34 +1,34 @@ - -// Les Includes -#include - -// PAGfx Include -#include "all_gfx.h" -//Fonction principale du code -int main(void) { - - //Initialision de PAlib - PA_Init(); - - // Load de sprite palette - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - // Load a few sprites... - u8 i = 0; - for (i = 0; i < 16; i++) PA_CreateSprite(0, i,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, i << 4, i << 3); - // This loads sprites a bit everywhere - - - while(1) - { - // Use the MoveSprite function on all sprites... - for (i = 0; i < 16; i++) PA_MoveSprite(i); - // The MoveSprite function checks if you are touching a sprite, and moves it around if you are... Pretty nice if you have multiple sprites around - - PA_WaitForVBL(); - } - - return 0; + +// Les Includes +#include + +// PAGfx Include +#include "all_gfx.h" +//Fonction principale du code +int main(void) { + + //Initialision de PAlib + PA_Init(); + + // Load de sprite palette + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + // Load a few sprites... + u8 i = 0; + for (i = 0; i < 16; i++) PA_CreateSprite(0, i,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, i << 4, i << 3); + // This loads sprites a bit everywhere + + + while(1) + { + // Use the MoveSprite function on all sprites... + for (i = 0; i < 16; i++) PA_MoveSprite(i); + // The MoveSprite function checks if you are touching a sprite, and moves it around if you are... Pretty nice if you have multiple sprites around + + PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Movement/MoveSpritewithKeys/Makefile b/examples/Sprites/Movement/MoveSpritewithKeys/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Movement/MoveSpritewithKeys/Makefile +++ b/examples/Sprites/Movement/MoveSpritewithKeys/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Movement/MoveSpritewithKeys/gfx/all_gfx.h b/examples/Sprites/Movement/MoveSpritewithKeys/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/Movement/MoveSpritewithKeys/gfx/all_gfx.h +++ b/examples/Sprites/Movement/MoveSpritewithKeys/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Movement/MoveSpritewithKeys/source/main.c b/examples/Sprites/Movement/MoveSpritewithKeys/source/main.c index a5f21a0..86a87d4 100644 --- a/examples/Sprites/Movement/MoveSpritewithKeys/source/main.c +++ b/examples/Sprites/Movement/MoveSpritewithKeys/source/main.c @@ -1,39 +1,39 @@ -//Move a sprite using the keys... - -#include - -// PAGfx Include -#include "all_gfx.h" -s32 x = 0; s32 y = 0; // sprite position... - -//Fonction principale du code -int main(void){ - - PA_Init(); //Initialision of PAlib - - PA_LoadDefaultText(0,0); - - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - //Create the sprite - PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 0, 0); - - - while(1){ // Main loop - - // Update the position according to the keypad... - x += Pad.Held.Right - Pad.Held.Left; - y += Pad.Held.Down - Pad.Held.Up; - - // Set the sprite's position - PA_SetSpriteXY(0, // screen - 0, // sprite - x, // x position - y); // y... - - PA_WaitForVBL(); - } - return 0; +//Move a sprite using the keys... + +#include + +// PAGfx Include +#include "all_gfx.h" +s32 x = 0; s32 y = 0; // sprite position... + +//Fonction principale du code +int main(void){ + + PA_Init(); //Initialision of PAlib + + PA_LoadDefaultText(0,0); + + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + //Create the sprite + PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 0, 0); + + + while(1){ // Main loop + + // Update the position according to the keypad... + x += Pad.Held.Right - Pad.Held.Left; + y += Pad.Held.Down - Pad.Held.Up; + + // Set the sprite's position + PA_SetSpriteXY(0, // screen + 0, // sprite + x, // x position + y); // y... + + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Movement/MoveSpritewithStylus/Makefile b/examples/Sprites/Movement/MoveSpritewithStylus/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Movement/MoveSpritewithStylus/Makefile +++ b/examples/Sprites/Movement/MoveSpritewithStylus/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Movement/MoveSpritewithStylus/gfx/all_gfx.h b/examples/Sprites/Movement/MoveSpritewithStylus/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/Movement/MoveSpritewithStylus/gfx/all_gfx.h +++ b/examples/Sprites/Movement/MoveSpritewithStylus/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Movement/MoveSpritewithStylus/source/main.c b/examples/Sprites/Movement/MoveSpritewithStylus/source/main.c index 4257f8c..430fe93 100644 --- a/examples/Sprites/Movement/MoveSpritewithStylus/source/main.c +++ b/examples/Sprites/Movement/MoveSpritewithStylus/source/main.c @@ -1,27 +1,27 @@ -//copyright smealum http://jvteamds.free.fr -// Les Includes -#include - -// PAGfx Include -#include "all_gfx.h" -//Fonction principale du code -int main(void) { - //Initialision de PAlib - PA_Init(); - - PA_LoadDefaultText(0,0); - - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 50, 50); - - while(1) - { - PA_OutputText(0,0,0,"Stylus X : %d \nStylus Y : %d ",Stylus.X,Stylus.Y); - PA_SetSpriteXY(0,0,Stylus.X,Stylus.Y); - PA_WaitForVBL(); - } - return 0; +//copyright smealum http://jvteamds.free.fr +// Les Includes +#include + +// PAGfx Include +#include "all_gfx.h" +//Fonction principale du code +int main(void) { + //Initialision de PAlib + PA_Init(); + + PA_LoadDefaultText(0,0); + + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 50, 50); + + while(1) + { + PA_OutputText(0,0,0,"Stylus X : %d \nStylus Y : %d ",Stylus.X,Stylus.Y); + PA_SetSpriteXY(0,0,Stylus.X,Stylus.Y); + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Others/CreateGfx/Makefile b/examples/Sprites/Others/CreateGfx/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Others/CreateGfx/Makefile +++ b/examples/Sprites/Others/CreateGfx/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Others/CreateGfx/gfx/all_gfx.h b/examples/Sprites/Others/CreateGfx/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/Others/CreateGfx/gfx/all_gfx.h +++ b/examples/Sprites/Others/CreateGfx/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/Others/CreateGfx/source/main.c b/examples/Sprites/Others/CreateGfx/source/main.c index 0e03973..029a6dd 100644 --- a/examples/Sprites/Others/CreateGfx/source/main.c +++ b/examples/Sprites/Others/CreateGfx/source/main.c @@ -1,69 +1,69 @@ -/* This simple demo will show you how to effectively use Sprite Gfxs -In a few word, when you load a sprite, it copies the sprite information (size, position, etc...) -and the sprite's image, the gfx... If you create 10 times the same sprite, you'll have 10 times -the same image in VRAM, which is kind of a shame... So let's see how to have a single copy of that image, -and thus save VRAM and loading time... -*/ - -// Includes, only one sprite -#include - -// PAGfx Include -#include "all_gfx.h" - -// Main function -int main(void){ - // PAlib init - PA_Init(); - PA_LoadDefaultText(1, 0); - -// Load the sprite palette, for both screens - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - PA_LoadSpritePal(1, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - - // Now, let's copy the image of the sprite to VRAM : - // First screen - u16 gfx0 = PA_CreateGfx(0, // screen - (void*)vaisseau_Sprite, // Image - OBJ_SIZE_32X32, // Size - 1); // 256 color sprite - // Same thing for the top screen : - u16 gfx1 = PA_CreateGfx(1, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1); - - // The gfx0 and gfx1 variables stock the number of the gfx, this will allow us to create sprites later on - - - PA_OutputSimpleText(1, 0, 10, "Press A to create a sprite on the bottom screen, B on the top screen"); - - u8 nsprites0 = 0; // Number of sprites on the bottom screen - u8 nsprites1 = 0; // Top screen - - // Infinite loop - while(1) - { - // If A pressed - if (Pad.Newpress.A) { - PA_CreateSpriteFromGfx(0, // screen - nsprites0, // Next sprite to load... - gfx0, // image to use in memory, no image copying ! - OBJ_SIZE_32X32, 1, 0, PA_Rand()%256, PA_Rand()%192); // The rest is like normal sprites - ++nsprites0; // Next time, load the next sprite number - } - // Same thing with B - if (Pad.Newpress.B) { - PA_CreateSpriteFromGfx(1, // screen - nsprites1, // Next sprite to load... - gfx1, // image to use in memory, no image copying ! - OBJ_SIZE_32X32, 1, 0, PA_Rand()%256, PA_Rand()%192); // The rest is like normal sprites - ++nsprites1; // Next time, load the next sprite number - } - - PA_WaitForVBL(); - } - return 0; +/* This simple demo will show you how to effectively use Sprite Gfxs +In a few word, when you load a sprite, it copies the sprite information (size, position, etc...) +and the sprite's image, the gfx... If you create 10 times the same sprite, you'll have 10 times +the same image in VRAM, which is kind of a shame... So let's see how to have a single copy of that image, +and thus save VRAM and loading time... +*/ + +// Includes, only one sprite +#include + +// PAGfx Include +#include "all_gfx.h" + +// Main function +int main(void){ + // PAlib init + PA_Init(); + PA_LoadDefaultText(1, 0); + +// Load the sprite palette, for both screens + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + PA_LoadSpritePal(1, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + + // Now, let's copy the image of the sprite to VRAM : + // First screen + u16 gfx0 = PA_CreateGfx(0, // screen + (void*)vaisseau_Sprite, // Image + OBJ_SIZE_32X32, // Size + 1); // 256 color sprite + // Same thing for the top screen : + u16 gfx1 = PA_CreateGfx(1, (void*)vaisseau_Sprite, OBJ_SIZE_32X32, 1); + + // The gfx0 and gfx1 variables stock the number of the gfx, this will allow us to create sprites later on + + + PA_OutputSimpleText(1, 0, 10, "Press A to create a sprite on the bottom screen, B on the top screen"); + + u8 nsprites0 = 0; // Number of sprites on the bottom screen + u8 nsprites1 = 0; // Top screen + + // Infinite loop + while(1) + { + // If A pressed + if (Pad.Newpress.A) { + PA_CreateSpriteFromGfx(0, // screen + nsprites0, // Next sprite to load... + gfx0, // image to use in memory, no image copying ! + OBJ_SIZE_32X32, 1, 0, PA_Rand()%256, PA_Rand()%192); // The rest is like normal sprites + ++nsprites0; // Next time, load the next sprite number + } + // Same thing with B + if (Pad.Newpress.B) { + PA_CreateSpriteFromGfx(1, // screen + nsprites1, // Next sprite to load... + gfx1, // image to use in memory, no image copying ! + OBJ_SIZE_32X32, 1, 0, PA_Rand()%256, PA_Rand()%192); // The rest is like normal sprites + ++nsprites1; // Next time, load the next sprite number + } + + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Priorities/Priorities/Makefile b/examples/Sprites/Priorities/Priorities/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Priorities/Priorities/Makefile +++ b/examples/Sprites/Priorities/Priorities/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Priorities/Priorities/source/main.c b/examples/Sprites/Priorities/Priorities/source/main.c index fc57bc2..426eee4 100644 --- a/examples/Sprites/Priorities/Priorities/source/main.c +++ b/examples/Sprites/Priorities/Priorities/source/main.c @@ -1,41 +1,41 @@ -/* This is a very simple demo, just tells you which sprite you are touching ! -*/ - - -// Includes -#include -#include "all_gfx.h" - - -// Main function -int main(void) { - - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Load the sprite palette - - // Load a few sprites... - u8 i = 0; - for (i = 0; i < 16; i++) PA_CreateSprite(0, i,(void*)mollusk_Sprite, OBJ_SIZE_32X32,1, 0, i << 3, i << 3); - - - PA_InitSpriteExtPrio(1); // Enable extended priorities - - - PA_OutputSimpleText(1, 0, 10, "Please touch a sprite to make it come in front of the others"); - - while(1) - { - // Now we'll test every sprite to see if we touch it... - for (i = 0; i < 16; i++) { - if (PA_SpriteTouched(i)) PA_SetSpriteExtPrio(0, i, 0); // Top priority - else PA_SetSpriteExtPrio(0, i, 127); // Last priority - } - - - PA_WaitForVBL(); - } - return 0; +/* This is a very simple demo, just tells you which sprite you are touching ! +*/ + + +// Includes +#include +#include "all_gfx.h" + + +// Main function +int main(void) { + + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Load the sprite palette + + // Load a few sprites... + u8 i = 0; + for (i = 0; i < 16; i++) PA_CreateSprite(0, i,(void*)mollusk_Sprite, OBJ_SIZE_32X32,1, 0, i << 3, i << 3); + + + PA_InitSpriteExtPrio(1); // Enable extended priorities + + + PA_OutputSimpleText(1, 0, 10, "Please touch a sprite to make it come in front of the others"); + + while(1) + { + // Now we'll test every sprite to see if we touch it... + for (i = 0; i < 16; i++) { + if (PA_SpriteTouched(i)) PA_SetSpriteExtPrio(0, i, 0); // Top priority + else PA_SetSpriteExtPrio(0, i, 127); // Last priority + } + + + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/Priorities/Priorities2/Makefile b/examples/Sprites/Priorities/Priorities2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/Priorities/Priorities2/Makefile +++ b/examples/Sprites/Priorities/Priorities2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/Priorities/Priorities2/source/main.c b/examples/Sprites/Priorities/Priorities2/source/main.c index 896bf41..3c36df2 100644 --- a/examples/Sprites/Priorities/Priorities2/source/main.c +++ b/examples/Sprites/Priorities/Priorities2/source/main.c @@ -1,42 +1,42 @@ -/* This is a very simple demo, just tells you which sprite you are touching ! -*/ - - -// Includes -#include -#include "all_gfx.h" - - -// Main function -int main(void) { - - PA_Init(); - - PA_LoadDefaultText(1, 0); - - PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Load the sprite palette - - // Load a few sprites... - u8 i = 0; - for (i = 0; i < 16; i++) PA_CreateSprite(0, i,(void*)mollusk_Sprite, OBJ_SIZE_32X32,1, 0, i << 3, i << 3); - - - PA_InitSpriteExtPrio(1); // Enable extended priorities - - - PA_OutputSimpleText(1, 0, 10, "Please move the sprites to see how their priorities change"); - - while(1) - { - // Now we'll test every sprite to see if we touch it... - for (i = 0; i < 16; i++) { - PA_MoveSprite(i); // move the sprites. - s16 y = PA_GetSpriteY(0, i); if (y > 192) y-=256; // if higher than 0... - PA_SetSpriteExtPrio(0, i, 192-y); // Top priority when at the bottom ! - } - - - PA_WaitForVBL(); - } - return 0; +/* This is a very simple demo, just tells you which sprite you are touching ! +*/ + + +// Includes +#include +#include "all_gfx.h" + + +// Main function +int main(void) { + + PA_Init(); + + PA_LoadDefaultText(1, 0); + + PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // Load the sprite palette + + // Load a few sprites... + u8 i = 0; + for (i = 0; i < 16; i++) PA_CreateSprite(0, i,(void*)mollusk_Sprite, OBJ_SIZE_32X32,1, 0, i << 3, i << 3); + + + PA_InitSpriteExtPrio(1); // Enable extended priorities + + + PA_OutputSimpleText(1, 0, 10, "Please move the sprites to see how their priorities change"); + + while(1) + { + // Now we'll test every sprite to see if we touch it... + for (i = 0; i < 16; i++) { + PA_MoveSprite(i); // move the sprites. + s16 y = PA_GetSpriteY(0, i); if (y > 192) y-=256; // if higher than 0... + PA_SetSpriteExtPrio(0, i, 192-y); // Top priority when at the bottom ! + } + + + PA_WaitForVBL(); + } + return 0; } \ No newline at end of file diff --git a/examples/Sprites/RotationZoom/Sprite_RotZoom/Makefile b/examples/Sprites/RotationZoom/Sprite_RotZoom/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/RotationZoom/Sprite_RotZoom/Makefile +++ b/examples/Sprites/RotationZoom/Sprite_RotZoom/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/RotationZoom/Sprite_RotZoom/gfx/all_gfx.h b/examples/Sprites/RotationZoom/Sprite_RotZoom/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/RotationZoom/Sprite_RotZoom/gfx/all_gfx.h +++ b/examples/Sprites/RotationZoom/Sprite_RotZoom/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/RotationZoom/Sprite_RotZoom/source/main.c b/examples/Sprites/RotationZoom/Sprite_RotZoom/source/main.c index f932182..9163cd3 100644 --- a/examples/Sprites/RotationZoom/Sprite_RotZoom/source/main.c +++ b/examples/Sprites/RotationZoom/Sprite_RotZoom/source/main.c @@ -1,56 +1,56 @@ -//copyright smealum http://jvteamds.free.fr - -// And now, rotations and zoom at the same time, easy ! - -// Les Includes -#include - - -// PAGfxConverter Include -#include "all_gfx.h" -//Fonction principale du code -int main(void) - -{ -//Initialision de PAlib -PA_Init(); - -// Load the palette - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - -// Load the sprite -PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 50, 50); -PA_SetSpriteDblsize(0, 0, 1); // Enable double size, which means that the sprite can become bigger than it's normal size - - -// Activate rotations for that sprite -PA_SetSpriteRotEnable(0,// screen - 0,// sprite number - 0);// rotset number. You have 32 rotsets (0-31) per screen. 2 sprites with the same rotset will - // be zoomed/rotated the same way... - -u16 zoom = 256; // Zoom. 256 means no zoom, 512 is twice as small, 128 is twice as big.... -u16 angle = 0; // Plain angle to start off - -while(1) -{ - zoom -= Pad.Held.Up - Pad.Held.Down; // Change the zoom according to the keys... - - angle++; - angle &= 511; // Limit it's range to 0-511... For other sizes, use angle %= 512, etc... - - // Fast function for zoom without rotations... - PA_SetRotset(0, //screen - 0, // rotset - angle, // Angle... - zoom, zoom); // Horizontal zoom, vertical zoom. You can have a sprite streched out if you wany, - // by putting the zoom only for x or y axis.... - - PA_WaitForVBL(); // Synch - -//La boucle infinie du programme -} -return 0; +//copyright smealum http://jvteamds.free.fr + +// And now, rotations and zoom at the same time, easy ! + +// Les Includes +#include + + +// PAGfxConverter Include +#include "all_gfx.h" +//Fonction principale du code +int main(void) + +{ +//Initialision de PAlib +PA_Init(); + +// Load the palette + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + +// Load the sprite +PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 50, 50); +PA_SetSpriteDblsize(0, 0, 1); // Enable double size, which means that the sprite can become bigger than it's normal size + + +// Activate rotations for that sprite +PA_SetSpriteRotEnable(0,// screen + 0,// sprite number + 0);// rotset number. You have 32 rotsets (0-31) per screen. 2 sprites with the same rotset will + // be zoomed/rotated the same way... + +u16 zoom = 256; // Zoom. 256 means no zoom, 512 is twice as small, 128 is twice as big.... +u16 angle = 0; // Plain angle to start off + +while(1) +{ + zoom -= Pad.Held.Up - Pad.Held.Down; // Change the zoom according to the keys... + + angle++; + angle &= 511; // Limit it's range to 0-511... For other sizes, use angle %= 512, etc... + + // Fast function for zoom without rotations... + PA_SetRotset(0, //screen + 0, // rotset + angle, // Angle... + zoom, zoom); // Horizontal zoom, vertical zoom. You can have a sprite streched out if you wany, + // by putting the zoom only for x or y axis.... + + PA_WaitForVBL(); // Synch + +//La boucle infinie du programme +} +return 0; } \ No newline at end of file diff --git a/examples/Sprites/RotationZoom/Sprite_Rotation/Makefile b/examples/Sprites/RotationZoom/Sprite_Rotation/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/RotationZoom/Sprite_Rotation/Makefile +++ b/examples/Sprites/RotationZoom/Sprite_Rotation/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/RotationZoom/Sprite_Rotation/gfx/all_gfx.h b/examples/Sprites/RotationZoom/Sprite_Rotation/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/RotationZoom/Sprite_Rotation/gfx/all_gfx.h +++ b/examples/Sprites/RotationZoom/Sprite_Rotation/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/RotationZoom/Sprite_Rotation/source/main.c b/examples/Sprites/RotationZoom/Sprite_Rotation/source/main.c index f8a4b75..678af1c 100644 --- a/examples/Sprites/RotationZoom/Sprite_Rotation/source/main.c +++ b/examples/Sprites/RotationZoom/Sprite_Rotation/source/main.c @@ -1,42 +1,42 @@ -// Activate sprite rotations and make your sprite turn around ! - -#include - -// PAGfxConverter Include -#include "all_gfx.h" - -int main(void){ - - PA_Init(); - - // Load the palette - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - // Load the sprite - PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 50, 50); - - // Activate rotations for that sprite - PA_SetSpriteRotEnable(0,// screen - 0,// sprite number - 0);// rotset number. You have 32 rotsets (0-31) per screen. 2 sprites with the same rotset will - // be zoomed/rotated the same way... - - u16 angle = 0; // Rotation angle... - - while(1) - { - ++angle; // change the angle - angle &= 511; // limit the range to 0-511. works only with 1, 3, 7, 15, 31, etc... (2^n - 1) - - // Fast function for rotations without zoom... - PA_SetRotsetNoZoom(0, //screen - 0, // rotset - angle); // angle, from 0 to 511 - - PA_WaitForVBL(); // Synch - } - - return 0; +// Activate sprite rotations and make your sprite turn around ! + +#include + +// PAGfxConverter Include +#include "all_gfx.h" + +int main(void){ + + PA_Init(); + + // Load the palette + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + // Load the sprite + PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 50, 50); + + // Activate rotations for that sprite + PA_SetSpriteRotEnable(0,// screen + 0,// sprite number + 0);// rotset number. You have 32 rotsets (0-31) per screen. 2 sprites with the same rotset will + // be zoomed/rotated the same way... + + u16 angle = 0; // Rotation angle... + + while(1) + { + ++angle; // change the angle + angle &= 511; // limit the range to 0-511. works only with 1, 3, 7, 15, 31, etc... (2^n - 1) + + // Fast function for rotations without zoom... + PA_SetRotsetNoZoom(0, //screen + 0, // rotset + angle); // angle, from 0 to 511 + + PA_WaitForVBL(); // Synch + } + + return 0; } \ No newline at end of file diff --git a/examples/Sprites/RotationZoom/Sprite_Zoom/Makefile b/examples/Sprites/RotationZoom/Sprite_Zoom/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Sprites/RotationZoom/Sprite_Zoom/Makefile +++ b/examples/Sprites/RotationZoom/Sprite_Zoom/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Sprites/RotationZoom/Sprite_Zoom/gfx/all_gfx.h b/examples/Sprites/RotationZoom/Sprite_Zoom/gfx/all_gfx.h index ca69a2f..056e25b 100644 --- a/examples/Sprites/RotationZoom/Sprite_Zoom/gfx/all_gfx.h +++ b/examples/Sprites/RotationZoom/Sprite_Zoom/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Sprites: -extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal - -// Palettes: -extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Sprites: +extern const unsigned char vaisseau_Sprite[1024] _GFX_ALIGN; // Palette: sprite0_Pal + +// Palettes: +extern const unsigned short sprite0_Pal[256] _GFX_ALIGN; + +#ifdef __cplusplus +} +#endif diff --git a/examples/Sprites/RotationZoom/Sprite_Zoom/source/main.c b/examples/Sprites/RotationZoom/Sprite_Zoom/source/main.c index bf90347..12c4812 100644 --- a/examples/Sprites/RotationZoom/Sprite_Zoom/source/main.c +++ b/examples/Sprites/RotationZoom/Sprite_Zoom/source/main.c @@ -1,47 +1,47 @@ -// Activate sprite zoom and make your sprite zoom in and out ! -// Dualis is a little buggy on this for the sprite without double size... - -#include - -// PAGfxConverter Include -#include "all_gfx.h" -int main(void){ - - PA_Init(); - - // Load the palette - PA_LoadSpritePal(0, // Screen - 0, // Palette number - (void*)sprite0_Pal); // Palette name - - // Load the sprite - PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 50, 50); - PA_SetSpriteDblsize(0, 0, 1); // Enable double size, which means that the sprite can become bigger than it's normal size - - // Let's do a sprit without double size to show the difference... - PA_CreateSprite(0, 1,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 120, 66); - - // Activate rotations for that sprite - PA_SetSpriteRotEnable(0,// screen - 0,// sprite number - 0);// rotset number. You have 32 rotsets (0-31) per screen. 2 sprites with the same rotset will - // be zoomed/rotated the same way... - PA_SetSpriteRotEnable(0, 1, 0); // Same rotset as the other sprite... it'll be zoomed the same way - - u16 zoom = 256; // Zoom. 256 means no zoom, 512 is twice as small, 128 is twice as big.... - - while(1) - { - zoom -= Pad.Held.Up - Pad.Held.Down; // Change the zoom according to the keys... - - // Fast function for zoom without rotations... - PA_SetRotsetNoAngle(0, //screen - 0, // rotset - zoom, zoom); // Horizontal zoom, vertical zoom. You can have a sprite streched out if you want, - // by putting the zoom only for x or y axis.... - - PA_WaitForVBL(); // Synch - } - - return 0; +// Activate sprite zoom and make your sprite zoom in and out ! +// Dualis is a little buggy on this for the sprite without double size... + +#include + +// PAGfxConverter Include +#include "all_gfx.h" +int main(void){ + + PA_Init(); + + // Load the palette + PA_LoadSpritePal(0, // Screen + 0, // Palette number + (void*)sprite0_Pal); // Palette name + + // Load the sprite + PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 50, 50); + PA_SetSpriteDblsize(0, 0, 1); // Enable double size, which means that the sprite can become bigger than it's normal size + + // Let's do a sprit without double size to show the difference... + PA_CreateSprite(0, 1,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 120, 66); + + // Activate rotations for that sprite + PA_SetSpriteRotEnable(0,// screen + 0,// sprite number + 0);// rotset number. You have 32 rotsets (0-31) per screen. 2 sprites with the same rotset will + // be zoomed/rotated the same way... + PA_SetSpriteRotEnable(0, 1, 0); // Same rotset as the other sprite... it'll be zoomed the same way + + u16 zoom = 256; // Zoom. 256 means no zoom, 512 is twice as small, 128 is twice as big.... + + while(1) + { + zoom -= Pad.Held.Up - Pad.Held.Down; // Change the zoom according to the keys... + + // Fast function for zoom without rotations... + PA_SetRotsetNoAngle(0, //screen + 0, // rotset + zoom, zoom); // Horizontal zoom, vertical zoom. You can have a sprite streched out if you want, + // by putting the zoom only for x or y axis.... + + PA_WaitForVBL(); // Synch + } + + return 0; } \ No newline at end of file diff --git a/examples/Text/16c/16cText/Makefile b/examples/Text/16c/16cText/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/16c/16cText/Makefile +++ b/examples/Text/16c/16cText/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/16c/16cText/source/main.c b/examples/Text/16c/16cText/source/main.c index d01b0a2..8077a1d 100644 --- a/examples/Text/16c/16cText/source/main.c +++ b/examples/Text/16c/16cText/source/main.c @@ -1,39 +1,39 @@ -// Includes -#include // Include for PA_Lib - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - - PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text - - PA_16cText(1, //screen - 10, 10, 255, 20, //x1, y1, x2, y2 position - "Hello World", //text - 1, //color (1-10) - 0, // text size (0-4) - 100); // maximum number of characters (use like 10000 if you don't know) - PA_16cText(1, 10, 25, 255, 40, "Hello World", 1, 1, 100); - PA_16cText(1, 10, 40, 255, 60, "Hello World", 1, 2, 100); - PA_16cText(1, 10, 60, 255, 80, "Hello World", 1, 3, 100); - PA_16cText(1, 10, 80, 255, 100, "Hello World", 1, 4, 100); - - // Different colors on the bottom sreen... - u8 i; - for (i = 0; i < 10; i++){ - PA_16cText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 3, 100); - } - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// Includes +#include // Include for PA_Lib + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + + PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text + + PA_16cText(1, //screen + 10, 10, 255, 20, //x1, y1, x2, y2 position + "Hello World", //text + 1, //color (1-10) + 0, // text size (0-4) + 100); // maximum number of characters (use like 10000 if you don't know) + PA_16cText(1, 10, 25, 255, 40, "Hello World", 1, 1, 100); + PA_16cText(1, 10, 40, 255, 60, "Hello World", 1, 2, 100); + PA_16cText(1, 10, 60, 255, 80, "Hello World", 1, 3, 100); + PA_16cText(1, 10, 80, 255, 100, "Hello World", 1, 4, 100); + + // Different colors on the bottom sreen... + u8 i; + for (i = 0; i < 10; i++){ + PA_16cText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 3, 100); + } + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/16c/16cText2/Makefile b/examples/Text/16c/16cText2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/16c/16cText2/Makefile +++ b/examples/Text/16c/16cText2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/16c/16cText2/source/main.c b/examples/Text/16c/16cText2/source/main.c index 4f74d37..ac9ba23 100644 --- a/examples/Text/16c/16cText2/source/main.c +++ b/examples/Text/16c/16cText2/source/main.c @@ -1,36 +1,36 @@ -// Includes -#include // Include for PA_Lib - -#include // standard lib for texts... - -char text[200]; - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - - PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text - - - - - // Infinite loop to keep the program running - while (1) - { - sprintf(text, // string to use - "%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); // String to transform - PA_16cText(0, 10, 20, 255, 40, text, 1, 3, 100); // Display the text transformed :) - - // And the time... - sprintf(text, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds); - PA_16cText(0, 10, 40, 255, 60, text, 1, 3, 100); // Display the text transformed :) - - PA_WaitForVBL(); - PA_16cErase(0); - } - - return 0; +// Includes +#include // Include for PA_Lib + +#include // standard lib for texts... + +char text[200]; + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + + PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text + + + + + // Infinite loop to keep the program running + while (1) + { + sprintf(text, // string to use + "%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); // String to transform + PA_16cText(0, 10, 20, 255, 40, text, 1, 3, 100); // Display the text transformed :) + + // And the time... + sprintf(text, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds); + PA_16cText(0, 10, 40, 255, 60, text, 1, 3, 100); // Display the text transformed :) + + PA_WaitForVBL(); + PA_16cErase(0); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/16c/16cTextFont/Makefile b/examples/Text/16c/16cTextFont/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/16c/16cTextFont/Makefile +++ b/examples/Text/16c/16cTextFont/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/16c/16cTextFont/gfx/all_gfx.h b/examples/Text/16c/16cTextFont/gfx/all_gfx.h index bc6cf63..46e4942 100644 --- a/examples/Text/16c/16cTextFont/gfx/all_gfx.h +++ b/examples/Text/16c/16cTextFont/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct bigfont; -extern const PA_BgStruct smallfont; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct bigfont; +extern const PA_BgStruct smallfont; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Text/16c/16cTextFont/gfx/bin/bigfont.c b/examples/Text/16c/16cTextFont/gfx/bin/bigfont.c index f70db6e..484e66b 100644 --- a/examples/Text/16c/16cTextFont/gfx/bin/bigfont.c +++ b/examples/Text/16c/16cTextFont/gfx/bin/bigfont.c @@ -1,17 +1,17 @@ -#include - -extern const char bigfont_Tiles[]; -extern const char bigfont_Map[]; -extern const char bigfont_Sizes[]; - -const PA_BgStruct bigfont = { - PA_Font4bit, - 512, 128, - - bigfont_Tiles, - bigfont_Map, - {bigfont_Sizes}, - - 8256, - {14} -}; +#include + +extern const char bigfont_Tiles[]; +extern const char bigfont_Map[]; +extern const char bigfont_Sizes[]; + +const PA_BgStruct bigfont = { + PA_Font4bit, + 512, 128, + + bigfont_Tiles, + bigfont_Map, + {bigfont_Sizes}, + + 8256, + {14} +}; diff --git a/examples/Text/16c/16cTextFont/gfx/bin/smallfont.c b/examples/Text/16c/16cTextFont/gfx/bin/smallfont.c index bb7d788..a24f0ac 100644 --- a/examples/Text/16c/16cTextFont/gfx/bin/smallfont.c +++ b/examples/Text/16c/16cTextFont/gfx/bin/smallfont.c @@ -1,17 +1,17 @@ -#include - -extern const char smallfont_Tiles[]; -extern const char smallfont_Map[]; -extern const char smallfont_Sizes[]; - -const PA_BgStruct smallfont = { - PA_Font4bit, - 256, 64, - - smallfont_Tiles, - smallfont_Map, - {smallfont_Sizes}, - - 3168, - {6} -}; +#include + +extern const char smallfont_Tiles[]; +extern const char smallfont_Map[]; +extern const char smallfont_Sizes[]; + +const PA_BgStruct smallfont = { + PA_Font4bit, + 256, 64, + + smallfont_Tiles, + smallfont_Map, + {smallfont_Sizes}, + + 3168, + {6} +}; diff --git a/examples/Text/16c/16cTextFont/source/main.c b/examples/Text/16c/16cTextFont/source/main.c index a8bb062..ff46fe6 100644 --- a/examples/Text/16c/16cTextFont/source/main.c +++ b/examples/Text/16c/16cTextFont/source/main.c @@ -1,43 +1,43 @@ -// Includes -#include // Include for PA_Lib - -// Include de newly converted fonts... -#include "all_gfx.h" - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - - PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text - - // Slots 0-4 are already used by default PAlib fonts, so we'll load on slots 5 and 6. - // Available slots : 5-9. You can overwrite a PAlib font though if you want to use slot 0 for example... - PA_Add16cFont(5, &smallfont); - PA_Add16cFont(6, &bigfont); - - - - - PA_16cText(1, 10, 25, 255, 40, "Small custom font...", 1, 5, 100); - PA_16cText(1, 10, 40, 255, 60, "Big custom font...", 1, 6, 100); - - - u8 i; - - // Different colors on the bottom sreen... - for (i = 0; i < 10; i++){ - PA_16cText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 6, 100); - } - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// Includes +#include // Include for PA_Lib + +// Include de newly converted fonts... +#include "all_gfx.h" + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + + PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text + + // Slots 0-4 are already used by default PAlib fonts, so we'll load on slots 5 and 6. + // Available slots : 5-9. You can overwrite a PAlib font though if you want to use slot 0 for example... + PA_Add16cFont(5, &smallfont); + PA_Add16cFont(6, &bigfont); + + + + + PA_16cText(1, 10, 25, 255, 40, "Small custom font...", 1, 5, 100); + PA_16cText(1, 10, 40, 255, 60, "Big custom font...", 1, 6, 100); + + + u8 i; + + // Different colors on the bottom sreen... + for (i = 0; i < 10; i++){ + PA_16cText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 6, 100); + } + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/8bit/8bitText/Makefile b/examples/Text/8bit/8bitText/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/8bit/8bitText/Makefile +++ b/examples/Text/8bit/8bitText/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/8bit/8bitText/source/main.c b/examples/Text/8bit/8bitText/source/main.c index 436f8d3..721284a 100644 --- a/examples/Text/8bit/8bitText/source/main.c +++ b/examples/Text/8bit/8bitText/source/main.c @@ -1,68 +1,68 @@ -// This example shows how to use 8 bit backgrounds, -// on which you can draw with the stylus or show text in different sizes, colors, or rotations - -// Includes -#include // Include for PA_Lib - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - //PA_LoadSplash(); // PA_Lib splash screen - - // Let's put some colors... in the background palettes - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); - PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); - - // Let's not load any backgrounds :p - - // This will initialise an bit background on each screen. This must be loaded before any other background. - // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload - // your backgrounds... - PA_Init8bitBg(0, 3); - PA_Init8bitBg(1, 3); - - // On these backgrounds, you can plot pixels, draw lines... and draw some custom text ! - PA_SmartText(1, // SCreen - 0, // Top left X - 1, // Top left Y - 255, // Botton right X - 20, // Bottom right Y - "Hello World", // Text - 1, // Text palette color (0-255) - 0, // Text size (0-4) - 1, // Text mode (0 - normal, 1 - transparent, 2 - no text, 3 - rotated 90°, 4 - 90° other way) - 100); // Maximum number of characters, if you want to right letter by letter... - PA_SmartText(1, 0, 20, 255, 40, "Hello World", 2, 1, 1, 100); - PA_SmartText(1, 0, 40, 255, 60, "Hello World", 3, 2, 1, 100); - PA_SmartText(1, 0, 60, 255, 80, "Hello World", 4, 3, 1, 100); - PA_SmartText(1, 0, 80, 255, 100, "Hello World", 1, 4, 1, 100); - - - // Let's have some rotated text :p - // X and Y positions are taken as if the DS was turned - PA_SmartText(1, 1, 1, 190, 20, "Hello World", 3, 3, 3, 100); - - // And a centered text, to check if it works - PA_CenterSmartText(1, 0, 100, 255, 120, "Hello World", 2, 4, 1); // Same as Smart text, but no letter limit - - - - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// This example shows how to use 8 bit backgrounds, +// on which you can draw with the stylus or show text in different sizes, colors, or rotations + +// Includes +#include // Include for PA_Lib + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + //PA_LoadSplash(); // PA_Lib splash screen + + // Let's put some colors... in the background palettes + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); + PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); + + // Let's not load any backgrounds :p + + // This will initialise an bit background on each screen. This must be loaded before any other background. + // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload + // your backgrounds... + PA_Init8bitBg(0, 3); + PA_Init8bitBg(1, 3); + + // On these backgrounds, you can plot pixels, draw lines... and draw some custom text ! + PA_SmartText(1, // SCreen + 0, // Top left X + 1, // Top left Y + 255, // Botton right X + 20, // Bottom right Y + "Hello World", // Text + 1, // Text palette color (0-255) + 0, // Text size (0-4) + 1, // Text mode (0 - normal, 1 - transparent, 2 - no text, 3 - rotated 90°, 4 - 90° other way) + 100); // Maximum number of characters, if you want to right letter by letter... + PA_SmartText(1, 0, 20, 255, 40, "Hello World", 2, 1, 1, 100); + PA_SmartText(1, 0, 40, 255, 60, "Hello World", 3, 2, 1, 100); + PA_SmartText(1, 0, 60, 255, 80, "Hello World", 4, 3, 1, 100); + PA_SmartText(1, 0, 80, 255, 100, "Hello World", 1, 4, 1, 100); + + + // Let's have some rotated text :p + // X and Y positions are taken as if the DS was turned + PA_SmartText(1, 1, 1, 190, 20, "Hello World", 3, 3, 3, 100); + + // And a centered text, to check if it works + PA_CenterSmartText(1, 0, 100, 255, 120, "Hello World", 2, 4, 1); // Same as Smart text, but no letter limit + + + + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/8bit/8bitText2/Makefile b/examples/Text/8bit/8bitText2/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/8bit/8bitText2/Makefile +++ b/examples/Text/8bit/8bitText2/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/8bit/8bitText2/source/main.c b/examples/Text/8bit/8bitText2/source/main.c index 062c02c..a020152 100644 --- a/examples/Text/8bit/8bitText2/source/main.c +++ b/examples/Text/8bit/8bitText2/source/main.c @@ -1,38 +1,38 @@ -// This example shows how to use 8 bit backgrounds, -// on which you can draw with the stylus or show text in different sizes, colors, or rotations - -// Includes -#include // Include for PA_Lib - -#include // standard lib for texts... - -char text[200]; - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - - // Let's put some colors... in the background palettes - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); - - PA_Init8bitBg(0, 3); - - - // Infinite loop to keep the program running - while (1) - { - sprintf(text, // string to use - "%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); // String to transform - PA_SmartText(0, 10, 20, 255, 40, text, 1, 3, 0, 100); // Display the text transformed :) - - // And the time... - sprintf(text, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds); - PA_SmartText(0, 10, 40, 255, 60, text, 1, 3, 0, 100); // Display the text transformed :) - - PA_WaitForVBL(); - } - - return 0; +// This example shows how to use 8 bit backgrounds, +// on which you can draw with the stylus or show text in different sizes, colors, or rotations + +// Includes +#include // Include for PA_Lib + +#include // standard lib for texts... + +char text[200]; + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + + // Let's put some colors... in the background palettes + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); + + PA_Init8bitBg(0, 3); + + + // Infinite loop to keep the program running + while (1) + { + sprintf(text, // string to use + "%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); // String to transform + PA_SmartText(0, 10, 20, 255, 40, text, 1, 3, 0, 100); // Display the text transformed :) + + // And the time... + sprintf(text, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds); + PA_SmartText(0, 10, 40, 255, 60, text, 1, 3, 0, 100); // Display the text transformed :) + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/8bit/8bitTextFont/Makefile b/examples/Text/8bit/8bitTextFont/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/8bit/8bitTextFont/Makefile +++ b/examples/Text/8bit/8bitTextFont/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/8bit/8bitTextFont/gfx/all_gfx.h b/examples/Text/8bit/8bitTextFont/gfx/all_gfx.h index bc6cf63..46e4942 100644 --- a/examples/Text/8bit/8bitTextFont/gfx/all_gfx.h +++ b/examples/Text/8bit/8bitTextFont/gfx/all_gfx.h @@ -1,19 +1,19 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct bigfont; -extern const PA_BgStruct smallfont; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct bigfont; +extern const PA_BgStruct smallfont; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Text/8bit/8bitTextFont/gfx/bin/bigfont.c b/examples/Text/8bit/8bitTextFont/gfx/bin/bigfont.c index 342beda..c9e66ff 100644 --- a/examples/Text/8bit/8bitTextFont/gfx/bin/bigfont.c +++ b/examples/Text/8bit/8bitTextFont/gfx/bin/bigfont.c @@ -1,17 +1,17 @@ -#include - -extern const char bigfont_Tiles[]; -extern const char bigfont_Map[]; -extern const char bigfont_Sizes[]; - -const PA_BgStruct bigfont = { - PA_Font8bit, - 512, 128, - - bigfont_Tiles, - bigfont_Map, - {bigfont_Sizes}, - - 16512, - {14} -}; +#include + +extern const char bigfont_Tiles[]; +extern const char bigfont_Map[]; +extern const char bigfont_Sizes[]; + +const PA_BgStruct bigfont = { + PA_Font8bit, + 512, 128, + + bigfont_Tiles, + bigfont_Map, + {bigfont_Sizes}, + + 16512, + {14} +}; diff --git a/examples/Text/8bit/8bitTextFont/gfx/bin/smallfont.c b/examples/Text/8bit/8bitTextFont/gfx/bin/smallfont.c index 744fb57..e71d954 100644 --- a/examples/Text/8bit/8bitTextFont/gfx/bin/smallfont.c +++ b/examples/Text/8bit/8bitTextFont/gfx/bin/smallfont.c @@ -1,17 +1,17 @@ -#include - -extern const char smallfont_Tiles[]; -extern const char smallfont_Map[]; -extern const char smallfont_Sizes[]; - -const PA_BgStruct smallfont = { - PA_Font8bit, - 256, 64, - - smallfont_Tiles, - smallfont_Map, - {smallfont_Sizes}, - - 6336, - {6} -}; +#include + +extern const char smallfont_Tiles[]; +extern const char smallfont_Map[]; +extern const char smallfont_Sizes[]; + +const PA_BgStruct smallfont = { + PA_Font8bit, + 256, 64, + + smallfont_Tiles, + smallfont_Map, + {smallfont_Sizes}, + + 6336, + {6} +}; diff --git a/examples/Text/8bit/8bitTextFont/source/main.c b/examples/Text/8bit/8bitTextFont/source/main.c index e385f3c..df4c139 100644 --- a/examples/Text/8bit/8bitTextFont/source/main.c +++ b/examples/Text/8bit/8bitTextFont/source/main.c @@ -1,59 +1,59 @@ -// This example shows how to use 8 bit backgrounds, -// on which you can draw with the stylus or show text in different sizes, colors, or rotations - -// Includes -#include // Include for PA_Lib - -// Include de newly converted fonts... -#include "all_gfx.h" - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - //PA_LoadSplash(); // PA_Lib splash screen - - // Let's put some colors... in the background palettes - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); - PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); - - // Let's not load any backgrounds :p - - // This will initialise an bit background on each screen. This must be loaded before any other background. - // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload - // your backgrounds... - PA_Init8bitBg(0, 3); PA_Init8bitBg(1, 3); - - // Slots 0-4 are already used by default PAlib fonts, so we'll load on slots 5 and 6. - // Available slots : 5-9. You can overwrite a PAlib font though if you want to use slot 0 for example... - PA_AddBitmapFont(5, &smallfont); - PA_AddBitmapFont(6, &bigfont); - - - - PA_SmartText(1, 0, 20, 255, 40, "Small custom font...", 1, 5, 1, 100); - PA_SmartText(1, 0, 40, 255, 60, "Big custom font...", 1, 6, 1, 100); - - - // Different colors on the bottom sreen... - u8 i; - for (i = 0; i < 10; i++){ - PA_SmartText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 6, 1, 100); - } - - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// This example shows how to use 8 bit backgrounds, +// on which you can draw with the stylus or show text in different sizes, colors, or rotations + +// Includes +#include // Include for PA_Lib + +// Include de newly converted fonts... +#include "all_gfx.h" + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + //PA_LoadSplash(); // PA_Lib splash screen + + // Let's put some colors... in the background palettes + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(0, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(0, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(0, 4, PA_RGB(0, 31, 0)); + PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(1, 2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(1, 3, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(1, 4, PA_RGB(0, 31, 0)); + + // Let's not load any backgrounds :p + + // This will initialise an bit background on each screen. This must be loaded before any other background. + // If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload + // your backgrounds... + PA_Init8bitBg(0, 3); PA_Init8bitBg(1, 3); + + // Slots 0-4 are already used by default PAlib fonts, so we'll load on slots 5 and 6. + // Available slots : 5-9. You can overwrite a PAlib font though if you want to use slot 0 for example... + PA_AddBitmapFont(5, &smallfont); + PA_AddBitmapFont(6, &bigfont); + + + + PA_SmartText(1, 0, 20, 255, 40, "Small custom font...", 1, 5, 1, 100); + PA_SmartText(1, 0, 40, 255, 60, "Big custom font...", 1, 6, 1, 100); + + + // Different colors on the bottom sreen... + u8 i; + for (i = 0; i < 10; i++){ + PA_SmartText(0, 10, i*20, 255, i*20 + 20, "Hello World", i+1, 6, 1, 100); + } + + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/8bit/StarWarsText/Makefile b/examples/Text/8bit/StarWarsText/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/8bit/StarWarsText/Makefile +++ b/examples/Text/8bit/StarWarsText/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/8bit/StarWarsText/source/main.c b/examples/Text/8bit/StarWarsText/source/main.c index 5060770..fa64fa0 100644 --- a/examples/Text/8bit/StarWarsText/source/main.c +++ b/examples/Text/8bit/StarWarsText/source/main.c @@ -1,74 +1,74 @@ -// This example shows how to use 8 bit backgrounds, -// on which you can draw with the stylus or show text in different sizes, colors, or rotations - -// Includes -#include // Include for PA_Lib - - - -char starwarstext[20][100] = { - "Star Wars Text Demo", - "", - "Brought to you", - "by Mollusk,", - "who got bored one", - "thursday evening...", - "", - "Works pretty well ;)", - "", - "But it's completely", - "USELESS !!!", - ".", - "..", - "...", - "THE END !" -}; - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Let's put some colors... in the background palettes - PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); - - // Init an 8bit bg... - PA_InitBig8bitBg(0, 3); // A big one ^^ - PA_Init8bitBg(1, 3); - - s16 i; - - PA_CenterSmartText(1, 10, 60, 245, 100, "Star Wars Text Demo", 1, 4, 0); - - // Infinite loop to keep the program running - while (1) - { - - PA_InitMode7(3); // Init Mode7 style for the star wars effect - - // Values that look good... - PA_Mode7Height(32000); - PA_Mode7MoveLeftRight(-128); - PA_Mode7MoveForwardBack(150); - - for (i = 0; i < 15; i++) PA_CenterSmartText(0, 20, 16+i*16, 235, 36+i*16, starwarstext[i], 1, 4, 1); // Draw the whole text - - for(i = 0 ; (i < 2048); i++) { // Scroll it star wars style - if((i%5)==0) PA_Mode7MoveForwardBack(-1); - PA_WaitForVBL(); - } - - PA_WaitFor(Stylus.Newpress); // Finished... - - PA_DeInitMode7(); // Reset Mode7 - PA_Clear8bitBg(0); // Erase screen - - - - } - - return 0; +// This example shows how to use 8 bit backgrounds, +// on which you can draw with the stylus or show text in different sizes, colors, or rotations + +// Includes +#include // Include for PA_Lib + + + +char starwarstext[20][100] = { + "Star Wars Text Demo", + "", + "Brought to you", + "by Mollusk,", + "who got bored one", + "thursday evening...", + "", + "Works pretty well ;)", + "", + "But it's completely", + "USELESS !!!", + ".", + "..", + "...", + "THE END !" +}; + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Let's put some colors... in the background palettes + PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31)); + + // Init an 8bit bg... + PA_InitBig8bitBg(0, 3); // A big one ^^ + PA_Init8bitBg(1, 3); + + s16 i; + + PA_CenterSmartText(1, 10, 60, 245, 100, "Star Wars Text Demo", 1, 4, 0); + + // Infinite loop to keep the program running + while (1) + { + + PA_InitMode7(3); // Init Mode7 style for the star wars effect + + // Values that look good... + PA_Mode7Height(32000); + PA_Mode7MoveLeftRight(-128); + PA_Mode7MoveForwardBack(150); + + for (i = 0; i < 15; i++) PA_CenterSmartText(0, 20, 16+i*16, 235, 36+i*16, starwarstext[i], 1, 4, 1); // Draw the whole text + + for(i = 0 ; (i < 2048); i++) { // Scroll it star wars style + if((i%5)==0) PA_Mode7MoveForwardBack(-1); + PA_WaitForVBL(); + } + + PA_WaitFor(Stylus.Newpress); // Finished... + + PA_DeInitMode7(); // Reset Mode7 + PA_Clear8bitBg(0); // Erase screen + + + + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/Normal/BoxText/Makefile b/examples/Text/Normal/BoxText/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/BoxText/Makefile +++ b/examples/Text/Normal/BoxText/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/BoxText/source/main.c b/examples/Text/Normal/BoxText/source/main.c index 7ec9ed7..658b830 100644 --- a/examples/Text/Normal/BoxText/source/main.c +++ b/examples/Text/Normal/BoxText/source/main.c @@ -1,46 +1,46 @@ -/* This time, draw the text letter by letter... -*/ - - -// Includes -#include // Include for PA_Lib - - -char text[200]; // This will be our text... - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, // Bootom screen - 0); // Background number, from 0-3, on which to load the text system - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - // This'll put a green color on the bottom screen... Color component (red, green, blue) range from 0 to 31 - - u32 nletters = 0; // Number of letter to output... - u32 letter = 0; // Current letter written... - - while (letter == nletters){ // Do this until the function outputs all the text - ++nletters; // Next frame, one more letter... - // This text function outputs a given number of letters... This way, it can do as if you were typing ! - letter = PA_BoxText(1, 2, 2, 29, 15, "Hi there :p Cool, the function works perfectly ! So you see the %c1text%c0 being typed...\n Line break works...", nletters); //%cX changes to color number X - PA_WaitForVBL(); // You can set more WaitForVBL if you want to slow down the text output... - } - - PA_OutputSimpleText(0, 10, 10, "Finished !"); // Finished... - - - // Infinite loop to keep the program running - while (1){ - - PA_WaitForVBL(); - - } - - return 0; +/* This time, draw the text letter by letter... +*/ + + +// Includes +#include // Include for PA_Lib + + +char text[200]; // This will be our text... + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, // Bootom screen + 0); // Background number, from 0-3, on which to load the text system + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + // This'll put a green color on the bottom screen... Color component (red, green, blue) range from 0 to 31 + + u32 nletters = 0; // Number of letter to output... + u32 letter = 0; // Current letter written... + + while (letter == nletters){ // Do this until the function outputs all the text + ++nletters; // Next frame, one more letter... + // This text function outputs a given number of letters... This way, it can do as if you were typing ! + letter = PA_BoxText(1, 2, 2, 29, 15, "Hi there :p Cool, the function works perfectly ! So you see the %c1text%c0 being typed...\n Line break works...", nletters); //%cX changes to color number X + PA_WaitForVBL(); // You can set more WaitForVBL if you want to slow down the text output... + } + + PA_OutputSimpleText(0, 10, 10, "Finished !"); // Finished... + + + // Infinite loop to keep the program running + while (1){ + + PA_WaitForVBL(); + + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/Normal/CustomFont/Makefile b/examples/Text/Normal/CustomFont/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/CustomFont/Makefile +++ b/examples/Text/Normal/CustomFont/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/CustomFont/gfx/all_gfx.h b/examples/Text/Normal/CustomFont/gfx/all_gfx.h index af91c35..eb8d2ad 100644 --- a/examples/Text/Normal/CustomFont/gfx/all_gfx.h +++ b/examples/Text/Normal/CustomFont/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct newfont; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct newfont; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Text/Normal/CustomFont/gfx/bin/newfont.c b/examples/Text/Normal/CustomFont/gfx/bin/newfont.c index 4cc95b5..f40abba 100644 --- a/examples/Text/Normal/CustomFont/gfx/bin/newfont.c +++ b/examples/Text/Normal/CustomFont/gfx/bin/newfont.c @@ -1,17 +1,17 @@ -#include - -extern const char newfont_Tiles[]; -extern const char newfont_Map[]; -extern const char newfont_Pal[]; - -const PA_BgStruct newfont = { - PA_BgNormal, - 256, 192, - - newfont_Tiles, - newfont_Map, - {newfont_Pal}, - - 4096, - {1536} -}; +#include + +extern const char newfont_Tiles[]; +extern const char newfont_Map[]; +extern const char newfont_Pal[]; + +const PA_BgStruct newfont = { + PA_BgNormal, + 256, 192, + + newfont_Tiles, + newfont_Map, + {newfont_Pal}, + + 4096, + {1536} +}; diff --git a/examples/Text/Normal/CustomFont/source/main.c b/examples/Text/Normal/CustomFont/source/main.c index e8607fb..40a9b6c 100644 --- a/examples/Text/Normal/CustomFont/source/main.c +++ b/examples/Text/Normal/CustomFont/source/main.c @@ -1,53 +1,53 @@ -/* The text is drawn on a background (you can chose which background you want, -and can display information on the screen -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_LoadDefaultText(0, 0); // Initialise the normal text on the bottom screen - - // Load a custom text font - PA_LoadText(1, //screen - 0, //background number - &newfont); //font name - - // PA_OutputSimpleText is the fastest text function, and displays 'static' text - PA_OutputSimpleText(1, // screen - 2, // X postion - 2, // Y position - "Hello World !!"); // - - PA_OutputSimpleText(0, 2, 2, "Hi there :p"); - - //PA_SetBgPalCol(1, 0, PA_RGB(31, 0,0)); // change the background color - BG_PALETTE[768] = PA_RGB(31, 0,0); - - PA_OutputText(1, 1, 7, // Screen and position - "Name : %s, Hour : %d, Float : %f3", // Write %s for string, %d for normal number, %f3 for float with 3 digits... - PA_UserInfo.Name, PA_RTC.Hour, 1.25); // And then give the variables, same order - PA_OutputText(1, 3, 10, "%04d", 12); // This will write 0012 instead of 12... - - - - // Infinite loop to keep the program running - while (1) - { - - - // Get the stylus position and show it on screen - PA_OutputText(1, 1, 11, "Stylus Position : %d, %d ", Stylus.X, Stylus.Y); - - PA_WaitForVBL(); - } - - return 0; +/* The text is drawn on a background (you can chose which background you want, +and can display information on the screen +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_LoadDefaultText(0, 0); // Initialise the normal text on the bottom screen + + // Load a custom text font + PA_LoadText(1, //screen + 0, //background number + &newfont); //font name + + // PA_OutputSimpleText is the fastest text function, and displays 'static' text + PA_OutputSimpleText(1, // screen + 2, // X postion + 2, // Y position + "Hello World !!"); // + + PA_OutputSimpleText(0, 2, 2, "Hi there :p"); + + //PA_SetBgPalCol(1, 0, PA_RGB(31, 0,0)); // change the background color + BG_PALETTE[768] = PA_RGB(31, 0,0); + + PA_OutputText(1, 1, 7, // Screen and position + "Name : %s, Hour : %d, Float : %f3", // Write %s for string, %d for normal number, %f3 for float with 3 digits... + PA_UserInfo.Name, PA_RTC.Hour, 1.25); // And then give the variables, same order + PA_OutputText(1, 3, 10, "%04d", 12); // This will write 0012 instead of 12... + + + + // Infinite loop to keep the program running + while (1) + { + + + // Get the stylus position and show it on screen + PA_OutputText(1, 1, 11, "Stylus Position : %d, %d ", Stylus.X, Stylus.Y); + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/Normal/CustomFontBorder/Makefile b/examples/Text/Normal/CustomFontBorder/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/CustomFontBorder/Makefile +++ b/examples/Text/Normal/CustomFontBorder/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/CustomFontBorder/gfx/all_gfx.h b/examples/Text/Normal/CustomFontBorder/gfx/all_gfx.h index af91c35..eb8d2ad 100644 --- a/examples/Text/Normal/CustomFontBorder/gfx/all_gfx.h +++ b/examples/Text/Normal/CustomFontBorder/gfx/all_gfx.h @@ -1,18 +1,18 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct newfont; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct newfont; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/examples/Text/Normal/CustomFontBorder/gfx/bin/newfont.c b/examples/Text/Normal/CustomFontBorder/gfx/bin/newfont.c index 8a369a7..8b2781f 100644 --- a/examples/Text/Normal/CustomFontBorder/gfx/bin/newfont.c +++ b/examples/Text/Normal/CustomFontBorder/gfx/bin/newfont.c @@ -1,17 +1,17 @@ -#include - -extern const char newfont_Tiles[]; -extern const char newfont_Map[]; -extern const char newfont_Pal[]; - -const PA_BgStruct newfont = { - PA_BgNormal, - 256, 192, - - newfont_Tiles, - newfont_Map, - {newfont_Pal}, - - 4352, - {1536} -}; +#include + +extern const char newfont_Tiles[]; +extern const char newfont_Map[]; +extern const char newfont_Pal[]; + +const PA_BgStruct newfont = { + PA_BgNormal, + 256, 192, + + newfont_Tiles, + newfont_Map, + {newfont_Pal}, + + 4352, + {1536} +}; diff --git a/examples/Text/Normal/CustomFontBorder/source/main.c b/examples/Text/Normal/CustomFontBorder/source/main.c index 8dcac05..6b03733 100644 --- a/examples/Text/Normal/CustomFontBorder/source/main.c +++ b/examples/Text/Normal/CustomFontBorder/source/main.c @@ -1,97 +1,97 @@ -/* The text is drawn on a background (you can chose which background you want, -and can display information on the screen -*/ - - -// Includes -#include // Include for PA_Lib - -#include "all_gfx.h" - -// Define the text borders -#define X1 0 // From left to right -#define X2 31 -#define Y1 24 // Under the screen ! -#define Y2 31 - - -void PA_LoadDefaultTextBorders(bool screen, u8 x1, u8 y1, u8 x2, u8 y2); - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Load a custom text font - PA_LoadText(1, //screen - 0, //background number - &newfont); //font name - - PA_LoadDefaultTextBorders(1, X1, Y1, X2, Y2); // Inits the text border ! - - s16 i; - s16 letter = 0; s16 nletters = 0; - - - - for(i = 0; i < 65; i++) {// We'll make the textbox enter slowly in... - PA_BGScrollY(1, 0, i); - PA_WaitForVBL(); - } - - - while (letter == nletters){ // Do this until the function outputs all the text - ++nletters; // Next frame, one more letter... - // This text function outputs a given number of letters... This way, it can do as if you were typing ! - letter = PA_SimpleBoxText(1, "Hi there :p Cool, the function works perfectly ! So you see the text being typed...\n Line break works...", nletters); //%cX changes to color number X - PA_WaitForVBL(); // You can set more WaitForVBL if you want to slow down the text output... - } - - // Wait a second - for(i = 0; i < 60; i++) PA_WaitForVBL(); - - for(i = 64; i >= 0; i--) {// We'll make the textbox move out - PA_BGScrollY(1, 0, i); - PA_WaitForVBL(); - } - - PA_EraseTextBox(1); // Erases the textbox on screen 1 - - // Wait a second - for(i = 0; i < 60; i++) PA_WaitForVBL(); - - for(i = 0; i < 65; i++) {// We'll make the textbox enter slowly in... - PA_BGScrollY(1, 0, i); - PA_WaitForVBL(); - } - - letter = 0; nletters = 0; // reinit varaibles - while (letter == nletters){ // Do this until the function outputs all the text - ++nletters; // Next frame, one more letter... - // This text function outputs a given number of letters... This way, it can do as if you were typing ! - letter = PA_SimpleBoxText(1, "And it comes back in with another text !", nletters); //%cX changes to color number X - PA_WaitForVBL(); // You can set more WaitForVBL if you want to slow down the text output... - } - - // Wait a second - for(i = 0; i < 60; i++) PA_WaitForVBL(); - - for(i = 64; i >= 0; i--) {// We'll make the textbox move out - PA_BGScrollY(1, 0, i); - PA_WaitForVBL(); - } - - - - // Infinite loop to keep the program running - while (1) - { - - PA_WaitForVBL(); - } - - return 0; -} // End of main() - - +/* The text is drawn on a background (you can chose which background you want, +and can display information on the screen +*/ + + +// Includes +#include // Include for PA_Lib + +#include "all_gfx.h" + +// Define the text borders +#define X1 0 // From left to right +#define X2 31 +#define Y1 24 // Under the screen ! +#define Y2 31 + + +void PA_LoadDefaultTextBorders(bool screen, u8 x1, u8 y1, u8 x2, u8 y2); + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Load a custom text font + PA_LoadText(1, //screen + 0, //background number + &newfont); //font name + + PA_LoadDefaultTextBorders(1, X1, Y1, X2, Y2); // Inits the text border ! + + s16 i; + s16 letter = 0; s16 nletters = 0; + + + + for(i = 0; i < 65; i++) {// We'll make the textbox enter slowly in... + PA_BGScrollY(1, 0, i); + PA_WaitForVBL(); + } + + + while (letter == nletters){ // Do this until the function outputs all the text + ++nletters; // Next frame, one more letter... + // This text function outputs a given number of letters... This way, it can do as if you were typing ! + letter = PA_SimpleBoxText(1, "Hi there :p Cool, the function works perfectly ! So you see the text being typed...\n Line break works...", nletters); //%cX changes to color number X + PA_WaitForVBL(); // You can set more WaitForVBL if you want to slow down the text output... + } + + // Wait a second + for(i = 0; i < 60; i++) PA_WaitForVBL(); + + for(i = 64; i >= 0; i--) {// We'll make the textbox move out + PA_BGScrollY(1, 0, i); + PA_WaitForVBL(); + } + + PA_EraseTextBox(1); // Erases the textbox on screen 1 + + // Wait a second + for(i = 0; i < 60; i++) PA_WaitForVBL(); + + for(i = 0; i < 65; i++) {// We'll make the textbox enter slowly in... + PA_BGScrollY(1, 0, i); + PA_WaitForVBL(); + } + + letter = 0; nletters = 0; // reinit varaibles + while (letter == nletters){ // Do this until the function outputs all the text + ++nletters; // Next frame, one more letter... + // This text function outputs a given number of letters... This way, it can do as if you were typing ! + letter = PA_SimpleBoxText(1, "And it comes back in with another text !", nletters); //%cX changes to color number X + PA_WaitForVBL(); // You can set more WaitForVBL if you want to slow down the text output... + } + + // Wait a second + for(i = 0; i < 60; i++) PA_WaitForVBL(); + + for(i = 64; i >= 0; i--) {// We'll make the textbox move out + PA_BGScrollY(1, 0, i); + PA_WaitForVBL(); + } + + + + // Infinite loop to keep the program running + while (1) + { + + PA_WaitForVBL(); + } + + return 0; +} // End of main() + + diff --git a/examples/Text/Normal/HelloWorld/Makefile b/examples/Text/Normal/HelloWorld/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/HelloWorld/Makefile +++ b/examples/Text/Normal/HelloWorld/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/HelloWorld/source/main.c b/examples/Text/Normal/HelloWorld/source/main.c index 40d1723..c6ee8d3 100644 --- a/examples/Text/Normal/HelloWorld/source/main.c +++ b/examples/Text/Normal/HelloWorld/source/main.c @@ -1,32 +1,32 @@ -///////////////////////// -// Hello World Program // -///////////////////////// - -// Lines starting with two slashes are ignored by the compiler -// Basically you can use them to comment what are you doing -// In fact, this kind of lines are called comments :P - -// Include PAlib so that you can use it -#include - -int main(){ - // Initialize PAlib - PA_Init(); - - // Load the default text font - PA_LoadDefaultText(1, // Top screen - 2); // Background #2 - - // Write the text "Hello World" - PA_OutputSimpleText(1, // Top screen - 1, // X position 1*8 = 8 - 1, // Y position 1*8 = 8 - "Hello World"); - - // Infinite loop to keep the program running - while(true){ - // Wait until the next frame. - // The DS runs at 60 frames per second. - PA_WaitForVBL(); - } +///////////////////////// +// Hello World Program // +///////////////////////// + +// Lines starting with two slashes are ignored by the compiler +// Basically you can use them to comment what are you doing +// In fact, this kind of lines are called comments :P + +// Include PAlib so that you can use it +#include + +int main(){ + // Initialize PAlib + PA_Init(); + + // Load the default text font + PA_LoadDefaultText(1, // Top screen + 2); // Background #2 + + // Write the text "Hello World" + PA_OutputSimpleText(1, // Top screen + 1, // X position 1*8 = 8 + 1, // Y position 1*8 = 8 + "Hello World"); + + // Infinite loop to keep the program running + while(true){ + // Wait until the next frame. + // The DS runs at 60 frames per second. + PA_WaitForVBL(); + } } \ No newline at end of file diff --git a/examples/Text/Normal/Hex/Makefile b/examples/Text/Normal/Hex/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/Hex/Makefile +++ b/examples/Text/Normal/Hex/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/Hex/source/main.c b/examples/Text/Normal/Hex/source/main.c index eda8b26..cc2889d 100644 --- a/examples/Text/Normal/Hex/source/main.c +++ b/examples/Text/Normal/Hex/source/main.c @@ -1,36 +1,36 @@ -/* The text is drawn on a background (you can chose which background you want, -and can display information on the screen -*/ - - -// Includes -#include // Include for PA_Lib - - - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, // Bootom screen - 0); // Background number, from 0-3, on which to load the text system - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - - // Infinite loop to keep the program running - while (1) - { - - // Get the stylus position and show it on screen - PA_OutputText(1, 1, 11, "Stylus Position : %x, %x ", Stylus.X, Stylus.Y); - - PA_WaitForVBL(); - } - - return 0; +/* The text is drawn on a background (you can chose which background you want, +and can display information on the screen +*/ + + +// Includes +#include // Include for PA_Lib + + + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, // Bootom screen + 0); // Background number, from 0-3, on which to load the text system + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + + // Infinite loop to keep the program running + while (1) + { + + // Get the stylus position and show it on screen + PA_OutputText(1, 1, 11, "Stylus Position : %x, %x ", Stylus.X, Stylus.Y); + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/Normal/Newline/Makefile b/examples/Text/Normal/Newline/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/Newline/Makefile +++ b/examples/Text/Normal/Newline/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/Newline/source/main.c b/examples/Text/Normal/Newline/source/main.c index 1782d0f..e9c8b8c 100644 --- a/examples/Text/Normal/Newline/source/main.c +++ b/examples/Text/Normal/Newline/source/main.c @@ -1,30 +1,30 @@ -/* The text is drawn on a background (you can chose which background you want, -and can display information on the screen, now supporting newlines with "\n" -*/ - - -// Includes -#include // Include for PA_Lib - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - -// Initialise the text system on the top screen - PA_LoadDefaultText(1, 0); - -// This'll put a green color on the bottom screen... Color component (red, green, blue) range from 0 to 31 - PA_SetTextCol(0, 0, 31, 0); - -// The same old PA_OutputSimpleText, but now with newline support - PA_OutputSimpleText(1, 1, 1, " ATTENTION:\n\nPA_OutputSimpleText now has\nsupport for line breaking in\nthe body of the text. So it's\nmuch easier to place a lot of\ntext on the screen.\n\nThis should be really useful\nif you need to parse a text\nfile loaded from FAT!"); - -// It works with PA_OutputText, as well - PA_OutputText(1, 1, 13, "But wait, that's not all! It\nalso works with variables in\nPA_OutputText.\n\nWhat do you think of that,\n%s?\n\nIt's %d:%02d, do you know\nwhere your text is?", PA_UserInfo.Name, PA_RTC.Hour, PA_RTC.Minutes); - - while (1) {PA_WaitForVBL();} - - return 0; +/* The text is drawn on a background (you can chose which background you want, +and can display information on the screen, now supporting newlines with "\n" +*/ + + +// Includes +#include // Include for PA_Lib + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + +// Initialise the text system on the top screen + PA_LoadDefaultText(1, 0); + +// This'll put a green color on the bottom screen... Color component (red, green, blue) range from 0 to 31 + PA_SetTextCol(0, 0, 31, 0); + +// The same old PA_OutputSimpleText, but now with newline support + PA_OutputSimpleText(1, 1, 1, " ATTENTION:\n\nPA_OutputSimpleText now has\nsupport for line breaking in\nthe body of the text. So it's\nmuch easier to place a lot of\ntext on the screen.\n\nThis should be really useful\nif you need to parse a text\nfile loaded from FAT!"); + +// It works with PA_OutputText, as well + PA_OutputText(1, 1, 13, "But wait, that's not all! It\nalso works with variables in\nPA_OutputText.\n\nWhat do you think of that,\n%s?\n\nIt's %d:%02d, do you know\nwhere your text is?", PA_UserInfo.Name, PA_RTC.Hour, PA_RTC.Minutes); + + while (1) {PA_WaitForVBL();} + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/Normal/Print/Makefile b/examples/Text/Normal/Print/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/Print/Makefile +++ b/examples/Text/Normal/Print/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/Print/source/main.c b/examples/Text/Normal/Print/source/main.c index f55b651..ffa32bb 100644 --- a/examples/Text/Normal/Print/source/main.c +++ b/examples/Text/Normal/Print/source/main.c @@ -1,35 +1,35 @@ -/* Print function, usefull for debugging purpose... -*/ - - -// Includes -#include // Include for PA_Lib - - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, // Bootom screen - 0); // Background number, from 0-3, on which to load the text system - - PA_Print(0, "Hello World %d \n", pa_printscroll[0]); - PA_Print(0, "Hi there ! :p\n"); - - - // Infinite loop to keep the program running - while (1) - { - - // Get the stylus position and show it on screen when the stylus touches the screen... - if(Stylus.Held) PA_Print(0, "Stylus Position : %d, %d \n", Stylus.X, Stylus.Y); - - PA_WaitForVBL(); - } - - return 0; +/* Print function, usefull for debugging purpose... +*/ + + +// Includes +#include // Include for PA_Lib + + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, // Bootom screen + 0); // Background number, from 0-3, on which to load the text system + + PA_Print(0, "Hello World %d \n", pa_printscroll[0]); + PA_Print(0, "Hi there ! :p\n"); + + + // Infinite loop to keep the program running + while (1) + { + + // Get the stylus position and show it on screen when the stylus touches the screen... + if(Stylus.Held) PA_Print(0, "Stylus Position : %d, %d \n", Stylus.X, Stylus.Y); + + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/Normal/SpecialText/Makefile b/examples/Text/Normal/SpecialText/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/SpecialText/Makefile +++ b/examples/Text/Normal/SpecialText/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/SpecialText/source/main.c b/examples/Text/Normal/SpecialText/source/main.c index bea837a..0197099 100644 --- a/examples/Text/Normal/SpecialText/source/main.c +++ b/examples/Text/Normal/SpecialText/source/main.c @@ -1,24 +1,24 @@ -// Les Includes -#include - -//Fonction principale du code -int main(void) -{ -//Initialision de PAlib -PA_Init(); - -PA_LoadDefaultText(1,2); - -while(1) -{ -PA_OutputSimpleText(1,0,0," "); -if(Pad.Held.A)PA_OutputTextSpecial0(1,0,1,"Hello World !"); -else if(Pad.Held.B)PA_OutputTextSpecial1(1,0,1,"Hello World !"); -else if(Pad.Held.Start)PA_OutputTextSpecial2(1,0,1,"Hello World !"); -else if(Pad.Held.R)PA_OutputTextSpecial3(1,0,1,"Hello World !"); -else if(Pad.Held.L)PA_OutputTextSpecial4(1,0,1,"Hello World !"); -else if(Pad.Held.Select)PA_OutputTextSpecial5(1,0,1,"Hello World !"); -//La boucle infinie du programme -} -return 0; +// Les Includes +#include + +//Fonction principale du code +int main(void) +{ +//Initialision de PAlib +PA_Init(); + +PA_LoadDefaultText(1,2); + +while(1) +{ +PA_OutputSimpleText(1,0,0," "); +if(Pad.Held.A)PA_OutputTextSpecial0(1,0,1,"Hello World !"); +else if(Pad.Held.B)PA_OutputTextSpecial1(1,0,1,"Hello World !"); +else if(Pad.Held.Start)PA_OutputTextSpecial2(1,0,1,"Hello World !"); +else if(Pad.Held.R)PA_OutputTextSpecial3(1,0,1,"Hello World !"); +else if(Pad.Held.L)PA_OutputTextSpecial4(1,0,1,"Hello World !"); +else if(Pad.Held.Select)PA_OutputTextSpecial5(1,0,1,"Hello World !"); +//La boucle infinie du programme +} +return 0; } \ No newline at end of file diff --git a/examples/Text/Normal/Text/Makefile b/examples/Text/Normal/Text/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/Text/Makefile +++ b/examples/Text/Normal/Text/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/Text/source/main.c b/examples/Text/Normal/Text/source/main.c index eb1dbff..9f60aa5 100644 --- a/examples/Text/Normal/Text/source/main.c +++ b/examples/Text/Normal/Text/source/main.c @@ -1,65 +1,65 @@ -/* The text is drawn on a background (you can chose which background you want, -and can display information on the screen -*/ - - -// Includes -#include // Include for PA_Lib - - -char text[200]; // This will be our text... - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, // Bootom screen - 0); // Background number, from 0-3, on which to load the text system - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - PA_SetTextCol(0, // Bottom screen - 0, // No red - 31, // Maximum green - 0); // No blue - // This'll put a green color on the bottom screen... Color component (red, green, blue) range from 0 to 31 - - // PA_OutputSimpleText is the fastest text function, and displays 'static' text - PA_OutputSimpleText(1, // screen - 2, // X postion - 2, // Y position - "Hello World !!"); // - - PA_OutputSimpleText(0, 2, 2, "Hi there :p"); - - // By the way, to erase text, just right " " (spaces) over it... - - - // There are some advance text function : PA_OutputText - // Let's use it to display a string (username), a number (current hour), and a float (1.25) : - PA_OutputText(1, 1, 7, // Screen and position - "Name : %s, Hour : %d, Float : %f3", // Write %s for string, %d for normal number, %f3 for float with 3 digits... - PA_UserInfo.Name, PA_RTC.Hour, 1.25); // And then give the variables, same order - - // You can also use %0Xd, X being a number, to complete the number by zeros : - PA_OutputText(1, 3, 10, "%04d", 12); // This will write 0012 instead of 12... - - - - // Infinite loop to keep the program running - while (1) - { - - - // Get the stylus position and show it on screen - PA_OutputText(1, 1, 11, "Stylus Position : %d, %d ", Stylus.X, Stylus.Y); - - PA_WaitForVBL(); - PA_OutputText(0, 0, 0, "%d ", PA_GetVcount()); - } - - return 0; +/* The text is drawn on a background (you can chose which background you want, +and can display information on the screen +*/ + + +// Includes +#include // Include for PA_Lib + + +char text[200]; // This will be our text... + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, // Bootom screen + 0); // Background number, from 0-3, on which to load the text system + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + PA_SetTextCol(0, // Bottom screen + 0, // No red + 31, // Maximum green + 0); // No blue + // This'll put a green color on the bottom screen... Color component (red, green, blue) range from 0 to 31 + + // PA_OutputSimpleText is the fastest text function, and displays 'static' text + PA_OutputSimpleText(1, // screen + 2, // X postion + 2, // Y position + "Hello World !!"); // + + PA_OutputSimpleText(0, 2, 2, "Hi there :p"); + + // By the way, to erase text, just right " " (spaces) over it... + + + // There are some advance text function : PA_OutputText + // Let's use it to display a string (username), a number (current hour), and a float (1.25) : + PA_OutputText(1, 1, 7, // Screen and position + "Name : %s, Hour : %d, Float : %f3", // Write %s for string, %d for normal number, %f3 for float with 3 digits... + PA_UserInfo.Name, PA_RTC.Hour, 1.25); // And then give the variables, same order + + // You can also use %0Xd, X being a number, to complete the number by zeros : + PA_OutputText(1, 3, 10, "%04d", 12); // This will write 0012 instead of 12... + + + + // Infinite loop to keep the program running + while (1) + { + + + // Get the stylus position and show it on screen + PA_OutputText(1, 1, 11, "Stylus Position : %d, %d ", Stylus.X, Stylus.Y); + + PA_WaitForVBL(); + PA_OutputText(0, 0, 0, "%d ", PA_GetVcount()); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/Normal/TextColors/Makefile b/examples/Text/Normal/TextColors/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/TextColors/Makefile +++ b/examples/Text/Normal/TextColors/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/TextColors/source/main.c b/examples/Text/Normal/TextColors/source/main.c index 561c93e..31fcbe7 100644 --- a/examples/Text/Normal/TextColors/source/main.c +++ b/examples/Text/Normal/TextColors/source/main.c @@ -1,46 +1,46 @@ -/* Text in different colors... -*/ - - -// Includes -#include // Include for PA_Lib - - -char text[200]; // This will be our text... - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, // Bootom screen - 1); // Background number, from 0-3, on which to load the text system - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - u8 i; - for (i = 0; i < 10; i++) - { - PA_SetTextTileCol(1, i); // Change the color on the top screen, values 0 to 9 (9 is black, so invisible on black background...) - PA_OutputSimpleText(1, 2, i, "Color test..."); // Screen 1 has different colors - } - - // You can also use macros TEXT_WHITE, TEXT_RED, etc... - PA_SetTextTileCol(1, TEXT_YELLOW); // Change the color on the top screen to yellow - PA_OutputSimpleText(1, 0, 17, "Yellow test..."); - - // You can also change the text color in a given text (either in OutputText or BoxText) : - PA_OutputText(0, 0, 0, "Color test...%c1another one, %c2again, %c3 again..."); // Screen 1 has different colors - //%c tells to change color, and the number gives the color number (0-7) - - - // Infinite loop to keep the program running - while (1) - { - PA_WaitForVBL(); - } - - return 0; +/* Text in different colors... +*/ + + +// Includes +#include // Include for PA_Lib + + +char text[200]; // This will be our text... + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, // Bootom screen + 1); // Background number, from 0-3, on which to load the text system + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + u8 i; + for (i = 0; i < 10; i++) + { + PA_SetTextTileCol(1, i); // Change the color on the top screen, values 0 to 9 (9 is black, so invisible on black background...) + PA_OutputSimpleText(1, 2, i, "Color test..."); // Screen 1 has different colors + } + + // You can also use macros TEXT_WHITE, TEXT_RED, etc... + PA_SetTextTileCol(1, TEXT_YELLOW); // Change the color on the top screen to yellow + PA_OutputSimpleText(1, 0, 17, "Yellow test..."); + + // You can also change the text color in a given text (either in OutputText or BoxText) : + PA_OutputText(0, 0, 0, "Color test...%c1another one, %c2again, %c3 again..."); // Screen 1 has different colors + //%c tells to change color, and the number gives the color number (0-7) + + + // Infinite loop to keep the program running + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Text/Normal/Text_BoxType/Makefile b/examples/Text/Normal/Text_BoxType/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Text/Normal/Text_BoxType/Makefile +++ b/examples/Text/Normal/Text_BoxType/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Text/Normal/Text_BoxType/source/main.c b/examples/Text/Normal/Text_BoxType/source/main.c index e5f1f10..736a345 100644 --- a/examples/Text/Normal/Text_BoxType/source/main.c +++ b/examples/Text/Normal/Text_BoxType/source/main.c @@ -1,50 +1,50 @@ -/* This time, draw the text letter by letter... -*/ - - -// Includes -#include // Include for PA_Lib - - -char text[200]; // This will be our text... - - - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Initialise the text system on the top screen - PA_LoadDefaultText(0, // Bootom screen - 0); // Background number, from 0-3, on which to load the text system - PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen - - PA_SetTextCol(0, // Bottom screen - 0, // No red - 31, // Maximum green - 0); // No blue - // This'll put a green color on the bottom screen... Color component (red, green, blue) range from 0 to 31 - - u32 nletters = 0; // Number of letter to output... - u32 letter = 0; // Current letter written... - - while (letter == nletters){ // Do this until the function outputs all the text - ++nletters; // Next frame, one more letter... - // This text function outputs a given number of letters... This way, it can do as if you were typing ! - letter = PA_BoxText(1, 2, 2, 29, 15, "Hi there :p Cool, the function works perfectly ! So you see the text being typed...", nletters); - PA_WaitForVBL(); // You can set more WaitForVBL if you want to slow down the text output... - } - - PA_OutputSimpleText(0, 10, 10, "Finished !"); // Finished... - - - // Infinite loop to keep the program running - while (1){ - - PA_WaitForVBL(); - - } - - return 0; +/* This time, draw the text letter by letter... +*/ + + +// Includes +#include // Include for PA_Lib + + +char text[200]; // This will be our text... + + + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Initialise the text system on the top screen + PA_LoadDefaultText(0, // Bootom screen + 0); // Background number, from 0-3, on which to load the text system + PA_LoadDefaultText(1, 0); // Initialise the text system on the top screen + + PA_SetTextCol(0, // Bottom screen + 0, // No red + 31, // Maximum green + 0); // No blue + // This'll put a green color on the bottom screen... Color component (red, green, blue) range from 0 to 31 + + u32 nletters = 0; // Number of letter to output... + u32 letter = 0; // Current letter written... + + while (letter == nletters){ // Do this until the function outputs all the text + ++nletters; // Next frame, one more letter... + // This text function outputs a given number of letters... This way, it can do as if you were typing ! + letter = PA_BoxText(1, 2, 2, 29, 15, "Hi there :p Cool, the function works perfectly ! So you see the text being typed...", nletters); + PA_WaitForVBL(); // You can set more WaitForVBL if you want to slow down the text output... + } + + PA_OutputSimpleText(0, 10, 10, "Finished !"); // Finished... + + + // Infinite loop to keep the program running + while (1){ + + PA_WaitForVBL(); + + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Wifi/dswifi/Connect/Makefile b/examples/Wifi/dswifi/Connect/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Wifi/dswifi/Connect/Makefile +++ b/examples/Wifi/dswifi/Connect/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Wifi/dswifi/Connect/source/main.c b/examples/Wifi/dswifi/Connect/source/main.c index e752cd2..8206f5a 100644 --- a/examples/Wifi/dswifi/Connect/source/main.c +++ b/examples/Wifi/dswifi/Connect/source/main.c @@ -1,33 +1,33 @@ -// Basic dswifi lib example using PAlib -// -// Make sure you have selected an ARM7 binary with DSWIFI support in your project Makefile! -// - -// Includes -#include // Include for PA_Lib -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - // Initialise the text system on the top screen - PA_LoadDefaultText(0,0); - PA_LoadDefaultText(1, 0); - - PA_OutputText(0, 1, 1, "PA_InitWifi() ..."); - PA_InitWifi(); - PA_OutputText(0, 1, 2, "done!\nPA_ConnectWifiWFC() ..."); - if (!PA_ConnectWifiWFC()) - { - PA_OutputText(0, 1, 4, "error!"); - return 1; - } - PA_OutputText(0, 1, 4, "done!\nWIFI is now ready!"); - - while (1) - { - PA_WaitForVBL(); - } - - return 0; +// Basic dswifi lib example using PAlib +// +// Make sure you have selected an ARM7 binary with DSWIFI support in your project Makefile! +// + +// Includes +#include // Include for PA_Lib +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + // Initialise the text system on the top screen + PA_LoadDefaultText(0,0); + PA_LoadDefaultText(1, 0); + + PA_OutputText(0, 1, 1, "PA_InitWifi() ..."); + PA_InitWifi(); + PA_OutputText(0, 1, 2, "done!\nPA_ConnectWifiWFC() ..."); + if (!PA_ConnectWifiWFC()) + { + PA_OutputText(0, 1, 4, "error!"); + return 1; + } + PA_OutputText(0, 1, 4, "done!\nWIFI is now ready!"); + + while (1) + { + PA_WaitForVBL(); + } + + return 0; } // End of main() \ No newline at end of file diff --git a/examples/Wifi/dswifi/DownloadFile/Makefile b/examples/Wifi/dswifi/DownloadFile/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Wifi/dswifi/DownloadFile/Makefile +++ b/examples/Wifi/dswifi/DownloadFile/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Wifi/dswifi/DownloadFile/ReadMe.txt b/examples/Wifi/dswifi/DownloadFile/ReadMe.txt index b4a190b..66cce58 100644 --- a/examples/Wifi/dswifi/DownloadFile/ReadMe.txt +++ b/examples/Wifi/dswifi/DownloadFile/ReadMe.txt @@ -1,8 +1,8 @@ -Important -========= - -This example uses a library called ky_GetURL() which was written by Kumyco (at the PAlib forums), so -thanks to him for allowing me to use his code :) - -If you want to use ky_GetURL() just copy the ky_geturl.c and ky_geturl.h files to your source folder -and add #include "ky_geturl.h" below the PAlib include line. +Important +========= + +This example uses a library called ky_GetURL() which was written by Kumyco (at the PAlib forums), so +thanks to him for allowing me to use his code :) + +If you want to use ky_GetURL() just copy the ky_geturl.c and ky_geturl.h files to your source folder +and add #include "ky_geturl.h" below the PAlib include line. diff --git a/examples/Wifi/dswifi/DownloadFile/source/main.c b/examples/Wifi/dswifi/DownloadFile/source/main.c index 14f6655..51071a0 100644 --- a/examples/Wifi/dswifi/DownloadFile/source/main.c +++ b/examples/Wifi/dswifi/DownloadFile/source/main.c @@ -1,42 +1,42 @@ -#include - -#include "ky_geturl.h" - -int main(void) -{ - const char url[] = "art.kh.nu/ds/r.php"; - int err, i; - sBuffer bfr; - - defaultExceptionHandler(); - - PA_Init(); - PA_Init16bitBg(1, 3); - PA_LoadDefaultText(0, 2); - PA_InitWifi(); - PA_ConnectWifiWFC(); - - ky_InitBuffer(&bfr); - for (;;) { - PA_OutputText(0, 0, 0, "downloading image, please wait..."); - err = ky_GetUrl(url, &bfr); - - PA_OutputText(0, 0, 0, " "); - PA_OutputText(0, 1, 1, " "); - PA_Clear16bitBg(1); - - if (err < 0) { - PA_OutputText(0, 1, 1, "Error: %d, %d, %d | %d: %s", err, ky_errno, ky_h_errno, errno, strerror(errno)); - } else { - PA_OutputText(0, 1, 1, "%s<%d> Recv %d bytes.", (err == 0) ? "Done" : "Fail", err, bfr.length); - if (bfr.length > 0) { - PA_LoadJpeg(1, (void*)bfr.buffer); - } - } - ky_FreeBuffer(&bfr); - - for (i=0; i < 60; ++i) PA_WaitForVBL(); - } - - return 0; +#include + +#include "ky_geturl.h" + +int main(void) +{ + const char url[] = "art.kh.nu/ds/r.php"; + int err, i; + sBuffer bfr; + + defaultExceptionHandler(); + + PA_Init(); + PA_Init16bitBg(1, 3); + PA_LoadDefaultText(0, 2); + PA_InitWifi(); + PA_ConnectWifiWFC(); + + ky_InitBuffer(&bfr); + for (;;) { + PA_OutputText(0, 0, 0, "downloading image, please wait..."); + err = ky_GetUrl(url, &bfr); + + PA_OutputText(0, 0, 0, " "); + PA_OutputText(0, 1, 1, " "); + PA_Clear16bitBg(1); + + if (err < 0) { + PA_OutputText(0, 1, 1, "Error: %d, %d, %d | %d: %s", err, ky_errno, ky_h_errno, errno, strerror(errno)); + } else { + PA_OutputText(0, 1, 1, "%s<%d> Recv %d bytes.", (err == 0) ? "Done" : "Fail", err, bfr.length); + if (bfr.length > 0) { + PA_LoadJpeg(1, (void*)bfr.buffer); + } + } + ky_FreeBuffer(&bfr); + + for (i=0; i < 60; ++i) PA_WaitForVBL(); + } + + return 0; } \ No newline at end of file diff --git a/examples/Wifi/dswifi/LeaderBoard/Makefile b/examples/Wifi/dswifi/LeaderBoard/Makefile index 4ce5239..3f73a6c 100644 --- a/examples/Wifi/dswifi/LeaderBoard/Makefile +++ b/examples/Wifi/dswifi/LeaderBoard/Makefile @@ -1 +1 @@ -include ../../../Makefile_example +include ../../../Makefile_example diff --git a/examples/Wifi/dswifi/LeaderBoard/source/main.c b/examples/Wifi/dswifi/LeaderBoard/source/main.c index cd5b7bd..215138d 100644 --- a/examples/Wifi/dswifi/LeaderBoard/source/main.c +++ b/examples/Wifi/dswifi/LeaderBoard/source/main.c @@ -1,93 +1,93 @@ -// Leaderboards using PAlib and dswifi lib example -// -// Make sure you have selected an ARM7 binary with DSWIFI support in your project Makefile! -// - -// Includes -#include - -#define GAMEKEY1 2345 -#define GAMEKEY2 45678 -#define GAMEKEY3 "ABCDE" - -// Function: main() -int main() -{ - PA_Init(); // Initializes PA_Lib - - PA_InitWifi(); - - // Initialise the text system on the top screen - PA_LoadDefaultText(0,0); - PA_LoadDefaultText(1, 0); - - PA_OutputText(0,1,1,"Up/Down to change score"); - PA_OutputText(0,1,2,"Right Left to change level"); - PA_OutputText(0,1,3,"Press A to toggle response type"); - - int rt =0; - int score = 100; - int level = 1; - bool submitted = false; - char *highscore = malloc(1000); - char *readhighscore = malloc(1001); - char *levelname = malloc(20); - char *gamekey = malloc(15); - - //do some trickery to hide the gamekey....yours should be more elaborate than this - sprintf(gamekey, "0%04d%05d%s", GAMEKEY1-1111, GAMEKEY2+11111, GAMEKEY3); - - while (1) - { - if (submitted) PA_OutputText(0,1,10,"Change values to submit again! "); - else PA_OutputText(0,1,10, " Press Start to Submit "); - - //if anything changed - we will allow a resubmit (this is just a demo afterall!) - if (Pad.Held.Up || Pad.Held.Down||Pad.Held.Right||Pad.Held.Left) submitted = false; - - if (Pad.Held.Up) score++; - if (Pad.Held.Down) score--; - - if (Pad.Newpress.A) {if (rt > 0) rt = 0; else rt = 1;} - - if (Pad.Newpress.Right) level++; - if (Pad.Newpress.Left) level--; - - PA_OutputText(0,2,5,"Score = %d ", score); - PA_OutputText(0,2,6,"Level = Level %d ", level); - PA_OutputText(0,2,7,"Response Type = %d ", rt); - PA_OutputText(0,2,8,"Secret Key = %s ", gamekey); - - if (Pad.Newpress.Start) - { - sprintf(levelname, "Level_%d", level); - submitted = PA_SubmitScore( highscore, //the string the response will be copied to - gamekey, //your game key - (char*)PA_UserInfo.Name, //player name (NO SPACES - use _ instead) - score, //the players score - levelname, //the name of the level (NO SPACES - use _ instead) - rt //the response type = 0 : top 10 + position; = 1 : just the position number of the score. - ); - PA_ClearTextBg(1); - if (submitted) - { - if (sprintf(readhighscore, "%s", highscore)) - { - //return string is readable! - PA_OutputText(1,2,2, highscore); //don't use box text here...it freezes sometimes - } - else - { - //score submitted but response no good - PA_BoxText(1,2,2,31,22, "Your score was sent to the online leaderboard but there was a problem with the response.\n\nCheck out your score online: \nleaderboard.\n palib.com", 1000); - } - } - else - { - PA_BoxText(1,2,2,31,22, "Your score was not transmitted succesfully. Press Start to try again",100); - } - } - PA_WaitForVBL(); - } - return 0; +// Leaderboards using PAlib and dswifi lib example +// +// Make sure you have selected an ARM7 binary with DSWIFI support in your project Makefile! +// + +// Includes +#include + +#define GAMEKEY1 2345 +#define GAMEKEY2 45678 +#define GAMEKEY3 "ABCDE" + +// Function: main() +int main() +{ + PA_Init(); // Initializes PA_Lib + + PA_InitWifi(); + + // Initialise the text system on the top screen + PA_LoadDefaultText(0,0); + PA_LoadDefaultText(1, 0); + + PA_OutputText(0,1,1,"Up/Down to change score"); + PA_OutputText(0,1,2,"Right Left to change level"); + PA_OutputText(0,1,3,"Press A to toggle response type"); + + int rt =0; + int score = 100; + int level = 1; + bool submitted = false; + char *highscore = malloc(1000); + char *readhighscore = malloc(1001); + char *levelname = malloc(20); + char *gamekey = malloc(15); + + //do some trickery to hide the gamekey....yours should be more elaborate than this + sprintf(gamekey, "0%04d%05d%s", GAMEKEY1-1111, GAMEKEY2+11111, GAMEKEY3); + + while (1) + { + if (submitted) PA_OutputText(0,1,10,"Change values to submit again! "); + else PA_OutputText(0,1,10, " Press Start to Submit "); + + //if anything changed - we will allow a resubmit (this is just a demo afterall!) + if (Pad.Held.Up || Pad.Held.Down||Pad.Held.Right||Pad.Held.Left) submitted = false; + + if (Pad.Held.Up) score++; + if (Pad.Held.Down) score--; + + if (Pad.Newpress.A) {if (rt > 0) rt = 0; else rt = 1;} + + if (Pad.Newpress.Right) level++; + if (Pad.Newpress.Left) level--; + + PA_OutputText(0,2,5,"Score = %d ", score); + PA_OutputText(0,2,6,"Level = Level %d ", level); + PA_OutputText(0,2,7,"Response Type = %d ", rt); + PA_OutputText(0,2,8,"Secret Key = %s ", gamekey); + + if (Pad.Newpress.Start) + { + sprintf(levelname, "Level_%d", level); + submitted = PA_SubmitScore( highscore, //the string the response will be copied to + gamekey, //your game key + (char*)PA_UserInfo.Name, //player name (NO SPACES - use _ instead) + score, //the players score + levelname, //the name of the level (NO SPACES - use _ instead) + rt //the response type = 0 : top 10 + position; = 1 : just the position number of the score. + ); + PA_ClearTextBg(1); + if (submitted) + { + if (sprintf(readhighscore, "%s", highscore)) + { + //return string is readable! + PA_OutputText(1,2,2, highscore); //don't use box text here...it freezes sometimes + } + else + { + //score submitted but response no good + PA_BoxText(1,2,2,31,22, "Your score was sent to the online leaderboard but there was a problem with the response.\n\nCheck out your score online: \nleaderboard.\n palib.com", 1000); + } + } + else + { + PA_BoxText(1,2,2,31,22, "Your score was not transmitted succesfully. Press Start to try again",100); + } + } + PA_WaitForVBL(); + } + return 0; } // End of main() \ No newline at end of file diff --git a/include/PA7.h b/include/PA7.h index f2587fb..1a81954 100644 --- a/include/PA7.h +++ b/include/PA7.h @@ -1,29 +1,29 @@ -#ifndef _PA_Main -#define _PA_Main - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#include - -#include "PA_IPC.h" -#include "PA_FifoMessages.h" -#include "PA_Transfer.h" - -#include "arm7/as_lib7.h" - -void PA_Init(void); - -void PA_InputGetAndSend(void); -void PA_LegacyIPCManage(void); - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_Main +#define _PA_Main + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include + +#include "PA_IPC.h" +#include "PA_FifoMessages.h" +#include "PA_Transfer.h" + +#include "arm7/as_lib7.h" + +void PA_Init(void); + +void PA_InputGetAndSend(void); +void PA_LegacyIPCManage(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/PA9.h b/include/PA9.h index bd6a89a..557205d 100644 --- a/include/PA9.h +++ b/include/PA9.h @@ -1,120 +1,120 @@ -#ifndef _PA_MAIN -#define _PA_MAIN - -/*! - \mainpage PAlib 100707 Documentation - - \section intro Introduction - Welcome to the PAlib documentation. Here you'll find - information on how to use PAlib. - - \section core_lib Core library - - \ref General "General functions" - - \ref Debug "Debugging utilities" - - \ref Math "Math functions" - - \ref cxx "C++ wrappers" - - \section bg_section Tiled backgrounds - - \ref BgTiles "Normal background functions" - - \ref BgRot "Rotating background functions" - - \ref TileDual "Dual background functions" - - \ref Text "Text system" - - \ref Mode7 "Mode 7 functions" - - \section bmp_section Bitmapped backgrounds - - \ref Bitmap "Bitmapped background functions" - - \ref c16 "16-color bitmapped background functions" - - \ref Fake16bit "Fake 16-bit background functions" - - \ref Gif "GIF functions" - - \section spr_section Sprites - - \ref Sprite "Sprite functions" - - \ref SpriteDual "Dual sprite functions" - - \ref f3DSprites "3D Sprite functions" - - \section pal_section Palettes - - \ref Palette "Palette functions" - - \ref PaletteDual "Dual palette functions" - - \section input_section Input - - \ref Keys "Pad and stylus functions" - - \ref Keyboard "Keyboard functions" - - \ref Reco "Handwriting recognition functions" - - \ref Micro "Microphone functions" - - \ref KeysSpecial "Special controller functions" - - \section snd_section Sound - - \ref ASlib "ASlib library" - - \section misc_section Misc. - - \ref SpecialFx "Special effects" - - \example Text/Normal/HelloWorld/source/main.c - \example Backgrounds/Effects/Mode7/source/main.c -*/ - -#ifdef __cplusplus -extern "C"{ -#endif - -#include -#include -#include - -#include -#include -#include -#include - -#include "PA_IPC.h" -#include "PA_FifoMessages.h" -#include "PA_BgStruct.h" - -#include "arm9/jpeg.h" - -#include "arm9/PA_Assert.h" -#include "arm9/PA_General.h" -#include "arm9/PA_Text.h" -#include "arm9/PA_TextBits.h" -#include "arm9/PA_BgTiles.h" -#include "arm9/PA_BgLargeMap.h" -#include "arm9/PA_Sprite.h" -#include "arm9/PA_SpriteDual.h" -#include "arm9/PA_Sound.h" -#include "arm9/PA_Micro.h" -#include "arm9/PA_Draw.h" -#include "arm9/PA_Interrupt.h" -#include "arm9/PA_Keys.h" -#include "arm9/PA_Motion.h" -#include "arm9/PA_BgRot.h" -#include "arm9/PA_Timer.h" -#include "arm9/PA_Math.h" -#include "arm9/PA_Palette.h" -#include "arm9/PA_PaletteDual.h" -#include "arm9/PA_SpecialFx.h" -#include "arm9/PA_TileDual.h" -#include "arm9/PA_Keyboard.h" -#include "arm9/PA_Window.h" -#include "arm9/PA_Mode7.h" -#include "arm9/PA_3DSprites.h" -#include "arm9/PA_IA.h" -#include "arm9/PA_Reco.h" -#include "arm9/PA_16c.h" -#include "arm9/PA_Wifi.h" -#include "arm9/PA_Gif.h" -#include "arm9/PA_BgTrans.h" -#include "arm9/PA_KeysSpecial.h" -#include "arm9/PA_Fake16bit.h" -#include "arm9/PA_Debug.h" - -#include "arm9/as_lib9.h" - -#ifdef __cplusplus -} - -// C++ specific header -#include "arm9/cpp/PA_CppHeader.h" - -#endif - -#endif +#ifndef _PA_MAIN +#define _PA_MAIN + +/*! + \mainpage PAlib 100707 Documentation + + \section intro Introduction + Welcome to the PAlib documentation. Here you'll find + information on how to use PAlib. + + \section core_lib Core library + - \ref General "General functions" + - \ref Debug "Debugging utilities" + - \ref Math "Math functions" + - \ref cxx "C++ wrappers" + + \section bg_section Tiled backgrounds + - \ref BgTiles "Normal background functions" + - \ref BgRot "Rotating background functions" + - \ref TileDual "Dual background functions" + - \ref Text "Text system" + - \ref Mode7 "Mode 7 functions" + + \section bmp_section Bitmapped backgrounds + - \ref Bitmap "Bitmapped background functions" + - \ref c16 "16-color bitmapped background functions" + - \ref Fake16bit "Fake 16-bit background functions" + - \ref Gif "GIF functions" + + \section spr_section Sprites + - \ref Sprite "Sprite functions" + - \ref SpriteDual "Dual sprite functions" + - \ref f3DSprites "3D Sprite functions" + + \section pal_section Palettes + - \ref Palette "Palette functions" + - \ref PaletteDual "Dual palette functions" + + \section input_section Input + - \ref Keys "Pad and stylus functions" + - \ref Keyboard "Keyboard functions" + - \ref Reco "Handwriting recognition functions" + - \ref Micro "Microphone functions" + - \ref KeysSpecial "Special controller functions" + + \section snd_section Sound + - \ref ASlib "ASlib library" + + \section misc_section Misc. + - \ref SpecialFx "Special effects" + + \example Text/Normal/HelloWorld/source/main.c + \example Backgrounds/Effects/Mode7/source/main.c +*/ + +#ifdef __cplusplus +extern "C"{ +#endif + +#include +#include +#include + +#include +#include +#include +#include + +#include "PA_IPC.h" +#include "PA_FifoMessages.h" +#include "PA_BgStruct.h" + +#include "arm9/jpeg.h" + +#include "arm9/PA_Assert.h" +#include "arm9/PA_General.h" +#include "arm9/PA_Text.h" +#include "arm9/PA_TextBits.h" +#include "arm9/PA_BgTiles.h" +#include "arm9/PA_BgLargeMap.h" +#include "arm9/PA_Sprite.h" +#include "arm9/PA_SpriteDual.h" +#include "arm9/PA_Sound.h" +#include "arm9/PA_Micro.h" +#include "arm9/PA_Draw.h" +#include "arm9/PA_Interrupt.h" +#include "arm9/PA_Keys.h" +#include "arm9/PA_Motion.h" +#include "arm9/PA_BgRot.h" +#include "arm9/PA_Timer.h" +#include "arm9/PA_Math.h" +#include "arm9/PA_Palette.h" +#include "arm9/PA_PaletteDual.h" +#include "arm9/PA_SpecialFx.h" +#include "arm9/PA_TileDual.h" +#include "arm9/PA_Keyboard.h" +#include "arm9/PA_Window.h" +#include "arm9/PA_Mode7.h" +#include "arm9/PA_3DSprites.h" +#include "arm9/PA_IA.h" +#include "arm9/PA_Reco.h" +#include "arm9/PA_16c.h" +#include "arm9/PA_Wifi.h" +#include "arm9/PA_Gif.h" +#include "arm9/PA_BgTrans.h" +#include "arm9/PA_KeysSpecial.h" +#include "arm9/PA_Fake16bit.h" +#include "arm9/PA_Debug.h" + +#include "arm9/as_lib9.h" + +#ifdef __cplusplus +} + +// C++ specific header +#include "arm9/cpp/PA_CppHeader.h" + +#endif + +#endif diff --git a/include/PA_BgStruct.h b/include/PA_BgStruct.h index fe95c6e..c890999 100644 --- a/include/PA_BgStruct.h +++ b/include/PA_BgStruct.h @@ -1,67 +1,67 @@ -#pragma once - -#include - -/*! \addtogroup BgTiles - @{ -*/ - -/// Graphics align define for PAGfx. -#define _GFX_ALIGN __attribute__((aligned (4))) - -/// Types of background -enum{ - /// Invalid background - PA_BgInvalid, - /// Normal tiled background AKA TiledBg - PA_BgNormal, - /// Large background AKA LargeMap - PA_BgLarge, - /// Unlimited background AKA InfiniteMap - PA_BgUnlimited, - /// Rotational background - PA_BgRot, - /// 1-bit bitmap font - PA_Font1bit, - /// 4-bit bitmap font - PA_Font4bit, - /// 8-bit bitmap font - PA_Font8bit -}; - -/// Background structure. -typedef struct{ - /// Type of background - int BgType; - /// Width of background in pixels - int width; - /// Height of background in pixels - int height; - - /// Pointer to background tiles - const void* BgTiles; - /// Pointer to background map - const void* BgMap; - - union{ - /// Pointer to palette - const void* BgPalette; - /// Pointer to font sizes - const void* FontSizes; - }; - - /// Size of tiles in bytes - size_t BgTiles_size; - - union{ - /// Size of the map in bytes - size_t BgMap_size; - /// Height of the font in pixels - int FontHeight; - }; - - // No need for BgPalette_size since palettes for - // backgrounds are always 512 bytes long. -}PA_BgStruct; - -/*! @} */ +#pragma once + +#include + +/*! \addtogroup BgTiles + @{ +*/ + +/// Graphics align define for PAGfx. +#define _GFX_ALIGN __attribute__((aligned (4))) + +/// Types of background +enum{ + /// Invalid background + PA_BgInvalid, + /// Normal tiled background AKA TiledBg + PA_BgNormal, + /// Large background AKA LargeMap + PA_BgLarge, + /// Unlimited background AKA InfiniteMap + PA_BgUnlimited, + /// Rotational background + PA_BgRot, + /// 1-bit bitmap font + PA_Font1bit, + /// 4-bit bitmap font + PA_Font4bit, + /// 8-bit bitmap font + PA_Font8bit +}; + +/// Background structure. +typedef struct{ + /// Type of background + int BgType; + /// Width of background in pixels + int width; + /// Height of background in pixels + int height; + + /// Pointer to background tiles + const void* BgTiles; + /// Pointer to background map + const void* BgMap; + + union{ + /// Pointer to palette + const void* BgPalette; + /// Pointer to font sizes + const void* FontSizes; + }; + + /// Size of tiles in bytes + size_t BgTiles_size; + + union{ + /// Size of the map in bytes + size_t BgMap_size; + /// Height of the font in pixels + int FontHeight; + }; + + // No need for BgPalette_size since palettes for + // backgrounds are always 512 bytes long. +}PA_BgStruct; + +/*! @} */ diff --git a/include/PA_FifoMessages.h b/include/PA_FifoMessages.h index 130bc09..3fe6816 100644 --- a/include/PA_FifoMessages.h +++ b/include/PA_FifoMessages.h @@ -1,123 +1,123 @@ -#ifndef _PA_FIFOMESSAGES -#define _PA_FIFOMESSAGES - -#ifdef __cplusplus -extern "C" { -#endif - -/*! \addtogroup General - @{ -*/ - -// Use a user channel that libnds doesn't use -/// PAlib Fifo channel number... -#define FIFO_PALIB FIFO_USER_08 - -/// PA_FifoMsg message types. -enum{ - // ARM7 to ARM9 messages - /// Input message (ARM7->ARM9) - PA_MSG_INPUT = 0x7000, - - // ARM9 to ARM7 messages - /// Microphone record message (ARM9->ARM7) - PA_MSG_MIC = 0x7100, - /// DS lite screen brightness message (ARM9->ARM7) - PA_MSG_DSLBRIGHT = 0x7102, - /// PSG play message (ARM9->ARM7) - PA_MSG_PSG = 0x7103, - /// Sends a memory buffer to the ARM7 to be used as shared memory - PA_SHARED_MEM_SET = 0x7104, -}; - -/// PA_SendFifoCmd() commands. -enum{ - // ARM9 to ARM7 commands - /// Microphone stop recording message (ARM9->ARM7) - PA_MSG_MICSTOP = 0x7101 -}; - -/// Represents a message sent through Fifo. -typedef struct{ - /// Type of message. - u32 type; - /// -- - union{ - /// Input message data - struct{ - /// TSC temperature diode 1 - u16 tdiode1; - /// TSC temperature diode 1 - u16 tdiode2; - /// TSC computed temperature - u32 temperature; - /// TSC battery - u16 battery; - /// Microphone volume - u8 micvol; - /// Extra byte - used as padding for now - u8 extra; - } InputMsg; - /// Microphone record message data - struct{ - /// Buffer to record microphone data - u8* buffer; - /// Length of the buffer in bytes. - u32 length; - } MicMsg; - /// DS lite brightness message data - struct{ - /// Brightness of the lights (0-3). - u8 brightness; - } DSLBrightMsg; - /// PSG play message data. - struct{ - /// Frequency (in hertz) - u32 freq; - /// Channel - u8 chan; - /// Volume (0-127) - u8 vol; - /// Pan (0-64-127) - u8 pan; - /// Duty (0-7) - u8 duty; - } PSGMsg; - /// Send IPC shared memory region from ARM9 to ARM7 - struct { - // Address of the shared memory region - void *address; - } SharedMemSet; - }; -} PA_FifoMsg; - -// Macros to ease the sending of fifo data -/// Send a PA_FifoMsg structure to the other CPU. -#define PA_SendFifoMsg(msg) fifoSendDatamsg(FIFO_PALIB, sizeof(PA_FifoMsg), (u8*) &msg) -/// Send a 32bit value to the other CPU. -#define PA_SendFifoVal(val) fifoSendValue32(FIFO_PALIB, val) -/// Send a command value to the other CPU (same as PA_SendFifoVal but for readability). -#define PA_SendFifoCmd PA_SendFifoVal - -/// Receive a PA_FifoMsg structure from the other CPU. -#define PA_GetFifoMsg(msg, bytes) fifoGetDatamsg(FIFO_PALIB, bytes, (u8*) &msg) - -// The macros below assume the executing CPU hasn't set a Value32 handler. -/// Wait for the other CPU to send a return value. -#define PA_FifoRetWait() while(!fifoCheckValue32(FIFO_PALIB)) -/// Get the other CPU's return value. -#define PA_FifoRetVal() fifoGetValue32(FIFO_PALIB) - -/// Inline function to ease the getting of the return value (wait + get) -static inline u32 PA_FifoGetRetVal(){ - PA_FifoRetWait(); - return PA_FifoRetVal(); -} - -/*! @} */ - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_FIFOMESSAGES +#define _PA_FIFOMESSAGES + +#ifdef __cplusplus +extern "C" { +#endif + +/*! \addtogroup General + @{ +*/ + +// Use a user channel that libnds doesn't use +/// PAlib Fifo channel number... +#define FIFO_PALIB FIFO_USER_08 + +/// PA_FifoMsg message types. +enum{ + // ARM7 to ARM9 messages + /// Input message (ARM7->ARM9) + PA_MSG_INPUT = 0x7000, + + // ARM9 to ARM7 messages + /// Microphone record message (ARM9->ARM7) + PA_MSG_MIC = 0x7100, + /// DS lite screen brightness message (ARM9->ARM7) + PA_MSG_DSLBRIGHT = 0x7102, + /// PSG play message (ARM9->ARM7) + PA_MSG_PSG = 0x7103, + /// Sends a memory buffer to the ARM7 to be used as shared memory + PA_SHARED_MEM_SET = 0x7104, +}; + +/// PA_SendFifoCmd() commands. +enum{ + // ARM9 to ARM7 commands + /// Microphone stop recording message (ARM9->ARM7) + PA_MSG_MICSTOP = 0x7101 +}; + +/// Represents a message sent through Fifo. +typedef struct{ + /// Type of message. + u32 type; + /// -- + union{ + /// Input message data + struct{ + /// TSC temperature diode 1 + u16 tdiode1; + /// TSC temperature diode 1 + u16 tdiode2; + /// TSC computed temperature + u32 temperature; + /// TSC battery + u16 battery; + /// Microphone volume + u8 micvol; + /// Extra byte - used as padding for now + u8 extra; + } InputMsg; + /// Microphone record message data + struct{ + /// Buffer to record microphone data + u8* buffer; + /// Length of the buffer in bytes. + u32 length; + } MicMsg; + /// DS lite brightness message data + struct{ + /// Brightness of the lights (0-3). + u8 brightness; + } DSLBrightMsg; + /// PSG play message data. + struct{ + /// Frequency (in hertz) + u32 freq; + /// Channel + u8 chan; + /// Volume (0-127) + u8 vol; + /// Pan (0-64-127) + u8 pan; + /// Duty (0-7) + u8 duty; + } PSGMsg; + /// Send IPC shared memory region from ARM9 to ARM7 + struct { + // Address of the shared memory region + void *address; + } SharedMemSet; + }; +} PA_FifoMsg; + +// Macros to ease the sending of fifo data +/// Send a PA_FifoMsg structure to the other CPU. +#define PA_SendFifoMsg(msg) fifoSendDatamsg(FIFO_PALIB, sizeof(PA_FifoMsg), (u8*) &msg) +/// Send a 32bit value to the other CPU. +#define PA_SendFifoVal(val) fifoSendValue32(FIFO_PALIB, val) +/// Send a command value to the other CPU (same as PA_SendFifoVal but for readability). +#define PA_SendFifoCmd PA_SendFifoVal + +/// Receive a PA_FifoMsg structure from the other CPU. +#define PA_GetFifoMsg(msg, bytes) fifoGetDatamsg(FIFO_PALIB, bytes, (u8*) &msg) + +// The macros below assume the executing CPU hasn't set a Value32 handler. +/// Wait for the other CPU to send a return value. +#define PA_FifoRetWait() while(!fifoCheckValue32(FIFO_PALIB)) +/// Get the other CPU's return value. +#define PA_FifoRetVal() fifoGetValue32(FIFO_PALIB) + +/// Inline function to ease the getting of the return value (wait + get) +static inline u32 PA_FifoGetRetVal(){ + PA_FifoRetWait(); + return PA_FifoRetVal(); +} + +/*! @} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/PA_IPC.h b/include/PA_IPC.h index 074c229..4753c31 100644 --- a/include/PA_IPC.h +++ b/include/PA_IPC.h @@ -1,36 +1,36 @@ -#ifndef _PA_IPC -#define _PA_IPC - -#ifdef __cplusplus -extern "C" { -#endif - -#define PAIPC_PLAY 0 -#define PAIPC_PAUSE 1 -#define PAIPC_STOP 2 - -typedef struct { - // fincs edit: rearranged the items to conserve space (*cough* word alignement *cough*...) - void* Data; - u8 Command; - u8 Busy; - u8 Volume; // |(1<<7) to change Volume, &127 to get value - u8 Pan; // |(1<<7) to change Pan, &127 to get value - s32 Rate; - u32 Length; - u8 Format; - u8 Padding; - u8 Repeat; - u8 Duty; - u32 RepeatPoint; -} PA_IPCSound; - -typedef struct{ - PA_IPCSound Sound[17]; -} PA_IPCType; - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_IPC +#define _PA_IPC + +#ifdef __cplusplus +extern "C" { +#endif + +#define PAIPC_PLAY 0 +#define PAIPC_PAUSE 1 +#define PAIPC_STOP 2 + +typedef struct { + // fincs edit: rearranged the items to conserve space (*cough* word alignement *cough*...) + void* Data; + u8 Command; + u8 Busy; + u8 Volume; // |(1<<7) to change Volume, &127 to get value + u8 Pan; // |(1<<7) to change Pan, &127 to get value + s32 Rate; + u32 Length; + u8 Format; + u8 Padding; + u8 Repeat; + u8 Duty; + u32 RepeatPoint; +} PA_IPCSound; + +typedef struct{ + PA_IPCSound Sound[17]; +} PA_IPCType; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/PA_Transfer.h b/include/PA_Transfer.h index 3cd0fb0..3e87173 100644 --- a/include/PA_Transfer.h +++ b/include/PA_Transfer.h @@ -1,42 +1,42 @@ -// PAlib transfer region (appended after the libnds one). - -#ifndef _PA_TRANSFER_ -#define _PA_TRANSFER_ - -#ifdef ARM9 -#define LEGACY __attribute__ ((deprecated)) -#else -#define LEGACY -#endif - -/*! \addtogroup General - @{ -*/ - -/// PAlib transfer region type. -typedef struct { - // Extra values that aren't read by libnds - /// TSC temperature diode 1 - vuint16 tdiode1; - /// TSC temperature diode 2 - vuint16 tdiode2; - /// TSC computed temperature - vuint32 temperature; - /// TSC battery - vuint16 battery; - /// Microphone volume - vuint8 micvol; - /// Extra field - used as padding for now. - vuint8 extra; - - /// Legacy IPC field - LEGACY vuint32 mailData; -} PA_TransferRegion; - -/// PAlib transfer region (used for the storage of data coming from the ARM7). -/// libnds also does this. As TransferRegion was removed we just skip the first 256 bytes. -extern volatile PA_TransferRegion *volatile PA_Transfer; - -/*! @} */ - -#endif +// PAlib transfer region (appended after the libnds one). + +#ifndef _PA_TRANSFER_ +#define _PA_TRANSFER_ + +#ifdef ARM9 +#define LEGACY __attribute__ ((deprecated)) +#else +#define LEGACY +#endif + +/*! \addtogroup General + @{ +*/ + +/// PAlib transfer region type. +typedef struct { + // Extra values that aren't read by libnds + /// TSC temperature diode 1 + vuint16 tdiode1; + /// TSC temperature diode 2 + vuint16 tdiode2; + /// TSC computed temperature + vuint32 temperature; + /// TSC battery + vuint16 battery; + /// Microphone volume + vuint8 micvol; + /// Extra field - used as padding for now. + vuint8 extra; + + /// Legacy IPC field + LEGACY vuint32 mailData; +} PA_TransferRegion; + +/// PAlib transfer region (used for the storage of data coming from the ARM7). +/// libnds also does this. As TransferRegion was removed we just skip the first 256 bytes. +extern volatile PA_TransferRegion *volatile PA_Transfer; + +/*! @} */ + +#endif diff --git a/include/arm7/as_lib7.h b/include/arm7/as_lib7.h index 96d5fe5..33a54e1 100644 --- a/include/arm7/as_lib7.h +++ b/include/arm7/as_lib7.h @@ -1,202 +1,202 @@ -/* - - Advanced Sound Library (ASlib) - ------------------------------ - - file : sound7.c - author : Lasorsa Yohan (Noda) - description : ARM7 sound definitions - - history : - - 28/11/2007 - v1.0 - = Original release - - 21/12/2007 - v1.1 - = corrected arm7/arm9 initialization (fix M3S/R4 problems) - = fixed stereo detection problem (thanks to ThomasS) - -*/ - -#ifndef __SOUND7_H__ -#define __SOUND7_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// mp3 static defines -#define AS_DECODEBUFFER_SIZE MAX_NCHAN * MAX_NGRAN * MAX_NSAMP - -// locate the IPC structure after the PAlib one -#define IPC_Sound ((IPC_SoundSystem*)((u32)(PA_Transfer) + sizeof(PA_TransferRegion))) // - -// mp3 commands -typedef enum -{ - // internal commands - MP3CMD_ARM9ALLOCDONE = 256, - MP3CMD_NONE = 0, - MP3CMD_MIX = 1, - MP3CMD_MIXING = 2, - MP3CMD_WAITING = 4, - - // user commands - MP3CMD_INIT = 8, - MP3CMD_STOP = 16, - MP3CMD_PLAY = 32, - MP3CMD_PAUSE = 64, - MP3CMD_SETRATE = 128 - -} MP3Command; - -// sound commands -typedef enum -{ - // internal commands - SNDCMD_ARM7READY = 128, - SNDCMD_NONE = 0, - SNDCMD_DELAY = 1, - - // user commands - SNDCMD_STOP = 2, - SNDCMD_PLAY = 4, - SNDCMD_SETVOLUME = 8, - SNDCMD_SETPAN = 16, - SNDCMD_SETRATE = 32, - SNDCMD_SETMASTERVOLUME = 64 - -} SoundCommand; - -// mp3 states -typedef enum -{ - MP3ST_STOPPED = 0, - MP3ST_PLAYING = 1, - MP3ST_PAUSED = 2, - MP3ST_OUT_OF_DATA = 4, - MP3ST_DECODE_ERROR = 8, - MP3ST_INITFAILED = 16, // - -} MP3Status; - -// ASlib modes -typedef enum -{ - AS_MODE_MP3 = 1, // use mp3 - AS_MODE_SURROUND = 2, // use surround - AS_MODE_16CH = 4, // use all DS channels - AS_MODE_8CH = 8 // use DS channels 1-8 only - -} AS_MODE; - -// delay values -typedef enum -{ - AS_NO_DELAY = 0, // 0 ms delay - AS_SURROUND = 1, // 16 ms delay - AS_REVERB = 4, // 66 ms delay - -} AS_DELAY; - -// sound formats -typedef enum -{ - AS_PCM_8BIT = 0, - AS_PCM_16BIT = 1, - AS_ADPCM = 2 - -} AS_SOUNDFORMAT; - -/// sound info -typedef struct -{ - u8 *data; - u32 size; - u8 format; - s32 rate; - u8 volume; - s8 pan; - u8 loop; - u8 priority; - u8 delay; - -} SoundInfo; - -/// sound info !![PAlib change] Word alignment!! -typedef struct -{ - u8 *data; - u32 size; - s32 rate; - u8 format; - u8 volume; - s8 pan; - u8 loop; - u8 priority; - u8 delay; - -} SoundInfoAlign; - -/// sound channel info -typedef struct -{ - SoundInfoAlign snd; // !![PAlib change] Word alignment!! - u8 busy; - u8 reserved; - s8 volume; - s8 pan; - u8 cmd; - -} SoundChannel; - -/// MP3 player info -typedef struct -{ - u8 *alloc_ram; - s8 *mixbuffer; - u32 buffersize; - s32 rate; - u32 state; - u32 soundcursor; - u32 numsamples; - s32 prevtimer; - u8 *mp3buffer; - u32 mp3buffersize; - u32 mp3filesize; - u32 cmd; - u8 channelL, channelR; - u8 loop; - u8 stream; - u8 needdata; - u8 delay; - -} MP3Player; - -/// IPC structure for the sound system -typedef struct -{ - MP3Player mp3; - u8 surround; // !![PAlib change] Word alignment!! - u8 num_chan; // !![PAlib change] Word alignment!! - SoundChannel chan[16]; - u8 volume; -} IPC_SoundSystem; - -// initialize the main system -void AS_Init(); - -// the sound engine, must be called each VBlank -void AS_SoundVBL(); - -// the mp3 decoding engine, must be called on a regular basis (like after VBlank) -void AS_MP3Engine(); - -#ifdef __cplusplus -} -#endif - -#endif +/* + + Advanced Sound Library (ASlib) + ------------------------------ + + file : sound7.c + author : Lasorsa Yohan (Noda) + description : ARM7 sound definitions + + history : + + 28/11/2007 - v1.0 + = Original release + + 21/12/2007 - v1.1 + = corrected arm7/arm9 initialization (fix M3S/R4 problems) + = fixed stereo detection problem (thanks to ThomasS) + +*/ + +#ifndef __SOUND7_H__ +#define __SOUND7_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// mp3 static defines +#define AS_DECODEBUFFER_SIZE MAX_NCHAN * MAX_NGRAN * MAX_NSAMP + +// locate the IPC structure after the PAlib one +#define IPC_Sound ((IPC_SoundSystem*)((u32)(PA_Transfer) + sizeof(PA_TransferRegion))) // + +// mp3 commands +typedef enum +{ + // internal commands + MP3CMD_ARM9ALLOCDONE = 256, + MP3CMD_NONE = 0, + MP3CMD_MIX = 1, + MP3CMD_MIXING = 2, + MP3CMD_WAITING = 4, + + // user commands + MP3CMD_INIT = 8, + MP3CMD_STOP = 16, + MP3CMD_PLAY = 32, + MP3CMD_PAUSE = 64, + MP3CMD_SETRATE = 128 + +} MP3Command; + +// sound commands +typedef enum +{ + // internal commands + SNDCMD_ARM7READY = 128, + SNDCMD_NONE = 0, + SNDCMD_DELAY = 1, + + // user commands + SNDCMD_STOP = 2, + SNDCMD_PLAY = 4, + SNDCMD_SETVOLUME = 8, + SNDCMD_SETPAN = 16, + SNDCMD_SETRATE = 32, + SNDCMD_SETMASTERVOLUME = 64 + +} SoundCommand; + +// mp3 states +typedef enum +{ + MP3ST_STOPPED = 0, + MP3ST_PLAYING = 1, + MP3ST_PAUSED = 2, + MP3ST_OUT_OF_DATA = 4, + MP3ST_DECODE_ERROR = 8, + MP3ST_INITFAILED = 16, // + +} MP3Status; + +// ASlib modes +typedef enum +{ + AS_MODE_MP3 = 1, // use mp3 + AS_MODE_SURROUND = 2, // use surround + AS_MODE_16CH = 4, // use all DS channels + AS_MODE_8CH = 8 // use DS channels 1-8 only + +} AS_MODE; + +// delay values +typedef enum +{ + AS_NO_DELAY = 0, // 0 ms delay + AS_SURROUND = 1, // 16 ms delay + AS_REVERB = 4, // 66 ms delay + +} AS_DELAY; + +// sound formats +typedef enum +{ + AS_PCM_8BIT = 0, + AS_PCM_16BIT = 1, + AS_ADPCM = 2 + +} AS_SOUNDFORMAT; + +/// sound info +typedef struct +{ + u8 *data; + u32 size; + u8 format; + s32 rate; + u8 volume; + s8 pan; + u8 loop; + u8 priority; + u8 delay; + +} SoundInfo; + +/// sound info !![PAlib change] Word alignment!! +typedef struct +{ + u8 *data; + u32 size; + s32 rate; + u8 format; + u8 volume; + s8 pan; + u8 loop; + u8 priority; + u8 delay; + +} SoundInfoAlign; + +/// sound channel info +typedef struct +{ + SoundInfoAlign snd; // !![PAlib change] Word alignment!! + u8 busy; + u8 reserved; + s8 volume; + s8 pan; + u8 cmd; + +} SoundChannel; + +/// MP3 player info +typedef struct +{ + u8 *alloc_ram; + s8 *mixbuffer; + u32 buffersize; + s32 rate; + u32 state; + u32 soundcursor; + u32 numsamples; + s32 prevtimer; + u8 *mp3buffer; + u32 mp3buffersize; + u32 mp3filesize; + u32 cmd; + u8 channelL, channelR; + u8 loop; + u8 stream; + u8 needdata; + u8 delay; + +} MP3Player; + +/// IPC structure for the sound system +typedef struct +{ + MP3Player mp3; + u8 surround; // !![PAlib change] Word alignment!! + u8 num_chan; // !![PAlib change] Word alignment!! + SoundChannel chan[16]; + u8 volume; +} IPC_SoundSystem; + +// initialize the main system +void AS_Init(); + +// the sound engine, must be called each VBlank +void AS_SoundVBL(); + +// the mp3 decoding engine, must be called on a regular basis (like after VBlank) +void AS_MP3Engine(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_16c.h b/include/arm9/PA_16c.h index 890a098..52ca00d 100644 --- a/include/arm9/PA_16c.h +++ b/include/arm9/PA_16c.h @@ -1,512 +1,512 @@ -#ifndef _PA_16C -#define _PA_16C - -#ifdef __cplusplus -extern "C" { -#endif - -/*! \file PA_16c.h - \brief 16color pseudo-bitmap mode. - - Special 16color background on which you can paste images. Usefull to show shots in SHMUP ! -*/ - -#include "PA9.h" - -#include "PA_Palette.h" -#include "PA_TextBits.h" - -// Pointers... -extern u16 *PA_Draw16[2]; -extern u32 *PA_Draw1632[2]; - -extern const u16 *bittext_maps[10]; -extern const u8 *bittext_tiles_blank[10]; -extern u32 *c16_tiles[10]; -extern const u8 *pa_bittextdefaultsize[10]; -extern u16 pa_bittextsizes[5]; -extern u8 pa_bittextpoliceheight[10]; - -#define ALIGN_LEFT 0 -#define ALIGN_RIGHT 1 -#define ALIGN_CENTER 2 -#define ALIGN_JUSTIFY 3 - -#define PA_16cLetterPos PA_LetterPos // For backwards compatibility - -#define PA_LoadPal16c(palette, source) DMA_Copy(source, (void*)palette, 16, DMA_16NOW); -#define PA_16cPos(x, y) ((((x)>>3)*26*8) + (y) + 8) -ALWAYSINLINE void PA_16c8X8(u8 screen, s16 x, s16 y, u32 *image); - -extern u32 *c16_tiles[10]; -extern const u16 *bittext_maps[10]; -extern u8 *pa16cdefaultsize[10]; -extern u8 c16policeheight[10]; - -void PA_16c8X8Color(u8 screen, s16 x, s16 y, u32 *image, u8 color); - -#define PA_Plot8Pixels(a,b,c,d) do{ PA_Draw1632[a][b] |= (d<>(32-c)); }while(0) - -static inline void PA_16c8pixels(u8 screen, s16 x, s16 y, u32 colors){ - PA_Plot8Pixels(screen, PA_16cPos(x+8, y+8), ((x&7)<<2), colors); -} - -static inline void PA_16c16X16Letter(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color){ - u16 firstpos = ((letter&31)<<1)+((letter >> 5)<<7); - PA_16c8X8Color(screen, x, y, (c16_tiles[size]+(bittext_maps[size][firstpos]<<3)), color); - PA_16c8X8Color(screen, x, y+8, (c16_tiles[size]+(bittext_maps[size][firstpos+64]<<3)), color); - firstpos ++; - PA_16c8X8Color(screen, x+8, y, (c16_tiles[size]+(bittext_maps[size][firstpos]<<3)), color); - PA_16c8X8Color(screen, x+8, y+8, (c16_tiles[size]+(bittext_maps[size][firstpos+64]<<3)), color); -} - -static inline void PA_16c8X8Letter(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color){ - PA_16c8X8Color(screen, x, y, (c16_tiles[size]+(bittext_maps[size][letter]<<3)), color); -} - -/** @defgroup c16 16color pseudo-bitmap mode - * Special 16color background on which you can paste images. Usefull to show shots in SHMUP ! - * @{ - */ - -/*! \fn void PA_Init16cBg(u8 screen, u8 bg) - \brief - \~english Initialise 16color background on which you can paste images... - \~french Initialise le mode de dessin 16 couleurs, sur lequel on peut coller de petites images... - \~\param screen - \~english Choose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg - \~english Background number (0-3) - \~english Background number (0-3) -*/ -void PA_Init16cBgEx(u8 screen, u8 bg, u8 npalette); - -/*! \fn static inline void PA_Init16cBg(u8 screen, u8 bg) - \brief - \~english Initialise 16color background on which you can paste images... Using palette 0 - \~french Initialise le mode de dessin 16 couleurs, sur lequel on peut coller de petites images... Utilisant la palette 0 - \~\param screen - \~english Choose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg - \~english Background number (0-3) - \~english Background number (0-3) -*/ -static inline void PA_Init16cBg(u8 screen, u8 bg){ - PA_Init16cBgEx(screen, bg, 0); -} - -/*! \fn static inline void PA_16cErase(u8 screen) - \brief - \~english Erase the 16color background. Must be used right after PA_WaitForVBL to avoid glitches - \~french Effacer un écran de 16 couleurs. Doit être utilisé juste après PA_WaitForVBL pour éviter des erreurs d'affichage - \~\param screen - \~english Choose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) -*/ -void PA_16cErase(u8 screen); - - - -/*! \fn static inline void PA_Dual16cErase(void) - \brief - \~english Erase the 16color background on both screens. Must be used right after PA_WaitForVBL to avoid glitches - \~french Effacer un écran de 16 couleurs sur les 2 écrans. Doit être utilisé juste après PA_WaitForVBL pour éviter des erreurs d'affichage -*/ -static inline void PA_Dual16cErase(void){ - PA_16cErase(0); PA_16cErase(1); -} - - -/*! \fn static inline void PA_InitComplete16c(u8 bg, void *Palette) - \brief - \~english Initialise a 16color background on each screen and give them a given palette - \~french Initialise le mode de dessin 16 couleurs sur les 2 écrans avec une palette donnée - \~\param bg - \~english Background number - \~french Numéro du fond - \~\param Palette - \~english 16 color palette... - \~french Palette de 16 couleurs -*/ -static inline void PA_InitComplete16c(u8 bg, void *Palette){ - PA_LoadPal16c(PAL_BG0, Palette); - PA_LoadPal16c(PAL_BG1, Palette); - PA_Init16cBg(0, bg); PA_Init16cBg(1, bg); -} - - -/*! \fn s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, s32 limit) - \brief - \~english This is a variable width and variable size function to draw text on the screen. - \~french Cette fonction permet d'écrire du texte à chasse variable à l'écran. - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param basex - \~english X coordinate of the top left corner - \~french Coordonnée X du coin supérieur gauche - \~\param basey - \~english Y coordinate of the top left corner - \~french Coordonnée Y du coin supérieur gauche - \~\param maxx - \~english X coordinate of the down right corner - \~french Coordonnée X du coin inférieur droit - \~\param maxy - \~english Y coordinate of the down right corner - \~french Coordonnée Y du coin inférieur droit - \~\param text - \~english Text, such as "Hello World" - \~french Texte, tel que "Hello World" - \~\param color - \~english Palette color to use (0-255) - \~french Couleur de la palette à utiliser (0-255) - \~\param size - \~english Size of the text, from 0 (really small) to 4 (pretty big) - \~french Taille du texte, de 0 (vraiment petit) à 4 (assez grand) - \~\param limit - \~english You can give a maximum number of characters to output. This can be usefull to have a slowing drawing text (allow to draw 1 more character each frame...) - \~french On peut fixer une limite au nombre de caractères. Ceci peut etre utile pour dessiner un texte progressivement, en augmentant de 1 le nombre de caractères à chaque boucle.... -*/ -s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, s32 limit); - -/*! \def PA_16cCustomFont(c16_slot, c16_font) - \deprecated - \brief - \~english [DEPRECATED] Add custom fonts to the 16cText system !! Font must be converted with PAGfx - \~french [DEPRECATED] Ajouter une police perso dans le systeme de texte 16c !! Doit être convertie avec PAGfx - \~\param c16_slot - \~english Font slot... 0-4 are used by the defaut PAlib fonts, 5-9 are free to use. You can freely overwrite the PAlib fonts if you want - \~french Slot pour ajouter la police. Les slots 0-4 sont utilisés pour les polices par défaut de PAlib, et 5-9 sont libres. On peut néanmoins charger par-dessus les polices PAlib si on veut. - \~\param c16_font - \~english Font name... - \~french Nom de la police... -*/ -#define PA_16cCustomFont(c16_slot, c16_font) do{\ - PA_DEPRECATED_MACRO;\ - bittext_maps[c16_slot] = (u16*)(void*)c16_font##_Map;\ - c16_tiles[c16_slot] = (u32*)(void*)c16_font##_Tiles;\ - pa_bittextdefaultsize[c16_slot] = (u8*)c16_font##_Sizes;\ - pa_bittextpoliceheight[c16_slot] = c16_font##_Height;\ -}while(0) - - -/*! \fn void PA_Add16cFont(int slot, const PA_BgStruct* font) - \brief - \~english Add a custom font to the 16c font system. - \~french Ajouter une police perso dans le système de texte 16c. - \~\param slot - \~english Font slot. 0-4 are used by the default PAlib fonts, 5-9 are free to use. You can freely overwrite the PAlib fonts if you want. - \~french Slot pour ajouter la police. Les slots 0-4 sont utilisés pour les polices par défaut de PAlib, et 5-9 sont libres. On peut néanmoins charger par-dessus les polices PAlib si on veut. - \~\param font - \~english Pointer to the font. - \~french Pointeur vers le police perso. -*/ -void PA_Add16cFont(int slot, const PA_BgStruct* font); - -/*! \fn ALWAYSINLINE PA_16cPutPixel(u8 screen, s16 x, s16 y, u32 color) - \brief - \~english Plot a pixel on a 16c background - \~french Afficher un pixel sur un fond 16c - \~\param screen - \~english Screen... - \~french Ecran... - \~\param x - \~english X position in pixels of the top left corner. Note that it ranges from -8 to 263, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches - \~french Position X en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 263, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... - \~\param y - \~english y position in pixels of the top left corner. Note that it ranges from -8 to 199, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches - \~french Position y en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 199, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... - \~\param color - \~english Pixel value (0-15, uses the loaded palette) - \~french Valeur du pixel (0-15, prend la couleur dans la palette chargée) -*/ -ALWAYSINLINE void PA_16cPutPixel(u8 screen, s16 x, s16 y, u32 color){ - x += 8; y += 8; - u16 temp = (x&7)<<2; - u16 pos = PA_16cPos(x, y); - PA_Draw1632[screen][pos] = (color<>temp); - PA_Draw1632[screen][pos+1] |= (image[1]>>temp); - PA_Draw1632[screen][pos+2] |= (image[2]>>temp); - PA_Draw1632[screen][pos+3] |= (image[3]>>temp); -} - -/*! \fn ALWAYSINLINE void PA_16c8X6(u8 screen, s16 x, s16 y, u32 *image) - \brief - \~english Load an 8x6 pixels image at a given position. Second fastest of all pasting functions - \~french Afficher une image de 8x6 pixels à un endroit donné, deuxième fonction la plus rapide de copie... - \~\param screen - \~english Screen... - \~french Ecran... - \~\param x - \~english X position in pixels of the top left corner. Note that it ranges from -8 to 255, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches - \~french Position X en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 255, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... - \~\param y - \~english y position in pixels of the top left corner. Note that it ranges from -8 to 191, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches - \~french Position y en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 191, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... - \~\param image - \~english 16 color image to load. Use (u32*)ImageName if you get an error... - \~french Image en 16 couleurs à charger. Utiliser (u32*)NomImage en cas d'erreur de compilation -*/ -ALWAYSINLINE void PA_16c8X6(u8 screen, s16 x, s16 y, u32 *image){ - - x += 8; y += 8; - u16 temp = (x&7)<<2; - u16 pos = PA_16cPos(x, y); - PA_Plot8Pixels(screen, pos, temp, image[0]); - PA_Plot8Pixels(screen, pos+1, temp, image[1]); - PA_Plot8Pixels(screen, pos+2, temp, image[2]); - PA_Plot8Pixels(screen, pos+3, temp, image[3]); - PA_Plot8Pixels(screen, pos+4, temp, image[4]); - PA_Plot8Pixels(screen, pos+5, temp, image[5]); -} - -/*! \fn ALWAYSINLINE void PA_16c8X8(u8 screen, s16 x, s16 y, u32 *image) - \brief - \~english Load an 8x8 pixels image at a given position. - \~french Afficher une image de 8x8 pixels à un endroit donné. - \~\param screen - \~english Screen... - \~french Ecran... - \~\param x - \~english X position in pixels of the top left corner. Note that it ranges from -8 to 255, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches - \~french Position X en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 255, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... - \~\param y - \~english y position in pixels of the top left corner. Note that it ranges from -8 to 191, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches - \~french Position y en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 191, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... - \~\param image - \~english 16 color image to load. Use (u32*)ImageName if you get an error... - \~french Image en 16 couleurs à charger. Utiliser (u32*)NomImage en cas d'erreur de compilation -*/ -ALWAYSINLINE void PA_16c8X8(u8 screen, s16 x, s16 y, u32 *image){ - x += 8; y += 8; - u16 temp = (x&7)<<2; - u16 pos = PA_16cPos(x, y); - PA_Draw1632[screen][pos] |= (image[0]<>temp); - PA_Draw1632[screen][pos+1] |= (image[1]>>temp); - PA_Draw1632[screen][pos+2] |= (image[2]>>temp); - PA_Draw1632[screen][pos+3] |= (image[3]>>temp); - PA_Draw1632[screen][pos+4] |= (image[4]>>temp); - PA_Draw1632[screen][pos+5] |= (image[5]>>temp); - PA_Draw1632[screen][pos+6] |= (image[6]>>temp); - PA_Draw1632[screen][pos+7] |= (image[7]>>temp); -} - -ALWAYSINLINE void PA_16c16X8(u8 screen, s16 x, s16 y, u32 *image){ - x += 8; y += 8; - u16 temp = (x&7)<<2; - u16 pos = PA_16cPos(x, y); - u8 i; - for (i = 0; i < 2; i++){ - PA_Plot8Pixels(screen, pos, temp, image[0]); - PA_Plot8Pixels(screen, pos+1, temp, image[1]); - PA_Plot8Pixels(screen, pos+2, temp, image[2]); - PA_Plot8Pixels(screen, pos+3, temp, image[3]); - PA_Plot8Pixels(screen, pos+4, temp, image[4]); - PA_Plot8Pixels(screen, pos+5, temp, image[5]); - PA_Plot8Pixels(screen, pos+6, temp, image[6]); - PA_Plot8Pixels(screen, pos+7, temp, image[7]); - pos+=26*8; - image+=8; - } -} - -ALWAYSINLINE void PA_16c16X12(u8 screen, s16 x, s16 y, u32 *image){ - - x += 8; y += 8; - u16 temp = (x&7)<<2; - u16 pos = PA_16cPos(x, y); - u8 i; - for (i = 0; i < 2; i++){ - PA_Plot8Pixels(screen, pos, temp, image[0]); - PA_Plot8Pixels(screen, pos+1, temp, image[1]); - PA_Plot8Pixels(screen, pos+2, temp, image[2]); - PA_Plot8Pixels(screen, pos+3, temp, image[3]); - PA_Plot8Pixels(screen, pos+4, temp, image[4]); - PA_Plot8Pixels(screen, pos+5, temp, image[5]); - PA_Plot8Pixels(screen, pos+6, temp, image[6]); - PA_Plot8Pixels(screen, pos+7, temp, image[7]); - PA_Plot8Pixels(screen, pos+8, temp, image[16]); - PA_Plot8Pixels(screen, pos+9, temp, image[17]); - PA_Plot8Pixels(screen, pos+10, temp, image[18]); - PA_Plot8Pixels(screen, pos+11, temp, image[19]); - pos+=26*8; - image+=8; - } -} - -ALWAYSINLINE void PA_16c16X16(u8 screen, s16 x, s16 y, u32 *image){ - x += 8; y += 8; - - u16 temp = (x&7)<<2; - u16 pos = PA_16cPos(x, y); - u8 i; - for (i = 0; i < 2; i++){ - PA_Plot8Pixels(screen, pos, temp, image[0]); - PA_Plot8Pixels(screen, pos+1, temp, image[1]); - PA_Plot8Pixels(screen, pos+2, temp, image[2]); - PA_Plot8Pixels(screen, pos+3, temp, image[3]); - PA_Plot8Pixels(screen, pos+4, temp, image[4]); - PA_Plot8Pixels(screen, pos+5, temp, image[5]); - PA_Plot8Pixels(screen, pos+6, temp, image[6]); - PA_Plot8Pixels(screen, pos+7, temp, image[7]); - PA_Plot8Pixels(screen, pos+8, temp, image[16]); - PA_Plot8Pixels(screen, pos+9, temp, image[17]); - PA_Plot8Pixels(screen, pos+10, temp, image[18]); - PA_Plot8Pixels(screen, pos+11, temp, image[19]); - PA_Plot8Pixels(screen, pos+12, temp, image[20]); - PA_Plot8Pixels(screen, pos+13, temp, image[21]); - PA_Plot8Pixels(screen, pos+14, temp, image[22]); - PA_Plot8Pixels(screen, pos+15, temp, image[23]); - pos+=26*8; - image+=8; - } -} - -/*! \fn ALWAYSINLINE void PA_16c8Xi(u8 screen, s16 x, s16 y, u32 *image,u8 i) - \brief - \~english Load an 8xi row from a 8x16 pixels image at a given position. If i>16 the image is repeated. - \~french Afficher une image de 8x8 pixels à un endroit donné. - \~\param screen - \~english Screen... - \~french Ecran... - \~\param x - \~english X position in pixels of the top left corner. Note that it ranges from -8 to 255, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches - \~french Position X en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 255, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... - \~\param y - \~english y position in pixels of the top left corner. Note that it ranges from -8 to 191, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches - \~french Position y en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 191, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... - \~\param image - \~english 16 color image to load. Use (u32*)ImageName if you get an error... - \~french Image en 16 couleurs à charger. Utiliser (u32*)NomImage en cas d'erreur de compilation - \~\param i - \~english Number of lines of the image drawn (if greater than 16 the image will be repeated). - \~french Nombre de lignes à dessiner -*/ -ALWAYSINLINE void PA_16c8Xi(u8 screen, s16 x, s16 y, u32 *image, u8 i){ - x += 8; y += 8; - u16 temp = ((x)&7)<<2; - u16 temp2 = 32-temp; - u16 pos = PA_16cPos(x, y); - u16 pos2 = pos + 208; // Next columns - u8 j=0; - while (j>temp2); - ++j; - } -} - -static inline void PA_16cLetter(u8 screen, s16 x, s16 y, char letter, u8 size, u8 color){ - if (pa_bittextpoliceheight[size]<=8) PA_16c8X8Letter(screen, x, y, letter, size, color); - else PA_16c16X16Letter(screen, x, y, letter, size, color); -} - -/*! \fn void PA_16cClearZone(u8 screen, s16 x1, s16 y1, s16 x2, s16 y2) - \brief - \~english Erase a 16c background zone - \~french Effacer une partie d'un fond 16c - \~\param screen - \~english Screen... - \~french Ecran... - \~\param x1 - \~english Upper left corner... - \~french Coin supérieur gauche... - \~\param y1 - \~english Upper left corner... - \~french Coin supérieur gauche... - \~\param x2 - \~english Lower right corner... - \~french Coin inférieur droit... - \~\param y2 - \~english Lower right corner... - \~french Coin inférieur droit... -*/ -void PA_16cClearZone(u8 screen, s16 x1, s16 y1, s16 x2, s16 y2); - -/*! \fn static inline u8 PA_16cGetPixel(u8 screen, s16 x, s16 y) - \brief - \~english Returns the pixel value of a given point on a 16c background - \~french Renvoie la valeur d'un pixel donné sur un fond 16c - \~\param screen - \~english Screen... - \~french Ecran... - \~\param x - \~english X value... - \~french Valeur X... - \~\param y - \~english Y value... - \~french Valeur Y... -*/ -static inline u8 PA_16cGetPixel(u8 screen, s16 x, s16 y){ - x += 8; y += 8; - u16 temp = (x&7)<<2; - u16 pos = PA_16cPos(x, y); - return (PA_Draw1632[screen][pos]&(15<>temp; -} - -// For backwards compatibility.... -#define PA_16cTextAlign(align) PA_TextAlign(align) -#define PA_16cTextLineSpacing(spacing) PA_TextLineSpacing(spacing) -#define PA_16cTextLetterSpacing(spacing) PA_TextLetterSpacing(spacing) -#define PA_16cSetTextRot(rotate) textinfo.rot = rotate -s16 PA_16cTextRot(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text, u8 color, u8 size, s32 limit); - -extern u32 buffer16c[8]; - -/** @} */ // end of 16c - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_16C +#define _PA_16C + +#ifdef __cplusplus +extern "C" { +#endif + +/*! \file PA_16c.h + \brief 16color pseudo-bitmap mode. + + Special 16color background on which you can paste images. Usefull to show shots in SHMUP ! +*/ + +#include "PA9.h" + +#include "PA_Palette.h" +#include "PA_TextBits.h" + +// Pointers... +extern u16 *PA_Draw16[2]; +extern u32 *PA_Draw1632[2]; + +extern const u16 *bittext_maps[10]; +extern const u8 *bittext_tiles_blank[10]; +extern u32 *c16_tiles[10]; +extern const u8 *pa_bittextdefaultsize[10]; +extern u16 pa_bittextsizes[5]; +extern u8 pa_bittextpoliceheight[10]; + +#define ALIGN_LEFT 0 +#define ALIGN_RIGHT 1 +#define ALIGN_CENTER 2 +#define ALIGN_JUSTIFY 3 + +#define PA_16cLetterPos PA_LetterPos // For backwards compatibility + +#define PA_LoadPal16c(palette, source) DMA_Copy(source, (void*)palette, 16, DMA_16NOW); +#define PA_16cPos(x, y) ((((x)>>3)*26*8) + (y) + 8) +ALWAYSINLINE void PA_16c8X8(u8 screen, s16 x, s16 y, u32 *image); + +extern u32 *c16_tiles[10]; +extern const u16 *bittext_maps[10]; +extern u8 *pa16cdefaultsize[10]; +extern u8 c16policeheight[10]; + +void PA_16c8X8Color(u8 screen, s16 x, s16 y, u32 *image, u8 color); + +#define PA_Plot8Pixels(a,b,c,d) do{ PA_Draw1632[a][b] |= (d<>(32-c)); }while(0) + +static inline void PA_16c8pixels(u8 screen, s16 x, s16 y, u32 colors){ + PA_Plot8Pixels(screen, PA_16cPos(x+8, y+8), ((x&7)<<2), colors); +} + +static inline void PA_16c16X16Letter(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color){ + u16 firstpos = ((letter&31)<<1)+((letter >> 5)<<7); + PA_16c8X8Color(screen, x, y, (c16_tiles[size]+(bittext_maps[size][firstpos]<<3)), color); + PA_16c8X8Color(screen, x, y+8, (c16_tiles[size]+(bittext_maps[size][firstpos+64]<<3)), color); + firstpos ++; + PA_16c8X8Color(screen, x+8, y, (c16_tiles[size]+(bittext_maps[size][firstpos]<<3)), color); + PA_16c8X8Color(screen, x+8, y+8, (c16_tiles[size]+(bittext_maps[size][firstpos+64]<<3)), color); +} + +static inline void PA_16c8X8Letter(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color){ + PA_16c8X8Color(screen, x, y, (c16_tiles[size]+(bittext_maps[size][letter]<<3)), color); +} + +/** @defgroup c16 16color pseudo-bitmap mode + * Special 16color background on which you can paste images. Usefull to show shots in SHMUP ! + * @{ + */ + +/*! \fn void PA_Init16cBg(u8 screen, u8 bg) + \brief + \~english Initialise 16color background on which you can paste images... + \~french Initialise le mode de dessin 16 couleurs, sur lequel on peut coller de petites images... + \~\param screen + \~english Choose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg + \~english Background number (0-3) + \~english Background number (0-3) +*/ +void PA_Init16cBgEx(u8 screen, u8 bg, u8 npalette); + +/*! \fn static inline void PA_Init16cBg(u8 screen, u8 bg) + \brief + \~english Initialise 16color background on which you can paste images... Using palette 0 + \~french Initialise le mode de dessin 16 couleurs, sur lequel on peut coller de petites images... Utilisant la palette 0 + \~\param screen + \~english Choose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg + \~english Background number (0-3) + \~english Background number (0-3) +*/ +static inline void PA_Init16cBg(u8 screen, u8 bg){ + PA_Init16cBgEx(screen, bg, 0); +} + +/*! \fn static inline void PA_16cErase(u8 screen) + \brief + \~english Erase the 16color background. Must be used right after PA_WaitForVBL to avoid glitches + \~french Effacer un écran de 16 couleurs. Doit être utilisé juste après PA_WaitForVBL pour éviter des erreurs d'affichage + \~\param screen + \~english Choose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) +*/ +void PA_16cErase(u8 screen); + + + +/*! \fn static inline void PA_Dual16cErase(void) + \brief + \~english Erase the 16color background on both screens. Must be used right after PA_WaitForVBL to avoid glitches + \~french Effacer un écran de 16 couleurs sur les 2 écrans. Doit être utilisé juste après PA_WaitForVBL pour éviter des erreurs d'affichage +*/ +static inline void PA_Dual16cErase(void){ + PA_16cErase(0); PA_16cErase(1); +} + + +/*! \fn static inline void PA_InitComplete16c(u8 bg, void *Palette) + \brief + \~english Initialise a 16color background on each screen and give them a given palette + \~french Initialise le mode de dessin 16 couleurs sur les 2 écrans avec une palette donnée + \~\param bg + \~english Background number + \~french Numéro du fond + \~\param Palette + \~english 16 color palette... + \~french Palette de 16 couleurs +*/ +static inline void PA_InitComplete16c(u8 bg, void *Palette){ + PA_LoadPal16c(PAL_BG0, Palette); + PA_LoadPal16c(PAL_BG1, Palette); + PA_Init16cBg(0, bg); PA_Init16cBg(1, bg); +} + + +/*! \fn s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, s32 limit) + \brief + \~english This is a variable width and variable size function to draw text on the screen. + \~french Cette fonction permet d'écrire du texte à chasse variable à l'écran. + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param basex + \~english X coordinate of the top left corner + \~french Coordonnée X du coin supérieur gauche + \~\param basey + \~english Y coordinate of the top left corner + \~french Coordonnée Y du coin supérieur gauche + \~\param maxx + \~english X coordinate of the down right corner + \~french Coordonnée X du coin inférieur droit + \~\param maxy + \~english Y coordinate of the down right corner + \~french Coordonnée Y du coin inférieur droit + \~\param text + \~english Text, such as "Hello World" + \~french Texte, tel que "Hello World" + \~\param color + \~english Palette color to use (0-255) + \~french Couleur de la palette à utiliser (0-255) + \~\param size + \~english Size of the text, from 0 (really small) to 4 (pretty big) + \~french Taille du texte, de 0 (vraiment petit) à 4 (assez grand) + \~\param limit + \~english You can give a maximum number of characters to output. This can be usefull to have a slowing drawing text (allow to draw 1 more character each frame...) + \~french On peut fixer une limite au nombre de caractères. Ceci peut etre utile pour dessiner un texte progressivement, en augmentant de 1 le nombre de caractères à chaque boucle.... +*/ +s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, s32 limit); + +/*! \def PA_16cCustomFont(c16_slot, c16_font) + \deprecated + \brief + \~english [DEPRECATED] Add custom fonts to the 16cText system !! Font must be converted with PAGfx + \~french [DEPRECATED] Ajouter une police perso dans le systeme de texte 16c !! Doit être convertie avec PAGfx + \~\param c16_slot + \~english Font slot... 0-4 are used by the defaut PAlib fonts, 5-9 are free to use. You can freely overwrite the PAlib fonts if you want + \~french Slot pour ajouter la police. Les slots 0-4 sont utilisés pour les polices par défaut de PAlib, et 5-9 sont libres. On peut néanmoins charger par-dessus les polices PAlib si on veut. + \~\param c16_font + \~english Font name... + \~french Nom de la police... +*/ +#define PA_16cCustomFont(c16_slot, c16_font) do{\ + PA_DEPRECATED_MACRO;\ + bittext_maps[c16_slot] = (u16*)(void*)c16_font##_Map;\ + c16_tiles[c16_slot] = (u32*)(void*)c16_font##_Tiles;\ + pa_bittextdefaultsize[c16_slot] = (u8*)c16_font##_Sizes;\ + pa_bittextpoliceheight[c16_slot] = c16_font##_Height;\ +}while(0) + + +/*! \fn void PA_Add16cFont(int slot, const PA_BgStruct* font) + \brief + \~english Add a custom font to the 16c font system. + \~french Ajouter une police perso dans le système de texte 16c. + \~\param slot + \~english Font slot. 0-4 are used by the default PAlib fonts, 5-9 are free to use. You can freely overwrite the PAlib fonts if you want. + \~french Slot pour ajouter la police. Les slots 0-4 sont utilisés pour les polices par défaut de PAlib, et 5-9 sont libres. On peut néanmoins charger par-dessus les polices PAlib si on veut. + \~\param font + \~english Pointer to the font. + \~french Pointeur vers le police perso. +*/ +void PA_Add16cFont(int slot, const PA_BgStruct* font); + +/*! \fn ALWAYSINLINE PA_16cPutPixel(u8 screen, s16 x, s16 y, u32 color) + \brief + \~english Plot a pixel on a 16c background + \~french Afficher un pixel sur un fond 16c + \~\param screen + \~english Screen... + \~french Ecran... + \~\param x + \~english X position in pixels of the top left corner. Note that it ranges from -8 to 263, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches + \~french Position X en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 263, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... + \~\param y + \~english y position in pixels of the top left corner. Note that it ranges from -8 to 199, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches + \~french Position y en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 199, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... + \~\param color + \~english Pixel value (0-15, uses the loaded palette) + \~french Valeur du pixel (0-15, prend la couleur dans la palette chargée) +*/ +ALWAYSINLINE void PA_16cPutPixel(u8 screen, s16 x, s16 y, u32 color){ + x += 8; y += 8; + u16 temp = (x&7)<<2; + u16 pos = PA_16cPos(x, y); + PA_Draw1632[screen][pos] = (color<>temp); + PA_Draw1632[screen][pos+1] |= (image[1]>>temp); + PA_Draw1632[screen][pos+2] |= (image[2]>>temp); + PA_Draw1632[screen][pos+3] |= (image[3]>>temp); +} + +/*! \fn ALWAYSINLINE void PA_16c8X6(u8 screen, s16 x, s16 y, u32 *image) + \brief + \~english Load an 8x6 pixels image at a given position. Second fastest of all pasting functions + \~french Afficher une image de 8x6 pixels à un endroit donné, deuxième fonction la plus rapide de copie... + \~\param screen + \~english Screen... + \~french Ecran... + \~\param x + \~english X position in pixels of the top left corner. Note that it ranges from -8 to 255, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches + \~french Position X en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 255, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... + \~\param y + \~english y position in pixels of the top left corner. Note that it ranges from -8 to 191, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches + \~french Position y en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 191, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... + \~\param image + \~english 16 color image to load. Use (u32*)ImageName if you get an error... + \~french Image en 16 couleurs à charger. Utiliser (u32*)NomImage en cas d'erreur de compilation +*/ +ALWAYSINLINE void PA_16c8X6(u8 screen, s16 x, s16 y, u32 *image){ + + x += 8; y += 8; + u16 temp = (x&7)<<2; + u16 pos = PA_16cPos(x, y); + PA_Plot8Pixels(screen, pos, temp, image[0]); + PA_Plot8Pixels(screen, pos+1, temp, image[1]); + PA_Plot8Pixels(screen, pos+2, temp, image[2]); + PA_Plot8Pixels(screen, pos+3, temp, image[3]); + PA_Plot8Pixels(screen, pos+4, temp, image[4]); + PA_Plot8Pixels(screen, pos+5, temp, image[5]); +} + +/*! \fn ALWAYSINLINE void PA_16c8X8(u8 screen, s16 x, s16 y, u32 *image) + \brief + \~english Load an 8x8 pixels image at a given position. + \~french Afficher une image de 8x8 pixels à un endroit donné. + \~\param screen + \~english Screen... + \~french Ecran... + \~\param x + \~english X position in pixels of the top left corner. Note that it ranges from -8 to 255, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches + \~french Position X en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 255, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... + \~\param y + \~english y position in pixels of the top left corner. Note that it ranges from -8 to 191, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches + \~french Position y en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 191, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... + \~\param image + \~english 16 color image to load. Use (u32*)ImageName if you get an error... + \~french Image en 16 couleurs à charger. Utiliser (u32*)NomImage en cas d'erreur de compilation +*/ +ALWAYSINLINE void PA_16c8X8(u8 screen, s16 x, s16 y, u32 *image){ + x += 8; y += 8; + u16 temp = (x&7)<<2; + u16 pos = PA_16cPos(x, y); + PA_Draw1632[screen][pos] |= (image[0]<>temp); + PA_Draw1632[screen][pos+1] |= (image[1]>>temp); + PA_Draw1632[screen][pos+2] |= (image[2]>>temp); + PA_Draw1632[screen][pos+3] |= (image[3]>>temp); + PA_Draw1632[screen][pos+4] |= (image[4]>>temp); + PA_Draw1632[screen][pos+5] |= (image[5]>>temp); + PA_Draw1632[screen][pos+6] |= (image[6]>>temp); + PA_Draw1632[screen][pos+7] |= (image[7]>>temp); +} + +ALWAYSINLINE void PA_16c16X8(u8 screen, s16 x, s16 y, u32 *image){ + x += 8; y += 8; + u16 temp = (x&7)<<2; + u16 pos = PA_16cPos(x, y); + u8 i; + for (i = 0; i < 2; i++){ + PA_Plot8Pixels(screen, pos, temp, image[0]); + PA_Plot8Pixels(screen, pos+1, temp, image[1]); + PA_Plot8Pixels(screen, pos+2, temp, image[2]); + PA_Plot8Pixels(screen, pos+3, temp, image[3]); + PA_Plot8Pixels(screen, pos+4, temp, image[4]); + PA_Plot8Pixels(screen, pos+5, temp, image[5]); + PA_Plot8Pixels(screen, pos+6, temp, image[6]); + PA_Plot8Pixels(screen, pos+7, temp, image[7]); + pos+=26*8; + image+=8; + } +} + +ALWAYSINLINE void PA_16c16X12(u8 screen, s16 x, s16 y, u32 *image){ + + x += 8; y += 8; + u16 temp = (x&7)<<2; + u16 pos = PA_16cPos(x, y); + u8 i; + for (i = 0; i < 2; i++){ + PA_Plot8Pixels(screen, pos, temp, image[0]); + PA_Plot8Pixels(screen, pos+1, temp, image[1]); + PA_Plot8Pixels(screen, pos+2, temp, image[2]); + PA_Plot8Pixels(screen, pos+3, temp, image[3]); + PA_Plot8Pixels(screen, pos+4, temp, image[4]); + PA_Plot8Pixels(screen, pos+5, temp, image[5]); + PA_Plot8Pixels(screen, pos+6, temp, image[6]); + PA_Plot8Pixels(screen, pos+7, temp, image[7]); + PA_Plot8Pixels(screen, pos+8, temp, image[16]); + PA_Plot8Pixels(screen, pos+9, temp, image[17]); + PA_Plot8Pixels(screen, pos+10, temp, image[18]); + PA_Plot8Pixels(screen, pos+11, temp, image[19]); + pos+=26*8; + image+=8; + } +} + +ALWAYSINLINE void PA_16c16X16(u8 screen, s16 x, s16 y, u32 *image){ + x += 8; y += 8; + + u16 temp = (x&7)<<2; + u16 pos = PA_16cPos(x, y); + u8 i; + for (i = 0; i < 2; i++){ + PA_Plot8Pixels(screen, pos, temp, image[0]); + PA_Plot8Pixels(screen, pos+1, temp, image[1]); + PA_Plot8Pixels(screen, pos+2, temp, image[2]); + PA_Plot8Pixels(screen, pos+3, temp, image[3]); + PA_Plot8Pixels(screen, pos+4, temp, image[4]); + PA_Plot8Pixels(screen, pos+5, temp, image[5]); + PA_Plot8Pixels(screen, pos+6, temp, image[6]); + PA_Plot8Pixels(screen, pos+7, temp, image[7]); + PA_Plot8Pixels(screen, pos+8, temp, image[16]); + PA_Plot8Pixels(screen, pos+9, temp, image[17]); + PA_Plot8Pixels(screen, pos+10, temp, image[18]); + PA_Plot8Pixels(screen, pos+11, temp, image[19]); + PA_Plot8Pixels(screen, pos+12, temp, image[20]); + PA_Plot8Pixels(screen, pos+13, temp, image[21]); + PA_Plot8Pixels(screen, pos+14, temp, image[22]); + PA_Plot8Pixels(screen, pos+15, temp, image[23]); + pos+=26*8; + image+=8; + } +} + +/*! \fn ALWAYSINLINE void PA_16c8Xi(u8 screen, s16 x, s16 y, u32 *image,u8 i) + \brief + \~english Load an 8xi row from a 8x16 pixels image at a given position. If i>16 the image is repeated. + \~french Afficher une image de 8x8 pixels à un endroit donné. + \~\param screen + \~english Screen... + \~french Ecran... + \~\param x + \~english X position in pixels of the top left corner. Note that it ranges from -8 to 255, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches + \~french Position X en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 255, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... + \~\param y + \~english y position in pixels of the top left corner. Note that it ranges from -8 to 191, in order to allow half-way offscreen images. NEVER DRAW BEYOND THESE LIMITS, or else you'll get major background glitches + \~french Position y en pixels du coin supérieur gauche. A noter que celle-ci va de -8 à 191, afin de permettre des images à moitié sorties... NE JAMAIS DEPASSER DU CADRE, sous peine de gros bugs graphiques... + \~\param image + \~english 16 color image to load. Use (u32*)ImageName if you get an error... + \~french Image en 16 couleurs à charger. Utiliser (u32*)NomImage en cas d'erreur de compilation + \~\param i + \~english Number of lines of the image drawn (if greater than 16 the image will be repeated). + \~french Nombre de lignes à dessiner +*/ +ALWAYSINLINE void PA_16c8Xi(u8 screen, s16 x, s16 y, u32 *image, u8 i){ + x += 8; y += 8; + u16 temp = ((x)&7)<<2; + u16 temp2 = 32-temp; + u16 pos = PA_16cPos(x, y); + u16 pos2 = pos + 208; // Next columns + u8 j=0; + while (j>temp2); + ++j; + } +} + +static inline void PA_16cLetter(u8 screen, s16 x, s16 y, char letter, u8 size, u8 color){ + if (pa_bittextpoliceheight[size]<=8) PA_16c8X8Letter(screen, x, y, letter, size, color); + else PA_16c16X16Letter(screen, x, y, letter, size, color); +} + +/*! \fn void PA_16cClearZone(u8 screen, s16 x1, s16 y1, s16 x2, s16 y2) + \brief + \~english Erase a 16c background zone + \~french Effacer une partie d'un fond 16c + \~\param screen + \~english Screen... + \~french Ecran... + \~\param x1 + \~english Upper left corner... + \~french Coin supérieur gauche... + \~\param y1 + \~english Upper left corner... + \~french Coin supérieur gauche... + \~\param x2 + \~english Lower right corner... + \~french Coin inférieur droit... + \~\param y2 + \~english Lower right corner... + \~french Coin inférieur droit... +*/ +void PA_16cClearZone(u8 screen, s16 x1, s16 y1, s16 x2, s16 y2); + +/*! \fn static inline u8 PA_16cGetPixel(u8 screen, s16 x, s16 y) + \brief + \~english Returns the pixel value of a given point on a 16c background + \~french Renvoie la valeur d'un pixel donné sur un fond 16c + \~\param screen + \~english Screen... + \~french Ecran... + \~\param x + \~english X value... + \~french Valeur X... + \~\param y + \~english Y value... + \~french Valeur Y... +*/ +static inline u8 PA_16cGetPixel(u8 screen, s16 x, s16 y){ + x += 8; y += 8; + u16 temp = (x&7)<<2; + u16 pos = PA_16cPos(x, y); + return (PA_Draw1632[screen][pos]&(15<>temp; +} + +// For backwards compatibility.... +#define PA_16cTextAlign(align) PA_TextAlign(align) +#define PA_16cTextLineSpacing(spacing) PA_TextLineSpacing(spacing) +#define PA_16cTextLetterSpacing(spacing) PA_TextLetterSpacing(spacing) +#define PA_16cSetTextRot(rotate) textinfo.rot = rotate +s16 PA_16cTextRot(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text, u8 color, u8 size, s32 limit); + +extern u32 buffer16c[8]; + +/** @} */ // end of 16c + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_3DSprites.h b/include/arm9/PA_3DSprites.h index 44e7eec..bdc4e46 100644 --- a/include/arm9/PA_3DSprites.h +++ b/include/arm9/PA_3DSprites.h @@ -1,441 +1,441 @@ -#ifndef _PA_3DSPRITES_ -#define _PA_3DSPRITES_ - -static inline u16 PA_GetGifWidth(void* gif); -static inline u16 PA_GetGifHeight(void* gif); - -#define PA_NMAXSPRITES 1024 - -#define TEX_A3I5 1 -#define TEX_A5I3 6 -#define TEX_4COL 2 -#define TEX_16COL 3 -#define TEX_256COL 4 -#define TEX_16BITS 7 - -#define BLOCKSIZE_3D 16 // Minimal block size - -#define N_TEXTURES 1024 -extern s16 obj_per_gfx3D[N_TEXTURES]; - -static inline void PA_Set3D(bool texture_mapping, bool shader, bool alpha_test, bool alpha_blend, - bool antialias, bool edgemark, bool fog_mode, bool fog, u8 fog_shift, bool rearplane){ - GFX_CONTROL = texture_mapping | (shader<<1) | (alpha_test<<2) | (alpha_blend<<3) | (antialias<<4) - | (edgemark<<5) | (fog_mode<<6) | (fog<<7) | (fog_shift<<8) | (rearplane<<14); -} - -void PA_Load3DSpritePal(u16 palette_number, void* palette); - -typedef struct{ - s16 x, y; -}pa3dcorners; - -typedef struct{ - u8 Alive; - s32 X, Y; - s32 ImgWidth, ImgHeight; - s32 Width, Height, Tex; - s32 RotX, RotY, RotZ; - u8 Hflip, Vflip; - u16 textureID; - u16 palette; // Palette... - u16 Priority; - pa3dcorners corner[4]; // Corners... - u8 alpha, polyID; -}pa3dsprites; -extern pa3dsprites pa_3dsprites[PA_NMAXSPRITES]; - -extern uint32 textures[MAX_TEXTURES]; -extern void *texturesptr[MAX_TEXTURES]; // for updates... -extern uint32 activeTexture; - -typedef struct{ - s32 firstframe, lastframe, currentframe; // frames... - s8 framechange; // 1 by default, -1 to go back... - s32 time; // Time... - u8 type; - s16 speed; - u8 play; - s32 ncycles; -}type_3danims; -extern type_3danims sprite3danims[PA_NMAXSPRITES]; -extern u16 n3Dspriteanims; - -static inline void PA_glTexParameter(uint8 sizeX, uint8 sizeY, uint32* addr, uint8 mode, uint32 param){ - textures[activeTexture] = param | (sizeX << 20) | (sizeY << 23) - | (((uint32)addr>>3) & 0xFFFF) | (mode << 26) | (1<<29); // 1 << 29 to set background color to blank -} - -/*! \file PA_3DSprites.h - \brief Sprites on one screen using the DS's 3D GPU - - Allows to have up to 2048 sprites of pretty much any size! -*/ - -/** @defgroup f3DSprites 3D Sprite System - * Sprites on one screen using the DS's 3D GPU - * @{ - */ - -/// Initializes 3D. -void PA_Init3D(); -/// Initializes 3D taking two banks of VRAM. -void PA_Init3D2Banks(); -/// Renders the 3D sprites. -void PA_3DProcess(); -/// Creates a 3D texture. -s16 PA_3DCreateTex(void* obj_data, u16 width, u16 height, u8 type); -/// Creates a 3D sprite from a texture. -void PA_3DCreateSpriteFromTex(u16 sprite, u16 texture, u16 width, u16 height, u8 palette, s16 x, s16 y); -/// Resets the 3D system. -void PA_Reset3DSprites(); -/// Resets the dual bank 3D system. -void PA_Reset3DSprites2Banks(); - -/// Creates a 3D sprite -static inline u16 PA_3DCreateSprite(u16 sprite, void *image, u16 width, u16 height, u8 type, u8 palette, s16 x, s16 y){ - u16 tex_gfx = PA_3DCreateTex(image, width, height, type); - PA_3DCreateSpriteFromTex(sprite, tex_gfx, width, height, palette, x, y); - obj_per_gfx3D[tex_gfx] --; - return tex_gfx; -} - -/// Deletes a 3D texture. -void PA_3DDeleteTex(u32 tex_gfx); // Delete... - -/// Deletes a 3D sprite. -static inline void PA_3DDeleteSprite(u16 sprite){ - pa_3dsprites[sprite].Alive = 0; - u16 tex_gfx = pa_3dsprites[sprite].textureID; - obj_per_gfx3D[tex_gfx] --; - if(obj_per_gfx3D[tex_gfx] == 0) PA_3DDeleteTex(tex_gfx); // Delete if only sprite to use the gfx... -} - -/// Moves a 3D sprite in the X axis. -static inline void PA_3DSetSpriteX(u16 sprite, s16 x){ - pa_3dsprites[sprite].X = x; -} - -/// Moves a 3D sprite in the Y axis. -static inline void PA_3DSetSpriteY(u16 sprite, s16 y){ - pa_3dsprites[sprite].Y = y; -} - -/// Moves a 3D sprite. -static inline void PA_3DSetSpriteXY(u16 sprite, s16 x, s16 y){ - pa_3dsprites[sprite].X = x; - pa_3dsprites[sprite].Y = y; -} - -/// Rotates a 3D sprite in the X axis. -static inline void PA_3DSetSpriteRotateX(u16 sprite, s16 rotateX){ - pa_3dsprites[sprite].RotX = rotateX; -} - -/// Rotates a 3D sprite in the Y axis. -static inline void PA_3DSetSpriteRotateY(u16 sprite, s16 rotateY){ - pa_3dsprites[sprite].RotY = rotateY; -} - -/// Rotates a 3D sprite in the Z axis. -static inline void PA_3DSetSpriteRotateZ(u16 sprite, s16 rotate){ - pa_3dsprites[sprite].RotZ = rotate; -} - -/// Rotates a 3D sprite. -static inline void PA_3DSetSpriteRotateXYZ(u16 sprite, s16 rotateX, s16 rotateY, s16 rotateZ){ - pa_3dsprites[sprite].RotX = rotateX; - pa_3dsprites[sprite].RotY = rotateY; - pa_3dsprites[sprite].RotZ = rotateZ; -} - -/// Zooms a 3D sprite horizontally. -static inline void PA_3DSetSpriteZoomX(u16 sprite, float zoomx){ - pa_3dsprites[sprite].Width = (s32)(pa_3dsprites[sprite].ImgWidth * zoomx); -} - -/// Zooms a 3D sprite vertically. -static inline void PA_3DSetSpriteZoomY(u16 sprite, float zoomy){ - pa_3dsprites[sprite].Height = (s32)(pa_3dsprites[sprite].ImgHeight * zoomy); -} - -/// Zooms a 3D sprite. -static inline void PA_3DSetSpriteZoomXY(u16 sprite, float zoomx, float zoomy){ - pa_3dsprites[sprite].Width = (s32)(pa_3dsprites[sprite].ImgWidth * zoomx); - pa_3dsprites[sprite].Height = (s32)(pa_3dsprites[sprite].ImgHeight * zoomy); -} - -/// Changes the width of a 3D sprite. -static inline void PA_3DSetSpriteWidth(u16 sprite, u16 width){ - pa_3dsprites[sprite].Width = width; -} - -/// Changes the height of a 3D sprite. -static inline void PA_3DSetSpriteHeight(u16 sprite, u16 height){ - pa_3dsprites[sprite].Height = height; -} - -/// Changes the size of a 3D sprite. -static inline void PA_3DSetSpriteWidthHeight(u16 sprite, u16 width, u16 height){ - PA_3DSetSpriteWidth(sprite, width); - PA_3DSetSpriteHeight(sprite, height); -} - -/// Sets the HFlip of a 3D sprite. -static inline void PA_3DSetSpriteHflip(u16 sprite, u8 hflip){ - pa_3dsprites[sprite].Hflip = hflip; -} - -/// Sets the VFlip of a 3D sprite. -static inline void PA_3DSetSpriteVflip(u16 sprite, u8 vflip){ - pa_3dsprites[sprite].Vflip = vflip; -} - -/// Retrives if a 3D sprite is being touched by the stylus. -static inline u8 PA_3DSpriteTouched(u16 sprite){ - // No comment. - return PA_StylusInZone((pa_3dsprites[sprite].X-(pa_3dsprites[sprite].Width>>1)), (pa_3dsprites[sprite].Y-(pa_3dsprites[sprite].Height>>1)), - (pa_3dsprites[sprite].X+(pa_3dsprites[sprite].Width>>1)), (pa_3dsprites[sprite].Y+(pa_3dsprites[sprite].Height>>1))); -} - -/// Sets the texture of a 3D sprite. -static inline void PA_3DSetSpriteTex(u16 sprite, u16 texture){ - pa_3dsprites[sprite].textureID = texture; -} - -/// Sets the palette of a 3D sprite. -static inline void PA_3DSetSpritePal(u16 sprite, u16 palette){ - pa_3dsprites[sprite].palette = palette; -} - -void PA_3DUpdateGfx(u16 texture, void *image); - -/// Sets the animation frame of a 3D sprite. -void PA_3DSetSpriteFrame(u16 sprite, u16 frame); - -/// Sets the top left corner of a 3D sprite. -static inline void PA_3DSetSpriteTopLeft(u16 sprite, s16 x, s16 y){ - pa_3dsprites[sprite].corner[0].x = x; - pa_3dsprites[sprite].corner[0].y = y; -} - -/// Sets the top right corner of a 3D sprite. -static inline void PA_3DSetSpriteTopRight(u16 sprite, s16 x, s16 y){ - pa_3dsprites[sprite].corner[1].x = x; - pa_3dsprites[sprite].corner[1].y = y; -} - -/// Sets the bottom left corner of a 3D sprite. -static inline void PA_3DSetSpriteBottomLeft(u16 sprite, s16 x, s16 y){ - pa_3dsprites[sprite].corner[2].x = x; - pa_3dsprites[sprite].corner[2].y = y; -} - -/// Sets the bottom right corner of a 3D sprite. -static inline void PA_3DSetSpriteBottomRight(u16 sprite, s16 x, s16 y){ - pa_3dsprites[sprite].corner[3].x = x; - pa_3dsprites[sprite].corner[3].y = y; -} - -/// Sets the priority of a 3D sprite. -static inline void PA_3DSetSpritePrio(u16 sprite, u16 priority){ - pa_3dsprites[sprite].Priority = priority; -} - -/// Sets the PolyID of a 3D sprite. -static inline void PA_3DSetSpritePolyID(u16 sprite, u8 polyID){ - pa_3dsprites[sprite].polyID = polyID; -} - -/// Sets the alpha value of a 3D sprite. -static inline void PA_3DSetSpriteAlpha(u16 sprite, u8 alpha){ - pa_3dsprites[sprite].alpha = alpha; -} - -/*! \fn void PA_3DStartSpriteAnimEx(u16 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles) - \brief - \~english Start a 3D sprite animation. Once started, it continues on and on by itself until you stop it ! - \~french Démarre une animation de sprite. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param firstframe - \~english First frame of the animation sequence, most of the time 0... - \~french Premières image de l'animation, généralement 0.... - \~\param lastframe - \~english Last frame to be displayed. When it gets there, it loops back to the first frame - \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première - \~\param speed - \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame - \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... - \~\param type - \~english Defines how you want it to loop. ANIM_LOOP (0) for a normal loop, ANIM_UPDOWN (1) for back and forth animation. - \~french Défini de quelle manière on veut boucler. ANIM_LOOP (0) pour normal, et ANIM_UPDOWN (1) pour d'avant en arrière - \~\param ncycles - \~english Number of animation cycles before stopping. If using ANIM_UPDOWN, it takes 2 cycles to come back to the original image - \~french Nombres de cycles d'animations avant l'arrêt. Si on utilise ANIM_UPDOWN, il faut 2 cycles pour que l'animation revienne à l'image de base -*/ - -void PA_3DStartSpriteAnimEx(u16 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles); - -/*! \fn static inline void PA_3DStartSpriteAnim(u16 sprite, s16 firstframe, s16 lastframe, s16 speed) - \brief - \~english Start a sprite animation. Once started, it continues on and on by itself until you stop it ! - \~french Démarre une animation de sprite. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param firstframe - \~english First frame of the animation sequence, most of the time 0... - \~french Premières image de l'animation, généralement 0.... - \~\param lastframe - \~english Last frame to be displayed. When it gets there, it loops back to the first frame - \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première - \~\param speed - \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame - \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... -*/ -static inline void PA_3DStartSpriteAnim(u16 sprite, s16 firstframe, s16 lastframe, s16 speed){ - PA_3DStartSpriteAnimEx(sprite, firstframe, lastframe, speed, ANIM_INFINITE); -} - -/*! \fn static inline void PA_3DStopSpriteAnim(u16 sprite) - \brief - \~english Stop a sprite animation - \~french Arrêter une animation de sprite - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ - -static inline void PA_3DStopSpriteAnim(u16 sprite){ - if (sprite3danims[sprite].play) n3Dspriteanims --; - sprite3danims[sprite].play = 0; -} - -/*! \fn static inline void PA_3DSetSpriteAnimFrame(u16 sprite, u16 frame) - \brief - \~english Set the current animation frame number - \~french Changer le numéro actuel de la frame d'animation - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param frame - \~english Frame number to use... - \~french Numéro de frame... -*/ - -static inline void PA_3DSetSpriteAnimFrame(u16 sprite, u16 frame){ - if(sprite3danims[sprite].currentframe != frame){ - PA_3DSetSpriteFrame(sprite, frame); - sprite3danims[sprite].currentframe = frame; - } -} - -/*! \fn static inline u16 PA_3DGetSpriteAnimFrame( u16 sprite) - \brief - \~english Returns the current animation frame number - \~french Renvoie le numéro actuel de la frame d'animation - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ - -static inline u16 PA_3DGetSpriteAnimFrame(u16 sprite){ - return sprite3danims[sprite].currentframe; -} - -/*! \fn static inline void PA_3DSetSpriteAnimSpeed(u16 sprite, s16 speed) - \brief - \~english Set the current animation speed - \~french Changer la vitesse de l'animation - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param speed - \~english Speed, in fps... - \~french Vitesse, en fps... -*/ -static inline void PA_3DSetSpriteAnimSpeed(u16 sprite, s16 speed){ - sprite3danims[sprite].speed = speed; -} - -/*! \fn static inline u16 PA_3DGetSpriteAnimSpeed(u16 sprite) - \brief - \~english Returns the current animation speed - \~french Renvoie la vitesse de l'animation - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline u16 PA_3DGetSpriteAnimSpeed(u16 sprite){ - return sprite3danims[sprite].speed; -} - - -/*! \fn static inline void PA_3DSetSpriteNCycles(u16 sprite, s16 NCycles) - \brief - \~english Set the current animation cycles left (-1 for inifinite loop) - \~french Changer le nombre de cycles d'animation restant (-1 pour inifini) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param NCycles - \~english Number of cycles - \~french Nombre de cycles -*/ -static inline void PA_3DSetSpriteNCycles(u16 sprite, s16 NCycles){ - sprite3danims[sprite].ncycles = NCycles; -} - -/*! \fn static inline u16 PA_3DGetSpriteNCycles(u16 sprite) - \brief - \~english Returns the current number of animation cycles left - \~french Renvoie le nombre de cycles d'animation restants - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline u16 PA_3DGetSpriteNCycles(u16 sprite){ - return sprite3danims[sprite].speed; -} - -/*! \fn static inline u16 PA_3DSpriteAnimPause(u16 sprite, u8 pause) - \brief - \~english Pause or UnPause a sprite animation - \~french Mettre en Pause en remettre en lecture une animation de sprite - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param pause - \~english 1 for pause, 0 for unpause - \~french 1 pour pause, 0 pour reprendre la lecture... -*/ -static inline void PA_3DSpriteAnimPause(u16 sprite, u8 pause){ - if(pause && sprite3danims[sprite].play) n3Dspriteanims --; - else if(!(pause) && !(sprite3danims[sprite].play)) n3Dspriteanims ++; - sprite3danims[sprite].play = !pause; -} - -/* -void PA_GifToTexTransp(u16 color); - -u16 PA_3DCreateTexFromGif(void *gif, u8 palette); - -static inline void PA_3DCreateSpriteFromGif(u16 sprite, void *gif, u8 palette, s16 x, s16 y){ - PA_3DCreateSpriteFromTex(sprite, PA_3DCreateTexFromGif(gif, palette), PA_GetGifWidth(gif), PA_GetGifHeight(gif), palette, x, y); -} -*/ - -/// Gets the X value of a 3D sprite. -static inline s32 PA_3DGetSpriteX(u16 sprite){ return pa_3dsprites[sprite].X; } -/// Gets the Y value of a 3D sprite. -static inline s32 PA_3DGetSpriteY(u16 sprite){ return pa_3dsprites[sprite].Y; } -/// Retrieves if a 3D sprite is visible. -static inline void PA_3DSetSpriteVisible(u16 sprite, u8 visible){ pa_3dsprites[sprite].Alive = visible; } - -void PA_Init3DDual(void); - -/** @} */ // end of 3DSprites - -#endif +#ifndef _PA_3DSPRITES_ +#define _PA_3DSPRITES_ + +static inline u16 PA_GetGifWidth(void* gif); +static inline u16 PA_GetGifHeight(void* gif); + +#define PA_NMAXSPRITES 1024 + +#define TEX_A3I5 1 +#define TEX_A5I3 6 +#define TEX_4COL 2 +#define TEX_16COL 3 +#define TEX_256COL 4 +#define TEX_16BITS 7 + +#define BLOCKSIZE_3D 16 // Minimal block size + +#define N_TEXTURES 1024 +extern s16 obj_per_gfx3D[N_TEXTURES]; + +static inline void PA_Set3D(bool texture_mapping, bool shader, bool alpha_test, bool alpha_blend, + bool antialias, bool edgemark, bool fog_mode, bool fog, u8 fog_shift, bool rearplane){ + GFX_CONTROL = texture_mapping | (shader<<1) | (alpha_test<<2) | (alpha_blend<<3) | (antialias<<4) + | (edgemark<<5) | (fog_mode<<6) | (fog<<7) | (fog_shift<<8) | (rearplane<<14); +} + +void PA_Load3DSpritePal(u16 palette_number, void* palette); + +typedef struct{ + s16 x, y; +}pa3dcorners; + +typedef struct{ + u8 Alive; + s32 X, Y; + s32 ImgWidth, ImgHeight; + s32 Width, Height, Tex; + s32 RotX, RotY, RotZ; + u8 Hflip, Vflip; + u16 textureID; + u16 palette; // Palette... + u16 Priority; + pa3dcorners corner[4]; // Corners... + u8 alpha, polyID; +}pa3dsprites; +extern pa3dsprites pa_3dsprites[PA_NMAXSPRITES]; + +extern uint32 textures[MAX_TEXTURES]; +extern void *texturesptr[MAX_TEXTURES]; // for updates... +extern uint32 activeTexture; + +typedef struct{ + s32 firstframe, lastframe, currentframe; // frames... + s8 framechange; // 1 by default, -1 to go back... + s32 time; // Time... + u8 type; + s16 speed; + u8 play; + s32 ncycles; +}type_3danims; +extern type_3danims sprite3danims[PA_NMAXSPRITES]; +extern u16 n3Dspriteanims; + +static inline void PA_glTexParameter(uint8 sizeX, uint8 sizeY, uint32* addr, uint8 mode, uint32 param){ + textures[activeTexture] = param | (sizeX << 20) | (sizeY << 23) + | (((uint32)addr>>3) & 0xFFFF) | (mode << 26) | (1<<29); // 1 << 29 to set background color to blank +} + +/*! \file PA_3DSprites.h + \brief Sprites on one screen using the DS's 3D GPU + + Allows to have up to 2048 sprites of pretty much any size! +*/ + +/** @defgroup f3DSprites 3D Sprite System + * Sprites on one screen using the DS's 3D GPU + * @{ + */ + +/// Initializes 3D. +void PA_Init3D(); +/// Initializes 3D taking two banks of VRAM. +void PA_Init3D2Banks(); +/// Renders the 3D sprites. +void PA_3DProcess(); +/// Creates a 3D texture. +s16 PA_3DCreateTex(void* obj_data, u16 width, u16 height, u8 type); +/// Creates a 3D sprite from a texture. +void PA_3DCreateSpriteFromTex(u16 sprite, u16 texture, u16 width, u16 height, u8 palette, s16 x, s16 y); +/// Resets the 3D system. +void PA_Reset3DSprites(); +/// Resets the dual bank 3D system. +void PA_Reset3DSprites2Banks(); + +/// Creates a 3D sprite +static inline u16 PA_3DCreateSprite(u16 sprite, void *image, u16 width, u16 height, u8 type, u8 palette, s16 x, s16 y){ + u16 tex_gfx = PA_3DCreateTex(image, width, height, type); + PA_3DCreateSpriteFromTex(sprite, tex_gfx, width, height, palette, x, y); + obj_per_gfx3D[tex_gfx] --; + return tex_gfx; +} + +/// Deletes a 3D texture. +void PA_3DDeleteTex(u32 tex_gfx); // Delete... + +/// Deletes a 3D sprite. +static inline void PA_3DDeleteSprite(u16 sprite){ + pa_3dsprites[sprite].Alive = 0; + u16 tex_gfx = pa_3dsprites[sprite].textureID; + obj_per_gfx3D[tex_gfx] --; + if(obj_per_gfx3D[tex_gfx] == 0) PA_3DDeleteTex(tex_gfx); // Delete if only sprite to use the gfx... +} + +/// Moves a 3D sprite in the X axis. +static inline void PA_3DSetSpriteX(u16 sprite, s16 x){ + pa_3dsprites[sprite].X = x; +} + +/// Moves a 3D sprite in the Y axis. +static inline void PA_3DSetSpriteY(u16 sprite, s16 y){ + pa_3dsprites[sprite].Y = y; +} + +/// Moves a 3D sprite. +static inline void PA_3DSetSpriteXY(u16 sprite, s16 x, s16 y){ + pa_3dsprites[sprite].X = x; + pa_3dsprites[sprite].Y = y; +} + +/// Rotates a 3D sprite in the X axis. +static inline void PA_3DSetSpriteRotateX(u16 sprite, s16 rotateX){ + pa_3dsprites[sprite].RotX = rotateX; +} + +/// Rotates a 3D sprite in the Y axis. +static inline void PA_3DSetSpriteRotateY(u16 sprite, s16 rotateY){ + pa_3dsprites[sprite].RotY = rotateY; +} + +/// Rotates a 3D sprite in the Z axis. +static inline void PA_3DSetSpriteRotateZ(u16 sprite, s16 rotate){ + pa_3dsprites[sprite].RotZ = rotate; +} + +/// Rotates a 3D sprite. +static inline void PA_3DSetSpriteRotateXYZ(u16 sprite, s16 rotateX, s16 rotateY, s16 rotateZ){ + pa_3dsprites[sprite].RotX = rotateX; + pa_3dsprites[sprite].RotY = rotateY; + pa_3dsprites[sprite].RotZ = rotateZ; +} + +/// Zooms a 3D sprite horizontally. +static inline void PA_3DSetSpriteZoomX(u16 sprite, float zoomx){ + pa_3dsprites[sprite].Width = (s32)(pa_3dsprites[sprite].ImgWidth * zoomx); +} + +/// Zooms a 3D sprite vertically. +static inline void PA_3DSetSpriteZoomY(u16 sprite, float zoomy){ + pa_3dsprites[sprite].Height = (s32)(pa_3dsprites[sprite].ImgHeight * zoomy); +} + +/// Zooms a 3D sprite. +static inline void PA_3DSetSpriteZoomXY(u16 sprite, float zoomx, float zoomy){ + pa_3dsprites[sprite].Width = (s32)(pa_3dsprites[sprite].ImgWidth * zoomx); + pa_3dsprites[sprite].Height = (s32)(pa_3dsprites[sprite].ImgHeight * zoomy); +} + +/// Changes the width of a 3D sprite. +static inline void PA_3DSetSpriteWidth(u16 sprite, u16 width){ + pa_3dsprites[sprite].Width = width; +} + +/// Changes the height of a 3D sprite. +static inline void PA_3DSetSpriteHeight(u16 sprite, u16 height){ + pa_3dsprites[sprite].Height = height; +} + +/// Changes the size of a 3D sprite. +static inline void PA_3DSetSpriteWidthHeight(u16 sprite, u16 width, u16 height){ + PA_3DSetSpriteWidth(sprite, width); + PA_3DSetSpriteHeight(sprite, height); +} + +/// Sets the HFlip of a 3D sprite. +static inline void PA_3DSetSpriteHflip(u16 sprite, u8 hflip){ + pa_3dsprites[sprite].Hflip = hflip; +} + +/// Sets the VFlip of a 3D sprite. +static inline void PA_3DSetSpriteVflip(u16 sprite, u8 vflip){ + pa_3dsprites[sprite].Vflip = vflip; +} + +/// Retrives if a 3D sprite is being touched by the stylus. +static inline u8 PA_3DSpriteTouched(u16 sprite){ + // No comment. + return PA_StylusInZone((pa_3dsprites[sprite].X-(pa_3dsprites[sprite].Width>>1)), (pa_3dsprites[sprite].Y-(pa_3dsprites[sprite].Height>>1)), + (pa_3dsprites[sprite].X+(pa_3dsprites[sprite].Width>>1)), (pa_3dsprites[sprite].Y+(pa_3dsprites[sprite].Height>>1))); +} + +/// Sets the texture of a 3D sprite. +static inline void PA_3DSetSpriteTex(u16 sprite, u16 texture){ + pa_3dsprites[sprite].textureID = texture; +} + +/// Sets the palette of a 3D sprite. +static inline void PA_3DSetSpritePal(u16 sprite, u16 palette){ + pa_3dsprites[sprite].palette = palette; +} + +void PA_3DUpdateGfx(u16 texture, void *image); + +/// Sets the animation frame of a 3D sprite. +void PA_3DSetSpriteFrame(u16 sprite, u16 frame); + +/// Sets the top left corner of a 3D sprite. +static inline void PA_3DSetSpriteTopLeft(u16 sprite, s16 x, s16 y){ + pa_3dsprites[sprite].corner[0].x = x; + pa_3dsprites[sprite].corner[0].y = y; +} + +/// Sets the top right corner of a 3D sprite. +static inline void PA_3DSetSpriteTopRight(u16 sprite, s16 x, s16 y){ + pa_3dsprites[sprite].corner[1].x = x; + pa_3dsprites[sprite].corner[1].y = y; +} + +/// Sets the bottom left corner of a 3D sprite. +static inline void PA_3DSetSpriteBottomLeft(u16 sprite, s16 x, s16 y){ + pa_3dsprites[sprite].corner[2].x = x; + pa_3dsprites[sprite].corner[2].y = y; +} + +/// Sets the bottom right corner of a 3D sprite. +static inline void PA_3DSetSpriteBottomRight(u16 sprite, s16 x, s16 y){ + pa_3dsprites[sprite].corner[3].x = x; + pa_3dsprites[sprite].corner[3].y = y; +} + +/// Sets the priority of a 3D sprite. +static inline void PA_3DSetSpritePrio(u16 sprite, u16 priority){ + pa_3dsprites[sprite].Priority = priority; +} + +/// Sets the PolyID of a 3D sprite. +static inline void PA_3DSetSpritePolyID(u16 sprite, u8 polyID){ + pa_3dsprites[sprite].polyID = polyID; +} + +/// Sets the alpha value of a 3D sprite. +static inline void PA_3DSetSpriteAlpha(u16 sprite, u8 alpha){ + pa_3dsprites[sprite].alpha = alpha; +} + +/*! \fn void PA_3DStartSpriteAnimEx(u16 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles) + \brief + \~english Start a 3D sprite animation. Once started, it continues on and on by itself until you stop it ! + \~french Démarre une animation de sprite. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param firstframe + \~english First frame of the animation sequence, most of the time 0... + \~french Premières image de l'animation, généralement 0.... + \~\param lastframe + \~english Last frame to be displayed. When it gets there, it loops back to the first frame + \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première + \~\param speed + \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame + \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... + \~\param type + \~english Defines how you want it to loop. ANIM_LOOP (0) for a normal loop, ANIM_UPDOWN (1) for back and forth animation. + \~french Défini de quelle manière on veut boucler. ANIM_LOOP (0) pour normal, et ANIM_UPDOWN (1) pour d'avant en arrière + \~\param ncycles + \~english Number of animation cycles before stopping. If using ANIM_UPDOWN, it takes 2 cycles to come back to the original image + \~french Nombres de cycles d'animations avant l'arrêt. Si on utilise ANIM_UPDOWN, il faut 2 cycles pour que l'animation revienne à l'image de base +*/ + +void PA_3DStartSpriteAnimEx(u16 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles); + +/*! \fn static inline void PA_3DStartSpriteAnim(u16 sprite, s16 firstframe, s16 lastframe, s16 speed) + \brief + \~english Start a sprite animation. Once started, it continues on and on by itself until you stop it ! + \~french Démarre une animation de sprite. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param firstframe + \~english First frame of the animation sequence, most of the time 0... + \~french Premières image de l'animation, généralement 0.... + \~\param lastframe + \~english Last frame to be displayed. When it gets there, it loops back to the first frame + \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première + \~\param speed + \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame + \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... +*/ +static inline void PA_3DStartSpriteAnim(u16 sprite, s16 firstframe, s16 lastframe, s16 speed){ + PA_3DStartSpriteAnimEx(sprite, firstframe, lastframe, speed, ANIM_INFINITE); +} + +/*! \fn static inline void PA_3DStopSpriteAnim(u16 sprite) + \brief + \~english Stop a sprite animation + \~french Arrêter une animation de sprite + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ + +static inline void PA_3DStopSpriteAnim(u16 sprite){ + if (sprite3danims[sprite].play) n3Dspriteanims --; + sprite3danims[sprite].play = 0; +} + +/*! \fn static inline void PA_3DSetSpriteAnimFrame(u16 sprite, u16 frame) + \brief + \~english Set the current animation frame number + \~french Changer le numéro actuel de la frame d'animation + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param frame + \~english Frame number to use... + \~french Numéro de frame... +*/ + +static inline void PA_3DSetSpriteAnimFrame(u16 sprite, u16 frame){ + if(sprite3danims[sprite].currentframe != frame){ + PA_3DSetSpriteFrame(sprite, frame); + sprite3danims[sprite].currentframe = frame; + } +} + +/*! \fn static inline u16 PA_3DGetSpriteAnimFrame( u16 sprite) + \brief + \~english Returns the current animation frame number + \~french Renvoie le numéro actuel de la frame d'animation + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ + +static inline u16 PA_3DGetSpriteAnimFrame(u16 sprite){ + return sprite3danims[sprite].currentframe; +} + +/*! \fn static inline void PA_3DSetSpriteAnimSpeed(u16 sprite, s16 speed) + \brief + \~english Set the current animation speed + \~french Changer la vitesse de l'animation + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param speed + \~english Speed, in fps... + \~french Vitesse, en fps... +*/ +static inline void PA_3DSetSpriteAnimSpeed(u16 sprite, s16 speed){ + sprite3danims[sprite].speed = speed; +} + +/*! \fn static inline u16 PA_3DGetSpriteAnimSpeed(u16 sprite) + \brief + \~english Returns the current animation speed + \~french Renvoie la vitesse de l'animation + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline u16 PA_3DGetSpriteAnimSpeed(u16 sprite){ + return sprite3danims[sprite].speed; +} + + +/*! \fn static inline void PA_3DSetSpriteNCycles(u16 sprite, s16 NCycles) + \brief + \~english Set the current animation cycles left (-1 for inifinite loop) + \~french Changer le nombre de cycles d'animation restant (-1 pour inifini) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param NCycles + \~english Number of cycles + \~french Nombre de cycles +*/ +static inline void PA_3DSetSpriteNCycles(u16 sprite, s16 NCycles){ + sprite3danims[sprite].ncycles = NCycles; +} + +/*! \fn static inline u16 PA_3DGetSpriteNCycles(u16 sprite) + \brief + \~english Returns the current number of animation cycles left + \~french Renvoie le nombre de cycles d'animation restants + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline u16 PA_3DGetSpriteNCycles(u16 sprite){ + return sprite3danims[sprite].speed; +} + +/*! \fn static inline u16 PA_3DSpriteAnimPause(u16 sprite, u8 pause) + \brief + \~english Pause or UnPause a sprite animation + \~french Mettre en Pause en remettre en lecture une animation de sprite + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param pause + \~english 1 for pause, 0 for unpause + \~french 1 pour pause, 0 pour reprendre la lecture... +*/ +static inline void PA_3DSpriteAnimPause(u16 sprite, u8 pause){ + if(pause && sprite3danims[sprite].play) n3Dspriteanims --; + else if(!(pause) && !(sprite3danims[sprite].play)) n3Dspriteanims ++; + sprite3danims[sprite].play = !pause; +} + +/* +void PA_GifToTexTransp(u16 color); + +u16 PA_3DCreateTexFromGif(void *gif, u8 palette); + +static inline void PA_3DCreateSpriteFromGif(u16 sprite, void *gif, u8 palette, s16 x, s16 y){ + PA_3DCreateSpriteFromTex(sprite, PA_3DCreateTexFromGif(gif, palette), PA_GetGifWidth(gif), PA_GetGifHeight(gif), palette, x, y); +} +*/ + +/// Gets the X value of a 3D sprite. +static inline s32 PA_3DGetSpriteX(u16 sprite){ return pa_3dsprites[sprite].X; } +/// Gets the Y value of a 3D sprite. +static inline s32 PA_3DGetSpriteY(u16 sprite){ return pa_3dsprites[sprite].Y; } +/// Retrieves if a 3D sprite is visible. +static inline void PA_3DSetSpriteVisible(u16 sprite, u8 visible){ pa_3dsprites[sprite].Alive = visible; } + +void PA_Init3DDual(void); + +/** @} */ // end of 3DSprites + +#endif diff --git a/include/arm9/PA_Assert.h b/include/arm9/PA_Assert.h index a16518e..618d52d 100644 --- a/include/arm9/PA_Assert.h +++ b/include/arm9/PA_Assert.h @@ -1,37 +1,37 @@ -#pragma once - -#define __PAASSERT_CPP_START extern "C"{ -#define __PAASSERT_CPP_END } - -#ifdef __cplusplus -__PAASSERT_CPP_START -#endif - -/*! \addtogroup Debug - @{ -*/ - -/*! \def PA_Assert(c, m) - \brief - \~english Shows an error message if the condition is not true. - \~french Afficher un erreur si la condition est faux. - \~\param c - \~english Condition, like MyVar < 128 - \~french Condition, comme MyVar < 128 - \~\param m - \~english Error message - \~french Message d'erreur -*/ - -#ifdef NDEBUG -#define PA_Assert(c,m) ((void)0) -#else -#define PA_Assert(c,m) ((c) ? ((void)0) : _PA_Assert(#c, m, __FILE__, __LINE__)) -void _PA_Assert(const char* condition, const char* message, const char* file, int linen); -#endif - -/*! @} */ - -#ifdef __cplusplus -__PAASSERT_CPP_END -#endif +#pragma once + +#define __PAASSERT_CPP_START extern "C"{ +#define __PAASSERT_CPP_END } + +#ifdef __cplusplus +__PAASSERT_CPP_START +#endif + +/*! \addtogroup Debug + @{ +*/ + +/*! \def PA_Assert(c, m) + \brief + \~english Shows an error message if the condition is not true. + \~french Afficher un erreur si la condition est faux. + \~\param c + \~english Condition, like MyVar < 128 + \~french Condition, comme MyVar < 128 + \~\param m + \~english Error message + \~french Message d'erreur +*/ + +#ifdef NDEBUG +#define PA_Assert(c,m) ((void)0) +#else +#define PA_Assert(c,m) ((c) ? ((void)0) : _PA_Assert(#c, m, __FILE__, __LINE__)) +void _PA_Assert(const char* condition, const char* message, const char* file, int linen); +#endif + +/*! @} */ + +#ifdef __cplusplus +__PAASSERT_CPP_END +#endif diff --git a/include/arm9/PA_BgLargeMap.h b/include/arm9/PA_BgLargeMap.h index 20705b6..0c50fa4 100644 --- a/include/arm9/PA_BgLargeMap.h +++ b/include/arm9/PA_BgLargeMap.h @@ -1,282 +1,282 @@ -#ifndef _PA_BGLARGEMAP -#define _PA_BGLARGEMAP - -#include "PA_BgTiles.h" - -// Tile engine functions, do not use ! -#define PA_TileNumber(x, y) (PA_Modulo((x)+1, 36)+(PA_Modulo((y)+1, 28)*36)) // Used by the tile engine - -#define PA_LoadTileEngine(screen, bg_select, bg_tiles) do{\ - PA_DeleteBg(screen, bg_select);\ - PA_LoadBgTilesEx(screen, bg_select, (void*)NULL, (1008<<5));\ - PA_BgInfo[screen][bg_select].Tiles = (void*)bg_tiles;\ - PA_LoadBgMap(screen, bg_select, NULL, BG_512X256); \ - PA_InitBg(screen, bg_select, BG_512X256, 0, 1);\ - PA_BGScrollXY(screen, bg_select, 0, 0);}while(0) - -#define INF_JUSTTILE 268435455 -#define MAX_TILES 1024 - -void PA_InfTilesScrollX(u8 screen, u8 bg_select, s32 x); -void PA_InfTilesScrollY(u8 screen, u8 bg_select, s32 y); -void PA_InfLargeScrollXN(u8 screen, u8 bg_select, s32 x); -void PA_InfLargeScrollYN(u8 screen, u8 bg_select, s32 y); -void PA_LargeScrollXN(u8 screen, u8 bg_select, s32 x); -void PA_LargeScrollYN(u8 screen, u8 bg_select, s32 y); - -/*! \file PA_BgLargeMap.h - \brief Everything concerning the LargeBg System - - This file contains all the old macros and variables regarding LargeMaps (> 512x512), - which have been obsoleted by PA_LoadBackground(). -*/ - -/** @defgroup BgLargeMap Old large background system - * Old LargeMap functions, obsoleted by PA_LoadBackground() - * @{ - */ - -/*! - \def PA_LoadLargeBg(screen, bg_select, bg_tiles, bg_map, color_mode, lx, ly) - \deprecated - \brief - \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels) - \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large) - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param bg_map - \~english Name of the map's info (example : ship_Map) - \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) - \~\param color_mode - \~english Color mode : 0 for 16 color mode, 1 for 256... - \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 - \~\param lx - \~english Width, in tiles. So a 512 pixel wide map is 64 tiles wide... - \~french Largeur, en tiles. Un fond de 512 pixels de large fera 64 tiles de large. - \~\param ly - \~english Height, in tiles. So a 512 pixel high map is 64 tiles high... - \~french Hauteur, en tiles. Un fond de 512 pixels de hauy fera 64 tiles de haut. -*/ - -#define PA_LoadLargeBg(screen, bg_select, bg_tiles, bg_map, color_mode, lx, ly) do{\ - PA_DEPRECATED_MACRO;\ - PA_BgInfo[screen][bg_select].NTiles = SIZEOF_16BIT(bg_tiles)>>5;\ - if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) {PA_LoadSimpleBg(screen, bg_select, bg_tiles, NULL, BG_512X256, 0, color_mode);}\ - else{PA_LoadTileEngine(screen, bg_select, (void*)bg_tiles);}\ - PA_InitLargeBg(screen, bg_select, lx, ly, (void*)bg_map);}while(0) - -/*! - \def PA_LoadPAGfxLargeBg(screen, bg_number, bg_name) - \deprecated - \brief - \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), converted with PAGfx - \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large), converti avec PAGfx - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (0-3) - \~\param bg_name - \~english Background name, in PAGfx - \~french Nom du fond dans PAGfx -*/ -#define PA_LoadPAGfxLargeBg(screen, bg_number, bg_name) do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadBgPal(screen, bg_number, (void*)bg_name##_Pal); \ - PA_LoadLargeBg(screen, bg_number, bg_name##_Tiles, bg_name##_Map, 1, (bg_name##_Info[1]) >> 3, (bg_name##_Info[2]) >> 3);}while(0) - -/*! - \def PA_LoadLargeBgEx(screen, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly) - \deprecated - \brief - \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), but here you can put yourself the tile size... - \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large), mais ici on met soi-meme la taille des tiles - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param tile_size - \~english Size of your tileset - \~french Taille du tilset - \~\param bg_map - \~english Name of the map's info (example : ship_Map) - \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) - \~\param color_mode - \~english Color mode : 0 for 16 color mode, 1 for 256... - \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 - \~\param lx - \~english Width, in tiles. So a 512 pixel wide map is 64 tiles wide... - \~french Largeur, en tiles. Un fond de 512 pixels de large fera 64 tiles de large. - \~\param ly - \~english Height, in tiles. So a 512 pixel high map is 64 tiles high... - \~french Hauteur, en tiles. Un fond de 512 pixels de hauy fera 64 tiles de haut. -*/ -#define PA_LoadLargeBgEx(screen, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly) do{\ - PA_DEPRECATED_MACRO;\ - PA_BgInfo[screen][bg_select].NTiles = SIZEOF_16BIT(bg_tiles)>>5;\ - if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) {PA_LoadBg(screen, bg_select, bg_tiles, tile_size, NULL, BG_512X256, 0, color_mode);}\ - else{PA_LoadTileEngine(screen, bg_select, bg_tiles);}\ - PA_InitLargeBg(screen, bg_select, lx, ly, (void*)bg_map);}while(0) - -/*! - \fn void PA_InfLargeScrollX(u8 screen, u8 bg_select, s32 x) - \brief - \~english Scroll a large infinite scrolling background horizontaly. It must have been initialised with PA_LoadLargeBg. - \~french Déplacer un fond à scrolling 'infini' horizontalement. Doit etre initialisé avec PA_LoadLargeBg. - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer -*/ - -static inline void PA_InfLargeScrollX(u8 screen, u8 bg_select, s32 x){ // Autoselect - if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) PA_InfLargeScrollXN(screen, bg_select, x); - else PA_InfTilesScrollX(screen, bg_select, x); - PA_BgInfo[screen][bg_select].ScrollX = x; -} - -/*! - \fn void PA_InfLargeScrollY(u8 screen, u8 bg_select, s32 y) - \brief - \~english Scroll a large infinite scrolling background vertically. It must have been initialised with PA_LoadLargeBg. - \~french Déplacer un fond à scrolling 'infini' verticalement. Doit etre initialisé avec PA_LoadLargeBg. - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_InfLargeScrollY(u8 screen, u8 bg_select, s32 y){ // Autoselect - if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) PA_InfLargeScrollYN(screen, bg_select, y); - else PA_InfTilesScrollY(screen, bg_select, y); - PA_BgInfo[screen][bg_select].ScrollY = y; -} - - -/*! - \fn static inline void PA_InfLargeScrollXY(u8 screen, u8 bg_select, s32 x, s32 y) - \brief - \~english Scroll a large infinite scrolling background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. - \~french Déplacer un fond à scrolling 'infini' horizontalement et verticalement. Doit etre initialisé avec PA_LoadLargeBg. - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_InfLargeScrollXY(u8 screen, u8 bg_select, s32 x, s32 y){ - PA_InfLargeScrollX(screen, bg_select, x); - PA_InfLargeScrollY(screen, bg_select, y); -} - -/*! - \fn void PA_LargeScrollX(u8 screen, u8 bg_select, s32 x) - \brief - \~english Scroll a large background horizontaly. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... - \~french Déplacer un grand fond à scrolling horizontalement.Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer -*/ -static inline void PA_LargeScrollX(u8 screen, u8 bg_select, s32 x){ // Autoselect - if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) { - PA_LargeScrollXN(screen, bg_select, x); - if (x < 0)x = 0; - else if (x >= (s32)(PA_BgInfo[screen][bg_select].Infos.Width-256)) - x = PA_BgInfo[screen][bg_select].Infos.Width - 257; - } - else { - PA_InfTilesScrollX(screen, bg_select, x); - } - PA_BgInfo[screen][bg_select].ScrollX = x; -} - -/*! - \fn void PA_LargeScrollY(u8 screen, u8 bg_select, s32 y) - \brief - \~english Scroll a large background vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... - \~french Déplacer un grand fond à scrolling verticalement. Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_LargeScrollY(u8 screen, u8 bg_select, s32 y){ // Autoselect - if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) { - PA_LargeScrollYN(screen, bg_select, y); - if (y < 0) y = 0; - else if (y >= (s32)(PA_BgInfo[screen][bg_select].Infos.Height-192)) y = PA_BgInfo[screen][bg_select].Infos.Height - 193; - } - else PA_InfTilesScrollY(screen, bg_select, y); - PA_BgInfo[screen][bg_select].ScrollY = y; -} - -/*! - \fn static inline void PA_LargeScrollXY(u8 screen, u8 bg_select, s32 x, s32 y) - \brief - \~english Scroll a large background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... - \~french Déplacer un grand fond à scrolling horizontalement et verticalement. Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_LargeScrollXY(u8 screen, u8 bg_select, s32 x, s32 y){ - PA_LargeScrollX(screen, bg_select, x); - PA_LargeScrollY(screen, bg_select, y); -} - -/** @} */ // end of BgLargeMap - -// Pas utilisé en direct par le programmaeur -void PA_InitLargeBg(u8 screen, u8 bg_select, s32 lx, s32 ly, void* bg_map); - -#endif +#ifndef _PA_BGLARGEMAP +#define _PA_BGLARGEMAP + +#include "PA_BgTiles.h" + +// Tile engine functions, do not use ! +#define PA_TileNumber(x, y) (PA_Modulo((x)+1, 36)+(PA_Modulo((y)+1, 28)*36)) // Used by the tile engine + +#define PA_LoadTileEngine(screen, bg_select, bg_tiles) do{\ + PA_DeleteBg(screen, bg_select);\ + PA_LoadBgTilesEx(screen, bg_select, (void*)NULL, (1008<<5));\ + PA_BgInfo[screen][bg_select].Tiles = (void*)bg_tiles;\ + PA_LoadBgMap(screen, bg_select, NULL, BG_512X256); \ + PA_InitBg(screen, bg_select, BG_512X256, 0, 1);\ + PA_BGScrollXY(screen, bg_select, 0, 0);}while(0) + +#define INF_JUSTTILE 268435455 +#define MAX_TILES 1024 + +void PA_InfTilesScrollX(u8 screen, u8 bg_select, s32 x); +void PA_InfTilesScrollY(u8 screen, u8 bg_select, s32 y); +void PA_InfLargeScrollXN(u8 screen, u8 bg_select, s32 x); +void PA_InfLargeScrollYN(u8 screen, u8 bg_select, s32 y); +void PA_LargeScrollXN(u8 screen, u8 bg_select, s32 x); +void PA_LargeScrollYN(u8 screen, u8 bg_select, s32 y); + +/*! \file PA_BgLargeMap.h + \brief Everything concerning the LargeBg System + + This file contains all the old macros and variables regarding LargeMaps (> 512x512), + which have been obsoleted by PA_LoadBackground(). +*/ + +/** @defgroup BgLargeMap Old large background system + * Old LargeMap functions, obsoleted by PA_LoadBackground() + * @{ + */ + +/*! + \def PA_LoadLargeBg(screen, bg_select, bg_tiles, bg_map, color_mode, lx, ly) + \deprecated + \brief + \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels) + \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large) + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param bg_map + \~english Name of the map's info (example : ship_Map) + \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) + \~\param color_mode + \~english Color mode : 0 for 16 color mode, 1 for 256... + \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 + \~\param lx + \~english Width, in tiles. So a 512 pixel wide map is 64 tiles wide... + \~french Largeur, en tiles. Un fond de 512 pixels de large fera 64 tiles de large. + \~\param ly + \~english Height, in tiles. So a 512 pixel high map is 64 tiles high... + \~french Hauteur, en tiles. Un fond de 512 pixels de hauy fera 64 tiles de haut. +*/ + +#define PA_LoadLargeBg(screen, bg_select, bg_tiles, bg_map, color_mode, lx, ly) do{\ + PA_DEPRECATED_MACRO;\ + PA_BgInfo[screen][bg_select].NTiles = SIZEOF_16BIT(bg_tiles)>>5;\ + if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) {PA_LoadSimpleBg(screen, bg_select, bg_tiles, NULL, BG_512X256, 0, color_mode);}\ + else{PA_LoadTileEngine(screen, bg_select, (void*)bg_tiles);}\ + PA_InitLargeBg(screen, bg_select, lx, ly, (void*)bg_map);}while(0) + +/*! + \def PA_LoadPAGfxLargeBg(screen, bg_number, bg_name) + \deprecated + \brief + \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), converted with PAGfx + \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large), converti avec PAGfx + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (0-3) + \~\param bg_name + \~english Background name, in PAGfx + \~french Nom du fond dans PAGfx +*/ +#define PA_LoadPAGfxLargeBg(screen, bg_number, bg_name) do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadBgPal(screen, bg_number, (void*)bg_name##_Pal); \ + PA_LoadLargeBg(screen, bg_number, bg_name##_Tiles, bg_name##_Map, 1, (bg_name##_Info[1]) >> 3, (bg_name##_Info[2]) >> 3);}while(0) + +/*! + \def PA_LoadLargeBgEx(screen, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly) + \deprecated + \brief + \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), but here you can put yourself the tile size... + \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large), mais ici on met soi-meme la taille des tiles + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param tile_size + \~english Size of your tileset + \~french Taille du tilset + \~\param bg_map + \~english Name of the map's info (example : ship_Map) + \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) + \~\param color_mode + \~english Color mode : 0 for 16 color mode, 1 for 256... + \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 + \~\param lx + \~english Width, in tiles. So a 512 pixel wide map is 64 tiles wide... + \~french Largeur, en tiles. Un fond de 512 pixels de large fera 64 tiles de large. + \~\param ly + \~english Height, in tiles. So a 512 pixel high map is 64 tiles high... + \~french Hauteur, en tiles. Un fond de 512 pixels de hauy fera 64 tiles de haut. +*/ +#define PA_LoadLargeBgEx(screen, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly) do{\ + PA_DEPRECATED_MACRO;\ + PA_BgInfo[screen][bg_select].NTiles = SIZEOF_16BIT(bg_tiles)>>5;\ + if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) {PA_LoadBg(screen, bg_select, bg_tiles, tile_size, NULL, BG_512X256, 0, color_mode);}\ + else{PA_LoadTileEngine(screen, bg_select, bg_tiles);}\ + PA_InitLargeBg(screen, bg_select, lx, ly, (void*)bg_map);}while(0) + +/*! + \fn void PA_InfLargeScrollX(u8 screen, u8 bg_select, s32 x) + \brief + \~english Scroll a large infinite scrolling background horizontaly. It must have been initialised with PA_LoadLargeBg. + \~french Déplacer un fond à scrolling 'infini' horizontalement. Doit etre initialisé avec PA_LoadLargeBg. + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer +*/ + +static inline void PA_InfLargeScrollX(u8 screen, u8 bg_select, s32 x){ // Autoselect + if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) PA_InfLargeScrollXN(screen, bg_select, x); + else PA_InfTilesScrollX(screen, bg_select, x); + PA_BgInfo[screen][bg_select].ScrollX = x; +} + +/*! + \fn void PA_InfLargeScrollY(u8 screen, u8 bg_select, s32 y) + \brief + \~english Scroll a large infinite scrolling background vertically. It must have been initialised with PA_LoadLargeBg. + \~french Déplacer un fond à scrolling 'infini' verticalement. Doit etre initialisé avec PA_LoadLargeBg. + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_InfLargeScrollY(u8 screen, u8 bg_select, s32 y){ // Autoselect + if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) PA_InfLargeScrollYN(screen, bg_select, y); + else PA_InfTilesScrollY(screen, bg_select, y); + PA_BgInfo[screen][bg_select].ScrollY = y; +} + + +/*! + \fn static inline void PA_InfLargeScrollXY(u8 screen, u8 bg_select, s32 x, s32 y) + \brief + \~english Scroll a large infinite scrolling background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. + \~french Déplacer un fond à scrolling 'infini' horizontalement et verticalement. Doit etre initialisé avec PA_LoadLargeBg. + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_InfLargeScrollXY(u8 screen, u8 bg_select, s32 x, s32 y){ + PA_InfLargeScrollX(screen, bg_select, x); + PA_InfLargeScrollY(screen, bg_select, y); +} + +/*! + \fn void PA_LargeScrollX(u8 screen, u8 bg_select, s32 x) + \brief + \~english Scroll a large background horizontaly. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... + \~french Déplacer un grand fond à scrolling horizontalement.Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer +*/ +static inline void PA_LargeScrollX(u8 screen, u8 bg_select, s32 x){ // Autoselect + if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) { + PA_LargeScrollXN(screen, bg_select, x); + if (x < 0)x = 0; + else if (x >= (s32)(PA_BgInfo[screen][bg_select].Infos.Width-256)) + x = PA_BgInfo[screen][bg_select].Infos.Width - 257; + } + else { + PA_InfTilesScrollX(screen, bg_select, x); + } + PA_BgInfo[screen][bg_select].ScrollX = x; +} + +/*! + \fn void PA_LargeScrollY(u8 screen, u8 bg_select, s32 y) + \brief + \~english Scroll a large background vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... + \~french Déplacer un grand fond à scrolling verticalement. Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_LargeScrollY(u8 screen, u8 bg_select, s32 y){ // Autoselect + if (PA_BgInfo[screen][bg_select].NTiles < MAX_TILES) { + PA_LargeScrollYN(screen, bg_select, y); + if (y < 0) y = 0; + else if (y >= (s32)(PA_BgInfo[screen][bg_select].Infos.Height-192)) y = PA_BgInfo[screen][bg_select].Infos.Height - 193; + } + else PA_InfTilesScrollY(screen, bg_select, y); + PA_BgInfo[screen][bg_select].ScrollY = y; +} + +/*! + \fn static inline void PA_LargeScrollXY(u8 screen, u8 bg_select, s32 x, s32 y) + \brief + \~english Scroll a large background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... + \~french Déplacer un grand fond à scrolling horizontalement et verticalement. Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_LargeScrollXY(u8 screen, u8 bg_select, s32 x, s32 y){ + PA_LargeScrollX(screen, bg_select, x); + PA_LargeScrollY(screen, bg_select, y); +} + +/** @} */ // end of BgLargeMap + +// Pas utilisé en direct par le programmaeur +void PA_InitLargeBg(u8 screen, u8 bg_select, s32 lx, s32 ly, void* bg_map); + +#endif diff --git a/include/arm9/PA_BgRot.h b/include/arm9/PA_BgRot.h index 23e0e26..537c09e 100644 --- a/include/arm9/PA_BgRot.h +++ b/include/arm9/PA_BgRot.h @@ -1,186 +1,186 @@ -#ifndef _PA_BGROT -#define _PA_BGROT - -#ifdef __cplusplus -extern "C"{ -#endif - -#include "PA_BgTiles.h" - -/*! \file PA_BgRot.h - \brief Everything concerning rotscale backgrounds - - This file contains all the macros and variables regarding Rotation backgrounds -*/ - -#define BG_ROT_128X128 0 -#define BG_ROT_256X256 1 -#define BG_ROT_512X512 2 -#define BG_ROT_1024X1024 3 - -void PA_LoadRotBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size); - -#define PA_BGXX(screen, bg) _REG32(0x4000008 + (0x1000 * screen) + (bg << 4)) -#define PA_BGXY(screen, bg) _REG32(0x400000C + (0x1000 * screen) + (bg << 4)) -#define PA_BGXPA(screen, bg) _REG16(0x4000000 + (0x1000 * screen) + (bg << 4)) -#define PA_BGXPB(screen, bg) _REG16(0x4000002 + (0x1000 * screen) + (bg << 4)) -#define PA_BGXPC(screen, bg) _REG16(0x4000004 + (0x1000 * screen) + (bg << 4)) -#define PA_BGXPD(screen, bg) _REG16(0x4000006 + (0x1000 * screen) + (bg << 4)) - -extern u8 rotbg_size[2][4]; // Background size of each possible rotbg - -/** @defgroup BgRot Rotating Backgrounds - * Load rotating backgrounds, move, rotate, scale them - * @{ - */ - -/*! - \def PA_LoadRotBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound) - \deprecated - \brief - \~english [DEPRECATED] Load a background fit for rotating/scaling! Warning, you must use PA_SetVideoMode to 1 if you want 1 rotating background (Bg3 only !), or 2 for 2 rotating backgrounds (Bg2 and 3). The background MUST be in 256 colors - \~french [DEPRECATED] Charger un fond pour les rotations/zoom! Attention, il faut avant utiliser PA_SetVideoMode avec 1 pour utiliser un fond rotatif (le fond 3 uniquement !), ou 2 pour 2 fonds (2 et 3). Le fond DOIT etre de 256 couleurs - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load - \~french Numéro du fond que l'on veut charger - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param bg_map - \~english Name of the map's info (example : ship_Map) - \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) - \~\param bg_size - \~english Background size. Use the following macros : BG_ROT_128X128, or 256X256, 512X512, or 1024X1024 - \~french Taille du fond. Utiliser les macros suivantes : BG_ROT_128X128, ou 256X256, 512X512, ou enfin 1024X1024 - \~\param wraparound - \~english If the background wraps around or not. - \~french Si le fond boucle ou non. -*/ -#define PA_LoadRotBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound) do{\ - PA_DEPRECATED_MACRO;\ - PA_DeleteBg(screen, bg_select);\ - PA_LoadBgTiles(screen, bg_select, bg_tiles); \ - PA_LoadRotBgMap(screen, bg_select, (void*)bg_map, bg_size); \ - PA_InitBg(screen, bg_select, bg_size, wraparound, 1);\ - PA_SetBgRot(screen, bg_select, 0, 0, 0, 0, 0, 256);\ - }while(0) - -/*! - \def PA_LoadPAGfxRotBg(screen, bg_select, bg_name, wraparound) - \deprecated - \brief - \~english [DEPRECATED] Load a background fit for rotating/scaling ! Warning, you must use PA_SetVideoMode to 1 if you want 1 rotating background (Bg3 only !), or 2 for 2 rotating backgrounds (Bg2 and 3). The background MUST be in 256 colors - \~french [DEPRECATED] Charger un fond pour les rotations/zoom ! Attention, il faut avant utiliser PA_SetVideoMode avec 1 pour utiliser un fond rotatif (le fond 3 uniquement !), ou 2 pour 2 fonds (2 et 3). Le fond DOIT etre de 256 couleurs - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load - \~french Numéro du fond que l'on veut charger - \~\param bg_name - \~english Background name, like bg0 - \~french Nom du fond, comme bg0 - \~\param wraparound - \~english If the background wraps around or not. - \~french Si le fond boucle ou non. -*/ -#define PA_LoadPAGfxRotBg(screen, bg_select, bg_name, wraparound) do{\ - PA_DEPRECATED_MACRO;\ - PA_Load8bitBgPal(screen, (void*)bg_name##_Pal);\ - PA_LoadRotBg(screen, bg_select, bg_name##_Tiles, bg_name##_Map, PA_GetPAGfxRotBgSize(bg_name##_Info[1]), wraparound);\ - }while(0) - -/*! - \fn static inline void PA_SetBgRot(u8 screen, u8 bg_select, s32 x_scroll, s32 y_scroll, s32 x_rotcentre, s32 y_rotcentre, s16 bg_angle, s32 bg_zoom) - \brief - \~english Rotate/Scale a RotBg - \~french Faire tourner/zoomer un fond rotatif - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load - \~french Numéro du fond que l'on veut charger - \~\param x_scroll - \~english X Scroll... - \~french Scroll x... - \~\param y_scroll - \~english Y Scroll... - \~french Scroll y... - \~\param x_rotcentre - \~english X position of the rotation center - \~french Position X du centre de rotation - \~\param y_rotcentre - \~english Y position of the rotation center - \~french Position Y du centre de rotation - \~\param bg_angle - \~english Rotation Angle (0-511) - \~french Angle de rotation (0-511) - \~\param bg_zoom - \~english Zoom (256 for no zoom) - \~french Zoom (256 pour pas de zoom...) -*/ -static inline void PA_SetBgRot(u8 screen, u8 bg_select, s32 x_scroll, s32 y_scroll, s32 x_rotcentre, s32 y_rotcentre, s16 bg_angle, s32 bg_zoom){ - s32 pa, pb, pc, pd; - - pa = (PA_Cos(bg_angle) * (bg_zoom)) >> 8; - pb = (-PA_Sin(bg_angle) * (bg_zoom)) >> 8; - pc = (PA_Sin(bg_angle) * (bg_zoom)) >> 8; - pd = pa; - - PA_BGXX(screen, bg_select) = (x_scroll << 8) - (x_rotcentre * pa + y_rotcentre * pb); - PA_BGXY(screen, bg_select) = (y_scroll << 8) - (x_rotcentre * pc + y_rotcentre * pd); - - PA_BGXPA(screen, bg_select) = pa; - PA_BGXPB(screen, bg_select) = pb; - PA_BGXPC(screen, bg_select) = pc; - PA_BGXPD(screen, bg_select) = pd; -} - - -// SetRotMapTile by gmiller -static inline void PA_SetRotMapTile(u8 screen, u8 bg_select, s16 x, s16 y, u8 tile_number) -{ - u16 hold, *where; - - // Calculate offset into rotational background map x + (y*32) ... tile is 8x8 and each pixel is 8 bits to 32 bytes wide - where = (u16*)(PA_BgInfo[screen][bg_select].Map + ((x&1022) + (y << (4+rotbg_size[screen][bg_select])))); - - // Get current value as 16 bit but we only have 8 bits per pixes (must be written as 16 bit) - hold = *where; - - // Odd or even (high or low byte - if ((x & 1) == 0) - hold = (hold & 0xFF00) | tile_number; // change low order byte - else - hold = (hold & 0x00FF) | (tile_number << 8); // change high order byte - *where = hold; // save as 16 bit, as required by hardware -} - -// SetRotMapTile by gmiller -static inline u8 PA_GetRotMapTile(u8 screen, u8 bg_select, s16 x, s16 y) -{ - u16 hold, *where; - - // Calculate offset into rotational background map x + (y*32) ... tile is 8x8 and each pixel is 8 bits to 32 bytes wide - where = (u16*)(PA_BgInfo[screen][bg_select].Map + ((x&1022) + (y << (4+rotbg_size[screen][bg_select])))); - - // Get current value as 16 bit but we only have 8 bits per pixes (must be written as 16 bit) - hold = *where; - - // Odd or even (high or low byte - if ((x & 1) == 0) return (u8)(hold&255); - else return (u8)(hold>>8); - -} - -/** @} */ // end of BgRot - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_BGROT +#define _PA_BGROT + +#ifdef __cplusplus +extern "C"{ +#endif + +#include "PA_BgTiles.h" + +/*! \file PA_BgRot.h + \brief Everything concerning rotscale backgrounds + + This file contains all the macros and variables regarding Rotation backgrounds +*/ + +#define BG_ROT_128X128 0 +#define BG_ROT_256X256 1 +#define BG_ROT_512X512 2 +#define BG_ROT_1024X1024 3 + +void PA_LoadRotBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size); + +#define PA_BGXX(screen, bg) _REG32(0x4000008 + (0x1000 * screen) + (bg << 4)) +#define PA_BGXY(screen, bg) _REG32(0x400000C + (0x1000 * screen) + (bg << 4)) +#define PA_BGXPA(screen, bg) _REG16(0x4000000 + (0x1000 * screen) + (bg << 4)) +#define PA_BGXPB(screen, bg) _REG16(0x4000002 + (0x1000 * screen) + (bg << 4)) +#define PA_BGXPC(screen, bg) _REG16(0x4000004 + (0x1000 * screen) + (bg << 4)) +#define PA_BGXPD(screen, bg) _REG16(0x4000006 + (0x1000 * screen) + (bg << 4)) + +extern u8 rotbg_size[2][4]; // Background size of each possible rotbg + +/** @defgroup BgRot Rotating Backgrounds + * Load rotating backgrounds, move, rotate, scale them + * @{ + */ + +/*! + \def PA_LoadRotBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound) + \deprecated + \brief + \~english [DEPRECATED] Load a background fit for rotating/scaling! Warning, you must use PA_SetVideoMode to 1 if you want 1 rotating background (Bg3 only !), or 2 for 2 rotating backgrounds (Bg2 and 3). The background MUST be in 256 colors + \~french [DEPRECATED] Charger un fond pour les rotations/zoom! Attention, il faut avant utiliser PA_SetVideoMode avec 1 pour utiliser un fond rotatif (le fond 3 uniquement !), ou 2 pour 2 fonds (2 et 3). Le fond DOIT etre de 256 couleurs + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load + \~french Numéro du fond que l'on veut charger + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param bg_map + \~english Name of the map's info (example : ship_Map) + \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) + \~\param bg_size + \~english Background size. Use the following macros : BG_ROT_128X128, or 256X256, 512X512, or 1024X1024 + \~french Taille du fond. Utiliser les macros suivantes : BG_ROT_128X128, ou 256X256, 512X512, ou enfin 1024X1024 + \~\param wraparound + \~english If the background wraps around or not. + \~french Si le fond boucle ou non. +*/ +#define PA_LoadRotBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound) do{\ + PA_DEPRECATED_MACRO;\ + PA_DeleteBg(screen, bg_select);\ + PA_LoadBgTiles(screen, bg_select, bg_tiles); \ + PA_LoadRotBgMap(screen, bg_select, (void*)bg_map, bg_size); \ + PA_InitBg(screen, bg_select, bg_size, wraparound, 1);\ + PA_SetBgRot(screen, bg_select, 0, 0, 0, 0, 0, 256);\ + }while(0) + +/*! + \def PA_LoadPAGfxRotBg(screen, bg_select, bg_name, wraparound) + \deprecated + \brief + \~english [DEPRECATED] Load a background fit for rotating/scaling ! Warning, you must use PA_SetVideoMode to 1 if you want 1 rotating background (Bg3 only !), or 2 for 2 rotating backgrounds (Bg2 and 3). The background MUST be in 256 colors + \~french [DEPRECATED] Charger un fond pour les rotations/zoom ! Attention, il faut avant utiliser PA_SetVideoMode avec 1 pour utiliser un fond rotatif (le fond 3 uniquement !), ou 2 pour 2 fonds (2 et 3). Le fond DOIT etre de 256 couleurs + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load + \~french Numéro du fond que l'on veut charger + \~\param bg_name + \~english Background name, like bg0 + \~french Nom du fond, comme bg0 + \~\param wraparound + \~english If the background wraps around or not. + \~french Si le fond boucle ou non. +*/ +#define PA_LoadPAGfxRotBg(screen, bg_select, bg_name, wraparound) do{\ + PA_DEPRECATED_MACRO;\ + PA_Load8bitBgPal(screen, (void*)bg_name##_Pal);\ + PA_LoadRotBg(screen, bg_select, bg_name##_Tiles, bg_name##_Map, PA_GetPAGfxRotBgSize(bg_name##_Info[1]), wraparound);\ + }while(0) + +/*! + \fn static inline void PA_SetBgRot(u8 screen, u8 bg_select, s32 x_scroll, s32 y_scroll, s32 x_rotcentre, s32 y_rotcentre, s16 bg_angle, s32 bg_zoom) + \brief + \~english Rotate/Scale a RotBg + \~french Faire tourner/zoomer un fond rotatif + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load + \~french Numéro du fond que l'on veut charger + \~\param x_scroll + \~english X Scroll... + \~french Scroll x... + \~\param y_scroll + \~english Y Scroll... + \~french Scroll y... + \~\param x_rotcentre + \~english X position of the rotation center + \~french Position X du centre de rotation + \~\param y_rotcentre + \~english Y position of the rotation center + \~french Position Y du centre de rotation + \~\param bg_angle + \~english Rotation Angle (0-511) + \~french Angle de rotation (0-511) + \~\param bg_zoom + \~english Zoom (256 for no zoom) + \~french Zoom (256 pour pas de zoom...) +*/ +static inline void PA_SetBgRot(u8 screen, u8 bg_select, s32 x_scroll, s32 y_scroll, s32 x_rotcentre, s32 y_rotcentre, s16 bg_angle, s32 bg_zoom){ + s32 pa, pb, pc, pd; + + pa = (PA_Cos(bg_angle) * (bg_zoom)) >> 8; + pb = (-PA_Sin(bg_angle) * (bg_zoom)) >> 8; + pc = (PA_Sin(bg_angle) * (bg_zoom)) >> 8; + pd = pa; + + PA_BGXX(screen, bg_select) = (x_scroll << 8) - (x_rotcentre * pa + y_rotcentre * pb); + PA_BGXY(screen, bg_select) = (y_scroll << 8) - (x_rotcentre * pc + y_rotcentre * pd); + + PA_BGXPA(screen, bg_select) = pa; + PA_BGXPB(screen, bg_select) = pb; + PA_BGXPC(screen, bg_select) = pc; + PA_BGXPD(screen, bg_select) = pd; +} + + +// SetRotMapTile by gmiller +static inline void PA_SetRotMapTile(u8 screen, u8 bg_select, s16 x, s16 y, u8 tile_number) +{ + u16 hold, *where; + + // Calculate offset into rotational background map x + (y*32) ... tile is 8x8 and each pixel is 8 bits to 32 bytes wide + where = (u16*)(PA_BgInfo[screen][bg_select].Map + ((x&1022) + (y << (4+rotbg_size[screen][bg_select])))); + + // Get current value as 16 bit but we only have 8 bits per pixes (must be written as 16 bit) + hold = *where; + + // Odd or even (high or low byte + if ((x & 1) == 0) + hold = (hold & 0xFF00) | tile_number; // change low order byte + else + hold = (hold & 0x00FF) | (tile_number << 8); // change high order byte + *where = hold; // save as 16 bit, as required by hardware +} + +// SetRotMapTile by gmiller +static inline u8 PA_GetRotMapTile(u8 screen, u8 bg_select, s16 x, s16 y) +{ + u16 hold, *where; + + // Calculate offset into rotational background map x + (y*32) ... tile is 8x8 and each pixel is 8 bits to 32 bytes wide + where = (u16*)(PA_BgInfo[screen][bg_select].Map + ((x&1022) + (y << (4+rotbg_size[screen][bg_select])))); + + // Get current value as 16 bit but we only have 8 bits per pixes (must be written as 16 bit) + hold = *where; + + // Odd or even (high or low byte + if ((x & 1) == 0) return (u8)(hold&255); + else return (u8)(hold>>8); + +} + +/** @} */ // end of BgRot + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_BgTiles.h b/include/arm9/PA_BgTiles.h index fda49de..04c844c 100644 --- a/include/arm9/PA_BgTiles.h +++ b/include/arm9/PA_BgTiles.h @@ -1,1110 +1,1110 @@ -#ifndef _PA_BGTILES -#define _PA_BGTILES - -#include -#include "PA_General.h" -#include "../PA_BgStruct.h" - - -#define BG_TILEDBG 2 -#define BG_ROTBG 3 -#define BG_LARGEMAP 4 -#define BG_INFINITEMAP 5 - -void PA_EasyBgLoadEx(u8 screen, u8 bg_number, u32 *Infos, void *Tiles, u32 TileSize, void *Map, u32 MapSize, void *Palette) DEPRECATED; - -// Extracts the size from PAGfx convertions -static inline u8 PA_GetPAGfxBgSize(u16 width, u16 height){ - u8 bg_size = 0; - if (height == 512) bg_size = 2; - if (width == 512) bg_size ++; - return bg_size; -} - -// Extracts the size from PAGfx convertions -static inline u8 PA_GetPAGfxRotBgSize(u16 width){ - u8 bg_size = 1; //256x256 by default - if (width <= 128) bg_size = 0; - else if (width <= 256) bg_size = 1; - else if (width <= 512) bg_size = 2; - else if (width <= 1024) bg_size = 3; - - return bg_size; -} - -typedef u8 (*EasyBgPixels)(u8, u8, s32, s32); - -extern EasyBgPixels PA_EasyBgPixel[6]; - -/*! \file PA_BgTiles.h - \brief Everything concerning the Bg Tile modes - - This file contains all the macros and variables regarding Tile modes, loading tiles and Bg, etc... -*/ - -//background memory offset macros -#define CharBaseBlock(screen, n) (((n)*0x4000) + 0x6000000 + (0x200000 * screen)) -#define ScreenBaseBlock(screen, n) (((n)*0x800) + 0x6000000 + (0x200000 * screen)) - -// Pointers towards background arrays -typedef struct{ - void *Tiles; - void *Map; - void *Palette; - u32 TileSize, MapSize; - u32 Type, Width, Height; -} PA_BgDefaultInfos; - -typedef struct{ - // Memory management info... - - u32 tilesetsize; // Place utilisée pour chaque tileset - u16 mapsize; // Place utilisée pour chaque map - u8 mapchar; // Emplacement mémoire de chaque map - u8 TileSetChar; - - u32 Map; // Map pointer - u32 NTiles; - u32 *TilePos; - void *Tiles; - - PA_BgDefaultInfos Infos; // Pointers towards background arrays - - s32 ScrollX, ScrollY; // Scroll values - - u8 BgMode; // Background mode -} PA_BgInfos; -extern PA_BgInfos PA_BgInfo[2][4]; - -extern u8 charblocks[2][70]; - -// Quantité de données à charger en fonction de la taille de la map... -extern u16 *PA_DrawBg[2]; // Fond dessinable - -extern u16 bg_sizes[4]; -extern u8 bg_place[4]; - -extern u8 charsetstart[2]; -extern s32 PA_parallaxX[2][4]; -extern s32 PA_parallaxY[2][4]; - -typedef struct { - u8 infscroll; // Passe à 1 si scrolling infini activé... - u16* bg_map; // Map - s32 lx, ly; - s32 scrollx, scrolly; - s32 maxx; // 32 ou 64, en fonction de la largeur... -}scrollpositions; - -extern scrollpositions scrollpos[2][4]; // Pour chaque écran et pour chaque fond :) - -// Mode de couleur -#define BG_COLOR16 0x00 -#define BG_COLOR256 0x80 - -#define CHAR_SHIFT 2 -#define SCREEN_SHIFT 8 -#define WRAPAROUND 0x1 - -#define SCREEN_TILES 24576 // Taille à convertir pour avoir un écran complet... - -//scrolling registers for background 0 - -// Registre pour les controles de chaque écran -#define REG_BGSCREEN0 0x04000000 -#define REG_BGSCREEN1 0x04001000 -#define REG_BGSCREEN(screen) (0x04000000 + (screen * 0x1000)) - -#define REG_BGCNT(screen, bg_number) (0x4000008 + (screen * 0x1000) + (bg_number << 1)) - -// Premier registre pour les scroll. On en déduit les autres en ajoutant pour le screen et le numéro du Bg -#define REG_BGSCROLLX 0x4000010 -#define REG_BGSCROLLY 0x4000012 - -// Tailles pour les Bg : -#define BG_256X256 0 -#define BG_512X256 1 -#define BG_256X512 2 -#define BG_512X512 3 - -//ALL_BUT() pour faire tout sauf... -#define TILE_N 1023 -#define TILE_PAL 61440 -#define TILE_HFLIP 1024 -#define TILE_VFLIP 2048 - -/** @defgroup BgTiles Tiled Background Modes - * Load a background, scroll it, etc... - * @{ - */ - -/*! - \fn void PA_ResetBgSys(void) - \brief - \~english Reset the background system - \~french Reinitialise le systeme de fonds -*/ -void PA_ResetBgSys(void); - -/*! - \fn void PA_ResetBgSysScreen(u8 screen) - \brief - \~english Reset the background system on 1 screen - \~french Reinitialise le systeme de fonds pour 1 écran - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) -*/ -void PA_ResetBgSysScreen(u8 screen); - -/*! - \fn void PA_InitBg(u8 screen, u8 bg_select, u8 bg_size, u8 wraparound, u8 color_mode) - \brief - \~english Initialise a given background. Do this only after having loaded a tileset and a map. - \~french Initialise un fond. A faire uniquement après avoir chargé un tileset et une map. - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_size - \~english Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... For a rotatable Bg, use the macros BG_ROT_128X128... - \~french Taille du fond. Ceci est très important, car ça détermine aussi si le Bg est rotatif ou non. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... Pour un fond rotatif, il suffit d'utiliser BG_ROT_128X128... - \~\param wraparound - \~english If the background wraps around or not. More important for rotating backgrounds. - \~french Si le fond boucle ou non. C'est plus important pour les fonds rotatifs... - \~\param color_mode - \~english Color mode : 0 for 16 color mode, 1 for 256... - \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 - -*/ -void PA_InitBg(u8 screen, u8 bg_select, u8 bg_size, u8 wraparound, u8 color_mode); - -/*! - \def PA_HideBg(screen, bg_select) - \brief - \~english Hide a screen's background. - \~french Cacher un fond. - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) -*/ -#define PA_HideBg(screen, bg_select) _REG16(REG_BGSCREEN(screen)) &= ~(0x100 << (bg_select)) - -/*! - \def PA_ShowBg(screen, bg_select) - \brief - \~english Show a hidden background. - \~french Afficher un fond auparavant caché. - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) -*/ -#define PA_ShowBg(screen, bg_select) _REG16(REG_BGSCREEN(screen)) |= (0x100 << (bg_select)) - -/*! - \def PA_ResetBg(screen) - \brief - \~english Reinitialize de Bg system of a screen. It only hides all the backgrounds in reality... - \~french Reinitialiser les fonds d'un écran. En fait ca ne fait que cacher tous les fonds - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) -*/ -#define PA_ResetBg(screen) _REG16(REG_BGSCREEN(screen)) &= ~(0xF00) - -/*! - \def PA_LoadBgTiles(screen, bg_select, bg_tiles) - \deprecated - \brief - \~english [DEPRECATED] Load a tileset into memory - \~french [DEPRECATED] Charger un tileset en mémoire - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) -*/ -#define PA_LoadBgTiles(screen, bg_select, bg_tiles) PA_LoadBgTilesEx(screen, bg_select, (void*)bg_tiles, SIZEOF_16BIT(bg_tiles)) - -/*! - \fn void PA_LoadBgTilesEx(u8 screen, u8 bg_select, void* bg_tiles, u32 size) - \brief - \~english Load a tileset into memory with a given size - \~french Charger un tileset en mémoire avec une taille donnée - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param size - \~english 16 bit size... - \~french Taille en 16 bits... - -*/ -void PA_LoadBgTilesEx(u8 screen, u8 bg_select, void* bg_tiles, u32 size); - -/*! - \fn void PA_ReLoadBgTiles(u8 screen, u8 bg_select, void* bg_tiles) - \brief - \~english ReLoad a tileset into memory - \~french ReCharger un tileset en mémoire - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) -*/ -void PA_ReLoadBgTiles(u8 screen, u8 bg_select, void* bg_tiles); - -/*! - \fn void PA_DeleteTiles(u8 screen, u8 bg_select) - \brief - \~english Delete a tilest in memory. Note that loading a tileset automatically deletes the preceding one, so you won't need to use this function often - \~french Effacer un tileset en mémoire. A noter que charger un tileset efface automatiquement le tileset précédent, donc on n'aura pas souvent besoin de cette fonction... - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) -*/ -void PA_DeleteTiles(u8 screen, u8 bg_select); - -/*! - \fn void PA_DeleteMap(u8 screen, u8 bg_select) - \brief - \~english Delete a map in memory. Note that loading a map automatically deletes the preceding one, so you won't need to use this function often - \~french Effacer une map en mémoire. A noter que charger une map efface automatiquement la map précédent, donc on n'aura pas souvent besoin de cette fonction... - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) -*/ -void PA_DeleteMap(u8 screen, u8 bg_select); - -/*! - \fn static inline void PA_DeleteBg(u8 screen, u8 bg_select) - \brief - \~english Delete and reset a complete background - \~french Effacer et reinitialiser un fond complètement - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) -*/ -static inline void PA_DeleteBg(u8 screen, u8 bg_select) { - // By Maple, June 2008 - // This is a small piece of PA_ResetBgSysScreen() - - PA_HideBg(screen, bg_select); - PA_DeleteTiles(screen, bg_select); - PA_DeleteMap(screen, bg_select); - - PA_BgInfo[screen][bg_select].tilesetsize = 0; - PA_BgInfo[screen][bg_select].mapsize = 0; - PA_BgInfo[screen][bg_select].TileSetChar = 0; - PA_BgInfo[screen][bg_select].mapchar = 0; - PA_parallaxX[screen][bg_select] = 0; - PA_parallaxY[screen][bg_select] = 0; - scrollpos[screen][bg_select].infscroll = 0; -} - -/*! - \fn void PA_LoadBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size) - \brief - \~english Load a background's map info - \~french Charge la carte d'un fond - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_map - \~english Name of the map's info (example : (void*)ship_Map) Don't forget the void... - \~french Nom du tableau contenant les infos sur la map (exemple : (void*)ship_Map) n'oublie pas le void... - \~\param bg_size - \~english Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... - \~french Taille du fond. Ceci est très important, car ça détermine aussi si le Bg est rotatif ou non. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... -*/ - -void PA_LoadBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size); - -/*! \fn void PA_LoadBackground(u8 screen, u8 bg_number, const PA_BgStruct* bg_name) - \brief - \~english Load a background (EasyBg or RotBg). - \~french Charger un fond (EasyBg ou RotBg). - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number... (0-3) - \~french Numéro du fond... (0-3) - \~\param bg_name - \~english Pointer to the background (struct) - \~french Pointeur vers le fond -*/ - -void PA_LoadBackground(u8 screen, u8 bg_select, const PA_BgStruct* bg_name); - -/*! - \def PA_LoadTiledBg(screen, bg_number, bg_name) - \deprecated - \brief - \~english [DEPRECATED] This will never get easier... Loads a background TiledBg converted with PAGfx, with its tiles, map, and palette. Only 256 color mode available. - \~french [DEPRECATED] On ne pourra jamais rendre ca plus simple... Charge un fond de type TiledBg converti avec PAGfx, en mettant les tiles, la map, et meme la palette ! Seulement en mode 256 couleurs - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_name - \~english Background name, like bg0 - \~french Nom du fond, comme bg0 -*/ - -#define PA_LoadTiledBg(screen, bg_number, bg_name) do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadBgPal(screen, bg_number, (void*)bg_name##_Pal); \ - PA_LoadSimpleBg(screen, bg_number, bg_name##_Tiles, bg_name##_Map, PA_GetPAGfxBgSize(bg_name##_Info[1], bg_name##_Info[2]), 0, 1);}while(0) - -/*! - \def PA_LoadSimpleBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode) - \deprecated - \brief - \~english [DEPRECATED] Simple way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap - \~french [DEPRECATED] Façon simple de cahrger un fond. Combine PA_InitBg, PA_LoadBgTiles, et PA_LoadBgMap - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param bg_map - \~english Name of the map's info (example : ship_Map) - \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) - \~\param bg_size - \~english Background size. To use a normal background, use the macros BG_256X256, BG_256X512, etc... - \~french Taille du fond. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... - \~\param wraparound - \~english If the background wraps around or not. More important for rotating backgrounds. - \~french Si le fond boucle ou non. C'est plus important pour les fonds rotatifs... - \~\param color_mode - \~english Color mode : 0 for 16 color mode, 1 for 256... - \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 -*/ - -#define PA_LoadSimpleBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode) do{\ - PA_DEPRECATED_MACRO;\ - PA_DeleteBg(screen, bg_select);\ - PA_LoadBgTiles(screen, bg_select, bg_tiles); \ - PA_LoadBgMap(screen, bg_select, (void*)bg_map, bg_size); \ - PA_InitBg(screen, bg_select, bg_size, 0, color_mode);\ - PA_BGScrollXY(screen, bg_select, 0, 0);}while(0) - -/*! - \def PA_LoadBg(screen, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode) - \deprecated - \brief - \~english [DEPRECATED] Simplest way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap - \~french [DEPRECATED] Facon la plus simple de cahrger un fond. Combine PA_InitBg, PA_LoadBgTiles, et PA_LoadBgMap - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param tile_size - \~english Size of your tileset - \~french Taille du tilset - \~\param bg_map - \~english Name of the map's info (example : ship_Map) - \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) - \~\param bg_size - \~english Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... For a rotatable Bg, use the macros BG_ROT_128X128... - \~french Taille du fond. Ceci est très important, car ça détermine aussi si le Bg est rotatif ou non. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... Por un fond rotatif, il suffit d'utiliser BG_ROT_128X128... - \~\param wraparound - \~english If the background wraps around or not. More important for rotating backgrounds. - \~french Si le fond boucle ou non. C'est plus important pour les fonds rotatifs... - \~\param color_mode - \~english Color mode : 0 for 16 color mode, 1 for 256... - \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 -*/ - -#define PA_LoadBg(screen, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode) do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadBgTilesEx(screen, bg_select, (void*)bg_tiles, tile_size); \ - PA_LoadBgMap(screen, bg_select, (void*)bg_map, bg_size); \ - PA_InitBg(screen, bg_select, bg_size, 0, color_mode);\ - PA_BGScrollXY(screen, bg_select, 0, 0);}while(0) - -/*! - \fn static inline void PA_BGScrollX(u8 screen, u8 bg_number, s32 x) - \brief - \~english Scroll horizontaly a Tiled background - \~french Scroll horizontal d'un fond de type Tiled - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer, horizontalement... -*/ -static inline void PA_BGScrollX(u8 screen, u8 bg_number, s32 x) { - PA_BgInfo[screen][bg_number].ScrollX = (x)&1023; - _REG16(REG_BGSCROLLX + ((screen) * 0x1000) + ((bg_number) << 2)) = (x)&1023; -} - -/*! - \fn static inline void PA_BGScrollY(u8 screen, u8 bg_number, s32 y) - \brief - \~english Scroll vertically a Tiled background - \~french Scroll vertical d'un fond de type Tiled - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer, verticalement... -*/ -static inline void PA_BGScrollY(u8 screen, u8 bg_number, s32 y) { - PA_BgInfo[screen][bg_number].ScrollY = (y)&1023; - _REG16(REG_BGSCROLLY + ((screen) * 0x1000) + ((bg_number) << 2)) = (y)&1023; -} - -/*! - \def PA_BGScrollXY(screen, bg_number, x, y) - \brief - \~english Scroll horizontaly and vertically a Tiled background - \~french Scroll horizontal et vertical d'un fond de type Tiled - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer, horizontalement... - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer, verticalement... -*/ -static inline void PA_BGScrollXY(u8 screen, u8 bg_number, s32 x, s32 y) { - PA_BGScrollX(screen, bg_number, x); - PA_BGScrollY(screen, bg_number, y); -} - -/*! - \fn static inline void PA_SetMapTile(u8 screen, u8 bg_select, s16 x, s16 y, s16 tile_number) - \brief - \~english Change the tile gfx used by a given tile in the map - \~french Change la tile gfx utilisée pour une tile donnée dans la map - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value of the tile to change - \~french Valeur X de la tile à changer - \~\param y - \~english Y value of the map tile to change - \~french Valeur Y de la tile à changer dans la carte - \~\param tile_number - \~english New tile number to put - \~french Nouveau numéro de tile que l'on veut mettre -*/ -static inline void PA_SetMapTile(u8 screen, u8 bg_select, s16 x, s16 y, s16 tile_number) { - *(u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)) &= ~(TILE_N); - *(u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)) |= ((tile_number)&TILE_N); -} - -/*! - \def PA_SetMapTileAll(screen, bg_select, x, y, tile_info) - \brief - \~english Change the tile info used by a given tile in the map - \~french Change les infos tiles utilisée pour une tile donnée dans la map - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value of the tile to change - \~french Valeur X de la tile à changer - \~\param y - \~english Y value of the map tile to change - \~french Valeur Y de la tile à changer dans la carte - \~\param tile_info - \~english New tile to put (tile + palette + flips...) - \~french Nouveau numéro de tile que l'on veut mettre (tile + palette + flips...) -*/ -#define PA_SetMapTileAll(screen, bg_select, x, y, tile_info) *(u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)) = (tile_info) - -/*! - \fn static inline void PA_SetLargeMapTile(u8 screen, u8 bg_select, s32 x, s32 y, u32 tile_info) - \brief - \~english Change the tile info used by a given tile in the map, only for big background (512 large or wide) - \~french Change les infos tiles utilisée pour une tile donnée dans la map, seulement pour les grands fonds (512 de large ou haut) - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value of the tile to change - \~french Valeur X de la tile à changer - \~\param y - \~english Y value of the map tile to change - \~french Valeur Y de la tile à changer dans la carte - \~\param tile_info - \~english New tile to put (tile + palette + flips...) - \~french Nouveau numéro de tile que l'on veut mettre (tile + palette + flips...) -*/ -static inline void PA_SetLargeMapTile(u8 screen, u8 bg_select, s32 x, s32 y, u32 tile_info) { - u32 truex; - u32 mapblock = 0; - truex = x&31; - mapblock = ((x >> 5) << 11) + ((y >> 5) << 12); // Permet d'avoir le bon block... - - *(u16*)(PA_BgInfo[screen][bg_select].Map + ((truex) << 1) + ((y&31) << 6) + mapblock) = tile_info; -} - -/*! - \fn void PA_SetMapTileHflip(u8 screen, u8 bg_select, u8 x, u8 y, u8 hflip) - \brief - \~english Flip a given tile horizontaly - \~french Flipper une tile de la carte, horizontalement - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value of the tile to change - \~french Valeur X de la tile à changer - \~\param y - \~english Y value of the map tile to change - \~french Valeur Y de la tile à changer dans la carte - \~\param hflip - \~english Set the map tile to horizontal flip - \~french Mettre la tile de la carte en flip horizontal -*/ -static inline void PA_SetMapTileHflip(u8 screen, u8 bg_select, u8 x, u8 y, u8 hflip) { - u16 *pointer = (u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)); - *pointer &= ~TILE_HFLIP; - *pointer |= ((hflip) << 10); -} - -/*! - \fn static inline void PA_SetMapTileVflip(u8 screen, u8 bg_select, u8 x, u8 y, u8 vflip) - \brief - \~english Flip a given tile verticaly - \~french Flipper une tile de la carte, verticalement - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value of the tile to change - \~french Valeur X de la tile à changer - \~\param y - \~english Y value of the map tile to change - \~french Valeur Y de la tile à changer dans la carte - \~\param vflip - \~english Set the map tile to vertical flip - \~french Mettre la tile de la carte en flip vertical -*/ -static inline void PA_SetMapTileVflip(u8 screen, u8 bg_select, u8 x, u8 y, u8 vflip) { - u16 *pointer = (u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)); - *pointer &= ~TILE_VFLIP; - *pointer |= ((vflip) << 10); -} - -/*! - \fn static inline void PA_SetMapTilePal(u8 screen, u8 bg_select, u8 x, u8 y, u8 palette_number) - \brief - \~english Change the 16 color palette used by a tile. Works only if the Bg is in 16 colors... - \~french Changer la palette de 16 couleurs utilisée par une tile de la carte. Marche uniquement en mode 16 couleurs pour le Bg. - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value of the tile to change - \~french Valeur X de la tile à changer - \~\param y - \~english Y value of the map tile to change - \~french Valeur Y de la tile à changer dans la carte - \~\param palette_number - \~english Palette number (0-15) - \~french Numéro de la palette (0-15) -*/ -static inline void PA_SetMapTilePal(u8 screen, u8 bg_select, u8 x, u8 y, u8 palette_number) { - u16 *pointer = (u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)); - *pointer &= ~TILE_PAL; - *pointer |= ((palette_number) << 12); -} - -/*! - \def PA_SetMapTileEx(screen, bg_select, x, y, tile_number, hflip, vflip, palette_number) - \brief - \~english Change every aspect of a given map tile - \~french Changer tous les aspect d'une tile donnée dans la map. - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value of the tile to change - \~french Valeur X de la tile à changer - \~\param y - \~english Y value of the map tile to change - \~french Valeur Y de la tile à changer dans la carte - \~\param tile_number - \~english New tile number to put - \~french Nouveau numéro de tile que l'on veut mettre - \~\param hflip - \~english Set the map tile to horizontal flip - \~french Mettre la tile de la carte en flip horizontal - \~\param vflip - \~english Set the map tile to vertical flip - \~french Mettre la tile de la carte en flip vertical - \~\param palette_number - \~english Palette number (0-15) - \~french Numéro de la palette (0-15) -*/ -static inline void PA_SetMapTileEx(u8 screen, u8 bg_select, s16 x, s16 y, u16 tile_number, u8 hflip, u8 vflip, u8 palette_number) { - *(u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)) = (tile_number) + ((hflip) << 10) + ((vflip) << 11) + ((palette_number) << 12); -} - -/*! - \fn static inline void PA_SetBgPrio(u8 screen, u8 bg, u8 prio) - \brief - \~english Change a backgrounds priority - \~french Changer la priorité d'un fond - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg - \~english Background... - \~french Numéro du fond... - \~\param prio - \~english Priority level (0-3, 0 being the highest) - \~french Niveau de priorité, de 0 à 3, 0 étant priorité la plus élevée -*/ -static inline void PA_SetBgPrio(u8 screen, u8 bg, u8 prio) { - _REG16(REG_BGCNT(screen, bg)) &= ~3; - _REG16(REG_BGCNT(screen, bg)) |= prio; -} - -static inline void PA_CreateBgFromTiles(u8 screen, u8 bg_select, u8 bg_tiles, void *bg_map, u8 bg_size){ - PA_LoadBgMap(screen, bg_select, bg_map, bg_size); - scrollpos[screen][bg_select].infscroll = 0; // Par défaut pas de scrolling infini... - PA_BgInfo[screen][bg_select].Map = ScreenBaseBlock(screen, PA_BgInfo[screen][bg_select].mapchar); - PA_BgInfo[screen][bg_select].TileSetChar = PA_BgInfo[screen][bg_tiles].TileSetChar; - PA_BgInfo[screen][bg_select].tilesetsize = PA_BgInfo[screen][bg_tiles].tilesetsize; - - _REG16(REG_BGSCREEN(screen)) |= (0x100 << (bg_select)); - _REG16(REG_BGCNT(screen, bg_select)) = bg_select | (bg_size << 14) |(PA_BgInfo[screen][bg_select].mapchar << SCREEN_SHIFT) | (1 << 13) | (PA_BgInfo[screen][bg_select].TileSetChar << 2) | (1 << 7); - PA_BGScrollXY(screen, bg_select, 0, 0); -} - -/*! - \fn static inline void PA_SetBgPrioSeq(u8 screen, u8 priority0, u8 priority1, u8 priority2, u8 priority3) - \brief - \~english Change all the background priorities to a given background order - \~french Changer la priorité des fonds pour qu'ils soient dans un ordre donné - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param priority0 - \~english Background to show on top - \~french Fond à mettre en premier - \~\param priority1 - \~english Next one... - \~french Suivant... - \~\param priority2 - \~english Next one... - \~french Suivant... - \~\param priority3 - \~english Last one... - \~french Dernier... - -*/ -static inline void PA_SetBgPrioSeq(u8 screen, u8 priority0, u8 priority1, u8 priority2, u8 priority3){ - PA_SetBgPrio(screen, priority0, 0); - PA_SetBgPrio(screen, priority1, 1); - PA_SetBgPrio(screen, priority2, 2); - PA_SetBgPrio(screen, priority3, 3); -} - -/*! \fn static inline void PA_ClearBg(u8 screen, u8 bg_select) - \brief - \~english Erase a given background (just the tilemap) - \~french Effacer un fond donné (juste la map) - \~\param screen - \~english Choose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background... - \~french Fond... -*/ -static inline void PA_ClearBg(u8 screen, u8 bg_select){ - int i, j; - for (i = 0; i < 32; i++) for (j = 0; j < 32; j++) PA_SetMapTileAll(screen, bg_select, i, j, 0); -} - -/*! \def PA_EasyBgLoad(screen, bg_number, bg_name) - \deprecated - \brief - \~english [DEPRECATED] Easiest way to load a background converted with PAGfx... - \~french [DEPRECATED] Moyen le plus simple de charger un fond créé avec PAGfx - \~\param screen - \~english Choose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number... (0-3) - \~french Numéro du fond... (0-3) - \~\param bg_name - \~english Background name - \~french Nom du fond -*/ -#define PA_EasyBgLoad(screen, bg_number, bg_name) do{PA_BgInfo[screen][bg_number].BgMode = bg_name##_Info[0];\ - PA_DEPRECATED_MACRO;\ - PA_StoreEasyBgInfos(screen, bg_number, bg_name##_Info[0], bg_name##_Info[1], bg_name##_Info[2], (void*)bg_name##_Tiles, SIZEOF_16BIT(bg_name##_Tiles), (void*)bg_name##_Map, SIZEOF_16BIT(bg_name##_Map), (void*)bg_name##_Pal);\ - if(PA_BgInfo[screen][bg_number].BgMode == BG_TILEDBG){ PA_LoadTiledBg(screen, bg_number, bg_name);}\ - else{PA_LoadPAGfxLargeBg(screen, bg_number, bg_name);}}while(0) - -/*! \def PA_EasyBgLoadPtr(screen, bg_number, bg_name) - \deprecated - \brief - \~english [DEPRECATED] Easiest way to load a background converted with PAGfx... Can take pointers ! - \~french [DEPRECATED] Moyen le plus simple de charger un fond créé avec PAGfx... Peut prendre des pointeurs ! - \~\param screen - \~english Choose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number... (0-3) - \~french Numéro du fond... (0-3) - \~\param bg_name - \~english Background, like &bg0 - \~french Fond, par exemple &bg0 -*/ -#define PA_EasyBgLoadPtr(screen, bg_number, bg_name) do{\ - PA_DEPRECATED_MACRO;\ - PA_EasyBgLoadEx(screen, bg_number, (u32*)bg_name->Info, bg_name->Tiles, bg_name->TileSize, bg_name->Map, bg_name->MapSize, bg_name->Palette);\ -}while(0) - -/*! - \fn void PA_EasyBgScrollX(u8 screen, u8 bg_number, s32 x) - \brief - \~english Scroll horizontaly any background - \~french Scroll horizontal de n'importe quel fond - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer, horizontalement... -*/ -void PA_EasyBgScrollX(u8 screen, u8 bg_number, s32 x); - -/*! - \fn void PA_EasyBgScrollY(u8 screen, u8 bg_number, s32 y) - \brief - \~english Scroll vertically any background - \~french Scroll vertical de n'importe quel fond - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer, verticalement... -*/ -void PA_EasyBgScrollY(u8 screen, u8 bg_number, s32 y); - -/*! - \fn static inline void PA_EasyBgScrollXY(u8 screen, u8 bg_number, s32 x, s32 y) - \brief - \~english Scroll horizontaly and vertically any background - \~french Scroll horizontal et vertical de n'importe quel fond - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer, horizontalement... - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer, verticalement... -*/ -static inline void PA_EasyBgScrollXY(u8 screen, u8 bg_number, s32 x, s32 y){ - PA_EasyBgScrollX(screen, bg_number, x); - PA_EasyBgScrollY(screen, bg_number, y); -} - -/*! - \fn static inline u8 PA_EasyBgGetPixel(u8 screen, u8 bg_number, s32 x, s32 y) - \brief - \~english Returns the color (number in the palette) of the screen pixel... - \~french Renvoie le numéro dans la palette du pixel à l'écran... - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X screen pixel position - \~french Valeur X du pixel à l'écran - \~\param y - \~english Y screen pixel position - \~french Valeur Y du pixel à l'écran -*/ -static inline u8 PA_EasyBgGetPixel(u8 screen, u8 bg_number, s32 x, s32 y){ - return PA_EasyBgPixel[PA_BgInfo[screen][bg_number].Infos.Type](screen, bg_number, x, y); -} - -/*! - \fn static inline u16 PA_EasyBgGetPixelCol(u8 screen, u8 bg_number, s32 x, s32 y) - \brief - \~english Returns the color (u16 value) of the screen pixel... - \~french Renvoie la couleur (valeur u16) du pixel à l'écran... - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X screen pixel position - \~french Valeur X du pixel à l'écran - \~\param y - \~english Y screen pixel position - \~french Valeur Y du pixel à l'écran -*/ -static inline u16 PA_EasyBgGetPixelCol(u8 screen, u8 bg_number, s32 x, s32 y){ - return ((u16*)(PA_BgInfo[screen][bg_number].Infos.Palette))[PA_EasyBgGetPixel(screen, bg_number, x, y)]; -} - -/*! - \fn static inline void PA_SetBgWrap(u8 screen, u8 bg, u8 wrap) - \brief - \~english Set on/off the background wrapping (for rotating, 8bit, and 16bit backgrounds) - \~french Active ou non le wrapping des fonds (rotatifs, 8bit, et 16bit) - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param wrap - \~english Wrap around on or off... - \~french Wrap activé ou désactivé... -*/ -static inline void PA_SetBgWrap(u8 screen, u8 bg, u8 wrap){ - _REG16(REG_BGCNT(screen, bg)) &= ~(1<<13); // Remove - _REG16(REG_BGCNT(screen, bg)) |= (wrap<<13); -} - - -/*! - \fn static inline void PA_InitParallaxX(u8 screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) - \brief - \~english Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... - \~french Initialiser le Parallax Scrolling pour plusieurs fonds, horizontalement. Choix de la vitesse à laquelle les fonds vont défiler par rapport aux autres... Utiliser PA_ParallaxScrollX par la suite pour scroller - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg0 - \~english Value for the first background (0). Set to 256 for normal scroll speed, lower for lower speed (128 is half speed...), higher for faster (512 is twice as fast...). You can set negative values. 0 inactivates parallax scrolling for this background - \~french Valeur pour le premier fond (0). 256 met en vitesse normal, moins pour moins lent (128 pour moitié de vitesse), plus pour plus rapide (512 équivaut à 2 fois plus vite). On peut utiliser des valeurs négatives. 0 désactive le scrolling parallax pour ce fond - \~\param bg1 - \~english Same thing for Background 1 - \~french Idem, pour le Fond 1 - \~\param bg2 - \~english Same thing for Background 2 - \~french Idem, pour le Fond 2 - \~\param bg3 - \~english Same thing for Background 3 - \~french Idem, pour le Fond 3 -*/ -static inline void PA_InitParallaxX(u8 screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) { - PA_parallaxX[screen][0] = bg0; - PA_parallaxX[screen][1] = bg1; - PA_parallaxX[screen][2] = bg2; - PA_parallaxX[screen][3] = bg3; -} - -/*! - \fn static inline void PA_InitParallaxY(u8 screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) - \brief - \~english Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... - \~french Initialiser le Parallax Scrolling pour plusieurs fonds, horizontalement. Choix de la vitesse à laquelle les fonds vont défiler par rapport aux autres... Utiliser PA_ParallaxScrollX par la suite pour scroller - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg0 - \~english Value for the first background (0). Set to 256 for normal scroll speed, lower for lower speed (128 is half speed...), higher for faster (512 is twice as fast...). You can set negative values. 0 inactivates parallax scrolling for this background - \~french Valeur pour le premier fond (0). 256 met en vitesse normal, moins pour moins lent (128 pour moitié de vitesse), plus pour plus rapide (512 équivaut à 2 fois plus vite). On peut utiliser des valeurs négatives. 0 désactive le scrolling parallax pour ce fond - \~\param bg1 - \~english Same thing for Background 1 - \~french Idem, pour le Fond 1 - \~\param bg2 - \~english Same thing for Background 2 - \~french Idem, pour le Fond 2 - \~\param bg3 - \~english Same thing for Background 3 - \~french Idem, pour le Fond 3 -*/ -static inline void PA_InitParallaxY(u8 screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) { - PA_parallaxY[screen][0] = bg0; - PA_parallaxY[screen][1] = bg1; - PA_parallaxY[screen][2] = bg2; - PA_parallaxY[screen][3] = bg3; -} - - - -/*! - \fn static inline void PA_ParallaxScrollX(u8 screen, s32 x) - \brief - \~english Scroll the backgrounds - \~french Déplacer les fonds activés pour le parallax... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer -*/ -static inline void PA_ParallaxScrollX(u8 screen, s32 x){ - int i; - for(i = 0; i < 4; i++) { - if (PA_parallaxX[screen][i]) { - /*if(scrollpos[screen][i].infscroll)*/ PA_EasyBgScrollX(screen, i, (PA_parallaxX[screen][i] * x) >> 8); // Si bg en scrolling infini - /*else PA_BGScrollX(screen, i, (PA_parallaxX[screen][i] * x) >> 8); // Sinon scrolling normal*/ - } - } -} - -/*! - \fn static inline void PA_ParallaxScrollY(u8 screen, s32 y) - \brief - \~english Scroll the backgrounds - \~french Déplacer les fonds activés pour le parallax... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_ParallaxScrollY(u8 screen, s32 y){ - int i; - for(i = 0; i < 4; i++) { - if (PA_parallaxY[screen][i]) { - /*if(scrollpos[screen][i].infscroll)*/ PA_EasyBgScrollY(screen, i, (PA_parallaxY[screen][i] * y) >> 8); // Si bg en scrolling infini - /*else PA_BGScrollY(screen, i, (PA_parallaxY[screen][i] * y) >> 8); // Sinon scrolling normal*/ - } - } -} - -/*! - \fn static inline void PA_ParallaxScrollXY(u8 screen, s32 x, s32 y) - \brief - \~english Scroll the backgrounds - \~french Déplacer les fonds activés pour le parallax... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_ParallaxScrollXY(u8 screen, s32 x, s32 y){ - PA_ParallaxScrollX(screen, x); - PA_ParallaxScrollY(screen, y); -} - -/** @} */ // end of BgTiles - -// Get pixel functions - -u8 PAEasyBgGetPixelTiled(u8 screen, u8 bg_number, s32 x, s32 y); -u8 PAEasyBgGetPixelLarge(u8 screen, u8 bg_number, s32 x, s32 y); -u8 PAEasyBgGetPixelInf(u8 screen, u8 bg_number, s32 x, s32 y); -u8 PANoPixel(u8 screen, u8 bg_number, s32 x, s32 y); - -static inline void PA_UpdateBgTile(u8 screen, u8 bg_select, u16 tilepos, void *tile){ - tilepos = tilepos << 4; - u32 *tilecopy = (u32*)tile; - int i; - for (i = 0; i < 16; i++) - PA_BgInfo[screen][bg_select].TilePos[tilepos+i] = tilecopy[i]; -} - -void PA_StoreEasyBgInfos(u8 screen, u8 bg_number, u32 Type, u32 Width, u32 Height, void *Tiles, u32 TileSize, void *Map, u32 MapSize, void *Palette); - -#endif +#ifndef _PA_BGTILES +#define _PA_BGTILES + +#include +#include "PA_General.h" +#include "../PA_BgStruct.h" + + +#define BG_TILEDBG 2 +#define BG_ROTBG 3 +#define BG_LARGEMAP 4 +#define BG_INFINITEMAP 5 + +void PA_EasyBgLoadEx(u8 screen, u8 bg_number, u32 *Infos, void *Tiles, u32 TileSize, void *Map, u32 MapSize, void *Palette) DEPRECATED; + +// Extracts the size from PAGfx convertions +static inline u8 PA_GetPAGfxBgSize(u16 width, u16 height){ + u8 bg_size = 0; + if (height == 512) bg_size = 2; + if (width == 512) bg_size ++; + return bg_size; +} + +// Extracts the size from PAGfx convertions +static inline u8 PA_GetPAGfxRotBgSize(u16 width){ + u8 bg_size = 1; //256x256 by default + if (width <= 128) bg_size = 0; + else if (width <= 256) bg_size = 1; + else if (width <= 512) bg_size = 2; + else if (width <= 1024) bg_size = 3; + + return bg_size; +} + +typedef u8 (*EasyBgPixels)(u8, u8, s32, s32); + +extern EasyBgPixels PA_EasyBgPixel[6]; + +/*! \file PA_BgTiles.h + \brief Everything concerning the Bg Tile modes + + This file contains all the macros and variables regarding Tile modes, loading tiles and Bg, etc... +*/ + +//background memory offset macros +#define CharBaseBlock(screen, n) (((n)*0x4000) + 0x6000000 + (0x200000 * screen)) +#define ScreenBaseBlock(screen, n) (((n)*0x800) + 0x6000000 + (0x200000 * screen)) + +// Pointers towards background arrays +typedef struct{ + void *Tiles; + void *Map; + void *Palette; + u32 TileSize, MapSize; + u32 Type, Width, Height; +} PA_BgDefaultInfos; + +typedef struct{ + // Memory management info... + + u32 tilesetsize; // Place utilisée pour chaque tileset + u16 mapsize; // Place utilisée pour chaque map + u8 mapchar; // Emplacement mémoire de chaque map + u8 TileSetChar; + + u32 Map; // Map pointer + u32 NTiles; + u32 *TilePos; + void *Tiles; + + PA_BgDefaultInfos Infos; // Pointers towards background arrays + + s32 ScrollX, ScrollY; // Scroll values + + u8 BgMode; // Background mode +} PA_BgInfos; +extern PA_BgInfos PA_BgInfo[2][4]; + +extern u8 charblocks[2][70]; + +// Quantité de données à charger en fonction de la taille de la map... +extern u16 *PA_DrawBg[2]; // Fond dessinable + +extern u16 bg_sizes[4]; +extern u8 bg_place[4]; + +extern u8 charsetstart[2]; +extern s32 PA_parallaxX[2][4]; +extern s32 PA_parallaxY[2][4]; + +typedef struct { + u8 infscroll; // Passe à 1 si scrolling infini activé... + u16* bg_map; // Map + s32 lx, ly; + s32 scrollx, scrolly; + s32 maxx; // 32 ou 64, en fonction de la largeur... +}scrollpositions; + +extern scrollpositions scrollpos[2][4]; // Pour chaque écran et pour chaque fond :) + +// Mode de couleur +#define BG_COLOR16 0x00 +#define BG_COLOR256 0x80 + +#define CHAR_SHIFT 2 +#define SCREEN_SHIFT 8 +#define WRAPAROUND 0x1 + +#define SCREEN_TILES 24576 // Taille à convertir pour avoir un écran complet... + +//scrolling registers for background 0 + +// Registre pour les controles de chaque écran +#define REG_BGSCREEN0 0x04000000 +#define REG_BGSCREEN1 0x04001000 +#define REG_BGSCREEN(screen) (0x04000000 + (screen * 0x1000)) + +#define REG_BGCNT(screen, bg_number) (0x4000008 + (screen * 0x1000) + (bg_number << 1)) + +// Premier registre pour les scroll. On en déduit les autres en ajoutant pour le screen et le numéro du Bg +#define REG_BGSCROLLX 0x4000010 +#define REG_BGSCROLLY 0x4000012 + +// Tailles pour les Bg : +#define BG_256X256 0 +#define BG_512X256 1 +#define BG_256X512 2 +#define BG_512X512 3 + +//ALL_BUT() pour faire tout sauf... +#define TILE_N 1023 +#define TILE_PAL 61440 +#define TILE_HFLIP 1024 +#define TILE_VFLIP 2048 + +/** @defgroup BgTiles Tiled Background Modes + * Load a background, scroll it, etc... + * @{ + */ + +/*! + \fn void PA_ResetBgSys(void) + \brief + \~english Reset the background system + \~french Reinitialise le systeme de fonds +*/ +void PA_ResetBgSys(void); + +/*! + \fn void PA_ResetBgSysScreen(u8 screen) + \brief + \~english Reset the background system on 1 screen + \~french Reinitialise le systeme de fonds pour 1 écran + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) +*/ +void PA_ResetBgSysScreen(u8 screen); + +/*! + \fn void PA_InitBg(u8 screen, u8 bg_select, u8 bg_size, u8 wraparound, u8 color_mode) + \brief + \~english Initialise a given background. Do this only after having loaded a tileset and a map. + \~french Initialise un fond. A faire uniquement après avoir chargé un tileset et une map. + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_size + \~english Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... For a rotatable Bg, use the macros BG_ROT_128X128... + \~french Taille du fond. Ceci est très important, car ça détermine aussi si le Bg est rotatif ou non. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... Pour un fond rotatif, il suffit d'utiliser BG_ROT_128X128... + \~\param wraparound + \~english If the background wraps around or not. More important for rotating backgrounds. + \~french Si le fond boucle ou non. C'est plus important pour les fonds rotatifs... + \~\param color_mode + \~english Color mode : 0 for 16 color mode, 1 for 256... + \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 + +*/ +void PA_InitBg(u8 screen, u8 bg_select, u8 bg_size, u8 wraparound, u8 color_mode); + +/*! + \def PA_HideBg(screen, bg_select) + \brief + \~english Hide a screen's background. + \~french Cacher un fond. + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) +*/ +#define PA_HideBg(screen, bg_select) _REG16(REG_BGSCREEN(screen)) &= ~(0x100 << (bg_select)) + +/*! + \def PA_ShowBg(screen, bg_select) + \brief + \~english Show a hidden background. + \~french Afficher un fond auparavant caché. + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) +*/ +#define PA_ShowBg(screen, bg_select) _REG16(REG_BGSCREEN(screen)) |= (0x100 << (bg_select)) + +/*! + \def PA_ResetBg(screen) + \brief + \~english Reinitialize de Bg system of a screen. It only hides all the backgrounds in reality... + \~french Reinitialiser les fonds d'un écran. En fait ca ne fait que cacher tous les fonds + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) +*/ +#define PA_ResetBg(screen) _REG16(REG_BGSCREEN(screen)) &= ~(0xF00) + +/*! + \def PA_LoadBgTiles(screen, bg_select, bg_tiles) + \deprecated + \brief + \~english [DEPRECATED] Load a tileset into memory + \~french [DEPRECATED] Charger un tileset en mémoire + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) +*/ +#define PA_LoadBgTiles(screen, bg_select, bg_tiles) PA_LoadBgTilesEx(screen, bg_select, (void*)bg_tiles, SIZEOF_16BIT(bg_tiles)) + +/*! + \fn void PA_LoadBgTilesEx(u8 screen, u8 bg_select, void* bg_tiles, u32 size) + \brief + \~english Load a tileset into memory with a given size + \~french Charger un tileset en mémoire avec une taille donnée + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param size + \~english 16 bit size... + \~french Taille en 16 bits... + +*/ +void PA_LoadBgTilesEx(u8 screen, u8 bg_select, void* bg_tiles, u32 size); + +/*! + \fn void PA_ReLoadBgTiles(u8 screen, u8 bg_select, void* bg_tiles) + \brief + \~english ReLoad a tileset into memory + \~french ReCharger un tileset en mémoire + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) +*/ +void PA_ReLoadBgTiles(u8 screen, u8 bg_select, void* bg_tiles); + +/*! + \fn void PA_DeleteTiles(u8 screen, u8 bg_select) + \brief + \~english Delete a tilest in memory. Note that loading a tileset automatically deletes the preceding one, so you won't need to use this function often + \~french Effacer un tileset en mémoire. A noter que charger un tileset efface automatiquement le tileset précédent, donc on n'aura pas souvent besoin de cette fonction... + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) +*/ +void PA_DeleteTiles(u8 screen, u8 bg_select); + +/*! + \fn void PA_DeleteMap(u8 screen, u8 bg_select) + \brief + \~english Delete a map in memory. Note that loading a map automatically deletes the preceding one, so you won't need to use this function often + \~french Effacer une map en mémoire. A noter que charger une map efface automatiquement la map précédent, donc on n'aura pas souvent besoin de cette fonction... + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) +*/ +void PA_DeleteMap(u8 screen, u8 bg_select); + +/*! + \fn static inline void PA_DeleteBg(u8 screen, u8 bg_select) + \brief + \~english Delete and reset a complete background + \~french Effacer et reinitialiser un fond complètement + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) +*/ +static inline void PA_DeleteBg(u8 screen, u8 bg_select) { + // By Maple, June 2008 + // This is a small piece of PA_ResetBgSysScreen() + + PA_HideBg(screen, bg_select); + PA_DeleteTiles(screen, bg_select); + PA_DeleteMap(screen, bg_select); + + PA_BgInfo[screen][bg_select].tilesetsize = 0; + PA_BgInfo[screen][bg_select].mapsize = 0; + PA_BgInfo[screen][bg_select].TileSetChar = 0; + PA_BgInfo[screen][bg_select].mapchar = 0; + PA_parallaxX[screen][bg_select] = 0; + PA_parallaxY[screen][bg_select] = 0; + scrollpos[screen][bg_select].infscroll = 0; +} + +/*! + \fn void PA_LoadBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size) + \brief + \~english Load a background's map info + \~french Charge la carte d'un fond + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_map + \~english Name of the map's info (example : (void*)ship_Map) Don't forget the void... + \~french Nom du tableau contenant les infos sur la map (exemple : (void*)ship_Map) n'oublie pas le void... + \~\param bg_size + \~english Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... + \~french Taille du fond. Ceci est très important, car ça détermine aussi si le Bg est rotatif ou non. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... +*/ + +void PA_LoadBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size); + +/*! \fn void PA_LoadBackground(u8 screen, u8 bg_number, const PA_BgStruct* bg_name) + \brief + \~english Load a background (EasyBg or RotBg). + \~french Charger un fond (EasyBg ou RotBg). + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number... (0-3) + \~french Numéro du fond... (0-3) + \~\param bg_name + \~english Pointer to the background (struct) + \~french Pointeur vers le fond +*/ + +void PA_LoadBackground(u8 screen, u8 bg_select, const PA_BgStruct* bg_name); + +/*! + \def PA_LoadTiledBg(screen, bg_number, bg_name) + \deprecated + \brief + \~english [DEPRECATED] This will never get easier... Loads a background TiledBg converted with PAGfx, with its tiles, map, and palette. Only 256 color mode available. + \~french [DEPRECATED] On ne pourra jamais rendre ca plus simple... Charge un fond de type TiledBg converti avec PAGfx, en mettant les tiles, la map, et meme la palette ! Seulement en mode 256 couleurs + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_name + \~english Background name, like bg0 + \~french Nom du fond, comme bg0 +*/ + +#define PA_LoadTiledBg(screen, bg_number, bg_name) do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadBgPal(screen, bg_number, (void*)bg_name##_Pal); \ + PA_LoadSimpleBg(screen, bg_number, bg_name##_Tiles, bg_name##_Map, PA_GetPAGfxBgSize(bg_name##_Info[1], bg_name##_Info[2]), 0, 1);}while(0) + +/*! + \def PA_LoadSimpleBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode) + \deprecated + \brief + \~english [DEPRECATED] Simple way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap + \~french [DEPRECATED] Façon simple de cahrger un fond. Combine PA_InitBg, PA_LoadBgTiles, et PA_LoadBgMap + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param bg_map + \~english Name of the map's info (example : ship_Map) + \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) + \~\param bg_size + \~english Background size. To use a normal background, use the macros BG_256X256, BG_256X512, etc... + \~french Taille du fond. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... + \~\param wraparound + \~english If the background wraps around or not. More important for rotating backgrounds. + \~french Si le fond boucle ou non. C'est plus important pour les fonds rotatifs... + \~\param color_mode + \~english Color mode : 0 for 16 color mode, 1 for 256... + \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 +*/ + +#define PA_LoadSimpleBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode) do{\ + PA_DEPRECATED_MACRO;\ + PA_DeleteBg(screen, bg_select);\ + PA_LoadBgTiles(screen, bg_select, bg_tiles); \ + PA_LoadBgMap(screen, bg_select, (void*)bg_map, bg_size); \ + PA_InitBg(screen, bg_select, bg_size, 0, color_mode);\ + PA_BGScrollXY(screen, bg_select, 0, 0);}while(0) + +/*! + \def PA_LoadBg(screen, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode) + \deprecated + \brief + \~english [DEPRECATED] Simplest way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap + \~french [DEPRECATED] Facon la plus simple de cahrger un fond. Combine PA_InitBg, PA_LoadBgTiles, et PA_LoadBgMap + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param tile_size + \~english Size of your tileset + \~french Taille du tilset + \~\param bg_map + \~english Name of the map's info (example : ship_Map) + \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) + \~\param bg_size + \~english Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... For a rotatable Bg, use the macros BG_ROT_128X128... + \~french Taille du fond. Ceci est très important, car ça détermine aussi si le Bg est rotatif ou non. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... Por un fond rotatif, il suffit d'utiliser BG_ROT_128X128... + \~\param wraparound + \~english If the background wraps around or not. More important for rotating backgrounds. + \~french Si le fond boucle ou non. C'est plus important pour les fonds rotatifs... + \~\param color_mode + \~english Color mode : 0 for 16 color mode, 1 for 256... + \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 +*/ + +#define PA_LoadBg(screen, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode) do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadBgTilesEx(screen, bg_select, (void*)bg_tiles, tile_size); \ + PA_LoadBgMap(screen, bg_select, (void*)bg_map, bg_size); \ + PA_InitBg(screen, bg_select, bg_size, 0, color_mode);\ + PA_BGScrollXY(screen, bg_select, 0, 0);}while(0) + +/*! + \fn static inline void PA_BGScrollX(u8 screen, u8 bg_number, s32 x) + \brief + \~english Scroll horizontaly a Tiled background + \~french Scroll horizontal d'un fond de type Tiled + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer, horizontalement... +*/ +static inline void PA_BGScrollX(u8 screen, u8 bg_number, s32 x) { + PA_BgInfo[screen][bg_number].ScrollX = (x)&1023; + _REG16(REG_BGSCROLLX + ((screen) * 0x1000) + ((bg_number) << 2)) = (x)&1023; +} + +/*! + \fn static inline void PA_BGScrollY(u8 screen, u8 bg_number, s32 y) + \brief + \~english Scroll vertically a Tiled background + \~french Scroll vertical d'un fond de type Tiled + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer, verticalement... +*/ +static inline void PA_BGScrollY(u8 screen, u8 bg_number, s32 y) { + PA_BgInfo[screen][bg_number].ScrollY = (y)&1023; + _REG16(REG_BGSCROLLY + ((screen) * 0x1000) + ((bg_number) << 2)) = (y)&1023; +} + +/*! + \def PA_BGScrollXY(screen, bg_number, x, y) + \brief + \~english Scroll horizontaly and vertically a Tiled background + \~french Scroll horizontal et vertical d'un fond de type Tiled + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer, horizontalement... + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer, verticalement... +*/ +static inline void PA_BGScrollXY(u8 screen, u8 bg_number, s32 x, s32 y) { + PA_BGScrollX(screen, bg_number, x); + PA_BGScrollY(screen, bg_number, y); +} + +/*! + \fn static inline void PA_SetMapTile(u8 screen, u8 bg_select, s16 x, s16 y, s16 tile_number) + \brief + \~english Change the tile gfx used by a given tile in the map + \~french Change la tile gfx utilisée pour une tile donnée dans la map + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value of the tile to change + \~french Valeur X de la tile à changer + \~\param y + \~english Y value of the map tile to change + \~french Valeur Y de la tile à changer dans la carte + \~\param tile_number + \~english New tile number to put + \~french Nouveau numéro de tile que l'on veut mettre +*/ +static inline void PA_SetMapTile(u8 screen, u8 bg_select, s16 x, s16 y, s16 tile_number) { + *(u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)) &= ~(TILE_N); + *(u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)) |= ((tile_number)&TILE_N); +} + +/*! + \def PA_SetMapTileAll(screen, bg_select, x, y, tile_info) + \brief + \~english Change the tile info used by a given tile in the map + \~french Change les infos tiles utilisée pour une tile donnée dans la map + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value of the tile to change + \~french Valeur X de la tile à changer + \~\param y + \~english Y value of the map tile to change + \~french Valeur Y de la tile à changer dans la carte + \~\param tile_info + \~english New tile to put (tile + palette + flips...) + \~french Nouveau numéro de tile que l'on veut mettre (tile + palette + flips...) +*/ +#define PA_SetMapTileAll(screen, bg_select, x, y, tile_info) *(u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)) = (tile_info) + +/*! + \fn static inline void PA_SetLargeMapTile(u8 screen, u8 bg_select, s32 x, s32 y, u32 tile_info) + \brief + \~english Change the tile info used by a given tile in the map, only for big background (512 large or wide) + \~french Change les infos tiles utilisée pour une tile donnée dans la map, seulement pour les grands fonds (512 de large ou haut) + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value of the tile to change + \~french Valeur X de la tile à changer + \~\param y + \~english Y value of the map tile to change + \~french Valeur Y de la tile à changer dans la carte + \~\param tile_info + \~english New tile to put (tile + palette + flips...) + \~french Nouveau numéro de tile que l'on veut mettre (tile + palette + flips...) +*/ +static inline void PA_SetLargeMapTile(u8 screen, u8 bg_select, s32 x, s32 y, u32 tile_info) { + u32 truex; + u32 mapblock = 0; + truex = x&31; + mapblock = ((x >> 5) << 11) + ((y >> 5) << 12); // Permet d'avoir le bon block... + + *(u16*)(PA_BgInfo[screen][bg_select].Map + ((truex) << 1) + ((y&31) << 6) + mapblock) = tile_info; +} + +/*! + \fn void PA_SetMapTileHflip(u8 screen, u8 bg_select, u8 x, u8 y, u8 hflip) + \brief + \~english Flip a given tile horizontaly + \~french Flipper une tile de la carte, horizontalement + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value of the tile to change + \~french Valeur X de la tile à changer + \~\param y + \~english Y value of the map tile to change + \~french Valeur Y de la tile à changer dans la carte + \~\param hflip + \~english Set the map tile to horizontal flip + \~french Mettre la tile de la carte en flip horizontal +*/ +static inline void PA_SetMapTileHflip(u8 screen, u8 bg_select, u8 x, u8 y, u8 hflip) { + u16 *pointer = (u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)); + *pointer &= ~TILE_HFLIP; + *pointer |= ((hflip) << 10); +} + +/*! + \fn static inline void PA_SetMapTileVflip(u8 screen, u8 bg_select, u8 x, u8 y, u8 vflip) + \brief + \~english Flip a given tile verticaly + \~french Flipper une tile de la carte, verticalement + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value of the tile to change + \~french Valeur X de la tile à changer + \~\param y + \~english Y value of the map tile to change + \~french Valeur Y de la tile à changer dans la carte + \~\param vflip + \~english Set the map tile to vertical flip + \~french Mettre la tile de la carte en flip vertical +*/ +static inline void PA_SetMapTileVflip(u8 screen, u8 bg_select, u8 x, u8 y, u8 vflip) { + u16 *pointer = (u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)); + *pointer &= ~TILE_VFLIP; + *pointer |= ((vflip) << 10); +} + +/*! + \fn static inline void PA_SetMapTilePal(u8 screen, u8 bg_select, u8 x, u8 y, u8 palette_number) + \brief + \~english Change the 16 color palette used by a tile. Works only if the Bg is in 16 colors... + \~french Changer la palette de 16 couleurs utilisée par une tile de la carte. Marche uniquement en mode 16 couleurs pour le Bg. + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value of the tile to change + \~french Valeur X de la tile à changer + \~\param y + \~english Y value of the map tile to change + \~french Valeur Y de la tile à changer dans la carte + \~\param palette_number + \~english Palette number (0-15) + \~french Numéro de la palette (0-15) +*/ +static inline void PA_SetMapTilePal(u8 screen, u8 bg_select, u8 x, u8 y, u8 palette_number) { + u16 *pointer = (u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)); + *pointer &= ~TILE_PAL; + *pointer |= ((palette_number) << 12); +} + +/*! + \def PA_SetMapTileEx(screen, bg_select, x, y, tile_number, hflip, vflip, palette_number) + \brief + \~english Change every aspect of a given map tile + \~french Changer tous les aspect d'une tile donnée dans la map. + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value of the tile to change + \~french Valeur X de la tile à changer + \~\param y + \~english Y value of the map tile to change + \~french Valeur Y de la tile à changer dans la carte + \~\param tile_number + \~english New tile number to put + \~french Nouveau numéro de tile que l'on veut mettre + \~\param hflip + \~english Set the map tile to horizontal flip + \~french Mettre la tile de la carte en flip horizontal + \~\param vflip + \~english Set the map tile to vertical flip + \~french Mettre la tile de la carte en flip vertical + \~\param palette_number + \~english Palette number (0-15) + \~french Numéro de la palette (0-15) +*/ +static inline void PA_SetMapTileEx(u8 screen, u8 bg_select, s16 x, s16 y, u16 tile_number, u8 hflip, u8 vflip, u8 palette_number) { + *(u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)) = (tile_number) + ((hflip) << 10) + ((vflip) << 11) + ((palette_number) << 12); +} + +/*! + \fn static inline void PA_SetBgPrio(u8 screen, u8 bg, u8 prio) + \brief + \~english Change a backgrounds priority + \~french Changer la priorité d'un fond + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg + \~english Background... + \~french Numéro du fond... + \~\param prio + \~english Priority level (0-3, 0 being the highest) + \~french Niveau de priorité, de 0 à 3, 0 étant priorité la plus élevée +*/ +static inline void PA_SetBgPrio(u8 screen, u8 bg, u8 prio) { + _REG16(REG_BGCNT(screen, bg)) &= ~3; + _REG16(REG_BGCNT(screen, bg)) |= prio; +} + +static inline void PA_CreateBgFromTiles(u8 screen, u8 bg_select, u8 bg_tiles, void *bg_map, u8 bg_size){ + PA_LoadBgMap(screen, bg_select, bg_map, bg_size); + scrollpos[screen][bg_select].infscroll = 0; // Par défaut pas de scrolling infini... + PA_BgInfo[screen][bg_select].Map = ScreenBaseBlock(screen, PA_BgInfo[screen][bg_select].mapchar); + PA_BgInfo[screen][bg_select].TileSetChar = PA_BgInfo[screen][bg_tiles].TileSetChar; + PA_BgInfo[screen][bg_select].tilesetsize = PA_BgInfo[screen][bg_tiles].tilesetsize; + + _REG16(REG_BGSCREEN(screen)) |= (0x100 << (bg_select)); + _REG16(REG_BGCNT(screen, bg_select)) = bg_select | (bg_size << 14) |(PA_BgInfo[screen][bg_select].mapchar << SCREEN_SHIFT) | (1 << 13) | (PA_BgInfo[screen][bg_select].TileSetChar << 2) | (1 << 7); + PA_BGScrollXY(screen, bg_select, 0, 0); +} + +/*! + \fn static inline void PA_SetBgPrioSeq(u8 screen, u8 priority0, u8 priority1, u8 priority2, u8 priority3) + \brief + \~english Change all the background priorities to a given background order + \~french Changer la priorité des fonds pour qu'ils soient dans un ordre donné + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param priority0 + \~english Background to show on top + \~french Fond à mettre en premier + \~\param priority1 + \~english Next one... + \~french Suivant... + \~\param priority2 + \~english Next one... + \~french Suivant... + \~\param priority3 + \~english Last one... + \~french Dernier... + +*/ +static inline void PA_SetBgPrioSeq(u8 screen, u8 priority0, u8 priority1, u8 priority2, u8 priority3){ + PA_SetBgPrio(screen, priority0, 0); + PA_SetBgPrio(screen, priority1, 1); + PA_SetBgPrio(screen, priority2, 2); + PA_SetBgPrio(screen, priority3, 3); +} + +/*! \fn static inline void PA_ClearBg(u8 screen, u8 bg_select) + \brief + \~english Erase a given background (just the tilemap) + \~french Effacer un fond donné (juste la map) + \~\param screen + \~english Choose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background... + \~french Fond... +*/ +static inline void PA_ClearBg(u8 screen, u8 bg_select){ + int i, j; + for (i = 0; i < 32; i++) for (j = 0; j < 32; j++) PA_SetMapTileAll(screen, bg_select, i, j, 0); +} + +/*! \def PA_EasyBgLoad(screen, bg_number, bg_name) + \deprecated + \brief + \~english [DEPRECATED] Easiest way to load a background converted with PAGfx... + \~french [DEPRECATED] Moyen le plus simple de charger un fond créé avec PAGfx + \~\param screen + \~english Choose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number... (0-3) + \~french Numéro du fond... (0-3) + \~\param bg_name + \~english Background name + \~french Nom du fond +*/ +#define PA_EasyBgLoad(screen, bg_number, bg_name) do{PA_BgInfo[screen][bg_number].BgMode = bg_name##_Info[0];\ + PA_DEPRECATED_MACRO;\ + PA_StoreEasyBgInfos(screen, bg_number, bg_name##_Info[0], bg_name##_Info[1], bg_name##_Info[2], (void*)bg_name##_Tiles, SIZEOF_16BIT(bg_name##_Tiles), (void*)bg_name##_Map, SIZEOF_16BIT(bg_name##_Map), (void*)bg_name##_Pal);\ + if(PA_BgInfo[screen][bg_number].BgMode == BG_TILEDBG){ PA_LoadTiledBg(screen, bg_number, bg_name);}\ + else{PA_LoadPAGfxLargeBg(screen, bg_number, bg_name);}}while(0) + +/*! \def PA_EasyBgLoadPtr(screen, bg_number, bg_name) + \deprecated + \brief + \~english [DEPRECATED] Easiest way to load a background converted with PAGfx... Can take pointers ! + \~french [DEPRECATED] Moyen le plus simple de charger un fond créé avec PAGfx... Peut prendre des pointeurs ! + \~\param screen + \~english Choose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number... (0-3) + \~french Numéro du fond... (0-3) + \~\param bg_name + \~english Background, like &bg0 + \~french Fond, par exemple &bg0 +*/ +#define PA_EasyBgLoadPtr(screen, bg_number, bg_name) do{\ + PA_DEPRECATED_MACRO;\ + PA_EasyBgLoadEx(screen, bg_number, (u32*)bg_name->Info, bg_name->Tiles, bg_name->TileSize, bg_name->Map, bg_name->MapSize, bg_name->Palette);\ +}while(0) + +/*! + \fn void PA_EasyBgScrollX(u8 screen, u8 bg_number, s32 x) + \brief + \~english Scroll horizontaly any background + \~french Scroll horizontal de n'importe quel fond + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer, horizontalement... +*/ +void PA_EasyBgScrollX(u8 screen, u8 bg_number, s32 x); + +/*! + \fn void PA_EasyBgScrollY(u8 screen, u8 bg_number, s32 y) + \brief + \~english Scroll vertically any background + \~french Scroll vertical de n'importe quel fond + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer, verticalement... +*/ +void PA_EasyBgScrollY(u8 screen, u8 bg_number, s32 y); + +/*! + \fn static inline void PA_EasyBgScrollXY(u8 screen, u8 bg_number, s32 x, s32 y) + \brief + \~english Scroll horizontaly and vertically any background + \~french Scroll horizontal et vertical de n'importe quel fond + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer, horizontalement... + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer, verticalement... +*/ +static inline void PA_EasyBgScrollXY(u8 screen, u8 bg_number, s32 x, s32 y){ + PA_EasyBgScrollX(screen, bg_number, x); + PA_EasyBgScrollY(screen, bg_number, y); +} + +/*! + \fn static inline u8 PA_EasyBgGetPixel(u8 screen, u8 bg_number, s32 x, s32 y) + \brief + \~english Returns the color (number in the palette) of the screen pixel... + \~french Renvoie le numéro dans la palette du pixel à l'écran... + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X screen pixel position + \~french Valeur X du pixel à l'écran + \~\param y + \~english Y screen pixel position + \~french Valeur Y du pixel à l'écran +*/ +static inline u8 PA_EasyBgGetPixel(u8 screen, u8 bg_number, s32 x, s32 y){ + return PA_EasyBgPixel[PA_BgInfo[screen][bg_number].Infos.Type](screen, bg_number, x, y); +} + +/*! + \fn static inline u16 PA_EasyBgGetPixelCol(u8 screen, u8 bg_number, s32 x, s32 y) + \brief + \~english Returns the color (u16 value) of the screen pixel... + \~french Renvoie la couleur (valeur u16) du pixel à l'écran... + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X screen pixel position + \~french Valeur X du pixel à l'écran + \~\param y + \~english Y screen pixel position + \~french Valeur Y du pixel à l'écran +*/ +static inline u16 PA_EasyBgGetPixelCol(u8 screen, u8 bg_number, s32 x, s32 y){ + return ((u16*)(PA_BgInfo[screen][bg_number].Infos.Palette))[PA_EasyBgGetPixel(screen, bg_number, x, y)]; +} + +/*! + \fn static inline void PA_SetBgWrap(u8 screen, u8 bg, u8 wrap) + \brief + \~english Set on/off the background wrapping (for rotating, 8bit, and 16bit backgrounds) + \~french Active ou non le wrapping des fonds (rotatifs, 8bit, et 16bit) + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param wrap + \~english Wrap around on or off... + \~french Wrap activé ou désactivé... +*/ +static inline void PA_SetBgWrap(u8 screen, u8 bg, u8 wrap){ + _REG16(REG_BGCNT(screen, bg)) &= ~(1<<13); // Remove + _REG16(REG_BGCNT(screen, bg)) |= (wrap<<13); +} + + +/*! + \fn static inline void PA_InitParallaxX(u8 screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) + \brief + \~english Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... + \~french Initialiser le Parallax Scrolling pour plusieurs fonds, horizontalement. Choix de la vitesse à laquelle les fonds vont défiler par rapport aux autres... Utiliser PA_ParallaxScrollX par la suite pour scroller + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg0 + \~english Value for the first background (0). Set to 256 for normal scroll speed, lower for lower speed (128 is half speed...), higher for faster (512 is twice as fast...). You can set negative values. 0 inactivates parallax scrolling for this background + \~french Valeur pour le premier fond (0). 256 met en vitesse normal, moins pour moins lent (128 pour moitié de vitesse), plus pour plus rapide (512 équivaut à 2 fois plus vite). On peut utiliser des valeurs négatives. 0 désactive le scrolling parallax pour ce fond + \~\param bg1 + \~english Same thing for Background 1 + \~french Idem, pour le Fond 1 + \~\param bg2 + \~english Same thing for Background 2 + \~french Idem, pour le Fond 2 + \~\param bg3 + \~english Same thing for Background 3 + \~french Idem, pour le Fond 3 +*/ +static inline void PA_InitParallaxX(u8 screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) { + PA_parallaxX[screen][0] = bg0; + PA_parallaxX[screen][1] = bg1; + PA_parallaxX[screen][2] = bg2; + PA_parallaxX[screen][3] = bg3; +} + +/*! + \fn static inline void PA_InitParallaxY(u8 screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) + \brief + \~english Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... + \~french Initialiser le Parallax Scrolling pour plusieurs fonds, horizontalement. Choix de la vitesse à laquelle les fonds vont défiler par rapport aux autres... Utiliser PA_ParallaxScrollX par la suite pour scroller + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg0 + \~english Value for the first background (0). Set to 256 for normal scroll speed, lower for lower speed (128 is half speed...), higher for faster (512 is twice as fast...). You can set negative values. 0 inactivates parallax scrolling for this background + \~french Valeur pour le premier fond (0). 256 met en vitesse normal, moins pour moins lent (128 pour moitié de vitesse), plus pour plus rapide (512 équivaut à 2 fois plus vite). On peut utiliser des valeurs négatives. 0 désactive le scrolling parallax pour ce fond + \~\param bg1 + \~english Same thing for Background 1 + \~french Idem, pour le Fond 1 + \~\param bg2 + \~english Same thing for Background 2 + \~french Idem, pour le Fond 2 + \~\param bg3 + \~english Same thing for Background 3 + \~french Idem, pour le Fond 3 +*/ +static inline void PA_InitParallaxY(u8 screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) { + PA_parallaxY[screen][0] = bg0; + PA_parallaxY[screen][1] = bg1; + PA_parallaxY[screen][2] = bg2; + PA_parallaxY[screen][3] = bg3; +} + + + +/*! + \fn static inline void PA_ParallaxScrollX(u8 screen, s32 x) + \brief + \~english Scroll the backgrounds + \~french Déplacer les fonds activés pour le parallax... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer +*/ +static inline void PA_ParallaxScrollX(u8 screen, s32 x){ + int i; + for(i = 0; i < 4; i++) { + if (PA_parallaxX[screen][i]) { + /*if(scrollpos[screen][i].infscroll)*/ PA_EasyBgScrollX(screen, i, (PA_parallaxX[screen][i] * x) >> 8); // Si bg en scrolling infini + /*else PA_BGScrollX(screen, i, (PA_parallaxX[screen][i] * x) >> 8); // Sinon scrolling normal*/ + } + } +} + +/*! + \fn static inline void PA_ParallaxScrollY(u8 screen, s32 y) + \brief + \~english Scroll the backgrounds + \~french Déplacer les fonds activés pour le parallax... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_ParallaxScrollY(u8 screen, s32 y){ + int i; + for(i = 0; i < 4; i++) { + if (PA_parallaxY[screen][i]) { + /*if(scrollpos[screen][i].infscroll)*/ PA_EasyBgScrollY(screen, i, (PA_parallaxY[screen][i] * y) >> 8); // Si bg en scrolling infini + /*else PA_BGScrollY(screen, i, (PA_parallaxY[screen][i] * y) >> 8); // Sinon scrolling normal*/ + } + } +} + +/*! + \fn static inline void PA_ParallaxScrollXY(u8 screen, s32 x, s32 y) + \brief + \~english Scroll the backgrounds + \~french Déplacer les fonds activés pour le parallax... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_ParallaxScrollXY(u8 screen, s32 x, s32 y){ + PA_ParallaxScrollX(screen, x); + PA_ParallaxScrollY(screen, y); +} + +/** @} */ // end of BgTiles + +// Get pixel functions + +u8 PAEasyBgGetPixelTiled(u8 screen, u8 bg_number, s32 x, s32 y); +u8 PAEasyBgGetPixelLarge(u8 screen, u8 bg_number, s32 x, s32 y); +u8 PAEasyBgGetPixelInf(u8 screen, u8 bg_number, s32 x, s32 y); +u8 PANoPixel(u8 screen, u8 bg_number, s32 x, s32 y); + +static inline void PA_UpdateBgTile(u8 screen, u8 bg_select, u16 tilepos, void *tile){ + tilepos = tilepos << 4; + u32 *tilecopy = (u32*)tile; + int i; + for (i = 0; i < 16; i++) + PA_BgInfo[screen][bg_select].TilePos[tilepos+i] = tilecopy[i]; +} + +void PA_StoreEasyBgInfos(u8 screen, u8 bg_number, u32 Type, u32 Width, u32 Height, void *Tiles, u32 TileSize, void *Map, u32 MapSize, void *Palette); + +#endif diff --git a/include/arm9/PA_BgTrans.h b/include/arm9/PA_BgTrans.h index 8cdcca0..ce27ed8 100644 --- a/include/arm9/PA_BgTrans.h +++ b/include/arm9/PA_BgTrans.h @@ -1,137 +1,137 @@ -#ifndef _PA_BGTRANS -#define _PA_BGTRANS - - -/*! \file PA_BgTrans.h - \brief Background Transition Effects - - All the different transition effects... -*/ - -enum{ - TRANS_ROUND, TRANS_DIAMOND, TRANS_CROSS, TRANS_LINES, TRANS_STAR, - TRANS_LENGTH = 70 -}; -/* -#define TRANS_LENGTH 70 - -#define TRANS_ROUND 0 -#define TRANS_DIAMOND 1 -#define TRANS_CROSS 2 -#define TRANS_LINES 3 -#define TRANS_STAR 4 -*/ -/** @defgroup bgtrans Background Transition Effects - * All the different transition effects... - * @{ - */ - -/*! \fn void PA_InitBgTransEx(u8 screen, u8 bg) - \brief - \~english Init the BgTransition System. - \~french Initialise le systeme BgTrans sur le fond 0 - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg - \~english Background (0-3) - \~french Fond (0-3) -*/ -void PA_InitBgTransEx(u8 screen, u8 bg); - -/*! \fn static inline void PA_InitBgTrans(u8 screen) - \brief - \~english Init the BgTransition System. USES BG0 !! Place your sprite at a priority of 1 or more if you want them to disappear... - \~french Initialise le systeme BgTrans sur le fond 0 - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) -*/ -static inline void PA_InitBgTrans(u8 screen){ - PA_InitBgTransEx(screen, 0); -} - -/*! \fn void PA_BgTransUpDown(u8 screen, u16 type, u8 vflip, s16 state) - \brief - \~english Up/Down swipping transition effect - \~french Effet de transition en Haut/Bas - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param type - \~english BgTrans type... (0-4). Use macros TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, or TRANS_STAR - \~french Type de transition... (0-4). Utiliser TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, ou TRANS_STAR - \~\param vflip - \~english Vertical flip... - \~french Flip vertical... - \~\param state - \~english State, from 0 to TRANS_LENGTH. 0 being visible, TRANS_LENGTH invisible - \~french Etat, de 0 à TRANS_LENGTH. 0 pour visible, TRANS_LENGTH pour invisible... -*/ -void PA_BgTransUpDown(u8 screen, u16 type, u8 vflip, s16 state); - -/*! \fn void PA_BgTransLeftRight(u8 screen, u16 type, u8 hflip, s16 state) - \brief - \~english Left/Right swipping transition effect - \~french Effet de transition en Gauche/Droite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param type - \~english BgTrans type... (0-4). Use macros TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, or TRANS_STAR - \~french Type de transition... (0-4). Utiliser TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, ou TRANS_STAR - \~\param hflip - \~english Horizontal flip... - \~french Flip horizontal... - \~\param state - \~english State, from 0 to TRANS_LENGTH. 0 being visible, TRANS_LENGTH invisible - \~french Etat, de 0 à TRANS_LENGTH. 0 pour visible, TRANS_LENGTH pour invisible... -*/ -void PA_BgTransLeftRight(u8 screen, u16 type, u8 hflip, s16 state); - -/*! \fn void PA_BgTransDiag(u8 screen, u16 type, u8 hflip, u8 vflip, s16 state) - \brief - \~english Diagonal swipping transition effect - \~french Effet de transition en diagonale - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param type - \~english BgTrans type... (0-4). Use macros TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, or TRANS_STAR - \~french Type de transition... (0-4). Utiliser TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, ou TRANS_STAR - \~\param hflip - \~english Horizontal flip... - \~french Flip horizontal... - \~\param vflip - \~english Vertical flip... - \~french Flip vertical... - \~\param state - \~english State, from 0 to TRANS_LENGTH. 0 being visible, TRANS_LENGTH invisible - \~french Etat, de 0 à TRANS_LENGTH. 0 pour visible, TRANS_LENGTH pour invisible... -*/ -void PA_BgTransDiag(u8 screen, u16 type, u8 hflip, u8 vflip, s16 state); - - -/*! \fn void PA_BgTransCenter(u8 screen, u16 type, u8 invert, s16 state) - \brief - \~english Center transition effect - \~french Effet de transition depuis le centre - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param type - \~english BgTrans type... (0-4). Use macros TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, or TRANS_STAR - \~french Type de transition... (0-4). Utiliser TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, ou TRANS_STAR - \~\param invert - \~english Invert in/out - \~french Inverser dedans/dehors - \~\param state - \~english State, from 0 to TRANS_LENGTH. 0 being visible, TRANS_LENGTH invisible - \~french Etat, de 0 à TRANS_LENGTH. 0 pour visible, TRANS_LENGTH pour invisible... -*/ -void PA_BgTransCenter(u8 screen, u16 type, u8 invert, s16 state); - -/** @} */ // end of bgtrans -////////////////////////////////////////////////////////////////////// - -#endif +#ifndef _PA_BGTRANS +#define _PA_BGTRANS + + +/*! \file PA_BgTrans.h + \brief Background Transition Effects + + All the different transition effects... +*/ + +enum{ + TRANS_ROUND, TRANS_DIAMOND, TRANS_CROSS, TRANS_LINES, TRANS_STAR, + TRANS_LENGTH = 70 +}; +/* +#define TRANS_LENGTH 70 + +#define TRANS_ROUND 0 +#define TRANS_DIAMOND 1 +#define TRANS_CROSS 2 +#define TRANS_LINES 3 +#define TRANS_STAR 4 +*/ +/** @defgroup bgtrans Background Transition Effects + * All the different transition effects... + * @{ + */ + +/*! \fn void PA_InitBgTransEx(u8 screen, u8 bg) + \brief + \~english Init the BgTransition System. + \~french Initialise le systeme BgTrans sur le fond 0 + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg + \~english Background (0-3) + \~french Fond (0-3) +*/ +void PA_InitBgTransEx(u8 screen, u8 bg); + +/*! \fn static inline void PA_InitBgTrans(u8 screen) + \brief + \~english Init the BgTransition System. USES BG0 !! Place your sprite at a priority of 1 or more if you want them to disappear... + \~french Initialise le systeme BgTrans sur le fond 0 + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) +*/ +static inline void PA_InitBgTrans(u8 screen){ + PA_InitBgTransEx(screen, 0); +} + +/*! \fn void PA_BgTransUpDown(u8 screen, u16 type, u8 vflip, s16 state) + \brief + \~english Up/Down swipping transition effect + \~french Effet de transition en Haut/Bas + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param type + \~english BgTrans type... (0-4). Use macros TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, or TRANS_STAR + \~french Type de transition... (0-4). Utiliser TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, ou TRANS_STAR + \~\param vflip + \~english Vertical flip... + \~french Flip vertical... + \~\param state + \~english State, from 0 to TRANS_LENGTH. 0 being visible, TRANS_LENGTH invisible + \~french Etat, de 0 à TRANS_LENGTH. 0 pour visible, TRANS_LENGTH pour invisible... +*/ +void PA_BgTransUpDown(u8 screen, u16 type, u8 vflip, s16 state); + +/*! \fn void PA_BgTransLeftRight(u8 screen, u16 type, u8 hflip, s16 state) + \brief + \~english Left/Right swipping transition effect + \~french Effet de transition en Gauche/Droite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param type + \~english BgTrans type... (0-4). Use macros TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, or TRANS_STAR + \~french Type de transition... (0-4). Utiliser TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, ou TRANS_STAR + \~\param hflip + \~english Horizontal flip... + \~french Flip horizontal... + \~\param state + \~english State, from 0 to TRANS_LENGTH. 0 being visible, TRANS_LENGTH invisible + \~french Etat, de 0 à TRANS_LENGTH. 0 pour visible, TRANS_LENGTH pour invisible... +*/ +void PA_BgTransLeftRight(u8 screen, u16 type, u8 hflip, s16 state); + +/*! \fn void PA_BgTransDiag(u8 screen, u16 type, u8 hflip, u8 vflip, s16 state) + \brief + \~english Diagonal swipping transition effect + \~french Effet de transition en diagonale + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param type + \~english BgTrans type... (0-4). Use macros TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, or TRANS_STAR + \~french Type de transition... (0-4). Utiliser TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, ou TRANS_STAR + \~\param hflip + \~english Horizontal flip... + \~french Flip horizontal... + \~\param vflip + \~english Vertical flip... + \~french Flip vertical... + \~\param state + \~english State, from 0 to TRANS_LENGTH. 0 being visible, TRANS_LENGTH invisible + \~french Etat, de 0 à TRANS_LENGTH. 0 pour visible, TRANS_LENGTH pour invisible... +*/ +void PA_BgTransDiag(u8 screen, u16 type, u8 hflip, u8 vflip, s16 state); + + +/*! \fn void PA_BgTransCenter(u8 screen, u16 type, u8 invert, s16 state) + \brief + \~english Center transition effect + \~french Effet de transition depuis le centre + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param type + \~english BgTrans type... (0-4). Use macros TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, or TRANS_STAR + \~french Type de transition... (0-4). Utiliser TRANS_ROUND, TRANS_DIAMOND , TRANS_CROSS, TRANS_LINES, ou TRANS_STAR + \~\param invert + \~english Invert in/out + \~french Inverser dedans/dehors + \~\param state + \~english State, from 0 to TRANS_LENGTH. 0 being visible, TRANS_LENGTH invisible + \~french Etat, de 0 à TRANS_LENGTH. 0 pour visible, TRANS_LENGTH pour invisible... +*/ +void PA_BgTransCenter(u8 screen, u16 type, u8 invert, s16 state); + +/** @} */ // end of bgtrans +////////////////////////////////////////////////////////////////////// + +#endif diff --git a/include/arm9/PA_Debug.h b/include/arm9/PA_Debug.h index ab4cb96..ec6a617 100644 --- a/include/arm9/PA_Debug.h +++ b/include/arm9/PA_Debug.h @@ -1,72 +1,72 @@ -#pragma once - -#ifdef __cplusplus -extern "C"{ -#endif - -/*! \file PA_Debug.h - \brief Debugging utilities - - Some debugging utilities like emulator detecting and iDeaS debug console printing -*/ - -/** @defgroup Debug Debugging utilities - * Some debugging utilities like emulator detecting and iDeaS debug console printing - * @{ - */ - -/*! \fn bool PA_IsEmulator() - \brief - \~english Detects if the program is running on an emulator - \~french Détecte si le programme est exécuté sur un émulateur -*/ - -bool PA_IsEmulator(); - -/*! \fn void PA_iDeaS_DebugOutput(const char* str) - \brief - \~english Outputs text to the iDeaS debugging console - \~french Sorties de texte à la iDeaS debugging console - \~\param str - \~english The text to output - \~french Le texte -*/ - -#ifndef PA_DISABLE_DEBUG -void PA_iDeaS_DebugOutput(const char* str); -#else -#define PA_iDeaS_DebugOutput(str) ((void)0) -#endif - -/*! \fn void PA_iDeaS_DebugPrintf(const char* str, ...) - \brief - \~english Outputs formatted text to the iDeaS debugging console - \~french Sorties de texte formaté à la iDeaS debugging console - \~\param str - \~english The text to output - \~french Le texte -*/ - -#ifndef PA_DISABLE_DEBUG -void PA_iDeaS_DebugPrintf(const char* str, ...); -#else -static inline void PA_iDeaS_DebugPrintf(const char* str, ...){} -#endif - -/*! \fn void PA_iDeaS_Breakpoint() - \brief - \~english Triggers a breakpoint on iDeaS - \~french Mets un breakpoint sur iDeaS -*/ - -#ifndef PA_DISABLE_DEBUG -void PA_iDeaS_Breakpoint(); -#else -#define PA_iDeaS_Breakpoint() ((void)0) -#endif - -/** @} */ // end of debugging utilities - -#ifdef __cplusplus -} -#endif +#pragma once + +#ifdef __cplusplus +extern "C"{ +#endif + +/*! \file PA_Debug.h + \brief Debugging utilities + + Some debugging utilities like emulator detecting and iDeaS debug console printing +*/ + +/** @defgroup Debug Debugging utilities + * Some debugging utilities like emulator detecting and iDeaS debug console printing + * @{ + */ + +/*! \fn bool PA_IsEmulator() + \brief + \~english Detects if the program is running on an emulator + \~french Détecte si le programme est exécuté sur un émulateur +*/ + +bool PA_IsEmulator(); + +/*! \fn void PA_iDeaS_DebugOutput(const char* str) + \brief + \~english Outputs text to the iDeaS debugging console + \~french Sorties de texte à la iDeaS debugging console + \~\param str + \~english The text to output + \~french Le texte +*/ + +#ifndef PA_DISABLE_DEBUG +void PA_iDeaS_DebugOutput(const char* str); +#else +#define PA_iDeaS_DebugOutput(str) ((void)0) +#endif + +/*! \fn void PA_iDeaS_DebugPrintf(const char* str, ...) + \brief + \~english Outputs formatted text to the iDeaS debugging console + \~french Sorties de texte formaté à la iDeaS debugging console + \~\param str + \~english The text to output + \~french Le texte +*/ + +#ifndef PA_DISABLE_DEBUG +void PA_iDeaS_DebugPrintf(const char* str, ...); +#else +static inline void PA_iDeaS_DebugPrintf(const char* str, ...){} +#endif + +/*! \fn void PA_iDeaS_Breakpoint() + \brief + \~english Triggers a breakpoint on iDeaS + \~french Mets un breakpoint sur iDeaS +*/ + +#ifndef PA_DISABLE_DEBUG +void PA_iDeaS_Breakpoint(); +#else +#define PA_iDeaS_Breakpoint() ((void)0) +#endif + +/** @} */ // end of debugging utilities + +#ifdef __cplusplus +} +#endif diff --git a/include/arm9/PA_Draw.h b/include/arm9/PA_Draw.h index 7815687..34a2b81 100644 --- a/include/arm9/PA_Draw.h +++ b/include/arm9/PA_Draw.h @@ -1,601 +1,601 @@ -#ifndef _PA_Buffer -#define _PA_Buffer - -#ifdef __cplusplus -extern "C" { -#endif - -/*! \file PA_Draw.h - \brief Bitmap mode, for drawing, loading images in 8 or 16 bit mode... - - Draw on screen, either a pixel or a line, or anything ! Load a Bitmap, a Jpeg... -*/ - -#include "PA9.h" - -#include "PA_Interrupt.h" -#include "PA_Palette.h" -#include "PA_Gif.h" - -extern u8 PA_nBit[2]; // 8 or 16 bit Bg - -extern u16 tempvar; - -#define PA_RGB8(r,g,b) ((((b)>>3)<<10)|(((g)>>3)<<5)|((r)>>3)|(1 << 15)) - -#define __PACKED __attribute__ ((__packed__)) - -typedef struct{ - u16 Id; // ? - u32 Length; - u16 Nothing1, Nothing2; // ? - u16 ImageStart1, ImageStart2; // Offset of start of image, start at position 0x0A, which can only be 2-byte aligined -} __PACKED BMPHeader0; - -typedef struct{ - u32 SizeofHeader; // 40 - u32 Width, Height; - u16 Colorplanes; // Usually 1 - u16 BitsperPixel; //1, 2, 4, 8, 16, 24, 32 - u32 Compression; // 0 for none, 1... - u32 SizeofData; // Not reliable - u32 WidthperMeter, HeightperMeter; // Don't care - u32 NColors, ImportantColors; // Number of colors used, important colors ? -} BMP_Headers; - -extern u16 PA_oldx[2]; -extern u16 PA_oldy[2]; -extern s16 PA_olddowntime[2]; -extern u8 PA_drawsize[2]; -extern u16 *PA_DrawBg[2]; -extern u32 *PA_DrawBg32[2]; -extern u8 PA_nBit[2]; // 8 or 16 bit Bg - -extern u16 PA_temppal[256]; - -/** @defgroup Bitmap Bitmap mode - * Draw on screen, either a pixel or a line, or anything ! Load a Bitmap, a Jpeg... - * @{ - */ - -/*! \fn void PA_Init8bitBg(u8 screen, u8 bg_priority) - \brief - \~english Initialise 8 bit draw mode (palette mode)... Chose the screen and the background priority (0-3). This drawable background will replace Background 3, and must be loaded before all other backgrounds. Takes about 3/8 of the VRAM. - \~french Initialise le mode de dessin 8 bit (avec palette). Il suffit de choisir l'écran et la priorité de ce font (de 0 à 3). Ce fond sera placé sur le fond 3 (le remplacant), et doit etre chargé avant tout autre fond ! Prend environ 3/8 de la VRAM - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_priority - \~english Background priority (0-3) - \~english Background priority (0-3) -*/ -void PA_Init8bitBg(u8 screen, u8 bg_priority); - -/*! \fn void PA_InitBig8bitBg(u8 screen, u8 bg_priority) - \brief - \~english Same as PA_Init8bitBg, but with an available size of 256x256. Takes up a little more space but allows correct vertical scrolling... - \~french Similaire à PA_Init8bitBg, mais avec une taille de 256x256. Ceci prend un peu plus de mémoire, mais autorise le scrolling vertical - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_priority - \~english Background priority (0-3) - \~english Background priority (0-3) -*/ -void PA_InitBig8bitBg(u8 screen, u8 bg_priority); - -void PA_8bitSwapBuffer(u8 screen); -void PA_Init8bitDblBuffer(u8 screen, u8 bg_priority); - - -/*! \fn void PA_Init16bitBg(u8 screen, u8 bg_priority) - \brief - \~english Initialise 16 bit draw mode (no palette mode, true colors)... Chose the screen and the background priority (0-3). This drawable background will replace Background 3, and must be loaded before all other backgrounds. Takes about 6/8 of the VRAM, so almost all the space ! - \~french Initialise le mode de dessin 16 bit (sans palettes, couleurs RGB). Il suffit de choisir l'écran et la priorité de ce font (de 0 à 3). Ce fond sera placé sur le fond 3 (le remplacant), et doit etre chargé avant tout autre fond ! Prend environ 3/8 de la VRAM - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_priority - \~english Background priority (0-3) - \~english Background priority (0-3) -*/ -void PA_Init16bitBg(u8 screen, u8 bg_priority); - -void PA_Init16bitDblBuffer(u8 screen, u8 bg_priority); -void PA_16bitSwapBuffer(u8 screen); - -/*! \fn static inline void PA_Put8bitPixel(u8 screen, s16 x, s16 y, u8 color) - \brief - \~english Draw a pixel on screen, on an 8 bit background - \~french Dessine un pixel à l'écran, sur un fond de 8 bits - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X position (0-255) - \~french Position X (0-255) - \~\param y - \~english Y position (0-191) - \~french Position Y (0-191) - \~\param color - \~english Color in the background palette (0-255) - \~french Couleur de la palette du fond (0-255) -*/ - -static inline void PA_Put8bitPixel(u8 screen, s16 x, s16 y, u8 color) { - u32 pos = (y<<7) + (x>>1); - u32 decal = ((x&1)<<3); - PA_DrawBg[screen][pos] &= 0xff00>>decal; - PA_DrawBg[screen][pos] |= color<> 1) + (y << 7)] = colors; -} - -/*! \fn static inline void PA_PutDouble8bitPixels(u8 screen, s16 x, s16 y, u8 color1, u8 color2) - \brief - \~english Draw 2 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. WAY faster than drawing both pixels separately - \~french Dessine deux pixels à l'écran, sur un fond de 8 bits. Ces pixels sont contigus, et le premier doit avoir une position X pair. Beaucoup plus rapide que de dessiner les 2 pixels séparemment - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X position (0-254), must be PAIR - \~french Position X (0-254), doit etre PAIR - \~\param y - \~english Y position (0-191) - \~french Position Y (0-191) - \~\param color1 - \~english Color of the first pixel, in the background palette (0-255) - \~french Couleur de la palette du fond (0-255) pour le premier pixel - \~\param color2 - \~english Color of the second pixel, in the background palette (0-255) - \~french Couleur de la palette du fond (0-255) pour le deuxième pixel -*/ -static inline void PA_PutDouble8bitPixels(u8 screen, s16 x, s16 y, u8 color1, u8 color2) { - PA_Put2_8bitPixels(screen, x, y, color1 + (color2 << 8)); -} - -/*! \fn static inline void PA_Put4_8bitPixels(u8 screen, s16 x, s16 y, u32 colors) - \brief - \~english Draw 4 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. Fastest way to draw on the screen... - \~french Dessine 4 pixels à l'écran, sur un fond de 8 bits. Ces pixels sont contigus, et le premier doit avoir une position X pair. Façon la plus rapide de dessiner à l'écran - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X position (0-254), must be PAIR - \~french Position X (0-254), doit etre PAIR - \~\param y - \~english Y position (0-191) - \~french Position Y (0-191) - \~\param colors - \~english Colors of the 4 pixels - \~french Couleurs des 4 pixels - -*/ -static inline void PA_Put4_8bitPixels(u8 screen, s16 x, s16 y, u32 colors) { - PA_DrawBg32[screen][(x >> 2) + (y << 6)] = colors; -} - -/*! \fn static inline u8 PA_Get8bitPixel(u8 screen, u8 x, u8 y) - \brief - \~english Get the pixel's color in 8 bit Draw mode... - \~french Récupérer la couleur d'un pixel, en mode dessin 8 bit - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X position. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y - \~english Y position. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - */ -static inline u8 PA_Get8bitPixel(u8 screen, u8 x, u8 y) { - u16 pos = (x >> 1) + (y << 7); - if(x & 1) - return (PA_DrawBg[screen][pos] >> 8); - else - return (PA_DrawBg[screen][pos]); -} - -/*! \fn static inline void PA_Put16bitPixel(u8 screen, s16 x, s16 y, u16 color) - \brief - \~english Draw a pixel on screen, on an 16 bit background - \~french Dessine un pixel à l'écran, sur un fond de 16 bits - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X position (0-255) - \~french Position X (0-255) - \~\param y - \~english Y position (0-191) - \~french Position Y (0-191) - \~\param color - \~english 16 bit color, obtained using PA_RGB(red, green, blue) - \~french Couleur de 16 bits, obtenue avec PA_RGB(rouge, vert, bleu) -*/ -static inline void PA_Put16bitPixel(u8 screen, s16 x, s16 y, u16 color) { - PA_DrawBg[screen][x + (y << 8)] = color; -} - -/*! \def PA_Get16bitPixel(x, y) - \brief - \~english Get the pixel's color in 16 bit Draw mode... - \~french Récupérer la couleur d'un pixel, en mode dessin 16 bit - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X position. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y - \~english Y position. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - */ -#define PA_Get16bitPixel(screen, x, y) PA_DrawBg[screen][(x) + ((y) << 8)] - -/*! \fn void PA_Draw8bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u8 color) - \brief - \~english Draw a line in Draw mode... for 8 bit drawable background - \~french Dessiner une ligne en mode dessin... pour le mode dessin 8 bit - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x1 - \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y1 - \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param x2 - \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y2 - \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param color - \~english Color in the background palette (0-255) - \~french Couleur de la palette du fond (0-255) - */ -void PA_Draw8bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u8 color); - -/*! \fn void PA_Draw16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color) - \brief - \~english Draw a line in Draw mode... for 16 bit drawable background - \~french Dessiner une ligne en mode dessin... pour le mode dessin 16 bit - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x1 - \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y1 - \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param x2 - \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y2 - \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param color - \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... - \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... - */ -void PA_Draw16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color); - -/*! \fn void PA_Draw16bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color, s8 size) - \brief - \~english Draw a thick line in Draw mode... for 16 bit drawable background - \~french Dessiner une ligne épaisse en mode dessin... pour le mode dessin 16 bit - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param basex - \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param basey - \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param endx - \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param endy - \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param color - \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... - \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... - \~\param size - \~english Width of the line, in pixels - \~french Largeur du trait, en pixels - */ -void PA_Draw16bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color, s8 size); - -/*! \fn void PA_Draw8bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u8 color, s8 size) - \brief - \~english Draw a thick line in Draw mode... for 8 bit drawable background - \~french Dessiner une ligne épaisse en mode dessin... pour le mode dessin 8 bit - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param basex - \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param basey - \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param endx - \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param endy - \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param color - \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... - \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... - \~\param size - \~english Width of the line, in pixels - \~french Largeur du trait, en pixels - */ -void PA_Draw8bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u8 color, s8 size); - -/*! \fn void PA_Draw16bitRect(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color) - \brief - \~english Draw a rectangle in Draw mode... for 16 bit drawable background - \~french Dessiner rectangle en mode dessin... pour le mode dessin 16 bit - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param basex - \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param basey - \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param endx - \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param endy - \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param color - \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... - \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... - */ -void PA_Draw16bitRect(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color); - -/*! \fn PA_8bitDraw(u8 screen, u8 color) - \brief - \~english For 8 bit background : Nice little function that draws on screen ! All you need to do is chose the color, it'll do the rest. If the PA VBL isn't initialised, don't forget to update the stylus position every frame... Juste execute PA_Draw every cycle... - \~french Pour 8 bit : Jolie petite fonction qui dessine à l'écran ! Tout ce qu'il reste à faire, c'est de choisir la couleur. Si le VBL PA n'est pas initialiser, ne pas oublier de rafraichir le Stylet à chaque cycle (et non, pas avec des glacons !). Il suffit d'executer PA_Draw à chaque cycle pour dessiner... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param color - \~english Color number in the palette (0-255) - \~french Numéro de la couleur dans la palette (0-255) - */ -void PA_8bitDraw(u8 screen, u8 color); - -/*! \fn PA_16bitDraw(u8 screen, u16 color) - \brief - \~english For 16 bit : Nice little function that draws on screen ! All you need to do is chose the color, it'll do the rest. If the PA VBL isn't initialised, don't forget to update the stylus position every frame... Juste execute PA_Draw every cycle... - \~french Pour 16 bit : Jolie petite fonction qui dessine à l'écran ! Tout ce qu'il reste à faire, c'est de choisir la couleur. Si le VBL PA n'est pas initialiser, ne pas oublier de rafraichir le Stylet à chaque cycle (et non, pas avec des glacons !). Il suffit d'executer PA_Draw à chaque cycle pour dessiner... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param color - \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... - \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... - */ -void PA_16bitDraw(u8 screen, u16 color); - -/*! \def PA_SetDrawSize(screen, draw_size) - \brief - \~english Set the size of the pen when drawing. - \~french Regler la taille du stylo quand on dessine. - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param draw_size - \~english Size... - \~french Taille... -*/ -#define PA_SetDrawSize(screen, draw_size) PA_drawsize[screen] = draw_size; - -/*! \def PA_Load8bitBitmap(screen, bitmap) - \brief - \~english Load a bitmap on the screen for an 8 bit drawable background - \~french Charger une image à l'écran... pour une fond dessinable de 8 bits - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bitmap - \~english Bitmap name - \~french Nom du bitmap -*/ -#define PA_Load8bitBitmap(screen, bitmap) DMA_Copy(bitmap, (void*)PA_DrawBg[screen], 256*96, DMA_16NOW) - -/*! \def PA_Load16bitBitmap(screen, bitmap) - \brief - \~english Load a bitmap on the screen for an 16 bit drawable background - \~french Charger une image à l'écran... pour une fond dessinable de 16 bits - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bitmap - \~english Bitmap name - \~french Nom du bitmap -*/ -#define PA_Load16bitBitmap(screen, bitmap) do{u32 PA_temp; \ - for (PA_temp = 0; PA_temp < 256*192; PA_temp++)\ - PA_DrawBg[screen][PA_temp] = bitmap[PA_temp] | (1 << 15);}while(0) - - -/*! \def PA_Clear8bitBg(screen) - \brief - \~english Clears the screen... for an 8 bit drawable background - \~french Efface l'écran... pour une fond dessinable de 8 bits - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) -*/ -#define PA_Clear8bitBg(screen) dmaFillWords(0, (void*)PA_DrawBg[screen], 256*96*2); - -/*! \def PA_Clear16bitBg(screen) - \brief - \~english Clears the screen... for an 16 bit drawable background - \~french Efface l'écran... pour une fond dessinable de 16 bits - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) -*/ -#define PA_Clear16bitBg(screen) dmaFillWords(0, (void*)PA_DrawBg[screen], 256*192*2) - - -/*! \fn static inline void PA_LoadJpeg(u8 screen, void *jpeg) - \brief - \~english Load a jpeg on a 16 bit background... Don't forget to Init the background ! - \~french Charger un jpeg sur un fond de 16 bits... Faut pas oublier de charger ce fond avant ! - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param jpeg - \~english jpeg image... - \~french image au format jpeg... -*/ -static inline void PA_LoadJpeg(u8 screen, void *jpeg) { - REG_IME = 0; - JPEG_DecompressImage((u8*)jpeg, PA_DrawBg[screen], 256, 192); - REG_IME = 1; -} - - - -/*! \fn void PA_LoadBmpToBuffer(u16 *Buffer, s16 x, s16 y, void *bmp, s16 SWidth) - \brief - \~english Load a BMP in a 16 bit Buffer - \~french Charger un BMP dans un buffer de 16 bit - \~\param Buffer - \~english Buffer... - \~french Buffer... - \~\param x - \~english X position of the top left corner - \~french Position X du coin supérieur gauche - \~\param y - \~english Y position of the top left corner - \~french Position Y du coin supérieur gauche - \~\param bmp - \~english BMP image... - \~french image au format BMP... - \~\param SWidth - \~english Buffer width to use (256 for screen width...) - \~french Largeur du buffer, en pixels (256 pour la taille de l'écran...) -*/ -void PA_LoadBmpToBuffer(u16 *Buffer, s16 x, s16 y, void *bmp, s16 SWidth); - - -/*! \fn static inline void PA_LoadBmpEx(u8 screen, s16 x, s16 y, void *bmp) - \brief - \~english Load a BMP on a 16 bit background... Don't forget to Init the background ! - \~french Charger un BMP sur un fond de 16 bits... Faut pas oublier de charger ce fond avant ! - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X position of the top left corner - \~french Position X du coin supérieur gauche - \~\param y - \~english Y position of the top left corner - \~french Position Y du coin supérieur gauche - \~\param bmp - \~english BMP image... - \~french image au format BMP... -*/ -static inline void PA_LoadBmpEx(u8 screen, s16 x, s16 y, void *bmp){ - PA_LoadBmpToBuffer(PA_DrawBg[screen], x, y, bmp, 256); -} - - - -/*! \fn static inline void PA_LoadBmp(u8 screen, void *bmp) - \brief - \~english Load a BMP on a 16 bit background... Don't forget to Init the background ! - \~french Charger un BMP sur un fond de 16 bits... Faut pas oublier de charger ce fond avant ! - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bmp - \~english BMP image... - \~french image au format BMP... -*/ -static inline void PA_LoadBmp(u8 screen, void *bmp){ - PA_LoadBmpEx(screen, 0, 0, bmp); -} - -/*! \fn static inline u16 PA_GetBmpWidth(void *bmp) - \brief - \~english Get a BMP's width in pixels - \~french Récupérer la largeur d'un BMP en pixels - \~\param bmp - \~english BMP image... - \~french image au format BMP... -*/ -static inline u16 PA_GetBmpWidth(void *bmpdata){ - u8 *temp = (u8*)bmpdata; - BMP_Headers *Bmpinfo = (BMP_Headers*)(temp+14); - return Bmpinfo->Width; -} - - -/*! \fn static inline u16 PA_GetBmpHeight(void *bmp) - \brief - \~english Get a BMP's height in pixels - \~french Récupérer la hauteur d'un BMP en pixels - \~\param bmp - \~english BMP image... - \~french image au format BMP... -*/ -static inline u16 PA_GetBmpHeight(void *bmpdata){ - u8 *temp = (u8*)bmpdata; - BMP_Headers *Bmpinfo = (BMP_Headers*)(temp+14); - return Bmpinfo->Height; -} -/** @} */ // end of Draw - -static inline void PA_8bit8x8Image(u8 screen, u16 basex, u16 basey, u8* data){ - int x, y; - - for (x = 0; x < 8; x++) - for (y = 0; y < 8; y++) - PA_Put8bitPixel(screen, x + basex, y + basey, data[x + (y << 3)]); -} - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_Buffer +#define _PA_Buffer + +#ifdef __cplusplus +extern "C" { +#endif + +/*! \file PA_Draw.h + \brief Bitmap mode, for drawing, loading images in 8 or 16 bit mode... + + Draw on screen, either a pixel or a line, or anything ! Load a Bitmap, a Jpeg... +*/ + +#include "PA9.h" + +#include "PA_Interrupt.h" +#include "PA_Palette.h" +#include "PA_Gif.h" + +extern u8 PA_nBit[2]; // 8 or 16 bit Bg + +extern u16 tempvar; + +#define PA_RGB8(r,g,b) ((((b)>>3)<<10)|(((g)>>3)<<5)|((r)>>3)|(1 << 15)) + +#define __PACKED __attribute__ ((__packed__)) + +typedef struct{ + u16 Id; // ? + u32 Length; + u16 Nothing1, Nothing2; // ? + u16 ImageStart1, ImageStart2; // Offset of start of image, start at position 0x0A, which can only be 2-byte aligined +} __PACKED BMPHeader0; + +typedef struct{ + u32 SizeofHeader; // 40 + u32 Width, Height; + u16 Colorplanes; // Usually 1 + u16 BitsperPixel; //1, 2, 4, 8, 16, 24, 32 + u32 Compression; // 0 for none, 1... + u32 SizeofData; // Not reliable + u32 WidthperMeter, HeightperMeter; // Don't care + u32 NColors, ImportantColors; // Number of colors used, important colors ? +} BMP_Headers; + +extern u16 PA_oldx[2]; +extern u16 PA_oldy[2]; +extern s16 PA_olddowntime[2]; +extern u8 PA_drawsize[2]; +extern u16 *PA_DrawBg[2]; +extern u32 *PA_DrawBg32[2]; +extern u8 PA_nBit[2]; // 8 or 16 bit Bg + +extern u16 PA_temppal[256]; + +/** @defgroup Bitmap Bitmap mode + * Draw on screen, either a pixel or a line, or anything ! Load a Bitmap, a Jpeg... + * @{ + */ + +/*! \fn void PA_Init8bitBg(u8 screen, u8 bg_priority) + \brief + \~english Initialise 8 bit draw mode (palette mode)... Chose the screen and the background priority (0-3). This drawable background will replace Background 3, and must be loaded before all other backgrounds. Takes about 3/8 of the VRAM. + \~french Initialise le mode de dessin 8 bit (avec palette). Il suffit de choisir l'écran et la priorité de ce font (de 0 à 3). Ce fond sera placé sur le fond 3 (le remplacant), et doit etre chargé avant tout autre fond ! Prend environ 3/8 de la VRAM + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_priority + \~english Background priority (0-3) + \~english Background priority (0-3) +*/ +void PA_Init8bitBg(u8 screen, u8 bg_priority); + +/*! \fn void PA_InitBig8bitBg(u8 screen, u8 bg_priority) + \brief + \~english Same as PA_Init8bitBg, but with an available size of 256x256. Takes up a little more space but allows correct vertical scrolling... + \~french Similaire à PA_Init8bitBg, mais avec une taille de 256x256. Ceci prend un peu plus de mémoire, mais autorise le scrolling vertical + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_priority + \~english Background priority (0-3) + \~english Background priority (0-3) +*/ +void PA_InitBig8bitBg(u8 screen, u8 bg_priority); + +void PA_8bitSwapBuffer(u8 screen); +void PA_Init8bitDblBuffer(u8 screen, u8 bg_priority); + + +/*! \fn void PA_Init16bitBg(u8 screen, u8 bg_priority) + \brief + \~english Initialise 16 bit draw mode (no palette mode, true colors)... Chose the screen and the background priority (0-3). This drawable background will replace Background 3, and must be loaded before all other backgrounds. Takes about 6/8 of the VRAM, so almost all the space ! + \~french Initialise le mode de dessin 16 bit (sans palettes, couleurs RGB). Il suffit de choisir l'écran et la priorité de ce font (de 0 à 3). Ce fond sera placé sur le fond 3 (le remplacant), et doit etre chargé avant tout autre fond ! Prend environ 3/8 de la VRAM + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_priority + \~english Background priority (0-3) + \~english Background priority (0-3) +*/ +void PA_Init16bitBg(u8 screen, u8 bg_priority); + +void PA_Init16bitDblBuffer(u8 screen, u8 bg_priority); +void PA_16bitSwapBuffer(u8 screen); + +/*! \fn static inline void PA_Put8bitPixel(u8 screen, s16 x, s16 y, u8 color) + \brief + \~english Draw a pixel on screen, on an 8 bit background + \~french Dessine un pixel à l'écran, sur un fond de 8 bits + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X position (0-255) + \~french Position X (0-255) + \~\param y + \~english Y position (0-191) + \~french Position Y (0-191) + \~\param color + \~english Color in the background palette (0-255) + \~french Couleur de la palette du fond (0-255) +*/ + +static inline void PA_Put8bitPixel(u8 screen, s16 x, s16 y, u8 color) { + u32 pos = (y<<7) + (x>>1); + u32 decal = ((x&1)<<3); + PA_DrawBg[screen][pos] &= 0xff00>>decal; + PA_DrawBg[screen][pos] |= color<> 1) + (y << 7)] = colors; +} + +/*! \fn static inline void PA_PutDouble8bitPixels(u8 screen, s16 x, s16 y, u8 color1, u8 color2) + \brief + \~english Draw 2 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. WAY faster than drawing both pixels separately + \~french Dessine deux pixels à l'écran, sur un fond de 8 bits. Ces pixels sont contigus, et le premier doit avoir une position X pair. Beaucoup plus rapide que de dessiner les 2 pixels séparemment + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X position (0-254), must be PAIR + \~french Position X (0-254), doit etre PAIR + \~\param y + \~english Y position (0-191) + \~french Position Y (0-191) + \~\param color1 + \~english Color of the first pixel, in the background palette (0-255) + \~french Couleur de la palette du fond (0-255) pour le premier pixel + \~\param color2 + \~english Color of the second pixel, in the background palette (0-255) + \~french Couleur de la palette du fond (0-255) pour le deuxième pixel +*/ +static inline void PA_PutDouble8bitPixels(u8 screen, s16 x, s16 y, u8 color1, u8 color2) { + PA_Put2_8bitPixels(screen, x, y, color1 + (color2 << 8)); +} + +/*! \fn static inline void PA_Put4_8bitPixels(u8 screen, s16 x, s16 y, u32 colors) + \brief + \~english Draw 4 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. Fastest way to draw on the screen... + \~french Dessine 4 pixels à l'écran, sur un fond de 8 bits. Ces pixels sont contigus, et le premier doit avoir une position X pair. Façon la plus rapide de dessiner à l'écran + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X position (0-254), must be PAIR + \~french Position X (0-254), doit etre PAIR + \~\param y + \~english Y position (0-191) + \~french Position Y (0-191) + \~\param colors + \~english Colors of the 4 pixels + \~french Couleurs des 4 pixels + +*/ +static inline void PA_Put4_8bitPixels(u8 screen, s16 x, s16 y, u32 colors) { + PA_DrawBg32[screen][(x >> 2) + (y << 6)] = colors; +} + +/*! \fn static inline u8 PA_Get8bitPixel(u8 screen, u8 x, u8 y) + \brief + \~english Get the pixel's color in 8 bit Draw mode... + \~french Récupérer la couleur d'un pixel, en mode dessin 8 bit + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X position. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y + \~english Y position. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + */ +static inline u8 PA_Get8bitPixel(u8 screen, u8 x, u8 y) { + u16 pos = (x >> 1) + (y << 7); + if(x & 1) + return (PA_DrawBg[screen][pos] >> 8); + else + return (PA_DrawBg[screen][pos]); +} + +/*! \fn static inline void PA_Put16bitPixel(u8 screen, s16 x, s16 y, u16 color) + \brief + \~english Draw a pixel on screen, on an 16 bit background + \~french Dessine un pixel à l'écran, sur un fond de 16 bits + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X position (0-255) + \~french Position X (0-255) + \~\param y + \~english Y position (0-191) + \~french Position Y (0-191) + \~\param color + \~english 16 bit color, obtained using PA_RGB(red, green, blue) + \~french Couleur de 16 bits, obtenue avec PA_RGB(rouge, vert, bleu) +*/ +static inline void PA_Put16bitPixel(u8 screen, s16 x, s16 y, u16 color) { + PA_DrawBg[screen][x + (y << 8)] = color; +} + +/*! \def PA_Get16bitPixel(x, y) + \brief + \~english Get the pixel's color in 16 bit Draw mode... + \~french Récupérer la couleur d'un pixel, en mode dessin 16 bit + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X position. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y + \~english Y position. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + */ +#define PA_Get16bitPixel(screen, x, y) PA_DrawBg[screen][(x) + ((y) << 8)] + +/*! \fn void PA_Draw8bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u8 color) + \brief + \~english Draw a line in Draw mode... for 8 bit drawable background + \~french Dessiner une ligne en mode dessin... pour le mode dessin 8 bit + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x1 + \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y1 + \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param x2 + \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y2 + \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param color + \~english Color in the background palette (0-255) + \~french Couleur de la palette du fond (0-255) + */ +void PA_Draw8bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u8 color); + +/*! \fn void PA_Draw16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color) + \brief + \~english Draw a line in Draw mode... for 16 bit drawable background + \~french Dessiner une ligne en mode dessin... pour le mode dessin 16 bit + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x1 + \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y1 + \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param x2 + \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y2 + \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param color + \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... + \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... + */ +void PA_Draw16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color); + +/*! \fn void PA_Draw16bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color, s8 size) + \brief + \~english Draw a thick line in Draw mode... for 16 bit drawable background + \~french Dessiner une ligne épaisse en mode dessin... pour le mode dessin 16 bit + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param basex + \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param basey + \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param endx + \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param endy + \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param color + \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... + \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... + \~\param size + \~english Width of the line, in pixels + \~french Largeur du trait, en pixels + */ +void PA_Draw16bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color, s8 size); + +/*! \fn void PA_Draw8bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u8 color, s8 size) + \brief + \~english Draw a thick line in Draw mode... for 8 bit drawable background + \~french Dessiner une ligne épaisse en mode dessin... pour le mode dessin 8 bit + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param basex + \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param basey + \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param endx + \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param endy + \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param color + \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... + \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... + \~\param size + \~english Width of the line, in pixels + \~french Largeur du trait, en pixels + */ +void PA_Draw8bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u8 color, s8 size); + +/*! \fn void PA_Draw16bitRect(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color) + \brief + \~english Draw a rectangle in Draw mode... for 16 bit drawable background + \~french Dessiner rectangle en mode dessin... pour le mode dessin 16 bit + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param basex + \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param basey + \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param endx + \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param endy + \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param color + \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... + \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... + */ +void PA_Draw16bitRect(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color); + +/*! \fn PA_8bitDraw(u8 screen, u8 color) + \brief + \~english For 8 bit background : Nice little function that draws on screen ! All you need to do is chose the color, it'll do the rest. If the PA VBL isn't initialised, don't forget to update the stylus position every frame... Juste execute PA_Draw every cycle... + \~french Pour 8 bit : Jolie petite fonction qui dessine à l'écran ! Tout ce qu'il reste à faire, c'est de choisir la couleur. Si le VBL PA n'est pas initialiser, ne pas oublier de rafraichir le Stylet à chaque cycle (et non, pas avec des glacons !). Il suffit d'executer PA_Draw à chaque cycle pour dessiner... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param color + \~english Color number in the palette (0-255) + \~french Numéro de la couleur dans la palette (0-255) + */ +void PA_8bitDraw(u8 screen, u8 color); + +/*! \fn PA_16bitDraw(u8 screen, u16 color) + \brief + \~english For 16 bit : Nice little function that draws on screen ! All you need to do is chose the color, it'll do the rest. If the PA VBL isn't initialised, don't forget to update the stylus position every frame... Juste execute PA_Draw every cycle... + \~french Pour 16 bit : Jolie petite fonction qui dessine à l'écran ! Tout ce qu'il reste à faire, c'est de choisir la couleur. Si le VBL PA n'est pas initialiser, ne pas oublier de rafraichir le Stylet à chaque cycle (et non, pas avec des glacons !). Il suffit d'executer PA_Draw à chaque cycle pour dessiner... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param color + \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... + \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... + */ +void PA_16bitDraw(u8 screen, u16 color); + +/*! \def PA_SetDrawSize(screen, draw_size) + \brief + \~english Set the size of the pen when drawing. + \~french Regler la taille du stylo quand on dessine. + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param draw_size + \~english Size... + \~french Taille... +*/ +#define PA_SetDrawSize(screen, draw_size) PA_drawsize[screen] = draw_size; + +/*! \def PA_Load8bitBitmap(screen, bitmap) + \brief + \~english Load a bitmap on the screen for an 8 bit drawable background + \~french Charger une image à l'écran... pour une fond dessinable de 8 bits + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bitmap + \~english Bitmap name + \~french Nom du bitmap +*/ +#define PA_Load8bitBitmap(screen, bitmap) DMA_Copy(bitmap, (void*)PA_DrawBg[screen], 256*96, DMA_16NOW) + +/*! \def PA_Load16bitBitmap(screen, bitmap) + \brief + \~english Load a bitmap on the screen for an 16 bit drawable background + \~french Charger une image à l'écran... pour une fond dessinable de 16 bits + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bitmap + \~english Bitmap name + \~french Nom du bitmap +*/ +#define PA_Load16bitBitmap(screen, bitmap) do{u32 PA_temp; \ + for (PA_temp = 0; PA_temp < 256*192; PA_temp++)\ + PA_DrawBg[screen][PA_temp] = bitmap[PA_temp] | (1 << 15);}while(0) + + +/*! \def PA_Clear8bitBg(screen) + \brief + \~english Clears the screen... for an 8 bit drawable background + \~french Efface l'écran... pour une fond dessinable de 8 bits + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) +*/ +#define PA_Clear8bitBg(screen) dmaFillWords(0, (void*)PA_DrawBg[screen], 256*96*2); + +/*! \def PA_Clear16bitBg(screen) + \brief + \~english Clears the screen... for an 16 bit drawable background + \~french Efface l'écran... pour une fond dessinable de 16 bits + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) +*/ +#define PA_Clear16bitBg(screen) dmaFillWords(0, (void*)PA_DrawBg[screen], 256*192*2) + + +/*! \fn static inline void PA_LoadJpeg(u8 screen, void *jpeg) + \brief + \~english Load a jpeg on a 16 bit background... Don't forget to Init the background ! + \~french Charger un jpeg sur un fond de 16 bits... Faut pas oublier de charger ce fond avant ! + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param jpeg + \~english jpeg image... + \~french image au format jpeg... +*/ +static inline void PA_LoadJpeg(u8 screen, void *jpeg) { + REG_IME = 0; + JPEG_DecompressImage((u8*)jpeg, PA_DrawBg[screen], 256, 192); + REG_IME = 1; +} + + + +/*! \fn void PA_LoadBmpToBuffer(u16 *Buffer, s16 x, s16 y, void *bmp, s16 SWidth) + \brief + \~english Load a BMP in a 16 bit Buffer + \~french Charger un BMP dans un buffer de 16 bit + \~\param Buffer + \~english Buffer... + \~french Buffer... + \~\param x + \~english X position of the top left corner + \~french Position X du coin supérieur gauche + \~\param y + \~english Y position of the top left corner + \~french Position Y du coin supérieur gauche + \~\param bmp + \~english BMP image... + \~french image au format BMP... + \~\param SWidth + \~english Buffer width to use (256 for screen width...) + \~french Largeur du buffer, en pixels (256 pour la taille de l'écran...) +*/ +void PA_LoadBmpToBuffer(u16 *Buffer, s16 x, s16 y, void *bmp, s16 SWidth); + + +/*! \fn static inline void PA_LoadBmpEx(u8 screen, s16 x, s16 y, void *bmp) + \brief + \~english Load a BMP on a 16 bit background... Don't forget to Init the background ! + \~french Charger un BMP sur un fond de 16 bits... Faut pas oublier de charger ce fond avant ! + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X position of the top left corner + \~french Position X du coin supérieur gauche + \~\param y + \~english Y position of the top left corner + \~french Position Y du coin supérieur gauche + \~\param bmp + \~english BMP image... + \~french image au format BMP... +*/ +static inline void PA_LoadBmpEx(u8 screen, s16 x, s16 y, void *bmp){ + PA_LoadBmpToBuffer(PA_DrawBg[screen], x, y, bmp, 256); +} + + + +/*! \fn static inline void PA_LoadBmp(u8 screen, void *bmp) + \brief + \~english Load a BMP on a 16 bit background... Don't forget to Init the background ! + \~french Charger un BMP sur un fond de 16 bits... Faut pas oublier de charger ce fond avant ! + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bmp + \~english BMP image... + \~french image au format BMP... +*/ +static inline void PA_LoadBmp(u8 screen, void *bmp){ + PA_LoadBmpEx(screen, 0, 0, bmp); +} + +/*! \fn static inline u16 PA_GetBmpWidth(void *bmp) + \brief + \~english Get a BMP's width in pixels + \~french Récupérer la largeur d'un BMP en pixels + \~\param bmp + \~english BMP image... + \~french image au format BMP... +*/ +static inline u16 PA_GetBmpWidth(void *bmpdata){ + u8 *temp = (u8*)bmpdata; + BMP_Headers *Bmpinfo = (BMP_Headers*)(temp+14); + return Bmpinfo->Width; +} + + +/*! \fn static inline u16 PA_GetBmpHeight(void *bmp) + \brief + \~english Get a BMP's height in pixels + \~french Récupérer la hauteur d'un BMP en pixels + \~\param bmp + \~english BMP image... + \~french image au format BMP... +*/ +static inline u16 PA_GetBmpHeight(void *bmpdata){ + u8 *temp = (u8*)bmpdata; + BMP_Headers *Bmpinfo = (BMP_Headers*)(temp+14); + return Bmpinfo->Height; +} +/** @} */ // end of Draw + +static inline void PA_8bit8x8Image(u8 screen, u16 basex, u16 basey, u8* data){ + int x, y; + + for (x = 0; x < 8; x++) + for (y = 0; y < 8; y++) + PA_Put8bitPixel(screen, x + basex, y + basey, data[x + (y << 3)]); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_Fake16bit.h b/include/arm9/PA_Fake16bit.h index 7e62fad..20a60dc 100644 --- a/include/arm9/PA_Fake16bit.h +++ b/include/arm9/PA_Fake16bit.h @@ -1,235 +1,235 @@ -#ifndef _PA_Fake16bit -#define _PA_Fake16bit - -#ifdef __cplusplus -extern "C" { -#endif - -#include "PA9.h" - -/*! \file PA_Fake16bit.h - \brief Fake 16 bit background functions - - This will allow you to create 16 bit backgrounds that use less memory. -*/ - - - -extern u16* PA_DrawFake16[2]; -extern bool PA_HasFake16bitBg[2]; - -/** @defgroup Fake16bit Fake 16bit bitmap mode - * Functions to handle fake 16 bit backgrounds that take up less - * memory than real ones! - * @{ - */ - -/*! \fn void PA_InitFake16bitBg(u8 screen, u8 prio) - \brief - \~english Initialize a fake 16 bit background - \~french [nothing] - \~\param screen - \~english Choose the screen (0 or 1) - \~french [nothing] - \~\param prio - \~english Background priority (from 0 to 3, being 0 the highest) - \~french [nothing] -*/ -extern void PA_InitFake16bitBg(u8 screen, u8 prio); - -/*! \fn void PA_DrawFake16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color) - \brief - \~english Draws a line on a fake 16 bit background - \~french [nothing] - \~\param screen - \~english Choose the screen (0 or 1) - \~french [nothing] - \~\param x1 - \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y1 - \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param x2 - \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y2 - \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param color - \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... - \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... -*/ -extern void PA_DrawFake16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color); - -/*! \def PA_LoadFake16bitBitmap(screen, bitmap) - \brief - \~english Load a 16 bit bitmap into a fake 16 bit background - \~french [nothing] - \~\param screen - \~english Choose the screen (0 or 1) - \~french [nothing] - \~\param bitmap - \~english Bitmap name - \~french [nothing] -*/ -#define PA_LoadFake16bitBitmap(screen, bitmap) DMA_Copy(bitmap, (void*)PA_DrawFake16[screen], 256*192, DMA_16NOW) - -/*! \def PA_ClearFake16bitBg(screen) - \brief - \~english Clear a fake 16 bit background - \~french [nothing] - \~\param screen - \~english Choose the screen (0 or 1) - \~french [nothing] -*/ -#define PA_ClearFake16bitBg(screen) dmaFillWords(0, (void*)PA_DrawFake16[screen], 256*192*2) - -/*! \def PA_PutFake16bitPixel(screen, x, y, color) - \brief - \~english Plots a pixel into a fake 16 bit background - \~french [nothing] - \~\param screen - \~english Choose the screen (0 or 1) - \~french [nothing] - \~\param x - \~english X position of the point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y - \~english Y position of the point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param color - \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... - \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... -*/ -#define PA_PutFake16bitPixel(screen, x, y, color) PA_DrawFake16[screen][(x) + 256 * (y)] = color - -/*! \def PA_GetFake16bitPixel(screen, x, y) - \brief - \~english Gets the color of a specified pixel of a fake 16 bit background - \~french [nothing] - \~\param screen - \~english Choose the screen (0 or 1) - \~french [nothing] - \~\param x - \~english X position of the point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y - \~english Y position of the point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté -*/ -#define PA_GetFake16bitPixel(screen, x, y) PA_DrawFake16[screen][(x) + 256 * (y)] - -/*! \def PA_DrawFake16bitRect(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color) - \brief - \~english Draws a rectangle on a fake 16 bit background - \~french [nothing] - \~\param screen - \~english Choose the screen (0 or 1) - \~french [nothing] - \~\param x1 - \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y1 - \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param x2 - \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results - \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté - \~\param y2 - \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results - \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté - \~\param color - \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... - \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... -*/ -#define PA_DrawFake16bitRect(screen, x1, y1, x2, y2, color) do{\ - PA_DrawFake16bitLine(screen, x1, y1, x2, y1, color);\ - PA_DrawFake16bitLine(screen, x1, y1, x1, y2, color);\ - PA_DrawFake16bitLine(screen, x2, y1, x2, y2, color);\ - PA_DrawFake16bitLine(screen, x1, y2, x2, y2, color);}while(0) - -/*! \def PA_Fake16bitLoadBmpEx(screen, x, y, bmp) - \brief - \~english Load a BMP on a fake 16 bit background... Don't forget to Init the background ! - \~french [nothing] - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X position of the top left corner - \~french Position X du coin supérieur gauche - \~\param y - \~english Y position of the top left corner - \~french Position Y du coin supérieur gauche - \~\param bmp - \~english BMP image... - \~french image au format BMP... -*/ -#define PA_Fake16bitLoadBmpEx(screen, bmp, x, y) PA_LoadBmpToBuffer(PA_DrawFake16[screen], x, y, bmp, 256) - -/*! \def PA_Fake16bitLoadBmp(screen, bmp) - \brief - \~english Load a BMP on a fake 16 bit background... Don't forget to Init the background ! - \~french [nothing] - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bmp - \~english BMP image... - \~french image au format BMP... -*/ -#define PA_Fake16bitLoadBmp(screen, bmp) PA_Fake16bitLoadBmpEx(screen, bmp, 0, 0) - -/*! \def PA_LoadGifXY(screen, x, y, gif) - \brief - \~english Load a Gif on a fake 16 bit background... Don't forget to Init the background ! - \~french [nothing] - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X position on the screen - \~french Position X à l'écran - \~\param y - \~english Y position on the screen - \~french Position Y à l'écran - \~\param gif - \~english Gif image... - \~french image au format Gif... -*/ -#define PA_Fake16bitLoadGifXY(screen, gif, x, y) DecodeGif((const u8*)gif, (u8*)(PA_DrawFake16[screen] + x + (y<<8)), NULL, 1, 256); - -/*! \def PA_Fake16bitLoadGif(screen, gif) - \brief - \~english Load a Gif on a fake 16 bit background... Don't forget to Init the background ! - \~french [nothing] - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param gif - \~english Gif image... - \~french image au format Gif... -*/ -#define PA_Fake16bitLoadGif(screen, gif) PA_Fake16bitLoadGifXY(screen, gif, 0, 0) - -/*! \def PA_Fake16bitLoadJpeg(screen, jpeg) - \brief - \~english Load a jpeg on a fake 16 bit background... Don't forget to Init the background ! - \~french [nothing] - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param jpeg - \~english jpeg image... - \~french image au format jpeg... -*/ -#define PA_Fake16bitLoadJpeg(screen, jpeg) JPEG_DecompressImage((u8*)jpeg, PA_DrawFake16[screen], 256, 192) - -#ifdef __cplusplus -} -#endif - -/** @} */ // end of fake 16 bit backgrounds - -#endif +#ifndef _PA_Fake16bit +#define _PA_Fake16bit + +#ifdef __cplusplus +extern "C" { +#endif + +#include "PA9.h" + +/*! \file PA_Fake16bit.h + \brief Fake 16 bit background functions + + This will allow you to create 16 bit backgrounds that use less memory. +*/ + + + +extern u16* PA_DrawFake16[2]; +extern bool PA_HasFake16bitBg[2]; + +/** @defgroup Fake16bit Fake 16bit bitmap mode + * Functions to handle fake 16 bit backgrounds that take up less + * memory than real ones! + * @{ + */ + +/*! \fn void PA_InitFake16bitBg(u8 screen, u8 prio) + \brief + \~english Initialize a fake 16 bit background + \~french [nothing] + \~\param screen + \~english Choose the screen (0 or 1) + \~french [nothing] + \~\param prio + \~english Background priority (from 0 to 3, being 0 the highest) + \~french [nothing] +*/ +extern void PA_InitFake16bitBg(u8 screen, u8 prio); + +/*! \fn void PA_DrawFake16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color) + \brief + \~english Draws a line on a fake 16 bit background + \~french [nothing] + \~\param screen + \~english Choose the screen (0 or 1) + \~french [nothing] + \~\param x1 + \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y1 + \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param x2 + \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y2 + \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param color + \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... + \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... +*/ +extern void PA_DrawFake16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color); + +/*! \def PA_LoadFake16bitBitmap(screen, bitmap) + \brief + \~english Load a 16 bit bitmap into a fake 16 bit background + \~french [nothing] + \~\param screen + \~english Choose the screen (0 or 1) + \~french [nothing] + \~\param bitmap + \~english Bitmap name + \~french [nothing] +*/ +#define PA_LoadFake16bitBitmap(screen, bitmap) DMA_Copy(bitmap, (void*)PA_DrawFake16[screen], 256*192, DMA_16NOW) + +/*! \def PA_ClearFake16bitBg(screen) + \brief + \~english Clear a fake 16 bit background + \~french [nothing] + \~\param screen + \~english Choose the screen (0 or 1) + \~french [nothing] +*/ +#define PA_ClearFake16bitBg(screen) dmaFillWords(0, (void*)PA_DrawFake16[screen], 256*192*2) + +/*! \def PA_PutFake16bitPixel(screen, x, y, color) + \brief + \~english Plots a pixel into a fake 16 bit background + \~french [nothing] + \~\param screen + \~english Choose the screen (0 or 1) + \~french [nothing] + \~\param x + \~english X position of the point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y + \~english Y position of the point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param color + \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... + \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... +*/ +#define PA_PutFake16bitPixel(screen, x, y, color) PA_DrawFake16[screen][(x) + 256 * (y)] = color + +/*! \def PA_GetFake16bitPixel(screen, x, y) + \brief + \~english Gets the color of a specified pixel of a fake 16 bit background + \~french [nothing] + \~\param screen + \~english Choose the screen (0 or 1) + \~french [nothing] + \~\param x + \~english X position of the point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y + \~english Y position of the point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté +*/ +#define PA_GetFake16bitPixel(screen, x, y) PA_DrawFake16[screen][(x) + 256 * (y)] + +/*! \def PA_DrawFake16bitRect(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color) + \brief + \~english Draws a rectangle on a fake 16 bit background + \~french [nothing] + \~\param screen + \~english Choose the screen (0 or 1) + \~french [nothing] + \~\param x1 + \~english X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du premier point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y1 + \~english Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du premier point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param x2 + \~english X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results + \~french Position X du deuxième point. Attention, si X n'est pas compris entre 0 et 255, le résultat ne sera pas celui escompté + \~\param y2 + \~english Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results + \~french Position Y du deuxième point. Attention, si Y n'est pas compris entre 0 et 191, le résultat ne sera pas celui escompté + \~\param color + \~english 15 bits color. You can use the PA_RGB macro to set the RGB values... + \~french Couleur de 15 bits.On peut utiliser la macro PA_RGB pour entrer les valeurs RGB... +*/ +#define PA_DrawFake16bitRect(screen, x1, y1, x2, y2, color) do{\ + PA_DrawFake16bitLine(screen, x1, y1, x2, y1, color);\ + PA_DrawFake16bitLine(screen, x1, y1, x1, y2, color);\ + PA_DrawFake16bitLine(screen, x2, y1, x2, y2, color);\ + PA_DrawFake16bitLine(screen, x1, y2, x2, y2, color);}while(0) + +/*! \def PA_Fake16bitLoadBmpEx(screen, x, y, bmp) + \brief + \~english Load a BMP on a fake 16 bit background... Don't forget to Init the background ! + \~french [nothing] + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X position of the top left corner + \~french Position X du coin supérieur gauche + \~\param y + \~english Y position of the top left corner + \~french Position Y du coin supérieur gauche + \~\param bmp + \~english BMP image... + \~french image au format BMP... +*/ +#define PA_Fake16bitLoadBmpEx(screen, bmp, x, y) PA_LoadBmpToBuffer(PA_DrawFake16[screen], x, y, bmp, 256) + +/*! \def PA_Fake16bitLoadBmp(screen, bmp) + \brief + \~english Load a BMP on a fake 16 bit background... Don't forget to Init the background ! + \~french [nothing] + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bmp + \~english BMP image... + \~french image au format BMP... +*/ +#define PA_Fake16bitLoadBmp(screen, bmp) PA_Fake16bitLoadBmpEx(screen, bmp, 0, 0) + +/*! \def PA_LoadGifXY(screen, x, y, gif) + \brief + \~english Load a Gif on a fake 16 bit background... Don't forget to Init the background ! + \~french [nothing] + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X position on the screen + \~french Position X à l'écran + \~\param y + \~english Y position on the screen + \~french Position Y à l'écran + \~\param gif + \~english Gif image... + \~french image au format Gif... +*/ +#define PA_Fake16bitLoadGifXY(screen, gif, x, y) DecodeGif((const u8*)gif, (u8*)(PA_DrawFake16[screen] + x + (y<<8)), NULL, 1, 256); + +/*! \def PA_Fake16bitLoadGif(screen, gif) + \brief + \~english Load a Gif on a fake 16 bit background... Don't forget to Init the background ! + \~french [nothing] + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param gif + \~english Gif image... + \~french image au format Gif... +*/ +#define PA_Fake16bitLoadGif(screen, gif) PA_Fake16bitLoadGifXY(screen, gif, 0, 0) + +/*! \def PA_Fake16bitLoadJpeg(screen, jpeg) + \brief + \~english Load a jpeg on a fake 16 bit background... Don't forget to Init the background ! + \~french [nothing] + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param jpeg + \~english jpeg image... + \~french image au format jpeg... +*/ +#define PA_Fake16bitLoadJpeg(screen, jpeg) JPEG_DecompressImage((u8*)jpeg, PA_DrawFake16[screen], 256, 192) + +#ifdef __cplusplus +} +#endif + +/** @} */ // end of fake 16 bit backgrounds + +#endif diff --git a/include/arm9/PA_General.h b/include/arm9/PA_General.h index 805323b..9cbcc73 100644 --- a/include/arm9/PA_General.h +++ b/include/arm9/PA_General.h @@ -1,398 +1,398 @@ -#ifndef _PA_GENERAL -#define _PA_GENERAL - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include "../PA_Transfer.h" - -#include // Pour le système de text -#include - -#ifndef PA_NO_DEPRECATION -#define DEPRECATED __attribute__ ((deprecated)) -#define PA_DEPRECATED_MACRO _PA_DeprecationStub() -#else -#define DEPRECATED -#define PA_DEPRECATED_MACRO ((void)0) -#endif - -static inline void _PA_DeprecationStub() __attribute__((deprecated)); -static inline void _PA_DeprecationStub(){} - -extern u8 PA_Screen; - -typedef struct { - u16 Year; - u8 Month; - u8 Day; - u8 Hour; - u8 Minutes; - u8 Seconds; -// u8 FPS, Frames, OldSeconds; // To test the FPS... -} RTC; -extern RTC PA_RTC; - -static inline void PA_WaitForVBL(); - -extern s16 PA_ScreenSpace; // Espace entre les 2 écrans...+192 - -#define PAWaitForVBL() swiWaitForVBlank() -/* -static inline void PAWaitForVBL(){ - //PA_RTC.Frames ++; // For the FPS counter - swiWaitForVBlank(); -} -*/ -static inline void PA_PowerOff(){ - powerOn(PM_SYSTEM_PWR); -} - -extern u8 pa_checklid; - -#define BG_GFX1 0x6000000 -#define BG_GFX2 0x6200000 -#define SPRITE_GFX1 0x6400000 -#define SPRITE_GFX2 0x6600000 - -//Pour le DMA Copy... -#define REG_DMA3SRC *(volatile u32*)0x040000D4 -#define REG_DMA3DST *(volatile u32*)0x040000D8 -#define REG_DMA3CNT *(volatile u32*)0x040000DC -#define DMA_ON 0x80000000 -#define DMA_NOW 0x00000000 -#define DMA_16 0x00000000 -#define DMA_32 0x04000000 -#define DMA_16NOW (DMA_ON | DMA_NOW | DMA_16) -#define DMA_32NOW (DMA_ON | DMA_NOW | DMA_32) - -#define DMA_Copy(source, dest, count, mode) do{if(((u32)(source)) == 0) DMA_Clear(dest, count, mode); else{REG_DMA3SRC = (u32)source; REG_DMA3DST = (u32)dest; REG_DMA3CNT = (count) | (mode);}}while(0) - -#define DMA_Clear(dest, count, mode) do{ if((mode) & DMA_32) dmaFillWords(0, (void*) (dest), (count) << 2); else dmaFillHalfWords(0, (void*) (dest), (count) << 1); }while(0) - -#define DMA_Force(ulVal, dest, count, mode) do{REG_DMA3SRC=(u32)&ulVal; REG_DMA3DST = (u32)dest; REG_DMA3CNT = (count) |(mode) | DMA_SRC_FIX;}while(0) - -#define DMA_CopyEx(type, source, dest, count, mode) do{DMA_SRC(type) = (u32)source; DMA_DEST(type) = (u32)dest; DMA_CR(type) = (count) | (mode);}while(0) - - -// Commandes pour la lumière des écrans -#define BACKLIGHT(screen) BIT(2+screen) - -#define ALWAYSINLINE __attribute__((always_inline)) static inline - -#define _REG8 *(vu16*) -#define _REG16 *(vu16*) -#define _REG32 *(vu32*) - -#define SWITCH_SCREENS (1<<15) - -#define N_HBLS 263 - -/*! \file PA_General.h - \brief Contains prototypes and macros... for the arm9 - - Contains prototypes and macros... for the arm9 -*/ - -// The PAlib IPC is deprecated... -extern volatile DEPRECATED PA_IPCType PA_IPC; - -////////////////////////////////////////////////////////////////////// -// Général -////////////////////////////////////////////////////////////////////// - -#define SIZEOF_8BIT(x) (sizeof(x)) -#define SIZEOF_16BIT(x) (sizeof(x)>>1) -#define SIZEOF_32BIT(x) (sizeof(x)>>2) - -#define PACKED __attribute__ ((packed)) - -// Jpeg functions: -void PA_jpeg_GetImageSize(char* name, int* width, int* height); -void PA_jpeg_BltImage(char* name, u16* vram, int output_width, int output_height); - -extern const s16 PA_SIN[512]; - -typedef struct { - u8 Color; // Favorite Color - u8 BdayMonth; // Mois d'anniversaire - u8 BdayDay; // Jour de naissance - u8 AlarmHour; - u8 AlarmMinute; - u8 Name[21]; - u8 NameLength; - u8 Message[53]; - u8 MessageLength; - u8 Language; // Langue... 0 pour Jap, 1 pour anglais, 2 pour français... -} infos; -extern infos PA_UserInfo; - -/** @defgroup General General Functions - * Initialise the lib, and other general functions... - * @{ - */ - -/*! \fn void PA_Init(void) - \brief - \~english Initialise the library. Should be used at the beginning of main() - \~french Initialise la lib... Doit etre placé au début de main() -*/ -void PA_Init(); - -/*! \fn void PA_InitFifo() - \brief - \~english Initialize the Fifo system. It is automatically done in PA_Init(). - \~french Initialise le système Fifo. C'est fait automatiquement dans PA_Init(). -*/ -void PA_InitFifo(); - -/*! \def PA_LegacyIPCInit() - \deprecated - \brief - \~english [DEPRECATED] Initialize the legacy IPC system. - \~french TODO -*/ - -#define PA_LegacyIPCInit() do{ \ - memset((void*) &PA_IPC, 0, sizeof(PA_IPCType)); \ - PA_Transfer->mailData = (u32)(&PA_IPC); \ -}while(0) - -/*! \fn void PA_Init2D(void) - \brief - \~english Resets to 2D state after using 3D functions - \~french Remet en mode 2D après avoir utilisé la 3D -*/ -void PA_Init2D(); - -// for the video modes... -extern u8 PA_ExtPal[2][2]; - -/*! \fn void PA_SetVideoMode(u8 screen, u8 mode) - \brief - \~english Change the video mode... Use this with caution - \~french Changer de mode video... A utiliser avec précaution - \~\param screen - \~english Screen... - \~french Ecran... - \~\param mode - \~english Mode 0 for normal, 1 for 1 rotating backgrounds, 2 for 2 - \~french Mode 0 pour normal, 1 pour 1 fond rotatif, 2 pour 2 -*/ -void PA_SetVideoMode(u8 screen, u8 mode); - -#define PA_GetVideoMode(screen) (((screen) ? REG_DISPCNT_SUB : REG_DISPCNT) & 7) - - -/*! \fn void PA_UpdateUserInfo(void) - \brief - \~english Updates the user info. This is automatically done in PA_Init. You can then get any info with the following variables : PA_UserInfo.Color (favorite color), .BdayDay, .BdayMonth, .AlarmHour, .AlarmMinute, .Name, .NameLength, .Message, .MessageLength, .Language - \~french Met à jour les infos sur l'utilisateur... C'est fait automatiquement dans PA_Init. On peut ensuite récupérer toutes les infos avec PA_UserInfo.Color (couleur favorite), .BdayDay, .BdayMonth, .AlarmHour, .AlarmMinute, .Name, .NameLength, .Message, .MessageLength, .Language -*/ -void PA_UpdateUserInfo(void); - - -/*! \fn void PA_UpdateRTC(void) - \brief - \~english Updates the Real Time Clock, with info on the current date and hour. Automatically updated in the PA VBL... Get the info with PA_RTC.Minutes, .Hour, .Seconds, .Day, .Month, and .Year - \~french Met à jour les infos sur l'heure et la date. C'est automatiquement mis à jour dans le VBL PA... On récupère les infos avec PA_RTC.Minutes, .Hour, .Seconds, .Day, .Month, et .Year -*/ -void PA_UpdateRTC(void); - -/*! \fn static inline void PA_SwitchScreens() - \brief - \~english Switch the bottom and top screens... - \~french Echange les écrans du haut et du bas -*/ -static inline void PA_SwitchScreens() { - REG_POWERCNT ^= SWITCH_SCREENS; - PA_Screen = !PA_Screen; -} - -extern vu8 _PA_LidDown; - -/*! \def PA_LidClosed() - \brief - \~english Check if the DS is closed. Returns 0 if open, 1 if closed - \~french Vérifie si la DS est fermée. Renvoie 0 si ouverte, 1 si fermée -*/ -#define PA_LidClosed() _PA_LidDown - -/*! \fn static inline void PA_SetAutoCheckLid(u8 on) - \brief - \~english Automatically check if the DS is closed in PA_WaitForVBL - \~french Vérifie automatiquement si la DS est fermée dans PA_WaitForVBL - \~\param on - \~english 1 for on, 0 for off - \~french 1 pour activer, 0 pour désactiver -*/ -static inline void PA_SetAutoCheckLid(u8 on){ - pa_checklid = on; -} - -static inline void PA_SetLedBlink(u8 blink, u8 speed); - -/*! \fn u8 PA_CheckLid() - \brief - \~english Check if the DS is closed. If closed, it pauses the DS, and returns 1. - \~french Vérifie si la DS est fermée. Si fermée, ca met en pause la DS et renvoie 1. -*/ -u8 PA_CheckLid(); - -/*! \fn static inline void PA_WaitForVBL() - \brief - \~english Wait for the VBlank to occur - \~french Attendre le vbl... -*/ -static inline void PA_WaitForVBL(){ - if(pa_checklid) PA_CheckLid(); - - // Let other threads interrupt the main thread - //swiWaitForVBlank(); - cothread_yield_irq(IRQ_VBLANK); -} - -#define PA_WaitForVBlank PA_WaitForVBL - -/*! \def PA_CloseLidSound(close_sound) - \brief - \~english Check if the DS is closed. If closed, it pauses the DS, and plays a sound - \~french Vérifie si la DS est fermée. Si fermée, ca met en pause la DS et joue un son - \~\param close_sound - \~english Sound to play, check the sounds doc if you're not sure what to do here - \~french Son à jouer, regarder la doc son si pas certain de quoi mettre... -*/ -#define PA_CloseLidSound(close_sound)do{\ - if(PA_LidClosed()){\ - PA_PlaySimpleSound(close_sound);\ - PA_CheckLid(); \ - }}while(0) - - -/*! \def PA_CloseLidSound2(close_sound, open_sound) - \brief - \~english Check if the DS is closed. If closed, it pauses the DS, and plays a sound. The sound system must be initialized before. - \~french Vérifie si la DS est fermée. Si fermée, ca met en pause la DS et joue un son - \~\param close_sound - \~english Sound to play when closes, check the sounds doc if you're not sure what to do here - \~french Son à jouer quand se ferme, regarder la doc son si pas certain de quoi mettre... - \~\param open_sound - \~english Sound to play when opens, check the sounds doc if you're not sure what to do here - \~french Son à jouer quand s'ouvre, regarder la doc son si pas certain de quoi mettre... -*/ -#define PA_CloseLidSound2(close_sound, open_sound)do{\ - if(PA_LidClosed()){\ - PA_PlaySimpleSound(close_sound);\ - PA_CheckLid(); \ - PA_PlaySimpleSound(open_sound); \ - }}while(0) - -/*! \fn void PA_SetScreenLight(u8 screen, u8 light) - \brief - \~english Set on or off the screen's light - \~french Allumer ou eteindre la lumière d'un écran - \~\param screen - \~english Screen... - \~french Ecran... - \~\param light - \~english Light, 1 for on, 0 for off - \~french Lumière, 1 pour allumé, 0 pour éteint -*/ -static inline void PA_SetScreenLight(u8 screen, u8 light){ - // Beware of the nested one-line IF blocks! - if(screen) - if(light) - powerOn(PM_BACKLIGHT_TOP); - else - powerOff(PM_BACKLIGHT_TOP); - else - if(light) - powerOn(PM_BACKLIGHT_BOTTOM); - else - powerOff(PM_BACKLIGHT_BOTTOM); -} - - -/*! \fn static inline void PA_SetLedBlink(u8 blink, u8 speed) - \brief - \~english Set teh DS Led blinking - \~french Régler le clignotement de la led - \~\param blink - \~english 1 for blinking, 0 for always on - \~french 1 pour clignoter, 0 pour toujours allumé - \~\param speed - \~english Speed : 0 for slow, 1 for fast - \~french Vitesse : 0 pour lent, 1 pour rapide -*/ -static inline void PA_SetLedBlink(u8 blink, u8 speed){ - ledBlink(((blink&1) | ((speed&1) << 1)) << 4); -} - -/*! \def PA_WaitFor(something) - \brief - \~english Wait for a specific thing to happen... - \~french Attendre un événement précis... - \~\param something - \~english Thing to wait for, like Pad.Newpress.A, or Stylus.Newpress, etc... - \~french Evénement à attendre, comme Pad.Newpress.A, ou Stylus.Newpress, etc... -*/ - -#define PA_WaitFor(something) do{while(!(something)) PA_WaitForVBL();}while(0) - -/*! \fn static inline void PA_SetDSLBrightness(u8 level) - \brief - \~english Set the DS Lite Light level... - \~french Régler le niveau de lumière de la DS Lite ! - \~\param level - \~english Light level (0-3) - \~french Niveau de la lumière (0-3) -*/ -static inline void PA_SetDSLBrightness(u8 level){ - PA_FifoMsg msg; - msg.type = PA_MSG_DSLBRIGHT; - msg.DSLBrightMsg.brightness = level; - PA_SendFifoMsg(msg); -} - -/*! \fn bool PA_Locate(char *start, char *target, bool isDir, int depth, char *result) - \brief - Find a directory in the file system within a given depth - \param start - from which directory to start, use "/" to search from the root - \param target - what to look for: the name of a file or directory - \param isDir - look for a directory or a file? - \param depth - how much depth level (in number of directories) to traverse; limiting this speeds up the search on crowded cards. A reasonable value is, for example, 3. - \param result - pointer to a buffer where the result will be stored - \return - true if the target was found -*/ -bool PA_Locate(char* start, char* target, bool isDir, int depth, char* result); - -/// Displays an error message. -void PA_Error(const char* text); - -/** @} */ // end of General - -void PA_Nothing(void); - -#ifdef __cplusplus -} -#endif -#endif +#ifndef _PA_GENERAL +#define _PA_GENERAL + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include "../PA_Transfer.h" + +#include // Pour le système de text +#include + +#ifndef PA_NO_DEPRECATION +#define DEPRECATED __attribute__ ((deprecated)) +#define PA_DEPRECATED_MACRO _PA_DeprecationStub() +#else +#define DEPRECATED +#define PA_DEPRECATED_MACRO ((void)0) +#endif + +static inline void _PA_DeprecationStub() __attribute__((deprecated)); +static inline void _PA_DeprecationStub(){} + +extern u8 PA_Screen; + +typedef struct { + u16 Year; + u8 Month; + u8 Day; + u8 Hour; + u8 Minutes; + u8 Seconds; +// u8 FPS, Frames, OldSeconds; // To test the FPS... +} RTC; +extern RTC PA_RTC; + +static inline void PA_WaitForVBL(); + +extern s16 PA_ScreenSpace; // Espace entre les 2 écrans...+192 + +#define PAWaitForVBL() swiWaitForVBlank() +/* +static inline void PAWaitForVBL(){ + //PA_RTC.Frames ++; // For the FPS counter + swiWaitForVBlank(); +} +*/ +static inline void PA_PowerOff(){ + powerOn(PM_SYSTEM_PWR); +} + +extern u8 pa_checklid; + +#define BG_GFX1 0x6000000 +#define BG_GFX2 0x6200000 +#define SPRITE_GFX1 0x6400000 +#define SPRITE_GFX2 0x6600000 + +//Pour le DMA Copy... +#define REG_DMA3SRC *(volatile u32*)0x040000D4 +#define REG_DMA3DST *(volatile u32*)0x040000D8 +#define REG_DMA3CNT *(volatile u32*)0x040000DC +#define DMA_ON 0x80000000 +#define DMA_NOW 0x00000000 +#define DMA_16 0x00000000 +#define DMA_32 0x04000000 +#define DMA_16NOW (DMA_ON | DMA_NOW | DMA_16) +#define DMA_32NOW (DMA_ON | DMA_NOW | DMA_32) + +#define DMA_Copy(source, dest, count, mode) do{if(((u32)(source)) == 0) DMA_Clear(dest, count, mode); else{REG_DMA3SRC = (u32)source; REG_DMA3DST = (u32)dest; REG_DMA3CNT = (count) | (mode);}}while(0) + +#define DMA_Clear(dest, count, mode) do{ if((mode) & DMA_32) dmaFillWords(0, (void*) (dest), (count) << 2); else dmaFillHalfWords(0, (void*) (dest), (count) << 1); }while(0) + +#define DMA_Force(ulVal, dest, count, mode) do{REG_DMA3SRC=(u32)&ulVal; REG_DMA3DST = (u32)dest; REG_DMA3CNT = (count) |(mode) | DMA_SRC_FIX;}while(0) + +#define DMA_CopyEx(type, source, dest, count, mode) do{DMA_SRC(type) = (u32)source; DMA_DEST(type) = (u32)dest; DMA_CR(type) = (count) | (mode);}while(0) + + +// Commandes pour la lumière des écrans +#define BACKLIGHT(screen) BIT(2+screen) + +#define ALWAYSINLINE __attribute__((always_inline)) static inline + +#define _REG8 *(vu16*) +#define _REG16 *(vu16*) +#define _REG32 *(vu32*) + +#define SWITCH_SCREENS (1<<15) + +#define N_HBLS 263 + +/*! \file PA_General.h + \brief Contains prototypes and macros... for the arm9 + + Contains prototypes and macros... for the arm9 +*/ + +// The PAlib IPC is deprecated... +extern volatile DEPRECATED PA_IPCType PA_IPC; + +////////////////////////////////////////////////////////////////////// +// Général +////////////////////////////////////////////////////////////////////// + +#define SIZEOF_8BIT(x) (sizeof(x)) +#define SIZEOF_16BIT(x) (sizeof(x)>>1) +#define SIZEOF_32BIT(x) (sizeof(x)>>2) + +#define PACKED __attribute__ ((packed)) + +// Jpeg functions: +void PA_jpeg_GetImageSize(char* name, int* width, int* height); +void PA_jpeg_BltImage(char* name, u16* vram, int output_width, int output_height); + +extern const s16 PA_SIN[512]; + +typedef struct { + u8 Color; // Favorite Color + u8 BdayMonth; // Mois d'anniversaire + u8 BdayDay; // Jour de naissance + u8 AlarmHour; + u8 AlarmMinute; + u8 Name[21]; + u8 NameLength; + u8 Message[53]; + u8 MessageLength; + u8 Language; // Langue... 0 pour Jap, 1 pour anglais, 2 pour français... +} infos; +extern infos PA_UserInfo; + +/** @defgroup General General Functions + * Initialise the lib, and other general functions... + * @{ + */ + +/*! \fn void PA_Init(void) + \brief + \~english Initialise the library. Should be used at the beginning of main() + \~french Initialise la lib... Doit etre placé au début de main() +*/ +void PA_Init(); + +/*! \fn void PA_InitFifo() + \brief + \~english Initialize the Fifo system. It is automatically done in PA_Init(). + \~french Initialise le système Fifo. C'est fait automatiquement dans PA_Init(). +*/ +void PA_InitFifo(); + +/*! \def PA_LegacyIPCInit() + \deprecated + \brief + \~english [DEPRECATED] Initialize the legacy IPC system. + \~french TODO +*/ + +#define PA_LegacyIPCInit() do{ \ + memset((void*) &PA_IPC, 0, sizeof(PA_IPCType)); \ + PA_Transfer->mailData = (u32)(&PA_IPC); \ +}while(0) + +/*! \fn void PA_Init2D(void) + \brief + \~english Resets to 2D state after using 3D functions + \~french Remet en mode 2D après avoir utilisé la 3D +*/ +void PA_Init2D(); + +// for the video modes... +extern u8 PA_ExtPal[2][2]; + +/*! \fn void PA_SetVideoMode(u8 screen, u8 mode) + \brief + \~english Change the video mode... Use this with caution + \~french Changer de mode video... A utiliser avec précaution + \~\param screen + \~english Screen... + \~french Ecran... + \~\param mode + \~english Mode 0 for normal, 1 for 1 rotating backgrounds, 2 for 2 + \~french Mode 0 pour normal, 1 pour 1 fond rotatif, 2 pour 2 +*/ +void PA_SetVideoMode(u8 screen, u8 mode); + +#define PA_GetVideoMode(screen) (((screen) ? REG_DISPCNT_SUB : REG_DISPCNT) & 7) + + +/*! \fn void PA_UpdateUserInfo(void) + \brief + \~english Updates the user info. This is automatically done in PA_Init. You can then get any info with the following variables : PA_UserInfo.Color (favorite color), .BdayDay, .BdayMonth, .AlarmHour, .AlarmMinute, .Name, .NameLength, .Message, .MessageLength, .Language + \~french Met à jour les infos sur l'utilisateur... C'est fait automatiquement dans PA_Init. On peut ensuite récupérer toutes les infos avec PA_UserInfo.Color (couleur favorite), .BdayDay, .BdayMonth, .AlarmHour, .AlarmMinute, .Name, .NameLength, .Message, .MessageLength, .Language +*/ +void PA_UpdateUserInfo(void); + + +/*! \fn void PA_UpdateRTC(void) + \brief + \~english Updates the Real Time Clock, with info on the current date and hour. Automatically updated in the PA VBL... Get the info with PA_RTC.Minutes, .Hour, .Seconds, .Day, .Month, and .Year + \~french Met à jour les infos sur l'heure et la date. C'est automatiquement mis à jour dans le VBL PA... On récupère les infos avec PA_RTC.Minutes, .Hour, .Seconds, .Day, .Month, et .Year +*/ +void PA_UpdateRTC(void); + +/*! \fn static inline void PA_SwitchScreens() + \brief + \~english Switch the bottom and top screens... + \~french Echange les écrans du haut et du bas +*/ +static inline void PA_SwitchScreens() { + REG_POWERCNT ^= SWITCH_SCREENS; + PA_Screen = !PA_Screen; +} + +extern vu8 _PA_LidDown; + +/*! \def PA_LidClosed() + \brief + \~english Check if the DS is closed. Returns 0 if open, 1 if closed + \~french Vérifie si la DS est fermée. Renvoie 0 si ouverte, 1 si fermée +*/ +#define PA_LidClosed() _PA_LidDown + +/*! \fn static inline void PA_SetAutoCheckLid(u8 on) + \brief + \~english Automatically check if the DS is closed in PA_WaitForVBL + \~french Vérifie automatiquement si la DS est fermée dans PA_WaitForVBL + \~\param on + \~english 1 for on, 0 for off + \~french 1 pour activer, 0 pour désactiver +*/ +static inline void PA_SetAutoCheckLid(u8 on){ + pa_checklid = on; +} + +static inline void PA_SetLedBlink(u8 blink, u8 speed); + +/*! \fn u8 PA_CheckLid() + \brief + \~english Check if the DS is closed. If closed, it pauses the DS, and returns 1. + \~french Vérifie si la DS est fermée. Si fermée, ca met en pause la DS et renvoie 1. +*/ +u8 PA_CheckLid(); + +/*! \fn static inline void PA_WaitForVBL() + \brief + \~english Wait for the VBlank to occur + \~french Attendre le vbl... +*/ +static inline void PA_WaitForVBL(){ + if(pa_checklid) PA_CheckLid(); + + // Let other threads interrupt the main thread + //swiWaitForVBlank(); + cothread_yield_irq(IRQ_VBLANK); +} + +#define PA_WaitForVBlank PA_WaitForVBL + +/*! \def PA_CloseLidSound(close_sound) + \brief + \~english Check if the DS is closed. If closed, it pauses the DS, and plays a sound + \~french Vérifie si la DS est fermée. Si fermée, ca met en pause la DS et joue un son + \~\param close_sound + \~english Sound to play, check the sounds doc if you're not sure what to do here + \~french Son à jouer, regarder la doc son si pas certain de quoi mettre... +*/ +#define PA_CloseLidSound(close_sound)do{\ + if(PA_LidClosed()){\ + PA_PlaySimpleSound(close_sound);\ + PA_CheckLid(); \ + }}while(0) + + +/*! \def PA_CloseLidSound2(close_sound, open_sound) + \brief + \~english Check if the DS is closed. If closed, it pauses the DS, and plays a sound. The sound system must be initialized before. + \~french Vérifie si la DS est fermée. Si fermée, ca met en pause la DS et joue un son + \~\param close_sound + \~english Sound to play when closes, check the sounds doc if you're not sure what to do here + \~french Son à jouer quand se ferme, regarder la doc son si pas certain de quoi mettre... + \~\param open_sound + \~english Sound to play when opens, check the sounds doc if you're not sure what to do here + \~french Son à jouer quand s'ouvre, regarder la doc son si pas certain de quoi mettre... +*/ +#define PA_CloseLidSound2(close_sound, open_sound)do{\ + if(PA_LidClosed()){\ + PA_PlaySimpleSound(close_sound);\ + PA_CheckLid(); \ + PA_PlaySimpleSound(open_sound); \ + }}while(0) + +/*! \fn void PA_SetScreenLight(u8 screen, u8 light) + \brief + \~english Set on or off the screen's light + \~french Allumer ou eteindre la lumière d'un écran + \~\param screen + \~english Screen... + \~french Ecran... + \~\param light + \~english Light, 1 for on, 0 for off + \~french Lumière, 1 pour allumé, 0 pour éteint +*/ +static inline void PA_SetScreenLight(u8 screen, u8 light){ + // Beware of the nested one-line IF blocks! + if(screen) + if(light) + powerOn(PM_BACKLIGHT_TOP); + else + powerOff(PM_BACKLIGHT_TOP); + else + if(light) + powerOn(PM_BACKLIGHT_BOTTOM); + else + powerOff(PM_BACKLIGHT_BOTTOM); +} + + +/*! \fn static inline void PA_SetLedBlink(u8 blink, u8 speed) + \brief + \~english Set teh DS Led blinking + \~french Régler le clignotement de la led + \~\param blink + \~english 1 for blinking, 0 for always on + \~french 1 pour clignoter, 0 pour toujours allumé + \~\param speed + \~english Speed : 0 for slow, 1 for fast + \~french Vitesse : 0 pour lent, 1 pour rapide +*/ +static inline void PA_SetLedBlink(u8 blink, u8 speed){ + ledBlink(((blink&1) | ((speed&1) << 1)) << 4); +} + +/*! \def PA_WaitFor(something) + \brief + \~english Wait for a specific thing to happen... + \~french Attendre un événement précis... + \~\param something + \~english Thing to wait for, like Pad.Newpress.A, or Stylus.Newpress, etc... + \~french Evénement à attendre, comme Pad.Newpress.A, ou Stylus.Newpress, etc... +*/ + +#define PA_WaitFor(something) do{while(!(something)) PA_WaitForVBL();}while(0) + +/*! \fn static inline void PA_SetDSLBrightness(u8 level) + \brief + \~english Set the DS Lite Light level... + \~french Régler le niveau de lumière de la DS Lite ! + \~\param level + \~english Light level (0-3) + \~french Niveau de la lumière (0-3) +*/ +static inline void PA_SetDSLBrightness(u8 level){ + PA_FifoMsg msg; + msg.type = PA_MSG_DSLBRIGHT; + msg.DSLBrightMsg.brightness = level; + PA_SendFifoMsg(msg); +} + +/*! \fn bool PA_Locate(char *start, char *target, bool isDir, int depth, char *result) + \brief + Find a directory in the file system within a given depth + \param start + from which directory to start, use "/" to search from the root + \param target + what to look for: the name of a file or directory + \param isDir + look for a directory or a file? + \param depth + how much depth level (in number of directories) to traverse; limiting this speeds up the search on crowded cards. A reasonable value is, for example, 3. + \param result + pointer to a buffer where the result will be stored + \return + true if the target was found +*/ +bool PA_Locate(char* start, char* target, bool isDir, int depth, char* result); + +/// Displays an error message. +void PA_Error(const char* text); + +/** @} */ // end of General + +void PA_Nothing(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/arm9/PA_Gif.h b/include/arm9/PA_Gif.h index e52cbc7..87271fe 100644 --- a/include/arm9/PA_Gif.h +++ b/include/arm9/PA_Gif.h @@ -1,203 +1,203 @@ -#ifndef _PA_Gif -#define _PA_Gif - -#ifdef __cplusplus -extern "C" { -#endif - -/*! \file PA_Gif.h - \brief Gif, animations... - - Manages everything about gif files. CONVERTING GRAPHICS AT RUNTIME IS A BAD IDEA AND SHOULD BE AVOIDED AT ALL COSTS. -*/ - -#include - -#include "PA_Interrupt.h" -#include "PA_Palette.h" -#include "PA_Draw.h" -#include "gif/gif_lib.h" - -extern GifFileType* gifinfo; -extern s16 gifwidth, gifheight; -extern u8 PA_nBit[2]; // 8 or 16 bit Bg -extern s32 GifCurrentLine; - -typedef struct{ - s32 StartFrame; - s32 EndFrame; - s32 CurrentFrame; - float Speed; - u8 Play; // 0 stop; 1 play; 2 pause; -} PA_GifInfos; -extern PA_GifInfos PA_GifInfo; - -void PA_Load16bitGif(u8 screen, s16 x, s16 y, void *gif); - -int DecodeGif(const u8 *userData, u8 *ScreenBuff, u16* Palette, u8 nBits, s16 SWidth); - -/** @defgroup Gif Gif functions - * Manages everything about gif files. - * @{ - */ - -/*! \fn static inline u16 PA_GetGifWidth(void* gif) - \brief - \~english Get a Gif's width in pixels - \~french Récupérer la largeur d'un Gif en pixels - \~\param gif - \~english Gif image... - \~french image au format Gif... -*/ -static inline u16 PA_GetGifWidth(void* gif){ - u16 *temp = (u16*)gif; - temp += 3; - return *temp; -} - -/*! \fn static inline u16 PA_GetGifHeight(void* gif) - \brief - \~english Get a Gif's height in pixels - \~french Récupérer la hauteur d'un Gif en pixels - \~\param gif - \~english Gif image... - \~french image au format Gif... -*/ -static inline u16 PA_GetGifHeight(void* gif){ - u16 *temp = (u16*)gif; - temp += 4; - return *temp; -} - -/*! \fn static inline void PA_LoadGifXY(u8 screen, s16 x, s16 y, void *gif) - \brief - \~english Load a Gif on a 16 bit background... Don't forget to Init the background ! - \~french Charger un Gif sur un fond de 16 bits... Faut pas oublier de charger ce fond avant ! - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X position on the screen - \~french Position X à l'écran - \~\param y - \~english Y position on the screen - \~french Position Y à l'écran - \~\param gif - \~english Gif image... - \~french image au format Gif... -*/ -static inline void PA_LoadGifXY(u8 screen, s16 x, s16 y, void *gif){ - if (PA_nBit[screen]) DecodeGif((const u8*)gif, (u8*)(PA_DrawBg[screen] + x + (y<<8)), (u16*)0x05000000, 1, 256); - else DecodeGif((const u8*)gif, (u8*)(PA_DrawBg[screen] + ((x + (y<<8))>>1)), (u16*)(0x05000000+(0x400*screen)), 0, 256); -} - -/*! \fn static inline void PA_LoadGif(u8 screen, void *gif) - \brief - \~english Load a Gif on a 16 bit background... Don't forget to Init the background ! - \~french Charger un Gif sur un fond de 16 bits... Faut pas oublier de charger ce fond avant ! - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param gif - \~english Gif image... - \~french image au format Gif... -*/ -static inline void PA_LoadGif(u8 screen, void *gif){ - PA_LoadGifXY(screen, 0, 0, gif); -} - -/*! \fn static inline void PA_GifAnimSpeed(float speed) - \brief - \~english Set the gif's speed - \~french Changer la vitesse d'un gif - \~\param speed - \~english 1 for normal, 2 for 2x, 0.5 for half speed... - \~french 1 pour normal, 2 pour 2x, 0.5 pour la moitié... -*/ -static inline void PA_GifAnimSpeed(float speed){ - PA_GifInfo.Speed = speed; -} - -/*! \fn static inline void PA_GifAnimStop(void) - \brief - \~english Stop a Gif animation - \~french Arrêter l'animation d'un gif -*/ -static inline void PA_GifAnimStop(void){ - PA_GifInfo.Play = 0; -} - -/*! \fn static inline void PA_GifAnimPause(void) - \brief - \~english Pause a Gif animation - \~french Mettre en pause l'animation d'un gif -*/ -static inline void PA_GifAnimPause(void){ - PA_GifInfo.Play = 2; -} - -/*! \fn static inline void PA_GifAnimStop(void) - \brief - \~english Unpause a Gif animation - \~french Reprendre l'animation d'un gif -*/ -static inline void PA_GifAnimPlay(void){ - PA_GifInfo.Play = 1; -} - -/*! \fn static inline void PA_GifSetStartFrame(s32 StartFrame) - \brief - \~english Set the Gif's starting frame number - \~french Régler à partir de quelle image commencer le gif - \~\param StartFrame - \~english Starting frame... (0 to start from beginning) - \~french Image où démarrer... (0 pour le début) -*/ -static inline void PA_GifSetStartFrame(s32 StartFrame){ - PA_GifInfo.StartFrame = StartFrame; -} - -/*! \fn static inline void PA_GifSetEndFrame(s32 EndFrame) - \brief - \~english Set the Gif's ending frame number - \~french Régler à partir de quelle image arrêter le gif - \~\param EndFrame - \~english Ending frame... (100000 if you want to be sure ^^) - \~french Image où démarrer... (100000 si vous voulez être sure de finir ^^) -*/ -static inline void PA_GifSetEndFrame(s32 EndFrame){ - PA_GifInfo.EndFrame = EndFrame; -} -/*! \fn static inline s16 PA_GifGetFrame(void) - \brief - \~english Return's the gif's current frame - \~french Renvoie le numéro d'image du gif en cours -*/ -static inline s32 PA_GifGetFrame(void){ - return PA_GifInfo.CurrentFrame; -} - -/* -/N! \fn void PA_GifToTiles(void *gif, u16 *temppal) - \brief - \~english Export Gif to a friendly 8x8 tile format, allowing it to be used to create sprites and backgrounds ! Returns a pointer towards your sprite gfx - \~french Exporter un Gif au format de tiles de 8x8 pixels, ce qui permet de l'utiliser pour créer des sprites ou des fonds ! Renvoie un pointeur vers le gfx du sprite - \~\param gif - \~english Your gif file... - \~french Fichier gif... - \~\param temppal - \~english A 256 u16 array that will receive the palette info to load - \~french Un tableau de 256 entrée en u16, qui recevra les infos de la palette à charger - - -N/ -u8* PA_GifToTiles(void *gif, u16 *temppal); -*/ - -/** @} */ // end of Gif - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_Gif +#define _PA_Gif + +#ifdef __cplusplus +extern "C" { +#endif + +/*! \file PA_Gif.h + \brief Gif, animations... + + Manages everything about gif files. CONVERTING GRAPHICS AT RUNTIME IS A BAD IDEA AND SHOULD BE AVOIDED AT ALL COSTS. +*/ + +#include + +#include "PA_Interrupt.h" +#include "PA_Palette.h" +#include "PA_Draw.h" +#include "gif/gif_lib.h" + +extern GifFileType* gifinfo; +extern s16 gifwidth, gifheight; +extern u8 PA_nBit[2]; // 8 or 16 bit Bg +extern s32 GifCurrentLine; + +typedef struct{ + s32 StartFrame; + s32 EndFrame; + s32 CurrentFrame; + float Speed; + u8 Play; // 0 stop; 1 play; 2 pause; +} PA_GifInfos; +extern PA_GifInfos PA_GifInfo; + +void PA_Load16bitGif(u8 screen, s16 x, s16 y, void *gif); + +int DecodeGif(const u8 *userData, u8 *ScreenBuff, u16* Palette, u8 nBits, s16 SWidth); + +/** @defgroup Gif Gif functions + * Manages everything about gif files. + * @{ + */ + +/*! \fn static inline u16 PA_GetGifWidth(void* gif) + \brief + \~english Get a Gif's width in pixels + \~french Récupérer la largeur d'un Gif en pixels + \~\param gif + \~english Gif image... + \~french image au format Gif... +*/ +static inline u16 PA_GetGifWidth(void* gif){ + u16 *temp = (u16*)gif; + temp += 3; + return *temp; +} + +/*! \fn static inline u16 PA_GetGifHeight(void* gif) + \brief + \~english Get a Gif's height in pixels + \~french Récupérer la hauteur d'un Gif en pixels + \~\param gif + \~english Gif image... + \~french image au format Gif... +*/ +static inline u16 PA_GetGifHeight(void* gif){ + u16 *temp = (u16*)gif; + temp += 4; + return *temp; +} + +/*! \fn static inline void PA_LoadGifXY(u8 screen, s16 x, s16 y, void *gif) + \brief + \~english Load a Gif on a 16 bit background... Don't forget to Init the background ! + \~french Charger un Gif sur un fond de 16 bits... Faut pas oublier de charger ce fond avant ! + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X position on the screen + \~french Position X à l'écran + \~\param y + \~english Y position on the screen + \~french Position Y à l'écran + \~\param gif + \~english Gif image... + \~french image au format Gif... +*/ +static inline void PA_LoadGifXY(u8 screen, s16 x, s16 y, void *gif){ + if (PA_nBit[screen]) DecodeGif((const u8*)gif, (u8*)(PA_DrawBg[screen] + x + (y<<8)), (u16*)0x05000000, 1, 256); + else DecodeGif((const u8*)gif, (u8*)(PA_DrawBg[screen] + ((x + (y<<8))>>1)), (u16*)(0x05000000+(0x400*screen)), 0, 256); +} + +/*! \fn static inline void PA_LoadGif(u8 screen, void *gif) + \brief + \~english Load a Gif on a 16 bit background... Don't forget to Init the background ! + \~french Charger un Gif sur un fond de 16 bits... Faut pas oublier de charger ce fond avant ! + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param gif + \~english Gif image... + \~french image au format Gif... +*/ +static inline void PA_LoadGif(u8 screen, void *gif){ + PA_LoadGifXY(screen, 0, 0, gif); +} + +/*! \fn static inline void PA_GifAnimSpeed(float speed) + \brief + \~english Set the gif's speed + \~french Changer la vitesse d'un gif + \~\param speed + \~english 1 for normal, 2 for 2x, 0.5 for half speed... + \~french 1 pour normal, 2 pour 2x, 0.5 pour la moitié... +*/ +static inline void PA_GifAnimSpeed(float speed){ + PA_GifInfo.Speed = speed; +} + +/*! \fn static inline void PA_GifAnimStop(void) + \brief + \~english Stop a Gif animation + \~french Arrêter l'animation d'un gif +*/ +static inline void PA_GifAnimStop(void){ + PA_GifInfo.Play = 0; +} + +/*! \fn static inline void PA_GifAnimPause(void) + \brief + \~english Pause a Gif animation + \~french Mettre en pause l'animation d'un gif +*/ +static inline void PA_GifAnimPause(void){ + PA_GifInfo.Play = 2; +} + +/*! \fn static inline void PA_GifAnimStop(void) + \brief + \~english Unpause a Gif animation + \~french Reprendre l'animation d'un gif +*/ +static inline void PA_GifAnimPlay(void){ + PA_GifInfo.Play = 1; +} + +/*! \fn static inline void PA_GifSetStartFrame(s32 StartFrame) + \brief + \~english Set the Gif's starting frame number + \~french Régler à partir de quelle image commencer le gif + \~\param StartFrame + \~english Starting frame... (0 to start from beginning) + \~french Image où démarrer... (0 pour le début) +*/ +static inline void PA_GifSetStartFrame(s32 StartFrame){ + PA_GifInfo.StartFrame = StartFrame; +} + +/*! \fn static inline void PA_GifSetEndFrame(s32 EndFrame) + \brief + \~english Set the Gif's ending frame number + \~french Régler à partir de quelle image arrêter le gif + \~\param EndFrame + \~english Ending frame... (100000 if you want to be sure ^^) + \~french Image où démarrer... (100000 si vous voulez être sure de finir ^^) +*/ +static inline void PA_GifSetEndFrame(s32 EndFrame){ + PA_GifInfo.EndFrame = EndFrame; +} +/*! \fn static inline s16 PA_GifGetFrame(void) + \brief + \~english Return's the gif's current frame + \~french Renvoie le numéro d'image du gif en cours +*/ +static inline s32 PA_GifGetFrame(void){ + return PA_GifInfo.CurrentFrame; +} + +/* +/N! \fn void PA_GifToTiles(void *gif, u16 *temppal) + \brief + \~english Export Gif to a friendly 8x8 tile format, allowing it to be used to create sprites and backgrounds ! Returns a pointer towards your sprite gfx + \~french Exporter un Gif au format de tiles de 8x8 pixels, ce qui permet de l'utiliser pour créer des sprites ou des fonds ! Renvoie un pointeur vers le gfx du sprite + \~\param gif + \~english Your gif file... + \~french Fichier gif... + \~\param temppal + \~english A 256 u16 array that will receive the palette info to load + \~french Un tableau de 256 entrée en u16, qui recevra les infos de la palette à charger + + +N/ +u8* PA_GifToTiles(void *gif, u16 *temppal); +*/ + +/** @} */ // end of Gif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_IA.h b/include/arm9/PA_IA.h index cf49d24..fbfd093 100644 --- a/include/arm9/PA_IA.h +++ b/include/arm9/PA_IA.h @@ -1,26 +1,26 @@ -#ifndef _PA_IA -#define _PA_IA - -#ifdef __cplusplus -extern "C" { -#endif - -#include -extern u16 *maze[255]; - -static inline void PA_InitAstar(u16 lx, u16 ly){ - int i; - lx = lx << 1; // u16 take up 2 spaces... - - for (i = 0; i < ly; i++){ - free(maze[i]); - maze[i] = (u16*)malloc(lx); - } -} - -s8 PA_Astar(u16 width, u16 height); - -#ifdef __cplusplus -} -#endif -#endif +#ifndef _PA_IA +#define _PA_IA + +#ifdef __cplusplus +extern "C" { +#endif + +#include +extern u16 *maze[255]; + +static inline void PA_InitAstar(u16 lx, u16 ly){ + int i; + lx = lx << 1; // u16 take up 2 spaces... + + for (i = 0; i < ly; i++){ + free(maze[i]); + maze[i] = (u16*)malloc(lx); + } +} + +s8 PA_Astar(u16 width, u16 height); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/arm9/PA_Interrupt.h b/include/arm9/PA_Interrupt.h index 708cb77..e681e0d 100644 --- a/include/arm9/PA_Interrupt.h +++ b/include/arm9/PA_Interrupt.h @@ -1,111 +1,111 @@ -#ifndef _PA_Interrupt -#define _PA_Interrupt - -#ifdef __cplusplus -extern "C" { -#endif - -/*! \file PA_Interrupt.h - \brief Interrupt system - - Mainly used for the VBlank system and the counters... -*/ - -typedef void (*funcpointer)(); - -extern funcpointer MotionVBL; -extern funcpointer GHPadVBL; -extern funcpointer PaddleVBL; - -extern s32 PA_VBLCounter[16]; // VBL counters -extern bool PA_VBLCounterOn[16]; // VBL counters enable/disable flag - -extern funcpointer CustomVBL; - -/*! \fn void PA_vblFunc() - \brief - \~english The standard PAlib VBL function. This will update the pad, the stylus, the RTC, etc... You could/should use this function if you do your own custom VBL. - \~french Fonction standard du VBL PAlib. Ceci met à jour le pad, le stylet, le RTC... Utilisez cette fonction si vous faites votre propre VBL. -*/ -void PA_vblFunc(); - -/*! \fn static inline void PA_InitVBL() - \deprecated - \brief - \~english [DEPRECATED] In previous PAlib versions this initialized the VBlank system, but it now does nothing since it's automatically done at PA_Init(). - \~french [DEPRECATED] Initialise une fonction VBL basique. Ca met à jour l'OAM (les sprites), les touches, et le stylet chaque frame. - -*/ -static inline void PA_InitVBL(){ - // This used to call this code, but it isn't needed anymore: - //irqSet(IRQ_VBLANK, PA_vblFunc); - //irqEnable(IRQ_VBLANK); -} - -/*! \def PA_GetVcount() - \brief - \~english Get the vertical line count... - \~french Récupérer le numéro de ligne tracée -*/ -#define PA_GetVcount() (REG_VCOUNT&511) - -/*! \fn void PA_VBLCountersReset() - \brief - \~english Resets the VBL counters - \~french Remet à 0 les compteurs VBL -*/ -void PA_VBLCountersReset(); - -/*! \fn static inline void PA_VBLCounterStart(u8 nCounter) - \brief - \~english Resets a given counter and starts running - \~french Remet à 0 un compteur donné et le démarre - \~\param nCounter - \~english Counter number (0-15) - \~french Numéro du compteur (0-15) -*/ -static inline void PA_VBLCounterStart(u8 nCounter){ - PA_VBLCounter[nCounter] = 0; - PA_VBLCounterOn[nCounter] = 1; -} - -/*! \fn static inline void PA_VBLCounterPause(u8 nCounter) - \brief - \~english Pauses a given VBL counter - \~french Met en pause un compteur VBL donné - \~\param nCounter - \~english Counter number (0-15) - \~french Numéro du compteur (0-15) -*/ -static inline void PA_VBLCounterPause(u8 nCounter){ - PA_VBLCounterOn[nCounter] = 0; -} - -/*! \fn static inline void PA_VBLCounterUnpause(u8 nCounter) - \brief - \~english Unpauses a given VBL counter - \~french Refait tourner un compteur VBL donné - \~\param nCounter - \~english Counter number (0-15) - \~french Numéro du compteur (0-15) -*/ -static inline void PA_VBLCounterUnpause(u8 nCounter){ - PA_VBLCounterOn[nCounter] = 1; -} - -static inline void PA_VBLFunctionInit(funcpointer VBLFunc){ - CustomVBL = VBLFunc; -} - -void PA_Nothing(); - -static inline void PA_VBLFunctionReset(void){ - PA_VBLFunctionInit(PA_Nothing); -} - -/** @} */ // end of Interrupts - -#ifdef __cplusplus -} -#endif -#endif +#ifndef _PA_Interrupt +#define _PA_Interrupt + +#ifdef __cplusplus +extern "C" { +#endif + +/*! \file PA_Interrupt.h + \brief Interrupt system + + Mainly used for the VBlank system and the counters... +*/ + +typedef void (*funcpointer)(); + +extern funcpointer MotionVBL; +extern funcpointer GHPadVBL; +extern funcpointer PaddleVBL; + +extern s32 PA_VBLCounter[16]; // VBL counters +extern bool PA_VBLCounterOn[16]; // VBL counters enable/disable flag + +extern funcpointer CustomVBL; + +/*! \fn void PA_vblFunc() + \brief + \~english The standard PAlib VBL function. This will update the pad, the stylus, the RTC, etc... You could/should use this function if you do your own custom VBL. + \~french Fonction standard du VBL PAlib. Ceci met à jour le pad, le stylet, le RTC... Utilisez cette fonction si vous faites votre propre VBL. +*/ +void PA_vblFunc(); + +/*! \fn static inline void PA_InitVBL() + \deprecated + \brief + \~english [DEPRECATED] In previous PAlib versions this initialized the VBlank system, but it now does nothing since it's automatically done at PA_Init(). + \~french [DEPRECATED] Initialise une fonction VBL basique. Ca met à jour l'OAM (les sprites), les touches, et le stylet chaque frame. + +*/ +static inline void PA_InitVBL(){ + // This used to call this code, but it isn't needed anymore: + //irqSet(IRQ_VBLANK, PA_vblFunc); + //irqEnable(IRQ_VBLANK); +} + +/*! \def PA_GetVcount() + \brief + \~english Get the vertical line count... + \~french Récupérer le numéro de ligne tracée +*/ +#define PA_GetVcount() (REG_VCOUNT&511) + +/*! \fn void PA_VBLCountersReset() + \brief + \~english Resets the VBL counters + \~french Remet à 0 les compteurs VBL +*/ +void PA_VBLCountersReset(); + +/*! \fn static inline void PA_VBLCounterStart(u8 nCounter) + \brief + \~english Resets a given counter and starts running + \~french Remet à 0 un compteur donné et le démarre + \~\param nCounter + \~english Counter number (0-15) + \~french Numéro du compteur (0-15) +*/ +static inline void PA_VBLCounterStart(u8 nCounter){ + PA_VBLCounter[nCounter] = 0; + PA_VBLCounterOn[nCounter] = 1; +} + +/*! \fn static inline void PA_VBLCounterPause(u8 nCounter) + \brief + \~english Pauses a given VBL counter + \~french Met en pause un compteur VBL donné + \~\param nCounter + \~english Counter number (0-15) + \~french Numéro du compteur (0-15) +*/ +static inline void PA_VBLCounterPause(u8 nCounter){ + PA_VBLCounterOn[nCounter] = 0; +} + +/*! \fn static inline void PA_VBLCounterUnpause(u8 nCounter) + \brief + \~english Unpauses a given VBL counter + \~french Refait tourner un compteur VBL donné + \~\param nCounter + \~english Counter number (0-15) + \~french Numéro du compteur (0-15) +*/ +static inline void PA_VBLCounterUnpause(u8 nCounter){ + PA_VBLCounterOn[nCounter] = 1; +} + +static inline void PA_VBLFunctionInit(funcpointer VBLFunc){ + CustomVBL = VBLFunc; +} + +void PA_Nothing(); + +static inline void PA_VBLFunctionReset(void){ + PA_VBLFunctionInit(PA_Nothing); +} + +/** @} */ // end of Interrupts + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/arm9/PA_Keyboard.h b/include/arm9/PA_Keyboard.h index 33bbd95..4fcb90e 100644 --- a/include/arm9/PA_Keyboard.h +++ b/include/arm9/PA_Keyboard.h @@ -1,237 +1,237 @@ -#ifndef _PA_Keyboard -#define _PA_Keyboard - -#ifdef __cplusplus -extern "C" { -#endif - -#include "PA9.h" - -extern u8 keyb_screen; - -/*! \file PA_Keyboard.h - \brief Keyboard functions - - This will allow you to show a keyboard, use it, etc... -*/ - -void PA_SetLetterPal(s16 x, s16 y, u8 Pal); - -extern const unsigned char keyboard_Tiles[10400]; -extern const unsigned short keyboard_Map[4096]; - -typedef struct { - u8 Bg; // Numéro du fond - u8 Type; // 0 pour normal, 1 pour majuscules.. - char Letter; // Lettre - s16 ScrollX, ScrollY; // Scroll x et y... - s16 Repeat; // Temps avant de répéter... - s16 oldX, oldY; // Ancienne zone touchée - u8 Color1, Color2; // Main color, pressed color... - u8 Custom; // using custom graphics -} Keyboards; -extern Keyboards PA_Keyboard_Struct; - -extern const u8 PA_Keyboard[2][5][24]; - -/** @defgroup Keyboard Keyboard - * Load a keyboard and have fun - * @{ - */ - -/// Old name for PA_LoadDefaultKeyboard(). -#define PA_InitKeyboard PA_LoadDefaultKeyboard - -/*! - \fn void PA_LoadDefaultKeyboard(u8 bg_number) - \brief - \~english Initialise the default Keyboard on a given background. Uses 16 color palettes 14 and 15 (doesn't mix with text though, don't worry) - \~french Initialiser le calvier sur un fond donné. Utilise les palettes de 16 couleurs 14 et 15 (n'interfère pas avec le texte) - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) -*/ -void PA_LoadDefaultKeyboard(u8 bg_number); - -/*! - \def PA_InitCustomKeyboard(bg_number, keyb_custom) - \deprecated - \brief - \~english [DEPRECATED] Initialise a custom Keyboard on a given background. - \~french [DEPRECATED] Initialiser un clavier perso sur un fond donné - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param keyb_custom - \~english Custom Keyboard name, converted as EasyBg - \~french Claviet perso, converti comme EasyBg -*/ -#define PA_InitCustomKeyboard(bg_number, keyb_custom) do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadBgPal(keyb_screen, bg_number, (void*)keyb_custom##_Pal);\ - PA_LoadSimpleBg(keyb_screen, bg_number, keyb_custom##_Tiles, keyb_custom##_Map, BG_256X512, 1, 1);\ - PA_Keyboard_Struct.Bg = bg_number; PA_Keyboard_Struct.Type = 0; PA_Keyboard_Struct.Repeat = 0;\ - PA_Keyboard_Struct.Custom = 1;\ - PA_BgInfo[keyb_screen][PA_Keyboard_Struct.Bg].Map = (u32)keyb_custom##_Map;\ -}while(0) - -/*! - \fn void PA_LoadKeyboard(u8 bg_number, const PA_BgStruct* keyboard) - \brief - \~english Load a custom Keyboard on a given background. - \~french Initialiser un clavier perso sur un fond donné - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param keyboard - \~english Pointer to the keyboard background, converted as EasyBg - \~french Pointeur vers le fond du claviet perso, converti comme EasyBg -*/ -void PA_LoadKeyboard(u8 bg_number, const PA_BgStruct* keyboard); - -/*! - \fn char PA_CheckKeyboard(void) - \brief - \~english Checks if the keyboard is used, and return the letter :) Use this every turn (even if the stylus isn't pressed) - \~french Vérifie le clavier, s'il est utilisé, et renvoie la lettre appuyée (0 si pas de nouvel appuye). A utiliser tout le temps, même si le stylet ne touche pas l'écran -*/ -char PA_CheckKeyboard(void); - -/*! - \fn static inline void PA_ScrollKeyboardX(s16 x) - \brief - \~english Set the Keyboard's X position - \~french Placer le Clavier à la position X - \~\param x - \~english X position... - \~french Position X -*/ -static inline void PA_ScrollKeyboardX(s16 x) { - PA_BGScrollX(keyb_screen, PA_Keyboard_Struct.Bg, -x); - PA_Keyboard_Struct.ScrollX = x; -} - -/*! - \fn static inline void PA_ScrollKeyboardY(s16 y) - \brief - \~english Set the Keyboard's Y position - \~french Placer le Clavier à la position Y - \~\param y - \~english Y position... - \~french Position Y -*/ -static inline void PA_ScrollKeyboardY(s16 y) { - PA_BGScrollY(keyb_screen, PA_Keyboard_Struct.Bg, -y); - PA_Keyboard_Struct.ScrollY = y; -} - -/*! - \fn static inline void PA_ScrollKeyboardXY(s16 x, s16 y) - \brief - \~english Set the Keyboard's position - \~french Placer le Clavier à une position donnée - \~\param x - \~english X position... - \~french Position X - \~\param y - \~english Y position... - \~french Position Y -*/ -static inline void PA_ScrollKeyboardXY(s16 x, s16 y) { - PA_BGScrollXY(keyb_screen, PA_Keyboard_Struct.Bg, -x, -y); - PA_Keyboard_Struct.ScrollX = x; - PA_Keyboard_Struct.ScrollY = y; -} - -/*! - \def PA_EraseLastKey() - \brief - \~english Erase the last key lit up (if it didn't on it's own) - \~french Effacer la dernière touche pressée, si ca ne le fait pas tout seul -*/ -#define PA_EraseLastKey() PA_SetLetterPal(PA_Keyboard_Struct.oldX, PA_Keyboard_Struct.oldY, 15) - -/*! - \fn static inline void PA_KeyboardIn(s16 x, s16 y) - \brief - \~english Make the keyboard enter to position (x, y), scrolling from the bottom of the screen - \~french Faire entrer le clavier à la position (x, y) en glissant depuis le bas de l'écran - \~\param x - \~english X position... - \~french Position X - \~\param y - \~english Y position... - \~french Position Y -*/ -static inline void PA_KeyboardIn(s16 x, s16 y){ // Faire rentrer le clavier... - int i; - PA_ScrollKeyboardXY(x, 192); // On le sort et met en X. Puis on fait glisser... - for (i = 192; i > y; i-=8){ - PA_ScrollKeyboardY(i); - PA_WaitForVBL(); - } - PA_ScrollKeyboardY(y); // On amène pile au bon y... -} - -/*! - \fn static inline void PA_KeyboardOut(void) - \brief - \~english Make the keyboard scroll out - \~french Faire sortir le clavier -*/ -static inline void PA_KeyboardOut(void){ // Faire sortir le clavier... - int i; - PA_EraseLastKey(); // Efface s'il reste une touche pressée... - for (i = PA_Keyboard_Struct.ScrollY; i < 200; i+=8){ - PA_ScrollKeyboardY(i); - PA_WaitForVBL(); - } -} - -/*! - \fn void PA_ReloadKeyboardCol(void) - \brief - \~english Reloads the keyboard's palette, usefull if you changed the background palette - \~french Recharge la palette du clavier, utile si on a changé de palette pour les fonds -*/ -void PA_ReloadKeyboardCol(void); - - -/*! - \fn static inline void PA_SetKeyboardColor(u8 color1, u8 color2) - \brief - \~english You can change the color used by the keyboard... - \~french On peut changer la couleur du clavier ! - \~\param color1 - \~english Normal color, 0 for blue, 1 for red, 2 for green - \~french Couleur normale, 0 pour bleu, 1 pour rouge, 2 pour vert - \~\param color2 - \~english Pressed key color, 0 for blue, 1 for red, 2 for green - \~french Couleur de la touche appuyée, 0 pour bleu, 1 pour rouge, 2 pour vert -*/ -static inline void PA_SetKeyboardColor(u8 color1, u8 color2){ - PA_Keyboard_Struct.Color1 = color1; - PA_Keyboard_Struct.Color2 = color2; - PA_ReloadKeyboardCol(); -} - -/*! - \fn static inline void PA_SetKeyboardScreen(u8 screen) - \brief - \~english Set Keyboard screen. Must be used BEFORE the keyboard init.. - \~french Régler l'écran du clavier. Doit être utilisé AVANT l'init du clavier - \~\param screen - \~english 0 (bottom) or 1 (top) - \~french 0 (bas) or 1 (haut) -*/ -static inline void PA_SetKeyboardScreen(u8 screen){ - keyb_screen = screen; // Top screen -} - -/** @} */ // end of Keyboard - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_Keyboard +#define _PA_Keyboard + +#ifdef __cplusplus +extern "C" { +#endif + +#include "PA9.h" + +extern u8 keyb_screen; + +/*! \file PA_Keyboard.h + \brief Keyboard functions + + This will allow you to show a keyboard, use it, etc... +*/ + +void PA_SetLetterPal(s16 x, s16 y, u8 Pal); + +extern const unsigned char keyboard_Tiles[10400]; +extern const unsigned short keyboard_Map[4096]; + +typedef struct { + u8 Bg; // Numéro du fond + u8 Type; // 0 pour normal, 1 pour majuscules.. + char Letter; // Lettre + s16 ScrollX, ScrollY; // Scroll x et y... + s16 Repeat; // Temps avant de répéter... + s16 oldX, oldY; // Ancienne zone touchée + u8 Color1, Color2; // Main color, pressed color... + u8 Custom; // using custom graphics +} Keyboards; +extern Keyboards PA_Keyboard_Struct; + +extern const u8 PA_Keyboard[2][5][24]; + +/** @defgroup Keyboard Keyboard + * Load a keyboard and have fun + * @{ + */ + +/// Old name for PA_LoadDefaultKeyboard(). +#define PA_InitKeyboard PA_LoadDefaultKeyboard + +/*! + \fn void PA_LoadDefaultKeyboard(u8 bg_number) + \brief + \~english Initialise the default Keyboard on a given background. Uses 16 color palettes 14 and 15 (doesn't mix with text though, don't worry) + \~french Initialiser le calvier sur un fond donné. Utilise les palettes de 16 couleurs 14 et 15 (n'interfère pas avec le texte) + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) +*/ +void PA_LoadDefaultKeyboard(u8 bg_number); + +/*! + \def PA_InitCustomKeyboard(bg_number, keyb_custom) + \deprecated + \brief + \~english [DEPRECATED] Initialise a custom Keyboard on a given background. + \~french [DEPRECATED] Initialiser un clavier perso sur un fond donné + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param keyb_custom + \~english Custom Keyboard name, converted as EasyBg + \~french Claviet perso, converti comme EasyBg +*/ +#define PA_InitCustomKeyboard(bg_number, keyb_custom) do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadBgPal(keyb_screen, bg_number, (void*)keyb_custom##_Pal);\ + PA_LoadSimpleBg(keyb_screen, bg_number, keyb_custom##_Tiles, keyb_custom##_Map, BG_256X512, 1, 1);\ + PA_Keyboard_Struct.Bg = bg_number; PA_Keyboard_Struct.Type = 0; PA_Keyboard_Struct.Repeat = 0;\ + PA_Keyboard_Struct.Custom = 1;\ + PA_BgInfo[keyb_screen][PA_Keyboard_Struct.Bg].Map = (u32)keyb_custom##_Map;\ +}while(0) + +/*! + \fn void PA_LoadKeyboard(u8 bg_number, const PA_BgStruct* keyboard) + \brief + \~english Load a custom Keyboard on a given background. + \~french Initialiser un clavier perso sur un fond donné + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param keyboard + \~english Pointer to the keyboard background, converted as EasyBg + \~french Pointeur vers le fond du claviet perso, converti comme EasyBg +*/ +void PA_LoadKeyboard(u8 bg_number, const PA_BgStruct* keyboard); + +/*! + \fn char PA_CheckKeyboard(void) + \brief + \~english Checks if the keyboard is used, and return the letter :) Use this every turn (even if the stylus isn't pressed) + \~french Vérifie le clavier, s'il est utilisé, et renvoie la lettre appuyée (0 si pas de nouvel appuye). A utiliser tout le temps, même si le stylet ne touche pas l'écran +*/ +char PA_CheckKeyboard(void); + +/*! + \fn static inline void PA_ScrollKeyboardX(s16 x) + \brief + \~english Set the Keyboard's X position + \~french Placer le Clavier à la position X + \~\param x + \~english X position... + \~french Position X +*/ +static inline void PA_ScrollKeyboardX(s16 x) { + PA_BGScrollX(keyb_screen, PA_Keyboard_Struct.Bg, -x); + PA_Keyboard_Struct.ScrollX = x; +} + +/*! + \fn static inline void PA_ScrollKeyboardY(s16 y) + \brief + \~english Set the Keyboard's Y position + \~french Placer le Clavier à la position Y + \~\param y + \~english Y position... + \~french Position Y +*/ +static inline void PA_ScrollKeyboardY(s16 y) { + PA_BGScrollY(keyb_screen, PA_Keyboard_Struct.Bg, -y); + PA_Keyboard_Struct.ScrollY = y; +} + +/*! + \fn static inline void PA_ScrollKeyboardXY(s16 x, s16 y) + \brief + \~english Set the Keyboard's position + \~french Placer le Clavier à une position donnée + \~\param x + \~english X position... + \~french Position X + \~\param y + \~english Y position... + \~french Position Y +*/ +static inline void PA_ScrollKeyboardXY(s16 x, s16 y) { + PA_BGScrollXY(keyb_screen, PA_Keyboard_Struct.Bg, -x, -y); + PA_Keyboard_Struct.ScrollX = x; + PA_Keyboard_Struct.ScrollY = y; +} + +/*! + \def PA_EraseLastKey() + \brief + \~english Erase the last key lit up (if it didn't on it's own) + \~french Effacer la dernière touche pressée, si ca ne le fait pas tout seul +*/ +#define PA_EraseLastKey() PA_SetLetterPal(PA_Keyboard_Struct.oldX, PA_Keyboard_Struct.oldY, 15) + +/*! + \fn static inline void PA_KeyboardIn(s16 x, s16 y) + \brief + \~english Make the keyboard enter to position (x, y), scrolling from the bottom of the screen + \~french Faire entrer le clavier à la position (x, y) en glissant depuis le bas de l'écran + \~\param x + \~english X position... + \~french Position X + \~\param y + \~english Y position... + \~french Position Y +*/ +static inline void PA_KeyboardIn(s16 x, s16 y){ // Faire rentrer le clavier... + int i; + PA_ScrollKeyboardXY(x, 192); // On le sort et met en X. Puis on fait glisser... + for (i = 192; i > y; i-=8){ + PA_ScrollKeyboardY(i); + PA_WaitForVBL(); + } + PA_ScrollKeyboardY(y); // On amène pile au bon y... +} + +/*! + \fn static inline void PA_KeyboardOut(void) + \brief + \~english Make the keyboard scroll out + \~french Faire sortir le clavier +*/ +static inline void PA_KeyboardOut(void){ // Faire sortir le clavier... + int i; + PA_EraseLastKey(); // Efface s'il reste une touche pressée... + for (i = PA_Keyboard_Struct.ScrollY; i < 200; i+=8){ + PA_ScrollKeyboardY(i); + PA_WaitForVBL(); + } +} + +/*! + \fn void PA_ReloadKeyboardCol(void) + \brief + \~english Reloads the keyboard's palette, usefull if you changed the background palette + \~french Recharge la palette du clavier, utile si on a changé de palette pour les fonds +*/ +void PA_ReloadKeyboardCol(void); + + +/*! + \fn static inline void PA_SetKeyboardColor(u8 color1, u8 color2) + \brief + \~english You can change the color used by the keyboard... + \~french On peut changer la couleur du clavier ! + \~\param color1 + \~english Normal color, 0 for blue, 1 for red, 2 for green + \~french Couleur normale, 0 pour bleu, 1 pour rouge, 2 pour vert + \~\param color2 + \~english Pressed key color, 0 for blue, 1 for red, 2 for green + \~french Couleur de la touche appuyée, 0 pour bleu, 1 pour rouge, 2 pour vert +*/ +static inline void PA_SetKeyboardColor(u8 color1, u8 color2){ + PA_Keyboard_Struct.Color1 = color1; + PA_Keyboard_Struct.Color2 = color2; + PA_ReloadKeyboardCol(); +} + +/*! + \fn static inline void PA_SetKeyboardScreen(u8 screen) + \brief + \~english Set Keyboard screen. Must be used BEFORE the keyboard init.. + \~french Régler l'écran du clavier. Doit être utilisé AVANT l'init du clavier + \~\param screen + \~english 0 (bottom) or 1 (top) + \~french 0 (bas) or 1 (haut) +*/ +static inline void PA_SetKeyboardScreen(u8 screen){ + keyb_screen = screen; // Top screen +} + +/** @} */ // end of Keyboard + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_Keys.h b/include/arm9/PA_Keys.h index 82bc27b..04fb63d 100644 --- a/include/arm9/PA_Keys.h +++ b/include/arm9/PA_Keys.h @@ -1,247 +1,247 @@ -#ifndef _PA_KEYS -#define _PA_KEYS - -#ifdef __cplusplus -extern "C" { -#endif - -#include "PA9.h" -/*! \file PA_Keys.h - \brief Everything concerning the keys and stylus - - Update the keys and stylus inputs -*/ -////////////////////////////////////////////////////////////////////// -// Système pour les touches -////////////////////////////////////////////////////////////////////// - -// Keyboard defines -#define PA_BACKSPACE 1 // On va dire que la touche backspace a pour valeur 1... -#define PA_CAPS 2 // 2 pour CAPS -#define PA_ENTER '\n' // 3 pour Enter -#define PA_SHIFT 4 // etc -#define PA_RIEN 0 // Si y'a rien, faudra faire comme si on appuye sur rien -#define PA_TAB 3 // tab... - -// Stylus and Pad definitions, will be used by the arm7 to auto-update positions... - -typedef struct { - u8 A, B, X, Y, L, R, Up, Down, Right, Left, Start, Select, Anykey; -} PA_Pad; - -typedef struct { - PA_Pad Held, Released, Newpress; // Pressed si on appuye, Held si on garde appuyé, et Released si on relache -} Pads; - -typedef struct { - u8 Held, Released, Newpress, Newpress0; - s16 X, Y, altX, altY, Pressure, Vx, Vy, oldVx, oldVy, Downtime, Uptime, DblClick; -} PA_Stylus; - -extern vu8 _PA_LidDown; -extern PA_Stylus Stylus; - -extern Pads Pad; -extern PA_Pad* PadPointer; - -// Structure pour les sprites que l'on déplace... -typedef struct { - u8 Moving; - u8 Sprite; - s16 X, Y, Vx, Vy, NextVx, NextVy; - u8 Time; // Si trop longtemps sans bouger le sprite, il décroche... -} PA_movingsprite; - -extern PA_movingsprite PA_MovedSprite; - -extern u8 PA_MoveSpriteType; - -/** @defgroup Keys Key input system - * Check which keys are pressed... - * @{ - */ - -/*! \fn void PA_UpdatePad() - \brief - \~english Update the Keypad, use it once per frame (in the VBL for example). You can then retrieve the held down keys with Pad.Held.A (or Up, Down...), Newly pressed keys with Pad.Newpress.R, and the just released keys with Pad.Released.Up... - \~french Permet de mettre à jour les touches appuyées. A utilisé une fois par frame (genre dans le vbl). On a ensuite accès aux touches pressées avec Pad.Held.A (ou Up, Down, L...), aux touches nouvellement pressées avec Pad.Newpress.R, et aux touches tout juste relachées avec Pad.Released.Up... - -*/ -void PA_UpdatePad(); - -/*! \fn void PA_UpdateStylus() - \brief - \~english Update the Stylus position. You can then check if the stylus is current in use (Stylus.Held), newly pressed (Stylus.Newpress), or released (Stylus.Released), and get it's position (Stylus.X, Stylus.Y). - \~french Mettre à jour la position du stylet. On peut vérifier si le stylet est actuellement sur l'écran (Stylus.Held), tout just appuyé (Stylus.Newpress), ou relaché (Stylus.Released), et obtenir sa position (Stylus.X, Stylus.Y). - -*/ -void PA_UpdateStylus(); - -/*! \fn u8 PA_MoveSpritePix(u8 sprite) - \brief - \~english Move a sprite according to the stylus's position, only if you touch a sprite's pixel. This is similar to PA_MoveSprite, but slightly slower and requires PA_InitSpriteDraw(screen, sprite) before. The sprite will be 'hooked' if the stylus passes over it, and then they'll be linked together. Returns 1 if the sprite is moved. You can also get information from PA_MovedSprite.Moving (1 if you are moving a sprite), .Sprite (sprite moved), .X (X position of the top left corner of the sprite), .Y (Y position of the top left corner of the sprite), .Vx (horizontal speed ! useful if you want to make the sprite continue to move when you release the stylus...), and .Vy - \~french Déplacer un sprite en fonction du stylet, avec détection au pixel pret. Ceci est comme PA_MoveSprite, mais un peu plus lent, et nécessite PA_InitSpriteDraw(screen, sprite). Le sprite sera accroché si le stylet passe aud-dessus, puis il sera déplacé en fonction... Donne 1 si on a déplacé ce sprite, sinon 0. On peut ensuite récupérer des infos avec PA_MovedSprite.Moving (1 si on déplace un sprite), .Sprite (numéro du sprite déplacé), .X (position X du coin sup gauche du sprite), .Y (position Y du point sup gauche du sprite déplacé), .Vx (vitesse horizontale du sprite déplacé !! Utile si l'on veut que le sprite continue à se déplacer par la suite...), et .Vy - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -u8 PA_MoveSpritePix(u8 sprite); - -/*! \def PA_MoveSprite(sprite) - \brief - \~english Move a sprite according to the stylus's position. The sprite will be 'hooked' if the stylus passes over it, and then they'll be linked together. Returns 1 if the sprite is moved. You can also get information from PA_MovedSprite.Moving (1 if you are moving a sprite), .Sprite (sprite moved), .X (X position of the center of the sprite), .Y (Y position of the center of the sprite), .Vx (horizontal speed ! useful if you want to make the sprite continue to move when you release the stylus...), and .Vy - \~french Déplacer un sprite en fonction du stylet. Le sprite sera accroché si le stylet passe aud-dessus, puis il sera déplacé en fonction... Donne 1 si on a déplacé ce sprite, sinon 0. On peut ensuite récupérer des infos avec PA_MovedSprite.Moving (1 si on déplace un sprite), .Sprite (numéro du sprite déplacé), .X (position X du centre du sprite), .Y (position Y du centre du sprite déplacé), .Vx (vitesse horizontale du sprite déplacé !! Utile si l'on veut que le sprite continue à se déplacer par la suite...), et .Vy - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_MoveSprite(sprite) PA_MoveSpriteEx(PA_Screen, sprite, PA_GetSpriteLx(0, sprite), PA_GetSpriteLy(0, sprite)) - -/*! \fn u8 PA_MoveSpriteEx(u8 screen, u8 sprite, u8 lx, u8 ly) - \brief - \~english Move a sprite according to the stylus's position. See PA_MoveSprite for more details... The difference is that here you chose the sprite dimension (lx and ly), which is useful if the sprite is smaller than the DS standard sizes... (for example 20x20...). This will also limit the 'hooking' distance - \~french Déplacer un sprite en fonction du stylet. Voir PA_MoveSprite pour plus de détails. La différence est qu'ici on précise la largeur et la hauteur du sprite, utile si le sprite ne fait pas vraiment la meme taille que la taille standard DS (genre si c'est un sprite de 20x20). Ceci limitera donc aussi la distance d'accrochage - \~\param screen - \~english On what screen to do it - \~french Sur quel écran le faire... - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param lx - \~english Sprite length - \~french Largeur du sprite - \~\param ly - \~english Sprite height - \~french Hauteur du sprite -*/ -u8 PA_MoveSpriteEx(u8 screen, u8 sprite, u8 lx, u8 ly); - -/*! \fn u8 PA_MoveSpriteDistance(u8 sprite, u8 distance) - \brief - \~english Move a sprite according to the stylus's position. See PA_MoveSprite for more details... The difference is that here you chose the hooking distance in pixels - \~french Déplacer un sprite en fonction du stylet. Voir PA_MoveSprite pour plus de détails. La différence est qu'ici on précise la distance d'accrochage, en pixels - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param distance - \~english Hooking distance - \~french Distance d'accrochage -*/ -static inline u8 PA_MoveSpriteDistance(u8 sprite, u8 distance){ - PA_MoveSpriteType = 1; // mode distance - u8 touched = PA_MoveSpriteEx(PA_Screen, sprite, distance, distance); - PA_MoveSpriteType = 0; // normal mode - return touched; -} - -/*! \fn static inline u8 PA_SpriteStylusOverEx(u8 sprite, u8 lx, u8 ly) - \brief - \~english Check if the stylus position is over a given sprite (stylus pressed or not) - \~french Vérifie si le stylet est placé au-dessus d'un sprite donné (que le stylet touche l'écran ou non) - \~\param sprite - \~english Sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param lx - \~english Wideness - \~french Largeur - \~\param ly - \~english Height - \~french Hauter - -*/ -static inline u8 PA_SpriteStylusOverEx(u8 sprite, u8 lx, u8 ly){ - s16 x = PA_GetSpriteX(PA_Screen, sprite); if(x > 256) x-= 512; - s16 y = PA_GetSpriteY(PA_Screen, sprite); if(y > 192) y-= 256; - return ((Stylus.X > x) && (Stylus.X < x + lx)&& (Stylus.Y > y) && (Stylus.Y < y + ly)); -} - -/*! \fn static inline u8 PA_SpriteTouchedEx(u8 sprite, u8 lx, u8 ly) - \brief - \~english Check if a given sprite is touched. Returns 1 if touched... You can chose the width and height around the sprite - \~french Vérifie si l'on touche un sprite donné. Renvoie 1 si touché... On peut choisir la hauteur et la largeur autour du sprite - \~\param sprite - \~english Sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param lx - \~english Wideness - \~french Largeur - \~\param ly - \~english Height - \~french Hauter - -*/ -static inline u8 PA_SpriteTouchedEx(u8 sprite, u8 lx, u8 ly){ - return (Stylus.Held && PA_SpriteStylusOverEx(sprite, lx, ly)); -} - -/*! \fn static inline u8 PA_SpriteTouched(u8 sprite) - \brief - \~english Check if a given sprite is touched. Returns 1 if touched... - \~french Vérifie si l'on touche un sprite donné. Renvoie 1 si touché... - \~\param sprite - \~english Sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline u8 PA_SpriteTouched(u8 sprite) { - return PA_SpriteTouchedEx(sprite, PA_GetSpriteLx(PA_Screen, sprite), PA_GetSpriteLy(PA_Screen, sprite)); -} - -/*! \fn static inline u8 PA_SpriteStylusOver(u8 sprite) - \brief - \~english Check if the stylus position is over a given sprite (stylus pressed or not) - \~french Vérifie si le stylet est placé au-dessus d'un sprite donné (que le stylet touche l'écran ou non) - \~\param sprite - \~english Sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline u8 PA_SpriteStylusOver(u8 sprite) { - return PA_SpriteStylusOverEx(sprite, PA_GetSpriteLx(PA_Screen, sprite), PA_GetSpriteLy(PA_Screen, sprite)); -} - -static inline u8 PA_SpriteTouchedPix(u8 sprite){ - s16 spritex = PA_GetSpriteX(PA_Screen, sprite); - s16 spritey = PA_GetSpriteY(PA_Screen, sprite); - if (spritex >= 458) spritex -=511; // normalize the X coordinate... - if (spritey >= 220) spritey -=256; // normalize the y coordinate... - u16 x = Stylus.X - spritex; - u16 y = Stylus.Y - spritey; - - return (Stylus.Held && (x < spriteanims[PA_Screen][sprite].lx) && (y < spriteanims[PA_Screen][sprite].ly) && PA_GetSpritePixel(PA_Screen, sprite, x, y)); -} - -static inline u8 PA_Sprite16cTouchedPix(u8 sprite){ - s16 spritex = PA_GetSpriteX(PA_Screen, sprite); - s16 spritey = PA_GetSpriteY(PA_Screen, sprite); - if (spritex >= 458) spritex -=511; // normalize the X coordinate... - if (spritey >= 220) spritey -=256; // normalize the y coordinate... - u16 x = Stylus.X - spritex; - u16 y = Stylus.Y - spritey; - - return (Stylus.Held && (x < spriteanims[PA_Screen][sprite].lx) && (y < spriteanims[PA_Screen][sprite].ly) && PA_GetSprite16cPixel(PA_Screen, sprite, x, y)); -} - -/*! \def PA_StylusInZone(x1, y1, x2, y2) - \brief - \~english Check if the stylus is in a given zone... Returns 1 if yes, 0 if not - \~french Vérifie si le stylet est dans une zone délimitée donnée... Renvoie 1 si oui, 0 sinon - \~\param x1 - \~english X value of the upper left corner - \~french Valeur X du coin supérieur gauche - \~\param y1 - \~english Y value of the upper left corner - \~french Valeur Y du coin supérieur gauche - \~\param x2 - \~english X value of the lower right corner - \~french Valeur X du coin inférieur droit - \~\param y2 - \~english Y value of the lower right corner - \~french Valeur Y du coin inférieur droit -*/ -#define PA_StylusInZone(x1, y1, x2, y2) ((Stylus.X>=x1)&&(Stylus.Y>=y1)&&(Stylus.X 256) x-= 512; + s16 y = PA_GetSpriteY(PA_Screen, sprite); if(y > 192) y-= 256; + return ((Stylus.X > x) && (Stylus.X < x + lx)&& (Stylus.Y > y) && (Stylus.Y < y + ly)); +} + +/*! \fn static inline u8 PA_SpriteTouchedEx(u8 sprite, u8 lx, u8 ly) + \brief + \~english Check if a given sprite is touched. Returns 1 if touched... You can chose the width and height around the sprite + \~french Vérifie si l'on touche un sprite donné. Renvoie 1 si touché... On peut choisir la hauteur et la largeur autour du sprite + \~\param sprite + \~english Sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param lx + \~english Wideness + \~french Largeur + \~\param ly + \~english Height + \~french Hauter + +*/ +static inline u8 PA_SpriteTouchedEx(u8 sprite, u8 lx, u8 ly){ + return (Stylus.Held && PA_SpriteStylusOverEx(sprite, lx, ly)); +} + +/*! \fn static inline u8 PA_SpriteTouched(u8 sprite) + \brief + \~english Check if a given sprite is touched. Returns 1 if touched... + \~french Vérifie si l'on touche un sprite donné. Renvoie 1 si touché... + \~\param sprite + \~english Sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline u8 PA_SpriteTouched(u8 sprite) { + return PA_SpriteTouchedEx(sprite, PA_GetSpriteLx(PA_Screen, sprite), PA_GetSpriteLy(PA_Screen, sprite)); +} + +/*! \fn static inline u8 PA_SpriteStylusOver(u8 sprite) + \brief + \~english Check if the stylus position is over a given sprite (stylus pressed or not) + \~french Vérifie si le stylet est placé au-dessus d'un sprite donné (que le stylet touche l'écran ou non) + \~\param sprite + \~english Sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline u8 PA_SpriteStylusOver(u8 sprite) { + return PA_SpriteStylusOverEx(sprite, PA_GetSpriteLx(PA_Screen, sprite), PA_GetSpriteLy(PA_Screen, sprite)); +} + +static inline u8 PA_SpriteTouchedPix(u8 sprite){ + s16 spritex = PA_GetSpriteX(PA_Screen, sprite); + s16 spritey = PA_GetSpriteY(PA_Screen, sprite); + if (spritex >= 458) spritex -=511; // normalize the X coordinate... + if (spritey >= 220) spritey -=256; // normalize the y coordinate... + u16 x = Stylus.X - spritex; + u16 y = Stylus.Y - spritey; + + return (Stylus.Held && (x < spriteanims[PA_Screen][sprite].lx) && (y < spriteanims[PA_Screen][sprite].ly) && PA_GetSpritePixel(PA_Screen, sprite, x, y)); +} + +static inline u8 PA_Sprite16cTouchedPix(u8 sprite){ + s16 spritex = PA_GetSpriteX(PA_Screen, sprite); + s16 spritey = PA_GetSpriteY(PA_Screen, sprite); + if (spritex >= 458) spritex -=511; // normalize the X coordinate... + if (spritey >= 220) spritey -=256; // normalize the y coordinate... + u16 x = Stylus.X - spritex; + u16 y = Stylus.Y - spritey; + + return (Stylus.Held && (x < spriteanims[PA_Screen][sprite].lx) && (y < spriteanims[PA_Screen][sprite].ly) && PA_GetSprite16cPixel(PA_Screen, sprite, x, y)); +} + +/*! \def PA_StylusInZone(x1, y1, x2, y2) + \brief + \~english Check if the stylus is in a given zone... Returns 1 if yes, 0 if not + \~french Vérifie si le stylet est dans une zone délimitée donnée... Renvoie 1 si oui, 0 sinon + \~\param x1 + \~english X value of the upper left corner + \~french Valeur X du coin supérieur gauche + \~\param y1 + \~english Y value of the upper left corner + \~french Valeur Y du coin supérieur gauche + \~\param x2 + \~english X value of the lower right corner + \~french Valeur X du coin inférieur droit + \~\param y2 + \~english Y value of the lower right corner + \~french Valeur Y du coin inférieur droit +*/ +#define PA_StylusInZone(x1, y1, x2, y2) ((Stylus.X>=x1)&&(Stylus.Y>=y1)&&(Stylus.X>6;\ - type.Red = (pad & BUTTON_RED) >> 5;\ - type.Yellow = (pad & BUTTON_YELLOW) >> 4;\ - type.Blue = (pad & BUTTON_BLUE) >> 3;\ - type.Anykey = (!(!((pad&120))));}while(0) - -typedef struct { - u8 Green, Red, Yellow, Blue, Anykey; -} GH_Buttons; - -typedef struct { - GH_Buttons Held, Released, Newpress; // Pressed si on appuye, Held si on garde appuyé, et Released si on relache -} GH_Pad; -extern GH_Pad GHPad; - -extern u16 GHCompletePad, GHExPad, GHTempPad; - - -/*! \fn bool PA_DetectGHPad() - \brief - \~english Check to see if there's a Guitar Hero pad inserted in slot-2. Returns 1 if there is or 0 if there isn't. - \~french -*/ -bool PA_DetectGHPad(); - -/*! \fn bool PA_InitGHPad() - \brief - \~english Set up the Guitar Hero pad for use. Returns a 1 if initialization was successful, or a 0 if it wasn't. - \~french -*/ -bool PA_InitGHPad(); - -/*! \fn void PA_DeInitGHPad() - \brief - \~english De-initialize the Guitar Hero pad. It's recommended to call this when you won't be using the GH pad anymore. - \~french -*/ -void PA_DeInitGHPad(); - -/*! \fn void PA_UpdateGHPad() - \brief - \~english Update the values of GHPad. But NOTE: you won't need it if you used PA_InitGHPad as it's done automatically every Vblank. - \~french -*/ -void PA_UpdateGHPad(); - -#define PADDLE_LOW (*(vuint8*)0x0A000000) -#define PADDLE_HIGH (*(vuint8*)0x0A000001) - -typedef struct { - u16 Count, OldCount; - s16 Speed; - u8 Low, High, OldLow, OldHigh; -} PaddleInfo; -extern PaddleInfo Paddle; - -/*! \fn bool PA_DetectPaddle() - \brief - \~english Check to see if there's a Taito Paddle inserted in slot-2. Return 1 if there is or 0 if there isn't. - \~french -*/ -bool PA_DetectPaddle(); - -/*! \fn bool PA_InitPaddle() - \brief - \~english Set up the Taito Paddle for use. Returns a 1 if initialization was successful, or a 0 if it wasn't. - \~french -*/ -bool PA_InitPaddle(); - -/*! \fn void PA_DeInitPaddle() - \brief - \~english De-initialize the Taito Paddle. It's recommended to call this when you won't be using the paddle anymore. - \~french -*/ -void PA_DeInitPaddle(); - -/*! \fn void PA_UpdatePaddle() - \brief - \~english Update the values of Paddle. But NOTE: you won't need it if you used PA_InitPaddle as it's done automatically every Vblank. - \~french -*/ -void PA_UpdatePaddle(); - -/** @} */ // end of Fat Loading group - -#ifdef __cplusplus -} -#endif -#endif +#ifndef _GH_KEYS +#define _GH_KEYS + +#ifdef __cplusplus +extern "C" { +#endif + +#include "PA9.h" + +/*! \file PA_KeysSpecial.h + \brief Support for special DS controllers + + Macros, variables, and prototypes needed for DS controller accessory (Guitar Hero Grip, Taito Paddle, ...) support. +*/ + +/** @defgroup KeysSpecial Special controllers + * Macros, variables, and prototypes needed for DS controller accessory (Guitar Hero Grip, Taito Paddle, ...) support. + + * @{ + */ + +#define GH_POLL (*(vuint8*)0x0A000000) +#define BUTTON_BLUE 8 +#define BUTTON_YELLOW 16 +#define BUTTON_RED 32 +#define BUTTON_GREEN 64 + +#define UPDATEGHPAD(type, pad) do{type.Green = (pad & BUTTON_GREEN)>>6;\ + type.Red = (pad & BUTTON_RED) >> 5;\ + type.Yellow = (pad & BUTTON_YELLOW) >> 4;\ + type.Blue = (pad & BUTTON_BLUE) >> 3;\ + type.Anykey = (!(!((pad&120))));}while(0) + +typedef struct { + u8 Green, Red, Yellow, Blue, Anykey; +} GH_Buttons; + +typedef struct { + GH_Buttons Held, Released, Newpress; // Pressed si on appuye, Held si on garde appuyé, et Released si on relache +} GH_Pad; +extern GH_Pad GHPad; + +extern u16 GHCompletePad, GHExPad, GHTempPad; + + +/*! \fn bool PA_DetectGHPad() + \brief + \~english Check to see if there's a Guitar Hero pad inserted in slot-2. Returns 1 if there is or 0 if there isn't. + \~french +*/ +bool PA_DetectGHPad(); + +/*! \fn bool PA_InitGHPad() + \brief + \~english Set up the Guitar Hero pad for use. Returns a 1 if initialization was successful, or a 0 if it wasn't. + \~french +*/ +bool PA_InitGHPad(); + +/*! \fn void PA_DeInitGHPad() + \brief + \~english De-initialize the Guitar Hero pad. It's recommended to call this when you won't be using the GH pad anymore. + \~french +*/ +void PA_DeInitGHPad(); + +/*! \fn void PA_UpdateGHPad() + \brief + \~english Update the values of GHPad. But NOTE: you won't need it if you used PA_InitGHPad as it's done automatically every Vblank. + \~french +*/ +void PA_UpdateGHPad(); + +#define PADDLE_LOW (*(vuint8*)0x0A000000) +#define PADDLE_HIGH (*(vuint8*)0x0A000001) + +typedef struct { + u16 Count, OldCount; + s16 Speed; + u8 Low, High, OldLow, OldHigh; +} PaddleInfo; +extern PaddleInfo Paddle; + +/*! \fn bool PA_DetectPaddle() + \brief + \~english Check to see if there's a Taito Paddle inserted in slot-2. Return 1 if there is or 0 if there isn't. + \~french +*/ +bool PA_DetectPaddle(); + +/*! \fn bool PA_InitPaddle() + \brief + \~english Set up the Taito Paddle for use. Returns a 1 if initialization was successful, or a 0 if it wasn't. + \~french +*/ +bool PA_InitPaddle(); + +/*! \fn void PA_DeInitPaddle() + \brief + \~english De-initialize the Taito Paddle. It's recommended to call this when you won't be using the paddle anymore. + \~french +*/ +void PA_DeInitPaddle(); + +/*! \fn void PA_UpdatePaddle() + \brief + \~english Update the values of Paddle. But NOTE: you won't need it if you used PA_InitPaddle as it's done automatically every Vblank. + \~french +*/ +void PA_UpdatePaddle(); + +/** @} */ // end of Fat Loading group + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/arm9/PA_Math.h b/include/arm9/PA_Math.h index 1b79529..904faa6 100644 --- a/include/arm9/PA_Math.h +++ b/include/arm9/PA_Math.h @@ -1,288 +1,288 @@ -#ifndef _PA_Math -#define _PA_Math - -#ifdef __cplusplus -extern "C" { -#endif - -#include "PA9.h" - -#include "PA_Interrupt.h" - - -/** @defgroup Math Math functions - * Adjust angles, get random values... - * @{ - */ - -/*! \def PA_Cos(angle) - \brief - \~english Returns the Cos value for an angle. The value goes from -256 to 256... Watch out though : the angle is not in 360 degrees, but in 512 ! - \~french Renvoie la valeur Cosinus d'un angle. Cette valeur est comprise entre -256 et 256... Attention : l'angle n'est pas en 360 degr?s, mais en 512 ! -*/ -#define PA_Cos(angle) PA_SIN[((angle) + 128)&511] - - -/*! \def PA_Sin(angle) - \brief - \~english Returns the Sin value for an angle. The value goes from -256 to 256... Watch out though : the angle is not in 360 degrees, but in 256 ! - \~french Renvoie la valeur Sinus d'un angle. Cette valeur est comprise entre -256 et 256... Attention : l'angle n'est pas en 360 degr?s, mais en 256 ! -*/ -#define PA_Sin(angle) PA_SIN[((angle))&511] - -extern u32 RandomValue; // Seed pour la fonction random - -/*! \fn static inline u32 PA_Rand() - \brief - \~english Gives a random number, taken from Ham... This is taken from Ham, I have no credit. - \~french Donne un numéro aléatoire... Ceci est pris de Ham, je n'ai aucun m?rite. -*/ -static inline u32 PA_Rand() { - u32 lo, hi; - lo = 16807 * (RandomValue & 0xFFFF); - hi = 16807 * (RandomValue >> 16); - lo += (hi & 0x7FFF) << 16; - lo += hi >> 15; - if (lo > 0x7FFFFFFF) - lo -= 0x7FFFFFFF; - RandomValue = lo; - return(RandomValue); -} - -/*! \fn static inline void PA_InitRand() - \brief - \~english Auto-seeds the Rand function based on the clock ! - \~french Initialisation automatique du rand, basé sur l'horloge interne... -*/ -// Les fonctions randoms sont prises de Ham, je n'ai strictement AUCUN mérite ! Désolé ! Je l'ai un peu modifiée, elle doit etre plus rapide -static inline void PA_InitRand() { - RandomValue = 1 + PA_RTC.Seconds + PA_RTC.Minutes*60 + PA_RTC.Hour*3600 + PA_RTC.Day*3600*24+PA_RTC.Month*3600*24*30; - PA_Rand(); PA_Rand(); PA_Rand(); // On fait plusieurs fois de base -} - -/*! \fn void PA_SRand(s32 r) - \brief - \~english Set the random's seed. This is taken from Ham, I have no credit. I just made it a little shorter/faster (maybe) - \~french Initialiser le random avec un seed. Ceci est pris de Ham, je n'ai aucun mérite. J'ai juste raccourci/accéléré un peu le tout - \~\param r - \~english Seed value - \~french Seed... - -*/ -// Les fonctions randoms sont prises de Ham, je n'ai strictement AUCUN m?rite ! D?sol? ! Je l'ai un peu modifi?e, elle doit etre plus rapide -static inline void PA_SRand(s32 r) { - if ((r==-2)||(r==0)||(r==2147483647)) - RandomValue = 1; - else - RandomValue = r; -} - -/*! \fn static inline u32 PA_RandMax(u32 max) - \brief - \~english Gives a random number, between 0 and the given number (included) - \~french Donne un num?ro al?atoire... Entre 0 et le nombre donn? (inclus) - \~\param max - \~english Maximum included value - \~french Valeur maximale incluse -*/ -static inline u32 PA_RandMax(u32 max){ - return PA_Rand()%(max + 1); -} - -/*! \fn static inline u32 PA_RandMinMax(u32 min,u32 max) - \brief - \~english Gives a random number, between the 2 given numbers (included) - \~french Donne un num?ro al?atoire... Entre les 2 nombres donn?s (inclus) - \~\param min - \~english Minimum included value - \~french Valeur minimale incluse - \~\param max - \~english Maximum included value - \~french Valeur maximale incluse -*/ -static inline u32 PA_RandMinMax(u32 min,u32 max){ - return ((PA_Rand()%((max + 1)-min)) + min); -} - -/*! \fn static inline u32 PA_Distance(s32 x1, s32 y1, s32 x2, s32 y2) - \brief - \~english Calculate the distance (squared) between 2 points - \~french Calculer la distance (au carr?) entre 2 points - \~\param x1 - \~english X coordinate of the fist point - \~french Coordonn?e X du premier point - \~\param y1 - \~english Y coordinate of the first point - \~french Coordonn?e Y du premier point - \~\param x2 - \~english X coordinate of the second point - \~french Coordonn?e X du deuxi?me point - \~\param y2 - \~english Y coordinate of the second point - \~french Coordonn?e Y du deuxi?me point -*/ -static inline u64 PA_Distance(s32 x1, s32 y1, s32 x2, s32 y2) { - s64 h = x1 - x2; - s64 v = y1 - y2; - return(h*h + v*v); -} - -/*! \fn static inline u32 PA_TrueDistance(s32 x1, s32 y1, s32 x2, s32 y2) - \brief - \~english Calculate the real distance between 2 points. A lot slower than PA_Distance - \~french Calculer la vraie distance entre 2 points. Beaucoup plus lent que PA_Distance - \~\param x1 - \~english X coordinate of the fist point - \~french Coordonn?e X du premier point - \~\param y1 - \~english Y coordinate of the first point - \~french Coordonn?e Y du premier point - \~\param x2 - \~english X coordinate of the second point - \~french Coordonn?e X du deuxi?me point - \~\param y2 - \~english Y coordinate of the second point - \~french Coordonn?e Y du deuxi?me point -*/ -static inline u64 PA_TrueDistance(s32 x1, s32 y1, s32 x2, s32 y2) { - s64 h = x1 - x2; - s64 v = y1 - y2; - return(swiSqrt(h*h + v*v)); -} - -/*! \fn u16 PA_AdjustAngle(u16 angle, s16 anglerot, s32 startx, s32 starty, s32 targetx, s32 targety) - \brief - \~english Adjust an angle, for example to calculate in which direction an object shoudl turn - \~french Ajuster un angle, par exemple pour calculer la direction ? prendre par un vaisseau - \~\param angle - \~english Base angle, from 0 to 511 - \~french Angle de base, de 0 ? 511 - \~\param anglerot - \~english For how much to turn... - \~french De combien tourner... - \~\param startx - \~english Initial X position - \~french Coordonn?e X de base - \~\param starty - \~english Initial Y position - \~french Coordonn?e Y de base - \~\param targetx - \~english Target X position - \~french Coordonn?e X de la cible - \~\param targety - \~english Target Y position - \~french Coordonn?e Y de la cible -*/ - -u16 PA_AdjustAngle(u16 angle, s16 anglerot, s32 startx, s32 starty, s32 targetx, s32 targety); - -/*! \fn static inline u16 PA_GetAngle(s32 startx, s32 starty, s32 targetx, s32 targety) - \brief - \~english Get the angle, from 0 to 511, formed between the horizontal and the line - \~french R?cup?rer l'angle, de 0 ? 511, par rapport ? l'horizontale... - \~\param startx - \~english Initial X position - \~french Coordonn?e X de base - \~\param starty - \~english Initial Y position - \~french Coordonn?e Y de base - \~\param targetx - \~english Target X position - \~french Coordonn?e X de la cible - \~\param targety - \~english Target Y position - \~french Coordonn?e Y de la cible -*/ -static inline u16 PA_GetAngle(s32 startx, s32 starty, s32 targetx, s32 targety) { - u16 angle = 0; - u16 anglerot = 180; - - while(anglerot > 5) { - angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety); - anglerot = (anglerot - ((3 * anglerot) >> 3)); // On diminue petit ? petit la rotation... - } - - // Ajustement encore plus précis... - anglerot = 4; - angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety); - anglerot = 2; - angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety); - anglerot = 1; - angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety); - - return angle; -} - -// fincs additions - -/// Simple point structure. -typedef struct{ - /// X value. - int x; - /// Y value. - int y; -}PA_Point; - -/*! \fn int PA_mulf32(int a, int b) - \brief - \~english Multiplies two .12 fixed point integers - \~french (TODO) - \~\param a - \~english First number - \~french Premier nombre - \~\param b - \~english Second number - \~french Deuxième nombre -*/ -int PA_mulf32(int a, int b); - -/*! \fn int PA_divf32(int a, int b) - \brief - \~english Divides two .12 fixed point integers - \~french (TODO) - \~\param a - \~english First number - \~french Premier nombre - \~\param b - \~english Second number - \~french Deuxième nombre -*/ -int PA_divf32(int a, int b); - -/*! \fn int PA_modf32(int a, int b) - \brief - \~english Gets the remainder of the division between two .12 fixed point integers (modulo) - \~french (TODO) - \~\param a - \~english First number - \~french Premier nombre - \~\param b - \~english Second number - \~french Deuxième nombre -*/ -int PA_modf32(int a, int b); - -/*! \fn int PA_sqrtf32(int a) - \brief - \~english Gets the square root of a .12 fixed point integer - \~french (TODO) - \~\param a - \~english Number - \~french Nombre -*/ -int PA_sqrtf32(int a); - -/** @} */ // end of Math - -static inline s32 PA_Modulo(s32 var, s32 modulo){ - while(var < 0) var += modulo; - return (var%modulo); -} - -#ifdef __cplusplus -} -#endif - -#endif - - +#ifndef _PA_Math +#define _PA_Math + +#ifdef __cplusplus +extern "C" { +#endif + +#include "PA9.h" + +#include "PA_Interrupt.h" + + +/** @defgroup Math Math functions + * Adjust angles, get random values... + * @{ + */ + +/*! \def PA_Cos(angle) + \brief + \~english Returns the Cos value for an angle. The value goes from -256 to 256... Watch out though : the angle is not in 360 degrees, but in 512 ! + \~french Renvoie la valeur Cosinus d'un angle. Cette valeur est comprise entre -256 et 256... Attention : l'angle n'est pas en 360 degr?s, mais en 512 ! +*/ +#define PA_Cos(angle) PA_SIN[((angle) + 128)&511] + + +/*! \def PA_Sin(angle) + \brief + \~english Returns the Sin value for an angle. The value goes from -256 to 256... Watch out though : the angle is not in 360 degrees, but in 256 ! + \~french Renvoie la valeur Sinus d'un angle. Cette valeur est comprise entre -256 et 256... Attention : l'angle n'est pas en 360 degr?s, mais en 256 ! +*/ +#define PA_Sin(angle) PA_SIN[((angle))&511] + +extern u32 RandomValue; // Seed pour la fonction random + +/*! \fn static inline u32 PA_Rand() + \brief + \~english Gives a random number, taken from Ham... This is taken from Ham, I have no credit. + \~french Donne un numéro aléatoire... Ceci est pris de Ham, je n'ai aucun m?rite. +*/ +static inline u32 PA_Rand() { + u32 lo, hi; + lo = 16807 * (RandomValue & 0xFFFF); + hi = 16807 * (RandomValue >> 16); + lo += (hi & 0x7FFF) << 16; + lo += hi >> 15; + if (lo > 0x7FFFFFFF) + lo -= 0x7FFFFFFF; + RandomValue = lo; + return(RandomValue); +} + +/*! \fn static inline void PA_InitRand() + \brief + \~english Auto-seeds the Rand function based on the clock ! + \~french Initialisation automatique du rand, basé sur l'horloge interne... +*/ +// Les fonctions randoms sont prises de Ham, je n'ai strictement AUCUN mérite ! Désolé ! Je l'ai un peu modifiée, elle doit etre plus rapide +static inline void PA_InitRand() { + RandomValue = 1 + PA_RTC.Seconds + PA_RTC.Minutes*60 + PA_RTC.Hour*3600 + PA_RTC.Day*3600*24+PA_RTC.Month*3600*24*30; + PA_Rand(); PA_Rand(); PA_Rand(); // On fait plusieurs fois de base +} + +/*! \fn void PA_SRand(s32 r) + \brief + \~english Set the random's seed. This is taken from Ham, I have no credit. I just made it a little shorter/faster (maybe) + \~french Initialiser le random avec un seed. Ceci est pris de Ham, je n'ai aucun mérite. J'ai juste raccourci/accéléré un peu le tout + \~\param r + \~english Seed value + \~french Seed... + +*/ +// Les fonctions randoms sont prises de Ham, je n'ai strictement AUCUN m?rite ! D?sol? ! Je l'ai un peu modifi?e, elle doit etre plus rapide +static inline void PA_SRand(s32 r) { + if ((r==-2)||(r==0)||(r==2147483647)) + RandomValue = 1; + else + RandomValue = r; +} + +/*! \fn static inline u32 PA_RandMax(u32 max) + \brief + \~english Gives a random number, between 0 and the given number (included) + \~french Donne un num?ro al?atoire... Entre 0 et le nombre donn? (inclus) + \~\param max + \~english Maximum included value + \~french Valeur maximale incluse +*/ +static inline u32 PA_RandMax(u32 max){ + return PA_Rand()%(max + 1); +} + +/*! \fn static inline u32 PA_RandMinMax(u32 min,u32 max) + \brief + \~english Gives a random number, between the 2 given numbers (included) + \~french Donne un num?ro al?atoire... Entre les 2 nombres donn?s (inclus) + \~\param min + \~english Minimum included value + \~french Valeur minimale incluse + \~\param max + \~english Maximum included value + \~french Valeur maximale incluse +*/ +static inline u32 PA_RandMinMax(u32 min,u32 max){ + return ((PA_Rand()%((max + 1)-min)) + min); +} + +/*! \fn static inline u32 PA_Distance(s32 x1, s32 y1, s32 x2, s32 y2) + \brief + \~english Calculate the distance (squared) between 2 points + \~french Calculer la distance (au carr?) entre 2 points + \~\param x1 + \~english X coordinate of the fist point + \~french Coordonn?e X du premier point + \~\param y1 + \~english Y coordinate of the first point + \~french Coordonn?e Y du premier point + \~\param x2 + \~english X coordinate of the second point + \~french Coordonn?e X du deuxi?me point + \~\param y2 + \~english Y coordinate of the second point + \~french Coordonn?e Y du deuxi?me point +*/ +static inline u64 PA_Distance(s32 x1, s32 y1, s32 x2, s32 y2) { + s64 h = x1 - x2; + s64 v = y1 - y2; + return(h*h + v*v); +} + +/*! \fn static inline u32 PA_TrueDistance(s32 x1, s32 y1, s32 x2, s32 y2) + \brief + \~english Calculate the real distance between 2 points. A lot slower than PA_Distance + \~french Calculer la vraie distance entre 2 points. Beaucoup plus lent que PA_Distance + \~\param x1 + \~english X coordinate of the fist point + \~french Coordonn?e X du premier point + \~\param y1 + \~english Y coordinate of the first point + \~french Coordonn?e Y du premier point + \~\param x2 + \~english X coordinate of the second point + \~french Coordonn?e X du deuxi?me point + \~\param y2 + \~english Y coordinate of the second point + \~french Coordonn?e Y du deuxi?me point +*/ +static inline u64 PA_TrueDistance(s32 x1, s32 y1, s32 x2, s32 y2) { + s64 h = x1 - x2; + s64 v = y1 - y2; + return(swiSqrt(h*h + v*v)); +} + +/*! \fn u16 PA_AdjustAngle(u16 angle, s16 anglerot, s32 startx, s32 starty, s32 targetx, s32 targety) + \brief + \~english Adjust an angle, for example to calculate in which direction an object shoudl turn + \~french Ajuster un angle, par exemple pour calculer la direction ? prendre par un vaisseau + \~\param angle + \~english Base angle, from 0 to 511 + \~french Angle de base, de 0 ? 511 + \~\param anglerot + \~english For how much to turn... + \~french De combien tourner... + \~\param startx + \~english Initial X position + \~french Coordonn?e X de base + \~\param starty + \~english Initial Y position + \~french Coordonn?e Y de base + \~\param targetx + \~english Target X position + \~french Coordonn?e X de la cible + \~\param targety + \~english Target Y position + \~french Coordonn?e Y de la cible +*/ + +u16 PA_AdjustAngle(u16 angle, s16 anglerot, s32 startx, s32 starty, s32 targetx, s32 targety); + +/*! \fn static inline u16 PA_GetAngle(s32 startx, s32 starty, s32 targetx, s32 targety) + \brief + \~english Get the angle, from 0 to 511, formed between the horizontal and the line + \~french R?cup?rer l'angle, de 0 ? 511, par rapport ? l'horizontale... + \~\param startx + \~english Initial X position + \~french Coordonn?e X de base + \~\param starty + \~english Initial Y position + \~french Coordonn?e Y de base + \~\param targetx + \~english Target X position + \~french Coordonn?e X de la cible + \~\param targety + \~english Target Y position + \~french Coordonn?e Y de la cible +*/ +static inline u16 PA_GetAngle(s32 startx, s32 starty, s32 targetx, s32 targety) { + u16 angle = 0; + u16 anglerot = 180; + + while(anglerot > 5) { + angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety); + anglerot = (anglerot - ((3 * anglerot) >> 3)); // On diminue petit ? petit la rotation... + } + + // Ajustement encore plus précis... + anglerot = 4; + angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety); + anglerot = 2; + angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety); + anglerot = 1; + angle = PA_AdjustAngle(angle, anglerot, startx, starty, targetx, targety); + + return angle; +} + +// fincs additions + +/// Simple point structure. +typedef struct{ + /// X value. + int x; + /// Y value. + int y; +}PA_Point; + +/*! \fn int PA_mulf32(int a, int b) + \brief + \~english Multiplies two .12 fixed point integers + \~french (TODO) + \~\param a + \~english First number + \~french Premier nombre + \~\param b + \~english Second number + \~french Deuxième nombre +*/ +int PA_mulf32(int a, int b); + +/*! \fn int PA_divf32(int a, int b) + \brief + \~english Divides two .12 fixed point integers + \~french (TODO) + \~\param a + \~english First number + \~french Premier nombre + \~\param b + \~english Second number + \~french Deuxième nombre +*/ +int PA_divf32(int a, int b); + +/*! \fn int PA_modf32(int a, int b) + \brief + \~english Gets the remainder of the division between two .12 fixed point integers (modulo) + \~french (TODO) + \~\param a + \~english First number + \~french Premier nombre + \~\param b + \~english Second number + \~french Deuxième nombre +*/ +int PA_modf32(int a, int b); + +/*! \fn int PA_sqrtf32(int a) + \brief + \~english Gets the square root of a .12 fixed point integer + \~french (TODO) + \~\param a + \~english Number + \~french Nombre +*/ +int PA_sqrtf32(int a); + +/** @} */ // end of Math + +static inline s32 PA_Modulo(s32 var, s32 modulo){ + while(var < 0) var += modulo; + return (var%modulo); +} + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/include/arm9/PA_Micro.h b/include/arm9/PA_Micro.h index c0307f1..454be24 100644 --- a/include/arm9/PA_Micro.h +++ b/include/arm9/PA_Micro.h @@ -1,74 +1,74 @@ -#ifndef _PA_MICRO -#define _PA_MICRO - -#include "PA_General.h" - -/** @defgroup Micro Microphone - * Record a sound and replay it... - * @{ - */ - - -/*! \def PA_MicGetVol() - \brief - \~english Returns the Microphone volume - \~french Renvoie le volume du micro -*/ -#define PA_MicGetVol() PA_Transfer->micvol - -/*! \fn static inline void PA_MicStartRecording(u8 *Buffer, u32 Length) - \brief - \~english Start recording from the microphone. - \~french Commencer � enregistrer avec le microphone. - \~\param Buffer - \~english 8bit buffer in which to record the sound - \~french Buffer dans lequel enregistrer le son - \~\param Length - \~english Buffer length. To convert seconds to 8bit length you have to multiply the seconds by 16384. - \~french Longueur du buffer. -*/ -static inline void PA_MicStartRecording(u8* buffer, u32 length){ - PA_FifoMsg msg; - msg.type = PA_MSG_MIC; - msg.MicMsg.buffer = buffer; - msg.MicMsg.length = length; - PA_SendFifoMsg(msg); -} - -/*! \def PA_MicStopRecording() - \brief - \~english Stop recording from the microphone. - \~french Arr�te l'enregistrement. -*/ - -#define PA_MicStopRecording() PA_SendFifoCmd(PA_MSG_MICSTOP) - - -/*! \fn static inline void PA_MicReplay(u8 *Buffer, s32 Length) - \brief - \~english Play a recorded sound using ASlib - \~french Rejouer un son enregistrer - \~\param Buffer - \~english 8bit buffer in which the sound was recorded - \~french Buffer dans lequel on a enregistr� le son - \~\param Length - \~english Buffer length - \~french Longueur du buffer -*/ -static inline void PA_MicReplay(u8* buffer, u32 length){ - SoundInfo snd = { - buffer, - length, - AS_PCM_8BIT, - 16384, - 127, - 64, - false, - 0, - AS_NO_DELAY}; - AS_SoundPlay(snd); -} - -/** @} */ // end of Micro - -#endif +#ifndef _PA_MICRO +#define _PA_MICRO + +#include "PA_General.h" + +/** @defgroup Micro Microphone + * Record a sound and replay it... + * @{ + */ + + +/*! \def PA_MicGetVol() + \brief + \~english Returns the Microphone volume + \~french Renvoie le volume du micro +*/ +#define PA_MicGetVol() PA_Transfer->micvol + +/*! \fn static inline void PA_MicStartRecording(u8 *Buffer, u32 Length) + \brief + \~english Start recording from the microphone. + \~french Commencer � enregistrer avec le microphone. + \~\param Buffer + \~english 8bit buffer in which to record the sound + \~french Buffer dans lequel enregistrer le son + \~\param Length + \~english Buffer length. To convert seconds to 8bit length you have to multiply the seconds by 16384. + \~french Longueur du buffer. +*/ +static inline void PA_MicStartRecording(u8* buffer, u32 length){ + PA_FifoMsg msg; + msg.type = PA_MSG_MIC; + msg.MicMsg.buffer = buffer; + msg.MicMsg.length = length; + PA_SendFifoMsg(msg); +} + +/*! \def PA_MicStopRecording() + \brief + \~english Stop recording from the microphone. + \~french Arr�te l'enregistrement. +*/ + +#define PA_MicStopRecording() PA_SendFifoCmd(PA_MSG_MICSTOP) + + +/*! \fn static inline void PA_MicReplay(u8 *Buffer, s32 Length) + \brief + \~english Play a recorded sound using ASlib + \~french Rejouer un son enregistrer + \~\param Buffer + \~english 8bit buffer in which the sound was recorded + \~french Buffer dans lequel on a enregistr� le son + \~\param Length + \~english Buffer length + \~french Longueur du buffer +*/ +static inline void PA_MicReplay(u8* buffer, u32 length){ + SoundInfo snd = { + buffer, + length, + AS_PCM_8BIT, + 16384, + 127, + 64, + false, + 0, + AS_NO_DELAY}; + AS_SoundPlay(snd); +} + +/** @} */ // end of Micro + +#endif diff --git a/include/arm9/PA_Mode7.h b/include/arm9/PA_Mode7.h index c00ecfa..01ad5f3 100644 --- a/include/arm9/PA_Mode7.h +++ b/include/arm9/PA_Mode7.h @@ -1,205 +1,205 @@ -#ifndef PA_MODE7 -#define PA_MODE7 - - -#include "PA_BgRot.h" -//#include "PA_BgTiles.h" - - -// Mode 7 functions !! - -void hbl_mode7(void); - -extern const s32 DIV[160]; - - -#define M7_D_SH 7 // focal shift -#define M7O_NORM 1 // object renormalization shift (by /2) - -// view frustrum limits -#define M7_NEAR 16 -#define M7_FAR 384 -#define M7_LEFT -120 -#define M7_RIGHT 120 -#define M7_TOP 80 -#define M7_BOTTOM -80 - -// the background uses a different far-plane than objects -#define M7_FAR_BG 512 - - -typedef struct{ - s32 x, y, z; -}VECTOR; - -typedef struct tagM7CAM{ - VECTOR pos; - int phi; // yaw - int theta; // pitch - VECTOR u; // local x-axis (right) - VECTOR v; // local y-axis (up) - VECTOR w; // local z-axis (back) -} M7CAM; - - -typedef struct { - s16 pa, pb, pc, pd; s32 dx, dy; -} BGAFF_EX; - -// in mode7.c -extern M7CAM _m7_cam; -extern int _m7_horizon; -extern BGAFF_EX _m7_bgaff_ex[192]; // affine parameters for each line - -#define X0 256<<8 -#define Y0 32<<8 // Default camera height -> 8192 -#define Z0 256<<8 - -// DRV -extern u8 PA_currentmode; - -// === GLOBALS ======================================================== -// DRV -extern s32 mode7cam_x, mode7cam_y, mode7cam_z, mode7alpha; -// DRV -extern s32 mode7cos, mode7sin; // temporaries for cos and sin alpha -// DRV -extern s16 mode7_distance; - -/** @defgroup Mode7 Mode 7 commands - * Different commands for Mode 7 :p A big thanks to TONC for these... - * @{ - */ - -/*! \fn void PA_InitMode7(u8 bg_select) - \brief - \~english Initialize Mode 7 for a given background. You MUST be in video mode 1 or 2 - \~french Initialise le Mode 7 pour un fond donné. Vous devez etre en mode 1 ou 2 impérativement ! - \~\param bg_select - \~english Bg number, 2 in mode 1, 2 or 3 in mode 2 - \~french Numéro du fond. 2 en mode 1, 2 ou 3 en mode 2 -*/ -void PA_InitMode7(u8 bg_select); - -/*! \fn static inline void PA_DeInitMode7(void) - \brief - \~english DeInitialize Mode 7 - \~french DesInitialise le Mode 7 -*/ -static inline void PA_DeInitMode7(){ - irqDisable(IRQ_HBLANK); -} - - -/*! \fn static inline void PA_Mode7Angle(s16 angle) - \brief - \~english Define the current angle. - \~french Définir l'angle - \~\param angle - \~english The angle ranges from 0 to 511... - \~french L'angle, qui va de 0 à 511... - -*/ -static inline void PA_Mode7Angle(s16 angle){ - mode7alpha = angle&511; - mode7cos = PA_Cos(mode7alpha); - mode7sin = PA_Sin(mode7alpha); -} - - - -/*! \fn static inline void PA_Mode7MoveLeftRight(s16 x_deplac) - \brief - \~english Move lateraly, so left or right... - \~french Se déplacer latéralement - \~\param x_deplac - \~english Number of pixels to move left or right - \~french De combien de pixels se déplacer à gauche ou à droite - -*/ -static inline void PA_Mode7MoveLeftRight(s16 x_deplac){ - mode7cam_x += x_deplac*mode7cos; - mode7cam_z += x_deplac*mode7sin; -} - - -/*! \fn static inline void PA_Mode7MoveForwardBack(s16 z_deplac) - \brief - \~english Move forward or backwards - \~french Se déplacer latéralement - \~\param z_deplac - \~english Number of pixels to move forward or backwards - \~french De combien se déplacer en avant ou en arrière - -*/ -static inline void PA_Mode7MoveForwardBack(s16 z_deplac){ - mode7cam_x += z_deplac*mode7sin; - mode7cam_z -= z_deplac*mode7cos; -} - - - -/*! \fn static inline void PA_Mode7X(s16 mode7x) - \brief - \~english Move to a given point on the map - \~french Se déplacer en un point donné de la carte - \~\param mode7x - \~english X position on the map - \~french Position X sur la carte - -*/ -static inline void PA_Mode7X(s16 mode7x){ - mode7cam_x = mode7x; -} - - -/*! \fn static inline void PA_Mode7Z(s16 mode7z) - \brief - \~english Move to a given point on the map - \~french Se déplacer en un point donné de la carte - \~\param mode7z - \~english Z position on the map - \~french Position Z sur la carte - -*/ -static inline void PA_Mode7Z(s16 mode7z){ - mode7cam_z = mode7z; -} - -/*! \fn static inline void PA_Mode7SetPointXZ(s16 mode7x, s16 mode7z) - \brief - \~english Move to a given point on the map (of coordinates x, z) - \~french Se déplacer en un point donné de la carte (de coordonnées x, z) - \~\param mode7x - \~english X position on the map - \~french Position X sur la carte - \~\param mode7z - \~english Z position on the map - \~french Position Z sur la carte -*/ -static inline void PA_Mode7SetPointXZ(s16 mode7x, s16 mode7z){ - mode7cam_x = mode7x; - mode7cam_z = mode7z; -} - - -/*! \fn static inline void PA_Mode7Height(s16 mode7y) - \brief - \~english Set the camera height. - \~french Régler la hauteur de la caméra - \~\param mode7y - \~english Camera Height. By default, 8192. You can set this from 0 to 40 000 (or even more, but then it gets a little small... - \~french Hauteur... Par défaut, elle est de 8192. On peut la mettre de 0 à 40 000 (ou beaucoup plus, mais après ca commence à faire petit... - -*/ -static inline void PA_Mode7Height(s16 mode7y){ - mode7cam_y = mode7y; -} - -/** @} */ // end of Mode7 - -void m7_aff_calc(); -void m7_hbl_flr(); -void m7_horz_calc(); - -#endif +#ifndef PA_MODE7 +#define PA_MODE7 + + +#include "PA_BgRot.h" +//#include "PA_BgTiles.h" + + +// Mode 7 functions !! + +void hbl_mode7(void); + +extern const s32 DIV[160]; + + +#define M7_D_SH 7 // focal shift +#define M7O_NORM 1 // object renormalization shift (by /2) + +// view frustrum limits +#define M7_NEAR 16 +#define M7_FAR 384 +#define M7_LEFT -120 +#define M7_RIGHT 120 +#define M7_TOP 80 +#define M7_BOTTOM -80 + +// the background uses a different far-plane than objects +#define M7_FAR_BG 512 + + +typedef struct{ + s32 x, y, z; +}VECTOR; + +typedef struct tagM7CAM{ + VECTOR pos; + int phi; // yaw + int theta; // pitch + VECTOR u; // local x-axis (right) + VECTOR v; // local y-axis (up) + VECTOR w; // local z-axis (back) +} M7CAM; + + +typedef struct { + s16 pa, pb, pc, pd; s32 dx, dy; +} BGAFF_EX; + +// in mode7.c +extern M7CAM _m7_cam; +extern int _m7_horizon; +extern BGAFF_EX _m7_bgaff_ex[192]; // affine parameters for each line + +#define X0 256<<8 +#define Y0 32<<8 // Default camera height -> 8192 +#define Z0 256<<8 + +// DRV +extern u8 PA_currentmode; + +// === GLOBALS ======================================================== +// DRV +extern s32 mode7cam_x, mode7cam_y, mode7cam_z, mode7alpha; +// DRV +extern s32 mode7cos, mode7sin; // temporaries for cos and sin alpha +// DRV +extern s16 mode7_distance; + +/** @defgroup Mode7 Mode 7 commands + * Different commands for Mode 7 :p A big thanks to TONC for these... + * @{ + */ + +/*! \fn void PA_InitMode7(u8 bg_select) + \brief + \~english Initialize Mode 7 for a given background. You MUST be in video mode 1 or 2 + \~french Initialise le Mode 7 pour un fond donné. Vous devez etre en mode 1 ou 2 impérativement ! + \~\param bg_select + \~english Bg number, 2 in mode 1, 2 or 3 in mode 2 + \~french Numéro du fond. 2 en mode 1, 2 ou 3 en mode 2 +*/ +void PA_InitMode7(u8 bg_select); + +/*! \fn static inline void PA_DeInitMode7(void) + \brief + \~english DeInitialize Mode 7 + \~french DesInitialise le Mode 7 +*/ +static inline void PA_DeInitMode7(){ + irqDisable(IRQ_HBLANK); +} + + +/*! \fn static inline void PA_Mode7Angle(s16 angle) + \brief + \~english Define the current angle. + \~french Définir l'angle + \~\param angle + \~english The angle ranges from 0 to 511... + \~french L'angle, qui va de 0 à 511... + +*/ +static inline void PA_Mode7Angle(s16 angle){ + mode7alpha = angle&511; + mode7cos = PA_Cos(mode7alpha); + mode7sin = PA_Sin(mode7alpha); +} + + + +/*! \fn static inline void PA_Mode7MoveLeftRight(s16 x_deplac) + \brief + \~english Move lateraly, so left or right... + \~french Se déplacer latéralement + \~\param x_deplac + \~english Number of pixels to move left or right + \~french De combien de pixels se déplacer à gauche ou à droite + +*/ +static inline void PA_Mode7MoveLeftRight(s16 x_deplac){ + mode7cam_x += x_deplac*mode7cos; + mode7cam_z += x_deplac*mode7sin; +} + + +/*! \fn static inline void PA_Mode7MoveForwardBack(s16 z_deplac) + \brief + \~english Move forward or backwards + \~french Se déplacer latéralement + \~\param z_deplac + \~english Number of pixels to move forward or backwards + \~french De combien se déplacer en avant ou en arrière + +*/ +static inline void PA_Mode7MoveForwardBack(s16 z_deplac){ + mode7cam_x += z_deplac*mode7sin; + mode7cam_z -= z_deplac*mode7cos; +} + + + +/*! \fn static inline void PA_Mode7X(s16 mode7x) + \brief + \~english Move to a given point on the map + \~french Se déplacer en un point donné de la carte + \~\param mode7x + \~english X position on the map + \~french Position X sur la carte + +*/ +static inline void PA_Mode7X(s16 mode7x){ + mode7cam_x = mode7x; +} + + +/*! \fn static inline void PA_Mode7Z(s16 mode7z) + \brief + \~english Move to a given point on the map + \~french Se déplacer en un point donné de la carte + \~\param mode7z + \~english Z position on the map + \~french Position Z sur la carte + +*/ +static inline void PA_Mode7Z(s16 mode7z){ + mode7cam_z = mode7z; +} + +/*! \fn static inline void PA_Mode7SetPointXZ(s16 mode7x, s16 mode7z) + \brief + \~english Move to a given point on the map (of coordinates x, z) + \~french Se déplacer en un point donné de la carte (de coordonnées x, z) + \~\param mode7x + \~english X position on the map + \~french Position X sur la carte + \~\param mode7z + \~english Z position on the map + \~french Position Z sur la carte +*/ +static inline void PA_Mode7SetPointXZ(s16 mode7x, s16 mode7z){ + mode7cam_x = mode7x; + mode7cam_z = mode7z; +} + + +/*! \fn static inline void PA_Mode7Height(s16 mode7y) + \brief + \~english Set the camera height. + \~french Régler la hauteur de la caméra + \~\param mode7y + \~english Camera Height. By default, 8192. You can set this from 0 to 40 000 (or even more, but then it gets a little small... + \~french Hauteur... Par défaut, elle est de 8192. On peut la mettre de 0 à 40 000 (ou beaucoup plus, mais après ca commence à faire petit... + +*/ +static inline void PA_Mode7Height(s16 mode7y){ + mode7cam_y = mode7y; +} + +/** @} */ // end of Mode7 + +void m7_aff_calc(); +void m7_hbl_flr(); +void m7_horz_calc(); + +#endif diff --git a/include/arm9/PA_Motion.h b/include/arm9/PA_Motion.h index 53d6da5..5149451 100644 --- a/include/arm9/PA_Motion.h +++ b/include/arm9/PA_Motion.h @@ -1,45 +1,45 @@ -#ifndef PA_MOTIOn -#define PA_MOTIOn - -#include - -/** @defgroup Motion DS Motion functions - * Easy enable and play around with your DS Motion ! - * @{ - */ - -typedef struct { - u8 Up, Down, Right, Left; -} pamotionpad; - -typedef struct{ - s32 X, Y, Z, AccelX, AccelY, AccelZ, Zrot, Angle, Force; - s32 Vx, Vy, Vz, Vzrot; - pamotionpad Newpress, Held, Released; -} motion_struct; -/// Motion struct. -extern motion_struct Motion; - -void PA_MotionVBL(void); - -/// Turn on the accelerometer -static inline void PA_MotionInit(void) { - motion_init(); - MotionVBL = PA_MotionVBL; -} - -/// Checks whether a DS Motion Card is plugged in -static inline u8 PA_CheckDSMotion(){ - return motion_init(); -} - -extern u8 pamotiontopad; - -/// Maps the DS Motion Card to the Pad structure (!!) -static inline void PA_MotionToPad(u8 enable){ - pamotiontopad = enable; -} - -/** @} */ // end of Motion - -#endif +#ifndef PA_MOTIOn +#define PA_MOTIOn + +#include + +/** @defgroup Motion DS Motion functions + * Easy enable and play around with your DS Motion ! + * @{ + */ + +typedef struct { + u8 Up, Down, Right, Left; +} pamotionpad; + +typedef struct{ + s32 X, Y, Z, AccelX, AccelY, AccelZ, Zrot, Angle, Force; + s32 Vx, Vy, Vz, Vzrot; + pamotionpad Newpress, Held, Released; +} motion_struct; +/// Motion struct. +extern motion_struct Motion; + +void PA_MotionVBL(void); + +/// Turn on the accelerometer +static inline void PA_MotionInit(void) { + motion_init(); + MotionVBL = PA_MotionVBL; +} + +/// Checks whether a DS Motion Card is plugged in +static inline u8 PA_CheckDSMotion(){ + return motion_init(); +} + +extern u8 pamotiontopad; + +/// Maps the DS Motion Card to the Pad structure (!!) +static inline void PA_MotionToPad(u8 enable){ + pamotiontopad = enable; +} + +/** @} */ // end of Motion + +#endif diff --git a/include/arm9/PA_Palette.h b/include/arm9/PA_Palette.h index 08c2a98..ba7402c 100644 --- a/include/arm9/PA_Palette.h +++ b/include/arm9/PA_Palette.h @@ -1,348 +1,348 @@ -#ifndef _PA_Palette -#define _PA_Palette - -void PA_LoadSpriteExtPal(u8 screen, u16 palette_number, void* palette); -#define PA_LoadBgExtPal(screen, bg_number, palette) PA_LoadBgPal(screen, bg_number, palette) - -/*! \file PA_Palette.h - \brief Everything concerning the palette system - - Not much for now, only a function to load a complete palette to a given palette -*/ - -////////////////////////////////////////////////////////////////////// -// Système pour les palettes -////////////////////////////////////////////////////////////////////// -#define PAL_BG0 0x05000000 -#define PAL_SPRITE0 0x05000200 -#define PAL_BG1 0x05000400 -#define PAL_SPRITE1 0x05000600 - -#define REG_BRIGHT 0x0400006C // Brightness - -/** @defgroup Palette Palette system - * Load palettes, change palette colors, set the gamma, etc... - * @{ - */ - -/*! \def PA_LoadPal(palette, source) - \brief - \~english Load a 256 color palette in the Bg or Sprite palette of screen 0 or 1. Ex : PA_LoadPal(PALETTE_BG1, bg_pal); - \~french Charger une palette de 256 couleurs pour les fonds ou les sprites pour l'écran 0 ou 1. Ex : PA_LoadPal(PALETTE_BG1, bg_pal); - \~\param palette - \~english Set the Bg palette or Obj palette, screen 0 or 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, or PAL_SPRITE1 - \~french Charger pour les Bg ou les Sprites, sur l'écran 0 ou 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, ou PAL_SPRITE1 - \~\param source - \~english Palette name (ex : master_Palette) - \~french Nom de la palette (ex : master_Palette) -*/ -#define PA_LoadPal(palette, source) do{\ - DMA_Copy((void*)source, (void*)palette, 256, DMA_16NOW);\ - if (palette == PAL_SPRITE0) PA_LoadSpritePal(0, 0, (void*)source);\ - if (palette == PAL_SPRITE1) PA_LoadSpritePal(1, 0, (void*)source);\ - if (palette == PAL_BG0) {u8 itemp; for (itemp = 0; itemp < 4; itemp++) PA_LoadBgPal(0, itemp, (void*)(source));}\ - if (palette == PAL_BG1) {u8 itemp; for (itemp = 0; itemp < 4; itemp++) PA_LoadBgPal(1, itemp, (void*)(source));}}while(0) - - -/*! \fn static inline void PA_Load8bitBgPal(u8 screen, void *Pal) - \brief - \~english Load a palette to be used by the 8bit background - \~french Charger une palette pour le fond 8bit - \~\param screen - \~english Screen... - \~french Ecran... - \~\param Pal - \~english Palette name (ex : master_Palette) - \~french Nom de la palette (ex : master_Palette) -*/ -static inline void PA_Load8bitBgPal(u8 screen, void *Pal){ - u32 dest = PAL_BG0 + (screen<<10); - DMA_Copy((void*)Pal, (void*)dest, 256, DMA_16NOW); -} - -/*! \def PA_LoadPal16(palette, n_palette, source) - \brief - \~english Load a 16 color palette in the Bg or Sprite palette of screen 0 or 1. Ex : PA_LoadPal16(PALETTE_BG1, 4, bg_pal); - \~french Charger une palette de 16 couleurs pour les fonds ou les sprites pour l'écran 0 ou 1. Ex : PA_LoadPal16(PALETTE_BG1, 4, bg_pal); - \~\param palette - \~english Set the Bg palette or Obj palette, screen 0 or 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, or PAL_SPRITE1 - \~french Charger pour les Bg ou les Sprites, sur l'écran 0 ou 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, ou PAL_SPRITE1 - \~\param n_palette - \~english Number of the 16 color palette to load (0-15) - \~french Numéro de la palette de 16 couleurs que l'on veut charger (0-15) - - \~\param source - \~english Palette name (ex : master_Palette) - \~french Nom de la palette (ex : master_Palette) -*/ -#define PA_LoadPal16(palette, n_palette, source) DMA_Copy((void*)source, (void*)(palette + (n_palette << 5)), 16, DMA_16NOW) - -/*! \def PA_LoadSprite16cPal(screen, n_palette, palette) - \brief - \~english Load a 16 color palette for sprites - \~french Charger une palette de 16 couleurs pour les sprites - \~\param screen - \~english Screen (0-1) - \~french Ecran (0-1) - \~\param n_palette - \~english Number of the 16 color palette to load (0-15) - \~french Numéro de la palette de 16 couleurs que l'on veut charger (0-15) - - \~\param palette - \~english Palette name (ex : Sprite_Pal) - \~french Nom de la palette (ex : Sprite_Pal) -*/ -#define PA_LoadSprite16cPal(screen, n_palette, palette) PA_LoadPal16((PAL_SPRITE0+(0x400*screen)), (n_palette), palette) - -/*! \def PA_RGB(r,g,b) - \brief - \~english Convert Red, Green, and Blue color indexes into a number used in the palette system. Careful : the R, G, B values range from 0 to 31 on gba ! - \~french Convertir une couleurs au format Rouge, Vert, Bleu en un nombre utilisable par le système de palette. Attention : sur Gba, les valeurs vont de 0 à 31... - \~\param r - \~english Red (0-31) - \~french Rouge (0-31) - \~\param g - \~english Green (0-31) - \~french Vert (0-31) - \~\param b - \~english Blue (0-31) - \~french Bleu (0-31) - -*/ -#define PA_RGB(r,g,b) ((1<<15) | (r) | ((g)<<5) | ((b)<<10)) - -/*! \fn void PA_SetBrightness(u8 screen, s8 bright) - \brief - \~english Set the screen's brightness - \~french Régler la luminosité de l'écran - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bright - \~english Brightness level, from -32 to 32, 0 being neutral - \~french Luminosité, de -32 à 32, 0 étant neutre -*/ -void PA_SetBrightness(u8 screen, s8 bright); - -/*! \fn static inline void PA_SetPalNeg(u32 palette) - \brief - \~english Set all the palette's color to negative. To undo this, simply negative again... - \~french Négativer une palette donnée. Pour annuler, il suffit de négativer à nouveau. - \~\param palette - \~english Set the Bg palette or Obj palette, screen 0 or 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, or PAL_SPRITE1 - \~french Charger pour les Bg ou les Sprites, sur l'écran 0 ou 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, ou PAL_SPRITE1 -*/ -static inline void PA_SetPalNeg(u32 palette) { - u16* pal = (u16*)palette; - int i; - - for (i = 0; i < 256; i++) pal[i] = ~pal[i]; // On fout le négatif... -} - -/*! \fn static inline void PA_SetPal16Neg(u32 palette, u8 n_palette) - \brief - \~english Set 16 color palette to negative. To undo this, simply negative again... - \~french Négativer une palette de 16 couleurs donnée. Pour annuler, il suffit de négativer à nouveau. - \~\param palette - \~english Set the Bg palette or Obj palette, screen 0 or 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, or PAL_SPRITE1 - \~french Charger pour les Bg ou les Sprites, sur l'écran 0 ou 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, ou PAL_SPRITE1 - \~\param n_palette - \~english Number of the 16 color palette (0-15) - \~french Numéro de la palette de 16 couleurs (0-15) -*/ -static inline void PA_SetPal16Neg(u32 palette, u8 n_palette) { - u16* pal = (u16*)palette; - int i; - - for (i = (n_palette << 4); i < ((n_palette + 1) << 4); i++) pal[i] = ~pal[i]; // On fout le négatif... -} - - -/*! \fn void PA_InitSpriteExtPal() - \brief - \~english Initialise 16 palette mode for 256 color sprites. Done by default - \~french Initialise le mode 16 palettes pour sprites de 256 couleurs... Effectué par défaut -*/ -void PA_InitSpriteExtPal(); - - -/*! \fn void PA_InitBgExtPal() - \brief - \~english Initialise 16 palette mode for 256 color backgrounds - \~french Initialise le mode 16 palettes pour fonds de 256 couleurs... -*/ -void PA_InitBgExtPal(); - -/*! \fn void PA_LoadSpritePal(u8 screen, u8 palette_number, void* palette) - \brief - \~english Load a 256 color palette for Sprites - \~french Charger une palette de 256 couleurs pour les sprites - \~\param screen - \~english Screen... - \~french Ecran... - \~\param palette_number - \~english Palette number (0-15) - \~french Numéro de la palette (0-15) - \~\param palette - \~english Palette to load ((void*)palette_name) - \~french Nom de la palette à charger ((void*)nom_palette) -*/ -static inline void PA_LoadSpritePal(u8 screen, u8 palette_number, void* palette){ - PA_LoadSpriteExtPal(screen, palette_number, palette); -} - -/*! \fn PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette) - \brief - \~english Load a 256 color palette in the Background palettes, to a given slot - \~french Charger une palette de 256 couleurs dans les palettes des fonds, à un slot donné - \~\param screen - \~english Screen... - \~french Ecran... - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond (0-3) - \~\param pal_number - \~english Palette number - \~french Numéro de palette - \~\param palette - \~english Palette to load ((void*)palette_name) - \~french Nom de la palette à charger ((void*)nom_palette) -*/ -void PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette); - -/*! \fn void PA_LoadBgPal(u8 screen, u16 bg_number, void* palette) - \brief - \~english Load a 256 color palette in the Background palettes - \~french Charger une palette de 256 couleurs dans les palettes des fonds - \~\param screen - \~english Screen... - \~french Ecran... - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond (0-3) - \~\param palette - \~english Palette to load ((void*)palette_name) - \~french Nom de la palette à charger ((void*)nom_palette) -*/ -static inline void PA_LoadBgPal(u8 screen, u16 bg_number, void* palette){ - PA_LoadBgPalN(screen, bg_number, 0, palette); -} - -/*! \fn void PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette) - \brief - \~english Load a 256 color palette in a given Background's palette - \~french Charger une palette de 256 couleurs dans les palettes des fonds - \~\param screen - \~english Screen... - \~french Ecran... - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond (0-3) - \~\param pal_number - \~english Palette number (0-15) - \~french Numéro de la palette (0-15) - \~\param palette - \~english Palette to load ((void*)palette_name) - \~french Nom de la palette à charger ((void*)nom_palette) -*/ -void PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette); - - -/*! \def PA_SetBgPalCol(screen, color_number, colorRGB) - \brief - \~english Change the color of one of the main background palette colors. Not used anymore - \~french Changer la couleur d'une des couleurs de la palette des fonds. Ne plus utiliser - \~\param screen - \~english Screen... - \~french Ecran... - \~\param color_number - \~english Color number in palette (0-255) - \~french Numéro de la couleur dans la palette (0-255) - \~\param colorRGB - \~english RGB value, like PA_RGB(31, 31, 31) for white - \~french Valeur RGB, comme PA_RGB(31, 31, 31) pour blanc -*/ -#define PA_SetBgPalCol(screen, color_number, colorRGB) BG_PALETTE[color_number + ((screen) << 9)] = colorRGB - -/*! \fn void PA_SetBgPalNCol(u8 screen, u8 bg_number, u8 pal_number, u8 color_number, u16 color) - \brief - \~english Change the color of one of the backgrounds' palettes' colors - \~french Changer la couleur d'une des couleurs d'une palette d'un fonds - \~\param screen - \~english Screen... - \~french Ecran... - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond (0-3) - \~\param pal_number - \~english Palette number (0-15). Leave to 0 if unsure - \~french Numéro de palette (0-15), laisser à 0 si pas sur... - \~\param color_number - \~english Color number in palette (0-255) - \~french Numéro de la couleur dans la palette (0-255) - \~\param color - \~english RGB value, like PA_RGB(31, 31, 31) for white - \~french Valeur RGB, comme PA_RGB(31, 31, 31) pour blanc -*/ -void PA_SetBgPalNCol(u8 screen, u8 bg_number, u8 pal_number, u8 color_number, u16 color); - -/*! \fn static inline void PA_SetBgColor(u8 screen, u16 color) - \brief - \~english Change the background color of a given screen - \~french Changer la couleur de fond d'un écran - \~\param screen - \~english Screen... - \~french Ecran... - \~\param color - \~english RGB value, like PA_RGB(31, 31, 31) for white - \~french Valeur RGB, comme PA_RGB(31, 31, 31) pour blanc -*/ -static inline void PA_SetBgColor(u8 screen, u16 color){ - BG_PALETTE[screen<<9] = color; -} - -/*! \fn void PA_SetSpritePalCol(u8 screen, u8 pal_number, u8 color_number, u16 color) - \brief - \~english Changes a color in a sprite palette - \~french Changer la couleur de fond d'un écran - \~\param screen - \~english Screen... - \~french Ecran... - \~\param pal_number - \~english Palette number - \~french Numéro de la palette - \~\param color_number - \~english Color in the palette - \~french Numéro de la couleur - \~\param color - \~english Color (given by PA_RGB...) - \~french Couleur (venant de PA_RGB...) -*/ -void PA_SetSpritePalCol(u8 screen, u8 pal_number, u8 color_number, u16 color); - -/*! \fn void PA_3DSetSpritePalCol(u8 pal_number, u8 color_number, u16 color) - \brief - Changes a color in a 3d sprite palette - \param pal_number - Palette number - \param color_number - Color number in the palette - \param color - Color (given by PA_RGB...) -*/ -void PA_3DSetSpritePalCol(u8 pal_number, u8 color_number, u16 color); - -#define PA_AdjustCol(color, bright) do{color+= bright; if (color < 0) color = 0; if (color > 31) color = 31;}while(0) - -void PA_CreatePalBright(u16 *pal, u16 *newpal, s8 bright); -void PA_CreatePalTransition(u16 *pal, u16 *newpal, s8 level, u8 destr, u8 destg, u8 destb); - -/** @} */ // end of Palette -////////////////////////////////////////////////////////////////////// - -static inline void* PA_GetBgPal(u8 screen, u8 bg_number){ - if (screen == 0) return (void*)(VRAM_E + (bg_number << 12)); - else return (void*)(VRAM_H + (bg_number << 12)); -} - -#endif +#ifndef _PA_Palette +#define _PA_Palette + +void PA_LoadSpriteExtPal(u8 screen, u16 palette_number, void* palette); +#define PA_LoadBgExtPal(screen, bg_number, palette) PA_LoadBgPal(screen, bg_number, palette) + +/*! \file PA_Palette.h + \brief Everything concerning the palette system + + Not much for now, only a function to load a complete palette to a given palette +*/ + +////////////////////////////////////////////////////////////////////// +// Système pour les palettes +////////////////////////////////////////////////////////////////////// +#define PAL_BG0 0x05000000 +#define PAL_SPRITE0 0x05000200 +#define PAL_BG1 0x05000400 +#define PAL_SPRITE1 0x05000600 + +#define REG_BRIGHT 0x0400006C // Brightness + +/** @defgroup Palette Palette system + * Load palettes, change palette colors, set the gamma, etc... + * @{ + */ + +/*! \def PA_LoadPal(palette, source) + \brief + \~english Load a 256 color palette in the Bg or Sprite palette of screen 0 or 1. Ex : PA_LoadPal(PALETTE_BG1, bg_pal); + \~french Charger une palette de 256 couleurs pour les fonds ou les sprites pour l'écran 0 ou 1. Ex : PA_LoadPal(PALETTE_BG1, bg_pal); + \~\param palette + \~english Set the Bg palette or Obj palette, screen 0 or 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, or PAL_SPRITE1 + \~french Charger pour les Bg ou les Sprites, sur l'écran 0 ou 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, ou PAL_SPRITE1 + \~\param source + \~english Palette name (ex : master_Palette) + \~french Nom de la palette (ex : master_Palette) +*/ +#define PA_LoadPal(palette, source) do{\ + DMA_Copy((void*)source, (void*)palette, 256, DMA_16NOW);\ + if (palette == PAL_SPRITE0) PA_LoadSpritePal(0, 0, (void*)source);\ + if (palette == PAL_SPRITE1) PA_LoadSpritePal(1, 0, (void*)source);\ + if (palette == PAL_BG0) {u8 itemp; for (itemp = 0; itemp < 4; itemp++) PA_LoadBgPal(0, itemp, (void*)(source));}\ + if (palette == PAL_BG1) {u8 itemp; for (itemp = 0; itemp < 4; itemp++) PA_LoadBgPal(1, itemp, (void*)(source));}}while(0) + + +/*! \fn static inline void PA_Load8bitBgPal(u8 screen, void *Pal) + \brief + \~english Load a palette to be used by the 8bit background + \~french Charger une palette pour le fond 8bit + \~\param screen + \~english Screen... + \~french Ecran... + \~\param Pal + \~english Palette name (ex : master_Palette) + \~french Nom de la palette (ex : master_Palette) +*/ +static inline void PA_Load8bitBgPal(u8 screen, void *Pal){ + u32 dest = PAL_BG0 + (screen<<10); + DMA_Copy((void*)Pal, (void*)dest, 256, DMA_16NOW); +} + +/*! \def PA_LoadPal16(palette, n_palette, source) + \brief + \~english Load a 16 color palette in the Bg or Sprite palette of screen 0 or 1. Ex : PA_LoadPal16(PALETTE_BG1, 4, bg_pal); + \~french Charger une palette de 16 couleurs pour les fonds ou les sprites pour l'écran 0 ou 1. Ex : PA_LoadPal16(PALETTE_BG1, 4, bg_pal); + \~\param palette + \~english Set the Bg palette or Obj palette, screen 0 or 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, or PAL_SPRITE1 + \~french Charger pour les Bg ou les Sprites, sur l'écran 0 ou 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, ou PAL_SPRITE1 + \~\param n_palette + \~english Number of the 16 color palette to load (0-15) + \~french Numéro de la palette de 16 couleurs que l'on veut charger (0-15) + + \~\param source + \~english Palette name (ex : master_Palette) + \~french Nom de la palette (ex : master_Palette) +*/ +#define PA_LoadPal16(palette, n_palette, source) DMA_Copy((void*)source, (void*)(palette + (n_palette << 5)), 16, DMA_16NOW) + +/*! \def PA_LoadSprite16cPal(screen, n_palette, palette) + \brief + \~english Load a 16 color palette for sprites + \~french Charger une palette de 16 couleurs pour les sprites + \~\param screen + \~english Screen (0-1) + \~french Ecran (0-1) + \~\param n_palette + \~english Number of the 16 color palette to load (0-15) + \~french Numéro de la palette de 16 couleurs que l'on veut charger (0-15) + + \~\param palette + \~english Palette name (ex : Sprite_Pal) + \~french Nom de la palette (ex : Sprite_Pal) +*/ +#define PA_LoadSprite16cPal(screen, n_palette, palette) PA_LoadPal16((PAL_SPRITE0+(0x400*screen)), (n_palette), palette) + +/*! \def PA_RGB(r,g,b) + \brief + \~english Convert Red, Green, and Blue color indexes into a number used in the palette system. Careful : the R, G, B values range from 0 to 31 on gba ! + \~french Convertir une couleurs au format Rouge, Vert, Bleu en un nombre utilisable par le système de palette. Attention : sur Gba, les valeurs vont de 0 à 31... + \~\param r + \~english Red (0-31) + \~french Rouge (0-31) + \~\param g + \~english Green (0-31) + \~french Vert (0-31) + \~\param b + \~english Blue (0-31) + \~french Bleu (0-31) + +*/ +#define PA_RGB(r,g,b) ((1<<15) | (r) | ((g)<<5) | ((b)<<10)) + +/*! \fn void PA_SetBrightness(u8 screen, s8 bright) + \brief + \~english Set the screen's brightness + \~french Régler la luminosité de l'écran + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bright + \~english Brightness level, from -32 to 32, 0 being neutral + \~french Luminosité, de -32 à 32, 0 étant neutre +*/ +void PA_SetBrightness(u8 screen, s8 bright); + +/*! \fn static inline void PA_SetPalNeg(u32 palette) + \brief + \~english Set all the palette's color to negative. To undo this, simply negative again... + \~french Négativer une palette donnée. Pour annuler, il suffit de négativer à nouveau. + \~\param palette + \~english Set the Bg palette or Obj palette, screen 0 or 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, or PAL_SPRITE1 + \~french Charger pour les Bg ou les Sprites, sur l'écran 0 ou 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, ou PAL_SPRITE1 +*/ +static inline void PA_SetPalNeg(u32 palette) { + u16* pal = (u16*)palette; + int i; + + for (i = 0; i < 256; i++) pal[i] = ~pal[i]; // On fout le négatif... +} + +/*! \fn static inline void PA_SetPal16Neg(u32 palette, u8 n_palette) + \brief + \~english Set 16 color palette to negative. To undo this, simply negative again... + \~french Négativer une palette de 16 couleurs donnée. Pour annuler, il suffit de négativer à nouveau. + \~\param palette + \~english Set the Bg palette or Obj palette, screen 0 or 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, or PAL_SPRITE1 + \~french Charger pour les Bg ou les Sprites, sur l'écran 0 ou 1 : PAL_BG0, PAL_SPRITE0, PAL_BG1, ou PAL_SPRITE1 + \~\param n_palette + \~english Number of the 16 color palette (0-15) + \~french Numéro de la palette de 16 couleurs (0-15) +*/ +static inline void PA_SetPal16Neg(u32 palette, u8 n_palette) { + u16* pal = (u16*)palette; + int i; + + for (i = (n_palette << 4); i < ((n_palette + 1) << 4); i++) pal[i] = ~pal[i]; // On fout le négatif... +} + + +/*! \fn void PA_InitSpriteExtPal() + \brief + \~english Initialise 16 palette mode for 256 color sprites. Done by default + \~french Initialise le mode 16 palettes pour sprites de 256 couleurs... Effectué par défaut +*/ +void PA_InitSpriteExtPal(); + + +/*! \fn void PA_InitBgExtPal() + \brief + \~english Initialise 16 palette mode for 256 color backgrounds + \~french Initialise le mode 16 palettes pour fonds de 256 couleurs... +*/ +void PA_InitBgExtPal(); + +/*! \fn void PA_LoadSpritePal(u8 screen, u8 palette_number, void* palette) + \brief + \~english Load a 256 color palette for Sprites + \~french Charger une palette de 256 couleurs pour les sprites + \~\param screen + \~english Screen... + \~french Ecran... + \~\param palette_number + \~english Palette number (0-15) + \~french Numéro de la palette (0-15) + \~\param palette + \~english Palette to load ((void*)palette_name) + \~french Nom de la palette à charger ((void*)nom_palette) +*/ +static inline void PA_LoadSpritePal(u8 screen, u8 palette_number, void* palette){ + PA_LoadSpriteExtPal(screen, palette_number, palette); +} + +/*! \fn PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette) + \brief + \~english Load a 256 color palette in the Background palettes, to a given slot + \~french Charger une palette de 256 couleurs dans les palettes des fonds, à un slot donné + \~\param screen + \~english Screen... + \~french Ecran... + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond (0-3) + \~\param pal_number + \~english Palette number + \~french Numéro de palette + \~\param palette + \~english Palette to load ((void*)palette_name) + \~french Nom de la palette à charger ((void*)nom_palette) +*/ +void PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette); + +/*! \fn void PA_LoadBgPal(u8 screen, u16 bg_number, void* palette) + \brief + \~english Load a 256 color palette in the Background palettes + \~french Charger une palette de 256 couleurs dans les palettes des fonds + \~\param screen + \~english Screen... + \~french Ecran... + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond (0-3) + \~\param palette + \~english Palette to load ((void*)palette_name) + \~french Nom de la palette à charger ((void*)nom_palette) +*/ +static inline void PA_LoadBgPal(u8 screen, u16 bg_number, void* palette){ + PA_LoadBgPalN(screen, bg_number, 0, palette); +} + +/*! \fn void PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette) + \brief + \~english Load a 256 color palette in a given Background's palette + \~french Charger une palette de 256 couleurs dans les palettes des fonds + \~\param screen + \~english Screen... + \~french Ecran... + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond (0-3) + \~\param pal_number + \~english Palette number (0-15) + \~french Numéro de la palette (0-15) + \~\param palette + \~english Palette to load ((void*)palette_name) + \~french Nom de la palette à charger ((void*)nom_palette) +*/ +void PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette); + + +/*! \def PA_SetBgPalCol(screen, color_number, colorRGB) + \brief + \~english Change the color of one of the main background palette colors. Not used anymore + \~french Changer la couleur d'une des couleurs de la palette des fonds. Ne plus utiliser + \~\param screen + \~english Screen... + \~french Ecran... + \~\param color_number + \~english Color number in palette (0-255) + \~french Numéro de la couleur dans la palette (0-255) + \~\param colorRGB + \~english RGB value, like PA_RGB(31, 31, 31) for white + \~french Valeur RGB, comme PA_RGB(31, 31, 31) pour blanc +*/ +#define PA_SetBgPalCol(screen, color_number, colorRGB) BG_PALETTE[color_number + ((screen) << 9)] = colorRGB + +/*! \fn void PA_SetBgPalNCol(u8 screen, u8 bg_number, u8 pal_number, u8 color_number, u16 color) + \brief + \~english Change the color of one of the backgrounds' palettes' colors + \~french Changer la couleur d'une des couleurs d'une palette d'un fonds + \~\param screen + \~english Screen... + \~french Ecran... + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond (0-3) + \~\param pal_number + \~english Palette number (0-15). Leave to 0 if unsure + \~french Numéro de palette (0-15), laisser à 0 si pas sur... + \~\param color_number + \~english Color number in palette (0-255) + \~french Numéro de la couleur dans la palette (0-255) + \~\param color + \~english RGB value, like PA_RGB(31, 31, 31) for white + \~french Valeur RGB, comme PA_RGB(31, 31, 31) pour blanc +*/ +void PA_SetBgPalNCol(u8 screen, u8 bg_number, u8 pal_number, u8 color_number, u16 color); + +/*! \fn static inline void PA_SetBgColor(u8 screen, u16 color) + \brief + \~english Change the background color of a given screen + \~french Changer la couleur de fond d'un écran + \~\param screen + \~english Screen... + \~french Ecran... + \~\param color + \~english RGB value, like PA_RGB(31, 31, 31) for white + \~french Valeur RGB, comme PA_RGB(31, 31, 31) pour blanc +*/ +static inline void PA_SetBgColor(u8 screen, u16 color){ + BG_PALETTE[screen<<9] = color; +} + +/*! \fn void PA_SetSpritePalCol(u8 screen, u8 pal_number, u8 color_number, u16 color) + \brief + \~english Changes a color in a sprite palette + \~french Changer la couleur de fond d'un écran + \~\param screen + \~english Screen... + \~french Ecran... + \~\param pal_number + \~english Palette number + \~french Numéro de la palette + \~\param color_number + \~english Color in the palette + \~french Numéro de la couleur + \~\param color + \~english Color (given by PA_RGB...) + \~french Couleur (venant de PA_RGB...) +*/ +void PA_SetSpritePalCol(u8 screen, u8 pal_number, u8 color_number, u16 color); + +/*! \fn void PA_3DSetSpritePalCol(u8 pal_number, u8 color_number, u16 color) + \brief + Changes a color in a 3d sprite palette + \param pal_number + Palette number + \param color_number + Color number in the palette + \param color + Color (given by PA_RGB...) +*/ +void PA_3DSetSpritePalCol(u8 pal_number, u8 color_number, u16 color); + +#define PA_AdjustCol(color, bright) do{color+= bright; if (color < 0) color = 0; if (color > 31) color = 31;}while(0) + +void PA_CreatePalBright(u16 *pal, u16 *newpal, s8 bright); +void PA_CreatePalTransition(u16 *pal, u16 *newpal, s8 level, u8 destr, u8 destg, u8 destb); + +/** @} */ // end of Palette +////////////////////////////////////////////////////////////////////// + +static inline void* PA_GetBgPal(u8 screen, u8 bg_number){ + if (screen == 0) return (void*)(VRAM_E + (bg_number << 12)); + else return (void*)(VRAM_H + (bg_number << 12)); +} + +#endif diff --git a/include/arm9/PA_PaletteDual.h b/include/arm9/PA_PaletteDual.h index f29330f..2b69f73 100644 --- a/include/arm9/PA_PaletteDual.h +++ b/include/arm9/PA_PaletteDual.h @@ -1,155 +1,155 @@ -#ifndef _PA_PaletteDual -#define _PA_PaletteDual - - -// Left for backwards compatibility -#define PA_DualLoadSpriteExtPal PA_DualLoadSpritePal - - -/*! \file PA_PaletteDual.h - \brief Everything concerning the palette system, for both screens at once - - Not much for now, only a function to load a complete palette to a given palette -*/ - -#include "PA_Palette.h" - -#define PAL_BG PAL_BG0 -#define PAL_SPRITE PAL_SPRITE0 - - -/** @defgroup PaletteDual Palette system for Dual Screen - * Load palettes, change palette colors, set the gamma, etc... on both screens ! - * @{ - */ - - -/*! \def PA_DualLoadPal(palette, source) - \brief - \~english Load a 256 color palette in the Bg or Sprite palette of both screens - \~french Charger une palette de 256 couleurs pour les fonds ou les sprites pour les 2 écrans - \~\param palette - \~english Set the Bg palette or Sprite palette : PAL_BG or PAL_SPRITE - \~french Charger pour les Bg ou les Sprites : PAL_BG ou PAL_SPRITE - \~\param source - \~english Palette name (ex : master_Palette) - \~french Nom de la palette (ex : master_Palette) -*/ -#define PA_DualLoadPal(palette, source) do{\ - DMA_Copy((void*)source, (void*)palette, 256, DMA_16NOW);\ - DMA_Copy((void*)(source+1024), (void*)palette, 256, DMA_16NOW);\ - if(palette == PAL_SPRITE)\ - PA_DualLoadSpriteExtPal(0, (void*)palette);\ -}while(0) - - - - -/*! \def PA_DualLoadPal16(palette, n_palette, source) - \brief - \~english Load a 16 color palette in the Bg or Sprite palette of both screens - \~french Charger une palette de 16 couleurs pour les fonds ou les sprites pour les deux écrans - \~\param palette - \~english Set the Bg palette or Obj palette : PAL_BG or PAL_SPRITE - \~french Charger pour les Bg ou les Sprites : PAL_BG ou PAL_SPRITE - \~\param n_palette - \~english Number of the 16 color palette to load (0-15) - \~french Numéro de la palette de 16 couleurs que l'on veut charger (0-15) - - \~\param source - \~english Palette name (ex : master_Palette) - \~french Nom de la palette (ex : master_Palette) -*/ -#define PA_DualLoadPal16(palette, n_palette, source) do{\ - DMA_Copy((void*)source, (void*)(palette + (n_palette << 5)), 16, DMA_16NOW);\ - DMA_Copy((void*)source, (void*)(palette + 1024 + (n_palette << 5)), 16, DMA_16NOW);}while(0) - - - - -/*! \fn static inline void PA_DualSetPalNeg(u32 palette) - \brief - \~english Set all the palette's color to negative. To undo this, simply negative again... - \~french Négativer une palette donnée. Pour annuler, il suffit de négativer à nouveau. - \~\param palette - \~english Set the Bg palette or Obj palette : PAL_BG, PAL_SPRITE - \~french Charger pour les Bg ou les Sprites : PAL_BG, PAL_SPRITE -*/ -static inline void PA_DualSetPalNeg(u32 palette) { - u16* pal = (u16*)palette; - int i; - for (i = 0; i < 256; i++) { - pal[i+512] = pal[i] = ~pal[i]; // On fout le négatif... - } -} - - - - -/*! \fn static inline void PA_DualSetPal16Neg(u32 palette, u8 n_palette) - \brief - \~english Set 16 color palette to negative. To undo this, simply negative again... - \~french Négativer une palette de 16 couleurs donnée. Pour annuler, il suffit de négativer à nouveau. - \~\param palette - \~english Set the Bg palette or Obj palette : PAL_BG, PAL_SPRITE - \~french Charger pour les Bg ou les Sprites : PAL_BG, PAL_SPRITE - \~\param n_palette - \~english Number of the 16 color palette (0-15) - \~french Numéro de la palette de 16 couleurs (0-15) -*/ -static inline void PA_DualSetPal16Neg(u32 palette, u8 n_palette) { - u16* pal = (u16*)palette; - int i; - for (i = (n_palette << 4); i < ((n_palette + 1) << 4); i++) { - pal[i+512] = pal[i] = ~pal[i]; // On fout le négatif... - } -} - -/*! \fn static inline void PA_DualLoadSpritePal(u8 palette_number, void* palette) - \brief - \~english Load a 256 color palette in the Sprite palettes - \~french Charger une palette de 256 couleurs dans les palettes des sprites - \~\param palette_number - \~english Palette number (0-15) - \~french Numéro de la palette (0-15) - \~\param palette - \~english Palette to load ((void*)palette_name) - \~french Nom de la palette à charger ((void*)nom_palette) -*/ -static inline void PA_DualLoadSpritePal(u8 palette_number, void* palette){ - PA_LoadSpriteExtPal(0, palette_number, palette); - PA_LoadSpriteExtPal(1, palette_number, palette); -} - -/*! \fn static inline void PA_DualLoadBgPal(u8 bg_number, void* palette) - \brief - \~english Load a 256 color palette for a given background - \~french Charger une palette de 256 couleurs pour un fond - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond (0-3) - \~\param palette - \~english Palette to load ((void*)palette_name) - \~french Nom de la palette à charger ((void*)nom_palette) -*/ -static inline void PA_DualLoadBgPal(u8 bg_number, void* palette){ - PA_LoadBgPal(0, bg_number, palette); - PA_LoadBgPal(1, bg_number, palette); -} - -/*! \fn static inline void PA_DualSetBgColor(u16 color) - \brief - \~english Change the background color of both screens - \~french Changer la couleur de fond des 2 écrans - \~\param color - \~english RGB value, like PA_RGB(31, 31, 31) for white - \~french Valeur RGB, comme PA_RGB(31, 31, 31) pour blanc -*/ -static inline void PA_DualSetBgColor(u16 color){ - BG_PALETTE[512] = BG_PALETTE[0] = color; -} - -/** @} */ // end of Palette -////////////////////////////////////////////////////////////////////// - -#endif +#ifndef _PA_PaletteDual +#define _PA_PaletteDual + + +// Left for backwards compatibility +#define PA_DualLoadSpriteExtPal PA_DualLoadSpritePal + + +/*! \file PA_PaletteDual.h + \brief Everything concerning the palette system, for both screens at once + + Not much for now, only a function to load a complete palette to a given palette +*/ + +#include "PA_Palette.h" + +#define PAL_BG PAL_BG0 +#define PAL_SPRITE PAL_SPRITE0 + + +/** @defgroup PaletteDual Palette system for Dual Screen + * Load palettes, change palette colors, set the gamma, etc... on both screens ! + * @{ + */ + + +/*! \def PA_DualLoadPal(palette, source) + \brief + \~english Load a 256 color palette in the Bg or Sprite palette of both screens + \~french Charger une palette de 256 couleurs pour les fonds ou les sprites pour les 2 écrans + \~\param palette + \~english Set the Bg palette or Sprite palette : PAL_BG or PAL_SPRITE + \~french Charger pour les Bg ou les Sprites : PAL_BG ou PAL_SPRITE + \~\param source + \~english Palette name (ex : master_Palette) + \~french Nom de la palette (ex : master_Palette) +*/ +#define PA_DualLoadPal(palette, source) do{\ + DMA_Copy((void*)source, (void*)palette, 256, DMA_16NOW);\ + DMA_Copy((void*)(source+1024), (void*)palette, 256, DMA_16NOW);\ + if(palette == PAL_SPRITE)\ + PA_DualLoadSpriteExtPal(0, (void*)palette);\ +}while(0) + + + + +/*! \def PA_DualLoadPal16(palette, n_palette, source) + \brief + \~english Load a 16 color palette in the Bg or Sprite palette of both screens + \~french Charger une palette de 16 couleurs pour les fonds ou les sprites pour les deux écrans + \~\param palette + \~english Set the Bg palette or Obj palette : PAL_BG or PAL_SPRITE + \~french Charger pour les Bg ou les Sprites : PAL_BG ou PAL_SPRITE + \~\param n_palette + \~english Number of the 16 color palette to load (0-15) + \~french Numéro de la palette de 16 couleurs que l'on veut charger (0-15) + + \~\param source + \~english Palette name (ex : master_Palette) + \~french Nom de la palette (ex : master_Palette) +*/ +#define PA_DualLoadPal16(palette, n_palette, source) do{\ + DMA_Copy((void*)source, (void*)(palette + (n_palette << 5)), 16, DMA_16NOW);\ + DMA_Copy((void*)source, (void*)(palette + 1024 + (n_palette << 5)), 16, DMA_16NOW);}while(0) + + + + +/*! \fn static inline void PA_DualSetPalNeg(u32 palette) + \brief + \~english Set all the palette's color to negative. To undo this, simply negative again... + \~french Négativer une palette donnée. Pour annuler, il suffit de négativer à nouveau. + \~\param palette + \~english Set the Bg palette or Obj palette : PAL_BG, PAL_SPRITE + \~french Charger pour les Bg ou les Sprites : PAL_BG, PAL_SPRITE +*/ +static inline void PA_DualSetPalNeg(u32 palette) { + u16* pal = (u16*)palette; + int i; + for (i = 0; i < 256; i++) { + pal[i+512] = pal[i] = ~pal[i]; // On fout le négatif... + } +} + + + + +/*! \fn static inline void PA_DualSetPal16Neg(u32 palette, u8 n_palette) + \brief + \~english Set 16 color palette to negative. To undo this, simply negative again... + \~french Négativer une palette de 16 couleurs donnée. Pour annuler, il suffit de négativer à nouveau. + \~\param palette + \~english Set the Bg palette or Obj palette : PAL_BG, PAL_SPRITE + \~french Charger pour les Bg ou les Sprites : PAL_BG, PAL_SPRITE + \~\param n_palette + \~english Number of the 16 color palette (0-15) + \~french Numéro de la palette de 16 couleurs (0-15) +*/ +static inline void PA_DualSetPal16Neg(u32 palette, u8 n_palette) { + u16* pal = (u16*)palette; + int i; + for (i = (n_palette << 4); i < ((n_palette + 1) << 4); i++) { + pal[i+512] = pal[i] = ~pal[i]; // On fout le négatif... + } +} + +/*! \fn static inline void PA_DualLoadSpritePal(u8 palette_number, void* palette) + \brief + \~english Load a 256 color palette in the Sprite palettes + \~french Charger une palette de 256 couleurs dans les palettes des sprites + \~\param palette_number + \~english Palette number (0-15) + \~french Numéro de la palette (0-15) + \~\param palette + \~english Palette to load ((void*)palette_name) + \~french Nom de la palette à charger ((void*)nom_palette) +*/ +static inline void PA_DualLoadSpritePal(u8 palette_number, void* palette){ + PA_LoadSpriteExtPal(0, palette_number, palette); + PA_LoadSpriteExtPal(1, palette_number, palette); +} + +/*! \fn static inline void PA_DualLoadBgPal(u8 bg_number, void* palette) + \brief + \~english Load a 256 color palette for a given background + \~french Charger une palette de 256 couleurs pour un fond + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond (0-3) + \~\param palette + \~english Palette to load ((void*)palette_name) + \~french Nom de la palette à charger ((void*)nom_palette) +*/ +static inline void PA_DualLoadBgPal(u8 bg_number, void* palette){ + PA_LoadBgPal(0, bg_number, palette); + PA_LoadBgPal(1, bg_number, palette); +} + +/*! \fn static inline void PA_DualSetBgColor(u16 color) + \brief + \~english Change the background color of both screens + \~french Changer la couleur de fond des 2 écrans + \~\param color + \~english RGB value, like PA_RGB(31, 31, 31) for white + \~french Valeur RGB, comme PA_RGB(31, 31, 31) pour blanc +*/ +static inline void PA_DualSetBgColor(u16 color){ + BG_PALETTE[512] = BG_PALETTE[0] = color; +} + +/** @} */ // end of Palette +////////////////////////////////////////////////////////////////////// + +#endif diff --git a/include/arm9/PA_Reco.h b/include/arm9/PA_Reco.h index 6a9176a..c74e908 100644 --- a/include/arm9/PA_Reco.h +++ b/include/arm9/PA_Reco.h @@ -1,115 +1,115 @@ -#ifndef _PA_Reco -#define _PA_Reco - -#ifdef __cplusplus -extern "C" { -#endif - -#include "PA9.h" - -/*! \file PA_Reco.h - \brief Touchscreen Shape recognotion system - - This will allow to recognize basic shapes drawn by the user ! -*/ - -typedef struct{ - u8 x, y; -} PA_StylusPosition; -extern PA_StylusPosition PA_StylusPos[20000]; - -#define PA_RECOTESTS 30 - -typedef struct{ - char letter; - char code[16]; -} PA_FormType; - -extern PA_FormType PA_Graffiti[PA_RECOTESTS]; - -typedef struct{ - u32 nvalues, oldn, veryold; -} PA_RecoValues; -extern PA_RecoValues PA_Reco; - -typedef struct{ - u32 Length; - u8 minX, minY, maxX, maxY; // Shape limits - u8 startX, startY, endX, endY; // Start and end position - s16 Angle; - s32 Difference; - u8 Shape; -} PA_RecoInfos; -extern PA_RecoInfos PA_RecoInfo; - -extern char PA_RecoShape[16]; // Stores the recognized pattern - -extern u8 PA_UseGraffiti; - -extern u8 PA_CustomReco; // number of custom shapes -extern PA_FormType PA_CustomShape[200]; - -/** @defgroup Reco Shape Recognition - * Draw a shape and have it recognized ! - * @{ - */ - -/*! - \fn char PA_CheckLetter() - \brief - \~english Analyzes the drawn shape and returns a letter according to it. 0 if nothing. The drawn shape's string is copied into PA_RecoShape on Stylus Release. You can find a copy of the current letters used here : http://www.palib.info/Reco/PAGraffiti.gif - \~french Analyse la forme et renvoie une lettre correspondante. 0 si rien. La chaine représentative de la forme est copiée dans PA_RecoShape au Stylus Release. Copie des images dispos : http://www.palib.info/Reco/PAGraffiti.gif -*/ -char PA_CheckLetter(); - -/*! - \fn static inline void PA_RecoAddShape(char letter, char *shape) - \brief - \~english Adds a new shape to the recognition system - \~french Ajouter une nouvelle forme au système de reconnaissance - \~\param letter - \~english Letter it will return for that shape (you can use any thing, even a number from 1 to 255) - \~french Lettre renvoyée par le système de reconnaissance pour cette forme (peut être n'imorte quelle lettre, ou un nombre de 1 à 255) - \~\param shape - \~english 15 characters string given by the recognition system in PA_RecoShape - \~french Chaine de 15 caractères fournie par le systeme de reconnaissance in PA_RecoShape -*/ -static inline void PA_RecoAddShape(char letter, char *shape){ - PA_CustomShape[PA_CustomReco].letter = letter; - int i; - for (i = 0; i < 16; i++) - PA_CustomShape[PA_CustomReco].code[i] = shape[i]; - PA_CustomReco++; -} - -/*! - \fn static inline void PA_ResetRecoSys(void) - \brief - \~english Resets the Recognition system - \~french Réinitialise le systeme de reconnaissance -*/ -static inline void PA_ResetRecoSys(){ - PA_CustomReco = 0; - PA_UseGraffiti = 1; -} - -/*! - \fn static inline void PA_UsePAGraffiti(u8 use) - \brief - \~english Set on or off the PA Graffiti letters. You'll want to turn them off if you plan on using your own shapes.... - \~french Activer ou désactiver les lettres PA Graffiti. On voudra le désactiver quand on veut utiliser uniquement ses propres formes - \~\param use - \~english 1/0, on/off... - \~french 1/0, on/off... -*/ -static inline void PA_UsePAGraffiti(u8 use){ - PA_UseGraffiti = use; -} - -/** @} */ // end of Reco - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_Reco +#define _PA_Reco + +#ifdef __cplusplus +extern "C" { +#endif + +#include "PA9.h" + +/*! \file PA_Reco.h + \brief Touchscreen Shape recognotion system + + This will allow to recognize basic shapes drawn by the user ! +*/ + +typedef struct{ + u8 x, y; +} PA_StylusPosition; +extern PA_StylusPosition PA_StylusPos[20000]; + +#define PA_RECOTESTS 30 + +typedef struct{ + char letter; + char code[16]; +} PA_FormType; + +extern PA_FormType PA_Graffiti[PA_RECOTESTS]; + +typedef struct{ + u32 nvalues, oldn, veryold; +} PA_RecoValues; +extern PA_RecoValues PA_Reco; + +typedef struct{ + u32 Length; + u8 minX, minY, maxX, maxY; // Shape limits + u8 startX, startY, endX, endY; // Start and end position + s16 Angle; + s32 Difference; + u8 Shape; +} PA_RecoInfos; +extern PA_RecoInfos PA_RecoInfo; + +extern char PA_RecoShape[16]; // Stores the recognized pattern + +extern u8 PA_UseGraffiti; + +extern u8 PA_CustomReco; // number of custom shapes +extern PA_FormType PA_CustomShape[200]; + +/** @defgroup Reco Shape Recognition + * Draw a shape and have it recognized ! + * @{ + */ + +/*! + \fn char PA_CheckLetter() + \brief + \~english Analyzes the drawn shape and returns a letter according to it. 0 if nothing. The drawn shape's string is copied into PA_RecoShape on Stylus Release. You can find a copy of the current letters used here : http://www.palib.info/Reco/PAGraffiti.gif + \~french Analyse la forme et renvoie une lettre correspondante. 0 si rien. La chaine représentative de la forme est copiée dans PA_RecoShape au Stylus Release. Copie des images dispos : http://www.palib.info/Reco/PAGraffiti.gif +*/ +char PA_CheckLetter(); + +/*! + \fn static inline void PA_RecoAddShape(char letter, char *shape) + \brief + \~english Adds a new shape to the recognition system + \~french Ajouter une nouvelle forme au système de reconnaissance + \~\param letter + \~english Letter it will return for that shape (you can use any thing, even a number from 1 to 255) + \~french Lettre renvoyée par le système de reconnaissance pour cette forme (peut être n'imorte quelle lettre, ou un nombre de 1 à 255) + \~\param shape + \~english 15 characters string given by the recognition system in PA_RecoShape + \~french Chaine de 15 caractères fournie par le systeme de reconnaissance in PA_RecoShape +*/ +static inline void PA_RecoAddShape(char letter, char *shape){ + PA_CustomShape[PA_CustomReco].letter = letter; + int i; + for (i = 0; i < 16; i++) + PA_CustomShape[PA_CustomReco].code[i] = shape[i]; + PA_CustomReco++; +} + +/*! + \fn static inline void PA_ResetRecoSys(void) + \brief + \~english Resets the Recognition system + \~french Réinitialise le systeme de reconnaissance +*/ +static inline void PA_ResetRecoSys(){ + PA_CustomReco = 0; + PA_UseGraffiti = 1; +} + +/*! + \fn static inline void PA_UsePAGraffiti(u8 use) + \brief + \~english Set on or off the PA Graffiti letters. You'll want to turn them off if you plan on using your own shapes.... + \~french Activer ou désactiver les lettres PA Graffiti. On voudra le désactiver quand on veut utiliser uniquement ses propres formes + \~\param use + \~english 1/0, on/off... + \~french 1/0, on/off... +*/ +static inline void PA_UsePAGraffiti(u8 use){ + PA_UseGraffiti = use; +} + +/** @} */ // end of Reco + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_Sound.h b/include/arm9/PA_Sound.h index 8bce192..2790fc8 100644 --- a/include/arm9/PA_Sound.h +++ b/include/arm9/PA_Sound.h @@ -1,46 +1,46 @@ -#ifndef _PA_SOUND9_ -#define _PA_SOUND9_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -// Some macros to improve compatibility to old code -#define PA_PlaySimpleSound(name) AS_SoundDefaultPlay((u8*)name, (u32)name##_size, 127, 64, false, 0) -#define PA_PlaySoundRepeat(name) AS_SoundDefaultPlay((u8*)name, (u32)name##_size, 127, 64, true, 0) -#define PA_SoundChannelIsBusy(channel) IPC_Sound->chan[channel].busy -#define PA_SetSoundChannelPan(chan, pan) AS_SetSoundPan(chan, pan) -#define PA_SetSoundChannelVol(chan, vol) AS_SetSoundVolume(chan, vol) -#define PA_StopSound(chan) AS_SoundStop(chan) -#define PA_SetSoundVol(vol) AS_SetMasterVolume(vol) - -/*! \fn void PA_PlayPSG(u8 chan, u8 vol, u8 pan, u32 freq, u8 duty) - \brief - \~english Play a tone (or noise) using the Programmable Sound Generator - \~french Utiliser le Programmable Sound Generator - \param PA_Channel - \~english Audio channel, from 8 to 15 - \~french Canal audio, de 8 à 15 - \param vol - \~english Volume (0-127) - \~french Volume (0-127) - \param freq - \~english Frenquency - \~french Fréquence - \param duty - \~english Duty (0-7) - \~french Duty (0-7) -*/ -void PA_PlayPSG(u8 chan, u8 vol, u8 pan, u32 freq, u8 duty); - -// Legacy functions... -void PA_PlaySoundEx2(u8 chan, const void* data, s32 length, u8 volume, int freq, s16 format, bool repeat, int repeatPoint) __attribute__((deprecated)); -void PA_SoundStop(u8 chan) __attribute__((deprecated)); - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_SOUND9_ +#define _PA_SOUND9_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +// Some macros to improve compatibility to old code +#define PA_PlaySimpleSound(name) AS_SoundDefaultPlay((u8*)name, (u32)name##_size, 127, 64, false, 0) +#define PA_PlaySoundRepeat(name) AS_SoundDefaultPlay((u8*)name, (u32)name##_size, 127, 64, true, 0) +#define PA_SoundChannelIsBusy(channel) IPC_Sound->chan[channel].busy +#define PA_SetSoundChannelPan(chan, pan) AS_SetSoundPan(chan, pan) +#define PA_SetSoundChannelVol(chan, vol) AS_SetSoundVolume(chan, vol) +#define PA_StopSound(chan) AS_SoundStop(chan) +#define PA_SetSoundVol(vol) AS_SetMasterVolume(vol) + +/*! \fn void PA_PlayPSG(u8 chan, u8 vol, u8 pan, u32 freq, u8 duty) + \brief + \~english Play a tone (or noise) using the Programmable Sound Generator + \~french Utiliser le Programmable Sound Generator + \param PA_Channel + \~english Audio channel, from 8 to 15 + \~french Canal audio, de 8 à 15 + \param vol + \~english Volume (0-127) + \~french Volume (0-127) + \param freq + \~english Frenquency + \~french Fréquence + \param duty + \~english Duty (0-7) + \~french Duty (0-7) +*/ +void PA_PlayPSG(u8 chan, u8 vol, u8 pan, u32 freq, u8 duty); + +// Legacy functions... +void PA_PlaySoundEx2(u8 chan, const void* data, s32 length, u8 volume, int freq, s16 format, bool repeat, int repeatPoint) __attribute__((deprecated)); +void PA_SoundStop(u8 chan) __attribute__((deprecated)); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_SpecialFx.h b/include/arm9/PA_SpecialFx.h index 34d157c..0645203 100644 --- a/include/arm9/PA_SpecialFx.h +++ b/include/arm9/PA_SpecialFx.h @@ -1,137 +1,137 @@ -#ifndef _PA_SpecialFx -#define _PA_SpecialFx - -#define PA_REG_MOSAIC(screen) _REG16(0x0400004C + (screen * 0x1000)) -#define PA_REG_BLDCNT(screen) _REG16(0x04000050 + (screen * 0x1000)) -#define PA_REG_BLDALPHA(screen) _REG16(0x04000052 + (screen * 0x1000)) - -#define SFX_BG0 1 -#define SFX_BG1 2 -#define SFX_BG2 4 -#define SFX_BG3 8 -#define SFX_OBJ 16 -#define SFX_BD 32 - -#define SFX_NONE 0 -#define SFX_ALPHA 1 -#define SFX_BRIGHTINC 2 -#define SFX_BRIGHTDEC 3 - -/*! \file PA_SpecialFx.h - \brief Special effects options - - Special effects (alpha-blending, luminosity, mosaic effect...) -*/ - -/** @defgroup SpecialFx Special Effects - * Set the sprite special effects (alpha-blending, luminosity, mosaic effects...) - * @{ - */ - -/*! \def PA_EnableBgMosaic(screen, bg) - \brief - \~english Enable the mosaic effect for a given background - \~french Activer l'effet de mosaic pour un fond donné - \~\param screen - \~english Background screen (0 or 1) - \~french Ecran du bg (0 ou 1) - \~\param bg - \~english Background number - \~french Numéro du fond -*/ -#define PA_EnableBgMosaic(screen, bg) _REG16(REG_BGCNT(screen, bg)) |= (1 << 6) - -/*! \def PA_DisableBgMosaic(screen, bg) - \brief - \~english Disable the mosaic effect for a given background - \~french Désactiver l'effet de mosaic pour un fond donné - \~\param screen - \~english Background screen (0 or 1) - \~french Ecran du bg (0 ou 1) - \~\param bg - \~english Background number - \~french Numéro du fond -*/ -#define PA_DisableBgMosaic(screen, bg) _REG16(REG_BGCNT(screen, bg)) &= ~(1 << 6) - -/*! \def PA_SetBgMosaicXY(screen, h_size, v_size) - \brief - \~english Set the Mosaic parameters for the backgrounds - \~french Régler les paramètres de la mosaic pour les fonds - \~\param screen - \~english Screen... - \~french Ecran... - \~\param h_size - \~english Horizontal size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...) - \~french Taille horizontale de la mosaic (1 pour 1 pixel, 2 pour 2 pixels, etc...) - \~\param v_size - \~english Vertical size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...) - \~french Taille verticale de la mosaic (1 pour 1 pixel, 2 pour 2 pixels, etc...) -*/ -#define PA_SetBgMosaicXY(screen, h_size, v_size) do{PA_REG_MOSAIC(screen) &= 255; PA_REG_MOSAIC(screen) |= ((h_size) + ((v_size) << 4));}while(0) - - -/*! \def PA_SetSpriteMosaicXY(screen, h_size, v_size) - \brief - \~english Set the Mosaic parameters for the sprites - \~french Régler les paramètres de la mosaic pour les sprites - \~\param screen - \~english Screen... - \~french Ecran... - \~\param h_size - \~english Horizontal size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...) - \~french Taille horizontale de la mosaic (1 pour 1 pixel, 2 pour 2 pixels, etc...) - \~\param v_size - \~english Vertical size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...) - \~french Taille verticale de la mosaic (1 pour 1 pixel, 2 pour 2 pixels, etc...) -*/ -#define PA_SetSpriteMosaicXY(screen, h_size, v_size) do{PA_REG_MOSAIC(screen) &= (255 << 8); PA_REG_MOSAIC(screen) |= (((h_size) << 8) + ((v_size) << 12));}while(0) - -/*! \def PA_EnableSpecialFx(screen, EffectType, FirstTarget, SecondTarget) - \brief - \~english Enable Special Effects and set whether backgrounds and sprites will use them or not. This also sets the type of Effect - \~french Activer les Effets Speciaux et choisir si les fonds et sprites l'utiliseront ou pas. On choisit aussi au passage quel Effet utiliser - \~\param screen - \~english Screen... - \~french Ecran... - \~\param EffectType - \~english Effect Type. 0 for non, 1 for alpha-blending, 2 for brightness increase, and 3 for brightness decrease. You can use the macros SFX_NONE, SFX_ALPHA, SFX_BRIGHTINC, SFX_BRIGHTDEC - \~french Type d'effet. 0 pour aucun, 1 pour transparence, 2 pour augmentation de la luminosité, et 3 pour diminution de celle-ci... On peut utiliser les macors SFX_NONE, SFX_ALPHA, SFX_BRIGHTINC, SFX_BRIGHTDEC - \~\param FirstTarget - \~english Backgrounds and sprites for which to activate the effect. Use the following macro : SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD (back drop) - \~french Fond et sprites à afficher aevc l'effet spécial, que l'on choisi de la facon suivante : SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD (back drop) - \~\param SecondTarget - \~english Backgrounds and sprites to be seen behind the alpha-blending. Use the following macro : SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD (back drop) - \~french Fond et sprites à afficher derrière la transparence, que l'on choisi de la facon suivante : SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD (back drop) -*/ -#define PA_EnableSpecialFx(screen, EffectType, FirstTarget, SecondTarget) PA_REG_BLDCNT(screen) = ((FirstTarget) + ((SecondTarget) << 8) + ((EffectType) << 6)) - -/*! \def PA_DisableSpecialFx(screen) - \brief - \~english Disable Special Effects - \~french Désactiver les Effets Speciaux - \~\param screen - \~english Screen... - \~french Ecran... -*/ -#define PA_DisableSpecialFx(screen) PA_REG_BLDCNT(screen) = 0 - -/*! \def PA_SetSFXAlpha(screen, Coeff1, Coeff2) - \brief - \~english Set the special effect parameters for Alpha-Blending - \~french Régler les paramètres pour l'Alpha-Blending - \~\param screen - \~english Screen... - \~french Ecran... - \~\param Coeff1 - \~english Coefficient for the first layer, from 0 to 31. Apparently, it's better to set between 0 and 16 - \~french Coefficient pour la première couche, de 0 à 31. A priori vaut mieux le mettre entre 0 et 16 - \~\param Coeff2 - \~english Coefficient for the second layer, from 0 to 31. Apparently, it's better to set between 0 and 16 - \~french Coefficient pour la deuxième couche, de 0 à 31. A priori vaut mieux le mettre entre 0 et 16 -*/ -#define PA_SetSFXAlpha(screen, Coeff1, Coeff2) PA_REG_BLDALPHA(screen) = (Coeff1) + ((Coeff2) << 8) - -/** @} */ // end of SpecialFx - -#endif +#ifndef _PA_SpecialFx +#define _PA_SpecialFx + +#define PA_REG_MOSAIC(screen) _REG16(0x0400004C + (screen * 0x1000)) +#define PA_REG_BLDCNT(screen) _REG16(0x04000050 + (screen * 0x1000)) +#define PA_REG_BLDALPHA(screen) _REG16(0x04000052 + (screen * 0x1000)) + +#define SFX_BG0 1 +#define SFX_BG1 2 +#define SFX_BG2 4 +#define SFX_BG3 8 +#define SFX_OBJ 16 +#define SFX_BD 32 + +#define SFX_NONE 0 +#define SFX_ALPHA 1 +#define SFX_BRIGHTINC 2 +#define SFX_BRIGHTDEC 3 + +/*! \file PA_SpecialFx.h + \brief Special effects options + + Special effects (alpha-blending, luminosity, mosaic effect...) +*/ + +/** @defgroup SpecialFx Special Effects + * Set the sprite special effects (alpha-blending, luminosity, mosaic effects...) + * @{ + */ + +/*! \def PA_EnableBgMosaic(screen, bg) + \brief + \~english Enable the mosaic effect for a given background + \~french Activer l'effet de mosaic pour un fond donné + \~\param screen + \~english Background screen (0 or 1) + \~french Ecran du bg (0 ou 1) + \~\param bg + \~english Background number + \~french Numéro du fond +*/ +#define PA_EnableBgMosaic(screen, bg) _REG16(REG_BGCNT(screen, bg)) |= (1 << 6) + +/*! \def PA_DisableBgMosaic(screen, bg) + \brief + \~english Disable the mosaic effect for a given background + \~french Désactiver l'effet de mosaic pour un fond donné + \~\param screen + \~english Background screen (0 or 1) + \~french Ecran du bg (0 ou 1) + \~\param bg + \~english Background number + \~french Numéro du fond +*/ +#define PA_DisableBgMosaic(screen, bg) _REG16(REG_BGCNT(screen, bg)) &= ~(1 << 6) + +/*! \def PA_SetBgMosaicXY(screen, h_size, v_size) + \brief + \~english Set the Mosaic parameters for the backgrounds + \~french Régler les paramètres de la mosaic pour les fonds + \~\param screen + \~english Screen... + \~french Ecran... + \~\param h_size + \~english Horizontal size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...) + \~french Taille horizontale de la mosaic (1 pour 1 pixel, 2 pour 2 pixels, etc...) + \~\param v_size + \~english Vertical size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...) + \~french Taille verticale de la mosaic (1 pour 1 pixel, 2 pour 2 pixels, etc...) +*/ +#define PA_SetBgMosaicXY(screen, h_size, v_size) do{PA_REG_MOSAIC(screen) &= 255; PA_REG_MOSAIC(screen) |= ((h_size) + ((v_size) << 4));}while(0) + + +/*! \def PA_SetSpriteMosaicXY(screen, h_size, v_size) + \brief + \~english Set the Mosaic parameters for the sprites + \~french Régler les paramètres de la mosaic pour les sprites + \~\param screen + \~english Screen... + \~french Ecran... + \~\param h_size + \~english Horizontal size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...) + \~french Taille horizontale de la mosaic (1 pour 1 pixel, 2 pour 2 pixels, etc...) + \~\param v_size + \~english Vertical size of the mosaic (1 for 1 pixel, 2 for 2 pixels, etc...) + \~french Taille verticale de la mosaic (1 pour 1 pixel, 2 pour 2 pixels, etc...) +*/ +#define PA_SetSpriteMosaicXY(screen, h_size, v_size) do{PA_REG_MOSAIC(screen) &= (255 << 8); PA_REG_MOSAIC(screen) |= (((h_size) << 8) + ((v_size) << 12));}while(0) + +/*! \def PA_EnableSpecialFx(screen, EffectType, FirstTarget, SecondTarget) + \brief + \~english Enable Special Effects and set whether backgrounds and sprites will use them or not. This also sets the type of Effect + \~french Activer les Effets Speciaux et choisir si les fonds et sprites l'utiliseront ou pas. On choisit aussi au passage quel Effet utiliser + \~\param screen + \~english Screen... + \~french Ecran... + \~\param EffectType + \~english Effect Type. 0 for non, 1 for alpha-blending, 2 for brightness increase, and 3 for brightness decrease. You can use the macros SFX_NONE, SFX_ALPHA, SFX_BRIGHTINC, SFX_BRIGHTDEC + \~french Type d'effet. 0 pour aucun, 1 pour transparence, 2 pour augmentation de la luminosité, et 3 pour diminution de celle-ci... On peut utiliser les macors SFX_NONE, SFX_ALPHA, SFX_BRIGHTINC, SFX_BRIGHTDEC + \~\param FirstTarget + \~english Backgrounds and sprites for which to activate the effect. Use the following macro : SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD (back drop) + \~french Fond et sprites à afficher aevc l'effet spécial, que l'on choisi de la facon suivante : SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD (back drop) + \~\param SecondTarget + \~english Backgrounds and sprites to be seen behind the alpha-blending. Use the following macro : SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD (back drop) + \~french Fond et sprites à afficher derrière la transparence, que l'on choisi de la facon suivante : SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD (back drop) +*/ +#define PA_EnableSpecialFx(screen, EffectType, FirstTarget, SecondTarget) PA_REG_BLDCNT(screen) = ((FirstTarget) + ((SecondTarget) << 8) + ((EffectType) << 6)) + +/*! \def PA_DisableSpecialFx(screen) + \brief + \~english Disable Special Effects + \~french Désactiver les Effets Speciaux + \~\param screen + \~english Screen... + \~french Ecran... +*/ +#define PA_DisableSpecialFx(screen) PA_REG_BLDCNT(screen) = 0 + +/*! \def PA_SetSFXAlpha(screen, Coeff1, Coeff2) + \brief + \~english Set the special effect parameters for Alpha-Blending + \~french Régler les paramètres pour l'Alpha-Blending + \~\param screen + \~english Screen... + \~french Ecran... + \~\param Coeff1 + \~english Coefficient for the first layer, from 0 to 31. Apparently, it's better to set between 0 and 16 + \~french Coefficient pour la première couche, de 0 à 31. A priori vaut mieux le mettre entre 0 et 16 + \~\param Coeff2 + \~english Coefficient for the second layer, from 0 to 31. Apparently, it's better to set between 0 and 16 + \~french Coefficient pour la deuxième couche, de 0 à 31. A priori vaut mieux le mettre entre 0 et 16 +*/ +#define PA_SetSFXAlpha(screen, Coeff1, Coeff2) PA_REG_BLDALPHA(screen) = (Coeff1) + ((Coeff2) << 8) + +/** @} */ // end of SpecialFx + +#endif diff --git a/include/arm9/PA_Sprite.h b/include/arm9/PA_Sprite.h index 615df96..289968e 100644 --- a/include/arm9/PA_Sprite.h +++ b/include/arm9/PA_Sprite.h @@ -1,1473 +1,1473 @@ -#ifndef _PA_Sprite -#define _PA_Sprite - -#ifdef __cplusplus -extern "C" { -#endif - -/*! \file PA_Sprite.h - \brief Everything concerning the sprite system - - This file contains all macros, variables, and prototypes regarding the sprite system (OAM, Sprite mouvement, Gfx loading...) -*/ - -#include "PA_Math.h" - -#define PA_Cos(angle) PA_SIN[((angle) + 128)&511] -#define PA_Sin(angle) PA_SIN[((angle))&511] - -extern const s16 PA_SIN[512]; - -#define MAX_DRAW 16 // Maximum 16 sprites dessinables... - -////////////////////////////////////////////////////////////////////// -// Système de sprites -////////////////////////////////////////////////////////////////////// - -#define OBJ_SIZE_8X8 0,0 -#define OBJ_SIZE_16X16 0,1 -#define OBJ_SIZE_32X32 0,2 -#define OBJ_SIZE_64X64 0,3 -#define OBJ_SIZE_16X8 1,0 -#define OBJ_SIZE_32X8 1,1 -#define OBJ_SIZE_32X16 1,2 -#define OBJ_SIZE_64X32 1,3 -#define OBJ_SIZE_8X16 2,0 -#define OBJ_SIZE_8X32 2,1 -#define OBJ_SIZE_16X32 2,2 -#define OBJ_SIZE_32X64 2,3 - -typedef struct { - u8 lx, ly; -} PA_sizes; - -extern const PA_sizes PA_size[3][4]; - -#define BITS_16 65535 -#define ALL_BUT(ATR) (BITS_16 - ATR) - -#define PA_OBJ_X 511 //511, debugging... -#define PA_OBJ_Y 255 -#define OBJ_ROT 256 -#define ALL_BUT_ROTSET 49663 // Numéro du rotset -#define ALL_BUT_PAL 4095 - -#define DBLSIZE 512 -#define N_COLORS (1 << 13) -#define OBJ_MODE 3072 -#define OBJ_MOSAIC 4096 -#define OBJ_HFLIP 4096 -#define OBJ_VFLIP 8192 - -#define OBJ_GFX 1023 -#define OBJ_PRIO 3072 - -#define COLORS_256 1 -#define COLORS_16 0 - -#define MEM_DECAL 5 -#define NUMBER_DECAL 7 - -// Mémoire gfx -typedef struct { - u16 mem_block; // Emplacement en mémoire, de 0 à 1023 - u16 free; // Doonées libres en ce point -} mem_usage; - -extern u16 n_free_mem[2]; // nombre d'emplacements libres -extern u8 used_mem[2][1024]; // Note la quantité de mémoire utilisée en chaque point de la mémoire pour pouvoir effacer les gfx... -extern u8 obj_per_gfx[2][1024]; // Nombre de sprites utilisant un gfx donné... -extern u8 pa_obj_created[2][128]; -extern mem_usage free_mem[2][1024]; - -extern u16 FirstGfx[2]; - -extern const u16 PA_obj_sizes[4][3]; - -typedef struct { - u16 atr0, atr1, atr2, atr3; -}obj_inf; -extern obj_inf PA_obj[2][128] __attribute__ ((aligned (4))); // Les 128 premiers pour l'écran du haut, et encore 128 pour l'écran du bas... - -extern u8 PA_SpritePrio[2][128]; // Set the sprite priorities... - -// Pour le dessin sur sprite -extern unsigned char *PA_SpriteBuffer[MAX_DRAW]; // Pointeurs vers les buffers que l'on créera à la volée - -extern u16 *PA_SpriteAnimP[2][1024]; - -#define ANIM_LOOP 0 // loop around -#define ANIM_UPDOWN 1 // back and forth animation - -#define ANIM_ONESHOT ANIM_LOOP, 1 -#define ANIM_INFINITE ANIM_LOOP, -1 - -extern s16 nspriteanims; // Number of animated sprites currently... -typedef struct{ - s32 firstframe, lastframe, currentframe; // frames... - s32 time; // Time... - s8 framechange; // 1 by default, -1 to go back... - u8 lx, ly; // Sprite sizes - u8 colors; - s16 speed; - u8 play; - u8 type; - u16 *gfx; // gfx pointer - s32 ncycles; - u32 HideX; -} spriteanim; -extern spriteanim spriteanims[2][128]; // Init the array on PAlib init... - -extern u8 PA_SpriteExtPrio; - -#define OAM0 0x07000000 -#define OAM1 0x07000400 - -/** @defgroup Sprite Sprite system - * Load Sprite, move them around, rotate them... - * @{ - */ - -/*! \def PA_UpdateOAM0() - \brief - \~english Update the sprite infos for screen 0 only. Do this in the VBL - \~french Mettre à jour les infos des sprites pour l'écran 0 uniquement. A faire dans le VBL -*/ -#define PA_UpdateOAM0() DMA_Copy((void*)PA_obj, (void*)OAM0, 256, DMA_32NOW) - -/*! \def PA_UpdateOAM1() - \brief - \~english Update the sprite infos for screen 1 only. Do this in the VBL - \~french Mettre à jour les infos des sprites pour l'écran 1 uniquement. A faire dans le VBL -*/ -#define PA_UpdateOAM1() DMA_Copy((void*)PA_obj + 256, (void*)OAM1, 256, DMA_32NOW) - -/*! \fn void PA_UpdateOAM(void) - \brief - \~english Update the sprite infos for both screens. Do this in the VBL - \~french Mettre à jour les infos des sprites pour les 2 écrans. A faire dans le VBL -*/ - -void PA_UpdateOAM(void); - -/*! \fn u16 PA_CreateGfx(u8 screen, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode) - \brief - \~english Load in mémory a gfx to use later on for a sprite. Returns the gfx's number in memory - \~french Charger en mémoire un gfx à utiliser plus tard pour un sprite. Renvoie le numéro en mémoire. - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_data - \~english Gfx to load - \~french Gfx à charger - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param color_mode - \~english 256 or 16 color mode (1 or 0), or 2 for 16bit - \~french Mode 256 ou 16 couleurs (1 ou 0), ou 2 pour 16 bits -*/ - -u16 PA_CreateGfx(u8 screen, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode); - -/*! \fn void PA_ResetSpriteSys(void) - \brief - \~english Reset the sprite system, memory, etc... - \~french Remise à 0 du système de sprite, de la mémoire... -*/ -void PA_ResetSpriteSysScreen(u8 screen); - - -/*! \fn void PA_ResetSpriteSys(void) - \brief - \~english Reset the sprite system, memory, etc... - \~french Remise à 0 du système de sprite, de la mémoire... -*/ -void PA_ResetSpriteSys(void); - -/*! \fn static inline void PA_CreateSprite(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) - \brief - \~english Create a sprite with it's gfx. This is the simple version of the function - \~french Creer un sprite avec ses gfx... Ceci est la version simple de la fonction - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_data - \~english Gfx to load - \~french Gfx à charger - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param color_mode - \~english 256 or 16 color mode (1 or 0). - \~french Mode 256 ou 16 couleurs (1 ou 0). - \~\param palette - \~english Palette to use (0-15). - \~french Palette à utiliser (0-15). - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ - -static inline void PA_CreateSprite(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) { - PA_obj[screen][obj_number].atr2 = PA_CreateGfx(screen, obj_data, obj_shape, obj_size, color_mode) + (palette << 12); - PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (color_mode << 13) + (obj_shape << 14); - PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (obj_size << 14); - obj_per_gfx[screen][PA_obj[screen][obj_number].atr2]++; - pa_obj_created[screen][obj_number]=1; -}; - -/*! \fn static inline void PA_CreateSpriteEx(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) - \brief - \~english Create a sprite with it's gfx. This is the complex version of the function - \~french Creer un sprite avec ses gfx... Ceci est la version complexe de la fonction - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_data - \~english Gfx to load - \~french Gfx à charger - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param color_mode - \~english 256 or 16 color mode (1 or 0). - \~french Mode 256 ou 16 couleurs (1 ou 0). - \~\param palette - \~english Palette to use (0-15). - \~french Palette à utiliser (0-15). - \~\param obj_mode - \~english Object mode (normal, transparent, window). Not functionnal yet, please leave to 0 for now - \~french Mode du sprite (normal, transparent, fenetre). Pas encore opérationnel, laisser à 0... - \~\param mosaic - \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p - \~french Activer le mode mosaique pour ce sprite. Pas encore au point... - \~\param hflip - \~english Horizontal flip on or off... - \~french Flip horizontal activé ou non. - \~\param vflip - \~english Vertical flip... - \~french Flip vertical... - \~\param prio - \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) - \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) - \~\param dblsize - \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite - \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_CreateSpriteEx(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) { - PA_obj[screen][obj_number].atr2 = PA_CreateGfx(screen, obj_data, obj_shape, obj_size, color_mode) + (prio << 10) + (palette << 12); - PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (dblsize << 9) + (obj_mode << 10) + (mosaic << 12) + ((color_mode) << 13) + (obj_shape << 14); - PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (hflip << 12) + (vflip << 13) + (obj_size << 14); - obj_per_gfx[screen][PA_obj[screen][obj_number].atr2]++; - pa_obj_created[screen][obj_number]=1; -}; - -/*! \fn static inline void PA_Create16bitSpriteEx(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) - \brief - \~english Create a 16 bit sprite with it's gfx. This is the complex version of the function. Warning : a 16bit sprite MUST be 128 pixels large, even if you sprite only takes up a small part on the left... - \~french Creer un sprite de 16 bits avec ses gfx... Ceci est la version complexe de la fonction. Attention : un sprite de 16 bits DOIT etre large de 128 pixels, meme si ce sprite ne prend qu'une petite partie sur la gauche - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_data - \~english Gfx to load - \~french Gfx à charger - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param mosaic - \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p - \~french Activer le mode mosaique pour ce sprite. Pas encore au point... - \~\param hflip - \~english Horizontal flip on or off... - \~french Flip horizontal activé ou non. - \~\param vflip - \~english Vertical flip... - \~french Flip vertical... - \~\param prio - \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) - \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) - \~\param dblsize - \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite - \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_Create16bitSpriteEx(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y){ - PA_obj[screen][obj_number].atr2 = PA_CreateGfx(screen, obj_data, obj_shape, obj_size, 2) + (prio << 10) + (15 << 12); - PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (dblsize << 9) + (3 << 10) + (mosaic << 12) + (0 << 13) + (obj_shape << 14); - PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (hflip << 12) + (vflip << 13) + (obj_size << 14); - obj_per_gfx[screen][PA_obj[screen][obj_number].atr2]++; - pa_obj_created[screen][obj_number]=1; -} - -/*! \fn static inline void PA_Create16bitSpriteFromGfx(u8 screen, u8 obj_number, u16 gfx, u8 obj_shape, u8 obj_size, s16 x, s16 y) - \brief - \~english Create a 16 bit sprite using a given gfx. - \~french Creer un sprite de 16 bits à partir de gfx... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param gfx - \~english Gfx to use - \~french Gfx à utiliser - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_Create16bitSpriteFromGfx(u8 screen, u8 obj_number, u16 gfx, u8 obj_shape, u8 obj_size, s16 x, s16 y){ - PA_obj[screen][obj_number].atr2 = gfx + (15 << 12); - PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (3 << 10) + (obj_shape << 14); - PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (obj_size << 14); - obj_per_gfx[screen][PA_obj[screen][obj_number].atr2]++; - pa_obj_created[screen][obj_number]=1; -} - -/*! \fn static inline void PA_Create16bitSprite(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, s16 x, s16 y) - \brief - \~english Create a 16 bit sprite with it's gfx. This is the simple version of the function. Warning : a 16bit sprite MUST be 128 pixels large, even if you sprite only takes up a small part on the left... - \~french Creer un sprite de 16 bits avec ses gfx... Ceci est la version simple de la fonction. Attention : un sprite de 16 bits DOIT etre large de 128 pixels, meme si ce sprite ne prend qu'une petite partie sur la gauche - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_data - \~english Gfx to load - \~french Gfx à charger - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_Create16bitSprite(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, s16 x, s16 y){ - PA_Create16bitSpriteEx(screen, obj_number, obj_data, obj_shape, obj_size, 0, 0, 0, 0, 0, x, y); -} - -/*! \fn static inline void PA_CreateSpriteFromGfx(u8 screen, u8 obj_number, u16 obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) - \brief - \~english Create a sprite with it's gfx. This is the simple version of the function - \~french Creer un sprite avec ses gfx... Ceci est la version simple de la fonction - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_gfx - \~english Memory gfx to use. Get it by using PA_GetSpriteGfx or PA_CreateGfx - \~french Gfx en mémoire à utiliser. On peut en avoir avec PA_GetSpriteGfx ou PA_CreateGfx - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param color_mode - \~english 256 or 16 color mode (1 or 0). - \~french Mode 256 ou 16 couleurs (1 ou 0). - \~\param palette - \~english Palette to use (0-15). - \~french Palette à utiliser (0-15). - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_CreateSpriteFromGfx(u8 screen, u8 obj_number, u16 obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) { - PA_obj[screen][obj_number].atr2 = obj_gfx + (palette << 12); - PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (color_mode << 13) + (obj_shape << 14); - PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (obj_size << 14); - obj_per_gfx[screen][obj_gfx]++; - pa_obj_created[screen][obj_number]=1; -}; - -/*! \fn static inline void PA_CreateSpriteExFromGfx(u8 screen, u8 obj_number, u16 obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) - \brief - \~english Create a sprite with it's gfx. This is the complex version of the function - \~french Creer un sprite avec ses gfx... Ceci est la version complexe de la fonction - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_gfx - \~english Memory gfx to use. Get it by using PA_GetSpriteGfx or PA_CreateGfx - \~french Gfx en mémoire à utiliser. On peut en avoir avec PA_GetSpriteGfx ou PA_CreateGfx - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param color_mode - \~english 256 or 16 color mode (1 or 0). - \~french Mode 256 ou 16 couleurs (1 ou 0). - \~\param palette - \~english Palette to use (0-15). - \~french Palette à utiliser (0-15). - \~\param obj_mode - \~english Object mode (normal, transparent, window). Not functionnal yet, please leave to 0 for now - \~french Mode du sprite (normal, transparent, fenetre). Pas encore opérationnel, laisser à 0... - \~\param mosaic - \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p - \~french Activer le mode mosaique pour ce sprite. Pas encore au point... - \~\param hflip - \~english Horizontal flip on or off... - \~french Flip horizontal activé ou non. - \~\param vflip - \~english Vertical flip... - \~french Flip vertical... - \~\param prio - \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) - \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) - \~\param dblsize - \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite - \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_CreateSpriteExFromGfx(u8 screen, u8 obj_number, u16 obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) { - PA_obj[screen][obj_number].atr2 = obj_gfx + (prio << 10) + (palette << 12); - PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (dblsize << 9) + (obj_mode << 10) + (mosaic << 12) + (color_mode << 13) + (obj_shape << 14); - PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (hflip << 12) + (vflip << 13) + (obj_size << 14); - obj_per_gfx[screen][obj_gfx]++; - pa_obj_created[screen][obj_number]=1; -}; - -/*! \def PA_UpdateSpriteGfx(screen, obj_number, obj_data) - \brief - \~english Update the Gfx of a given sprite - \~french Mettre à jour les Gfx d'un sprite donné - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_number - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param obj_data - \~english Gfx to load - \~french Graphisme à charger -*/ -#define PA_UpdateSpriteGfx(screen, obj_number, obj_data) PA_UpdateGfx(screen, PA_GetSpriteGfx(screen, obj_number), obj_data) - -/*! \fn static inline void PA_UpdateGfx(u8 screen, u16 gfx_number, void *obj_data) - \brief - \~english Update a given Gfx - \~french Mettre à jour les Gfx donnés - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param gfx_number - \~english Gfx number in memory - \~french Numéro du Gfx en mémoire - \~\param obj_data - \~english Gfx to load - \~french Graphisme à charger -*/ - -static inline void PA_UpdateGfx(u8 screen, u16 gfx_number, void *obj_data) { - DMA_Copy((obj_data), (void*)(SPRITE_GFX1 + (0x200000 * (screen)) + ((gfx_number) << NUMBER_DECAL)), (used_mem[screen][gfx_number] << (MEM_DECAL+1)), DMA_16NOW); -} - -/*! \fn static inline void PA_UpdateGfxAndMem(u8 screen, u8 gfx_number, void *obj_data) - \brief - \~english Update the Gfx of a given sprite and updates the PAlib animation pointer... Only for advanced users - \~french Mettre à jour les Gfx donnés et le pointer d'animation dans PAlib... Uniquement pour utilisateurs avertis - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param gfx_number - \~english Gfx number in memory - \~french Numéro du Gfx en mémoire - \~\param obj_data - \~english Gfx to load - \~french Graphisme à charger -*/ - -static inline void PA_UpdateGfxAndMem(u8 screen, u8 gfx_number, void *obj_data){ - DMA_Copy((obj_data), (void*)(SPRITE_GFX1 + (0x200000 * (screen)) + ((gfx_number) << NUMBER_DECAL)), (used_mem[screen][gfx_number] << MEM_DECAL), DMA_32NOW); - PA_SpriteAnimP[screen][gfx_number] = (u16*)obj_data; // mémorise la source de l'image... -} - -/*! \fn void PA_DeleteGfx(u8 screen, u16 obj_gfx) - \brief - \~english Delete a given Gfx. If a sprite uses this gfx, it'll become invisible - \~french Effacer un Gfx. Si un sprite l'utilisait, il deviendra invisible... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_gfx - \~english Gfx number in memory - \~french Numéro du Gfx en mémoire -*/ -void PA_DeleteGfx(u8 screen, u16 obj_gfx); - -/*! \fn void PA_DeleteSprite(u8 screen, u8 obj_number) - \brief - \~english Delete a given sprite. If it is the only one to use it's gfx, it'll be deleted too. - \~french Effacer un sprite. S'il était le seul à utiliser un gfx, il sera effacé lui aussi - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj_number - \~english Sprite number - \~french Numéro du sprite -*/ -void PA_DeleteSprite(u8 screen, u8 obj_number); - -/*! \def PA_SetSpriteRotEnable(screen, sprite, rotset) - \brief - \~english Rotate and zoom a sprite - \~french Faire tourner et zoomer un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Sprite you want to rotate - \~french Sprite que l'on veut faire tourner - \~\param rotset - \~english Rotset you want to give to that sprite (0-31). You can apparently use a rotset for multiple sprites if zoomed/rotated identically... - \~french Rotset que l'on veut pour un sprite donné (0-31). On peut a priori utiliser un rotset pour plusieurs sprites, s'ils sont zoomés/tournés pareil... -*/ -#define PA_SetSpriteRotEnable(screen, sprite, rotset) do{PA_obj[screen][sprite].atr0 |= OBJ_ROT; PA_obj[screen][sprite].atr1 = (PA_obj[screen][sprite].atr1 & ALL_BUT_ROTSET) + ((rotset) << 9);}while(0) - -/*! \def PA_SetSpriteRotDisable(screen, sprite) - \brief - \~english Stop rotating and zooming a sprite - \~french Arreter de faire tourner et zoomer un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Sprite you want to rotate - \~french Sprite que l'on veut faire tourner -*/ -#define PA_SetSpriteRotDisable(screen, sprite) do{PA_obj[screen][sprite].atr0 &= ALL_BUT(OBJ_ROT); PA_obj[screen][sprite].atr1 &= ALL_BUT_ROTSET;}while(0) - -/*! \fn static inline void PA_SetRotset(u8 screen, u8 rotset, s16 angle, u16 zoomx, u16 zoomy) - \brief - \~english Rotate and zoom a sprite - \~french Faire tourner et zoomer un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param rotset - \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... - \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable - \~\param angle - \~english Angle, between 0 and 512 (not 360, be carefull) - \~french Angle, entre 0 et 512 (et non 360, attention !) - \~\param zoomx - \~english Horizontal zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p - \~french Zoom horizontal. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p - \~\param zoomy - \~english Vertical zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p - \~french Zoom vertical. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p -*/ - -static inline void PA_SetRotset(u8 screen, u8 rotset, s16 angle, u16 zoomx, u16 zoomy) { - u8 obj_num = (rotset << 2); - PA_obj[screen][obj_num].atr3 = (PA_Cos(angle) * zoomx) >> 8; - PA_obj[screen][obj_num + 1].atr3 = (-PA_Sin(angle) * zoomy) >> 8; - PA_obj[screen][obj_num + 2].atr3 = (PA_Sin(angle) * zoomx) >> 8; - PA_obj[screen][obj_num + 3].atr3 = (PA_Cos(angle) * zoomy) >> 8; -} - -/*! \fn static inline void PA_SetRotsetNoZoom(u8 screen, u8 rotset, s16 angle) - \brief - \~english Rotate a sprite without zooming. It's a bit faster than the normal PA_SetRotset function - \~french Faire tourner un sprite sans zoomer. C'est un peu plus rapide que la fonction PA_SetRotset - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param rotset - \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... - \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable - \~\param angle - \~english Angle, between 0 and 512 (not 360, be carefull) - \~french Angle, entre 0 et 512 (et non 360, attention !) -*/ -static inline void PA_SetRotsetNoZoom(u8 screen, u8 rotset, s16 angle) { - u8 obj_num = (rotset << 2); - PA_obj[screen][obj_num].atr3 = PA_Cos(angle); - PA_obj[screen][obj_num + 1].atr3 = -PA_Sin(angle); - PA_obj[screen][obj_num + 2].atr3 = PA_Sin(angle); - PA_obj[screen][obj_num + 3].atr3 = PA_Cos(angle); -} - -/*! \fn static inline void PA_SetRotsetNoAngle(u8 screen, u8 rotset, u16 zoomx, u16 zoomy) - \brief - \~english Zoom a sprite without rotating. It's a bit faster than the normal PA_SetRotset function - \~french Zoomer un sprite sans le faire tourner. C'est un peu plus rapide que la fonction PA_SetRotset - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param rotset - \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... - \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable - \~\param zoomx - \~english Horizontal zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p - \~french Zoom horizontal. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p - \~\param zoomy - \~english Vertical zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p - \~french Zoom vertical. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p -*/ -static inline void PA_SetRotsetNoAngle(u8 screen, u8 rotset, u16 zoomx, u16 zoomy) { - u8 obj_num = (rotset << 2); - PA_obj[screen][obj_num].atr3 = zoomx; - PA_obj[screen][obj_num + 1].atr3 = 0; - PA_obj[screen][obj_num + 2].atr3 = 0; - PA_obj[screen][obj_num + 3].atr3 = zoomy; -} - -/*! \def PA_SetSpriteX(screen, obj, x) - \brief - \~english Set the X position of a sprite on screen - \~french Position X du sprite à l'écran - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param x - \~english X position - \~french Position X -*/ -#define PA_SetSpriteX(screen, obj, x) PA_obj[screen][obj].atr1 = (PA_obj[screen][obj].atr1 & ALL_BUT(PA_OBJ_X)) + ((x) & PA_OBJ_X) - -/*! \def PA_GetSpriteX(screen, obj) - \brief - \~english Get the X position of a sprite on screen - \~french Position X du sprite à l'écran - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ - -#define PA_GetSpriteX(screen, obj) (PA_obj[screen][obj].atr1 & (PA_OBJ_X)) - -/*! \def PA_SetSpriteY(screen, obj, y) - \brief - \~english Set the Y position of a sprite on screen - \~french Position Y du sprite à l'écran - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param y - \~english Y position - \~french Position Y -*/ -#define PA_SetSpriteY(screen, obj, y) PA_obj[screen][obj].atr0 = (PA_obj[screen][obj].atr0 & ALL_BUT(PA_OBJ_Y)) + ((y) & PA_OBJ_Y) - -/*! \def PA_GetSpriteY(screen, obj) - \brief - \~english Get the Y position of a sprite on screen - \~french Position Y du sprite à l'écran - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - -*/ -#define PA_GetSpriteY(screen, obj) (PA_obj[screen][obj].atr0 & PA_OBJ_Y) - -/*! \fn static inline void PA_SetSpriteXY(u8 screen, u8 sprite, s16 x, s16 y) - \brief - \~english Set the X and Y position of a sprite on screen - \~french Position X et Y du sprite à l'écran - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param x - \~english X position - \~french Position Y - \~\param y - \~english X position - \~french Position Y -*/ -static inline void PA_SetSpriteXY(u8 screen, u8 sprite, s16 x, s16 y) { - PA_SetSpriteX(screen, sprite, x); - PA_SetSpriteY(screen, sprite, y); -} - -/*! \def PA_SetSpritePal(screen, obj, pal) - \brief - \~english Set the sprite's palette number - \~french Changer la palette d'un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param pal - \~english Palette number (0 - 15) - \~french Numéro de la palette (de 0 à 15) -*/ -#define PA_SetSpritePal(screen, obj, pal) PA_obj[screen][obj].atr2 = (PA_obj[screen][obj].atr2 & ALL_BUT_PAL) + ((pal) << 12) - -/*! \fn static inline void PA_Set16bitSpriteAlpha(u8 screen, u8 sprite, u8 alpha) - \brief - \~english Set the X position of a sprite on screen - \~french Position X du sprite à l'écran - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Object number in the sprite system, only for 16bit sprites - \~french Numéro de l'objet dans le systeme de sprite, uniquement pour les sprites 16bit - \~\param alpha - \~english Alpha parameter, 0-15 - \~french Paramèter alpha, 0-15 -*/ - -static inline void PA_Set16bitSpriteAlpha(u8 screen, u8 sprite, u8 alpha){ - PA_SetSpritePal(screen, sprite, alpha&15); -} - -/*! \def PA_GetSpritePal(screen, obj) - \brief - \~english Get thepalette used by a sprite - \~french Palette d'un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpritePal(screen, obj) (PA_obj[screen][obj].atr2 >> 12) - -/*! \def PA_SetSpriteDblsize(screen, obj, dblsize) - \brief - \~english Enable or disable double size for a given sprite - \~french Activer ou désactiver le mode Doublesize pour un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param dblsize - \~english 1 to enable doublesize, 0 to disable it... - \~french 1 pour l'activer, 0 pour l'inactiver -*/ -#define PA_SetSpriteDblsize(screen, obj, dblsize) PA_obj[screen][obj].atr0 = (PA_obj[screen][obj].atr0 & ALL_BUT(DBLSIZE)) + ((dblsize) << 9) - -/*! \def PA_GetSpriteDblsize(screen, obj) - \brief - \~english Get the double size state for a given sprite - \~french Etat du mode Doublesize pour un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpriteDblsize(screen, obj) ((PA_obj[screen][obj].atr0 & DBLSIZE) >> 9) - -/*! \def PA_SetSpriteColors(screen, sprite, n_colors) - \brief - \~english Change the sprite's color mode - \~french Changer le mode de couleur du sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param n_colors - \~english 0 for 16 colors, 1 for 256 - \~french 0 pour 16 couleurs, 1 pour 256 -*/ -#define PA_SetSpriteColors(screen, sprite, n_colors) PA_obj[screen][sprite].atr0 = (PA_obj[screen][sprite].atr0 & ALL_BUT(N_COLORS)) + ((n_colors) << 13) - -/*! \def PA_GetSpriteColors(screen, sprite) - \brief - \~english Get a sprite's color mode - \~french Mode de couleur d'un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpriteColors(screen, sprite) ((PA_obj[screen][sprite].atr0 & N_COLORS) >> 13) - -/*! \def PA_SetSpriteMode(screen, sprite, obj_mode) - \brief - \~english Set the sprite's mode : 0 for normal, 1 for alpha blending, 2 for window - \~french Régler le mode d'un sprite : 0 pour normal, 1 pour transparent, 2 pour fenetre - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param obj_mode - \~english Object mode : 0 for normal, 1 for alpha blending, 2 for window ; not working yet - \~french Mode : 0 pour normal, 1 pour transparent, 2 pour fenetre ; ne marche pas encore -*/ -#define PA_SetSpriteMode(screen, sprite, obj_mode) PA_obj[screen][sprite].atr0 = (PA_obj[screen][sprite].atr0 & ALL_BUT(OBJ_MODE)) + ((obj_mode) << 10) - -/*! \def PA_GetSpriteMode(screen, obj) - \brief - \~english Get the sprite's mode : 0 for normal, 1 for alpha blending, 2 for window - \~french Mode d'un sprite : 0 pour normal, 1 pour transparent, 2 pour fenetre - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpriteMode(screen, obj) ((PA_obj[screen][obj].atr0 & OBJ_MODE) >> 10) - -/*! \def PA_SetSpriteMosaic(screen, obj, mosaic) - \brief - \~english Enable or disable mosaic mode for a given sprite - \~french Mettre ou non un sprite en mode mosaic - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param mosaic - \~english Set mosaic on (1) or off (0) - \~french Mode mosaic activé (1) ou désactivé (0) -*/ -#define PA_SetSpriteMosaic(screen, obj, mosaic) PA_obj[screen][obj].atr0 = (PA_obj[screen][obj].atr0 & ALL_BUT(OBJ_MOSAIC)) + ((mosaic) << 12) - -/*! \def PA_GetSpriteMosaic(screen, obj) - \brief - \~english Get the mosaic mode for a given sprite - \~french Si un sprite est en mode mosaic - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpriteMosaic(screen, obj) ((PA_obj[screen][obj].atr0 & OBJ_MOSAIC) >> 12) - -/*! \def PA_SetSpriteHflip(screen, obj, hflip) - \brief - \~english Enable or disable horizontal flip for a given sprite - \~french Utiliser ou non le flip horizontal pour un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param hflip - \~english Horizontal flip, 1 to enable, 0 to disable... - \~french Flip horizontal, 1 pour oui, 0 pour non... -*/ -#define PA_SetSpriteHflip(screen, obj, hflip) PA_obj[screen][obj].atr1 = (PA_obj[screen][obj].atr1 & ALL_BUT(OBJ_HFLIP)) + ((hflip) << 12) - -/*! \def PA_GetSpriteHflip(screen, obj) - \brief - \~english Get the horizontal flip state for a given sprite - \~french S'il y a un flip horizontal pour un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpriteHflip(screen, obj) ((PA_obj[screen][obj].atr1 & OBJ_HFLIP) >> 12) - -/*! \def PA_SetSpriteVflip(screen, obj, vflip) - \brief - \~english Enable or disable vertical flip for a given sprite - \~french Utiliser ou non le flip vertical pour un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param vflip - \~english Vertical flip, 1 to enable, 0 to disable... - \~french Flip vertical, 1 pour oui, 0 pour non... -*/ -#define PA_SetSpriteVflip(screen, obj, vflip) PA_obj[screen][obj].atr1 = (PA_obj[screen][obj].atr1 & ALL_BUT(OBJ_VFLIP)) + ((vflip) << 13) - -/*! \def PA_GetSpriteVflip(screen, obj) - \brief - \~english Get the vertical flip state for a given sprite - \~french Si le flip vertical est utilisé ou non pour un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpriteVflip(screen, obj) ((PA_obj[screen][obj].atr1 & OBJ_VFLIP) >> 13) - -/*! \def PA_SetSpriteGfx(screen, obj, gfx) - \brief - \~english Change the gfx used by a sprite - \~french Modifier les graphismes utilisés par un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param gfx - \~english Gfx number ; you can get one by using PA_CreateGfx or PA_GetSpriteGfx(obj_number); - \~french Numéro du gfx en mémoire ; on peut obtenir un numéro avec PA_CreateGfx ou PA_GetSpriteGfx(obj_number); -*/ -#define PA_SetSpriteGfx(screen, obj, gfx) PA_obj[screen][obj].atr2 = (PA_obj[screen][obj].atr2 & ALL_BUT(OBJ_GFX)) + ((gfx) & OBJ_GFX) - -/*! \def PA_GetSpriteGfx(screen, obj) - \brief - \~english Get the gfx used by a sprite - \~french Récupérer le gfx utilisés par un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpriteGfx(screen, obj) (PA_obj[screen][obj].atr2 & OBJ_GFX) - -/*! \def PA_SetSpritePrio(screen, obj, prio) - \brief - \~english Set a sprite's Background priority - \~french Régler la priorité d'un sprite par rapport au Bg. - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param prio - \~english Sprite priority : 0 is over background 0, 1 over Bg 1, etc... (0-3) - \~french Priorité du sprite : 0 est au-dessus du fond 0, 1 au-dessus du 1, etc... (0-3) -*/ -#define PA_SetSpritePrio(screen, obj, prio) PA_obj[screen][obj].atr2 = (PA_obj[screen][obj].atr2 & ALL_BUT(OBJ_PRIO)) + ((prio) << 10) - -/*! \def PA_GetSpritePrio(screen, obj) - \brief - \~english Get a sprite's Background priority - \~french Récupérer la priorité d'un sprite par rapport au Bg. - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpritePrio(screen, obj) ((PA_obj[screen][obj].atr2 & OBJ_PRIO) >> 10) - -/*! \def PA_GetSpriteLx(screen, sprite) - \brief - \~english Get a sprite's length - \~french Récupérer la largeur d'un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpriteLx(screen, sprite) PA_size[PA_obj[screen][sprite].atr0 >> 14][PA_obj[screen][sprite].atr1 >> 14].lx - -/*! \def PA_GetSpriteLy(screen, sprite) - \brief - \~english Get a sprite's height - \~french Récupérer la hauteur d'un sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite -*/ -#define PA_GetSpriteLy(screen, sprite)PA_size[PA_obj[screen][sprite].atr0 >> 14][PA_obj[screen][sprite].atr1 >> 14].ly - -/*! \def PA_CloneSprite(screen, obj, target) - \brief - \~english Clone a sprite. Works only for sprites on the same screen - \~french Cloner un sprite. Marche uniquement pour les sprites sur un meme écran - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param target - \~english Target sprite to clone - \~french Numéro de la cible à cloner -*/ -#define PA_CloneSprite(screen, obj, target) do{PA_obj[screen][obj].atr0 = PA_obj[screen][target].atr0; PA_obj[screen][obj].atr1 = PA_obj[screen][target].atr1; PA_obj[screen][obj].atr2 = PA_obj[screen][target].atr2; ++obj_per_gfx[screen][PA_GetSpriteGfx(screen, target)];}while(0) - -/*! \fn static inline void PA_SetSpriteAnimEx(u8 screen, u8 sprite, u8 lx, u8 ly, u8 ncolors, s16 animframe) - \brief - \~english Set the animation frame for a given sprite. This function is faster than the normal PA_SetSpriteAnim because it doesn't have to lookup the sprite dimensions... - \~french Régler l'image du sprite dans l'animation. Cette fonction est plus rapide que PA_SetSpriteAnim parce qu'elle n'a pas à rechercher les dimensions du sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param lx - \~english Sprite width (8, 16, 32, 64) - \~french Largeur du sprite (8, 16, 32, 64) - \~\param ly - \~english Sprite height (8, 16, 32, 64) - \~french Hauteur du sprite (8, 16, 32, 64) - \~\param ncolors - \~english Sprite color mode (0 for 16 colors, 1 for 256) - \~french Mode couleur du sprite (0 pour 16 couleurs, 1 pour 256) - \~\param animframe - \~english Sprite animation frame (0, 1, 2, etc...) - \~french Frame de l'animation du sprite (0, 1, 2, etc...) -*/ -static inline void PA_SetSpriteAnimEx(u8 screen, u8 sprite, u8 lx, u8 ly, u8 ncolors, s16 animframe){ - u16 gfx = PA_GetSpriteGfx(screen, sprite); - spriteanims[screen][sprite].currentframe = animframe; - PA_UpdateGfx(screen, gfx, (void*)(PA_SpriteAnimP[screen][gfx] + (animframe * (lx * ly) >> (2 - ncolors)))); -} - -/*! \fn static inline void PA_SetSpriteAnim(u8 screen, u8 sprite, s16 animframe) - \brief - \~english Set the animation frame for a given sprite. Same as PA_SetSpriteAnimEx, but a bit slower and easier to use... - \~french Régler l'image du sprite dans l'animation. Identique à PA_SetSpriteAnimEx, mais plus simple à utiliser, par contre plus lent - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param animframe - \~english Sprite animation frame (0, 1, 2, etc...) - \~french Frame de l'animation du sprite (0, 1, 2, etc...) -*/ -static inline void PA_SetSpriteAnim(u8 screen, u8 sprite, s16 animframe){ - PA_SetSpriteAnimEx(screen, sprite, PA_GetSpriteLx(screen, sprite), PA_GetSpriteLy(screen, sprite), PA_GetSpriteColors(screen, sprite), animframe); -} - -/*! \fn void PA_StartSpriteAnimEx(u8 screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles) - \brief - \~english Start a sprite animation. Once started, it continues on and on by itself until you stop it ! - \~french Démarre une animation de sprite. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param firstframe - \~english First frame of the animation sequence, most of the time 0... - \~french Premières image de l'animation, généralement 0.... - \~\param lastframe - \~english Last frame to be displayed. When it gets there, it loops back to the first frame - \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première - \~\param speed - \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame - \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... - \~\param type - \~english Defines how you want it to loop. ANIM_LOOP (0) for a normal loop, ANIM_UPDOWN (1) for back and forth animation. - \~french Défini de quelle manière on veut boucler. ANIM_LOOP (0) pour normal, et ANIM_UPDOWN (1) pour d'avant en arrière - \~\param ncycles - \~english Number of animation cycles before stopping. If using ANIM_UPDOWN, it takes 2 cycles to come back to the original image - \~french Nombres de cycles d'animations avant l'arrêt. Si on utilise ANIM_UPDOWN, il faut 2 cycles pour que l'animation revienne à l'image de base -*/ -void PA_StartSpriteAnimEx(u8 screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles); - -/*! \fn static inline void PA_StartSpriteAnim(u8 screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed) - \brief - \~english Start a sprite animation. Once started, it continues on and on by itself until you stop it ! - \~french Démarre une animation de sprite. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param firstframe - \~english First frame of the animation sequence, most of the time 0... - \~french Premières image de l'animation, généralement 0.... - \~\param lastframe - \~english Last frame to be displayed. When it gets there, it loops back to the first frame - \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première - \~\param speed - \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame - \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... -*/ -static inline void PA_StartSpriteAnim(u8 screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed){ - PA_StartSpriteAnimEx(screen, sprite, firstframe, lastframe, speed, ANIM_INFINITE); -} - -/*! \fn static inline void PA_StopSpriteAnim(u8 screen, u8 sprite) - \brief - \~english Stop a sprite animation - \~french Arrêter une animation de sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline void PA_StopSpriteAnim(u8 screen, u8 sprite){ - if (spriteanims[screen][sprite].play) nspriteanims--; - spriteanims[screen][sprite].play = 0; -} - -/*! \fn static inline void PA_SetSpriteAnimFrame(u8 screen, u8 sprite, u16 frame) - \brief - \~english Set the current animation frame number - \~french Changer le numéro actuel de la frame d'animation - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param frame - \~english Frame number to use... - \~french Numéro de frame... -*/ -static inline void PA_SetSpriteAnimFrame(u8 screen, u8 sprite, u16 frame){ - if(spriteanims[screen][sprite].currentframe != frame){ - spriteanims[screen][sprite].currentframe = frame; - PA_SetSpriteAnimEx(screen, sprite, spriteanims[screen][sprite].lx, spriteanims[screen][sprite].ly, spriteanims[screen][sprite].colors, spriteanims[screen][sprite].currentframe); - } -} - -/*! \fn static inline u16 PA_GetSpriteAnimFrame(u8 screen, u8 sprite) - \brief - \~english Returns the current animation frame number - \~french Renvoie le numéro actuel de la frame d'animation - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline u16 PA_GetSpriteAnimFrame(u8 screen, u8 sprite){ - return spriteanims[screen][sprite].currentframe; -} - -/*! \fn static inline void PA_SetSpriteAnimSpeed(u8 screen, u8 sprite, s16 speed) - \brief - \~english Set the current animation speed - \~french Changer la vitesse de l'animation - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param speed - \~english Speed, in fps... - \~french Vitesse, en fps... -*/ -static inline void PA_SetSpriteAnimSpeed(u8 screen, u8 sprite, s16 speed){ - spriteanims[screen][sprite].speed = speed; -} - -/*! \fn static inline u16 PA_GetSpriteAnimSpeed(u8 screen, u8 sprite) - \brief - \~english Returns the current animation speed - \~french Renvoie la vitesse de l'animation - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline u16 PA_GetSpriteAnimSpeed(u8 screen, u8 sprite){ - return spriteanims[screen][sprite].speed; -} - -/*! \fn static inline void PA_SetSpriteNCycles(u8 screen, u8 sprite, s32 NCycles) - \brief - \~english Set the current animation cycles left (-1 for inifinite loop) - \~french Changer le nombre de cycles d'animation restant (-1 pour inifini) - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param NCycles - \~english Number of cycles - \~french Nombre de cycles -*/ -static inline void PA_SetSpriteNCycles(u8 screen, u8 sprite, s32 NCycles){ - spriteanims[screen][sprite].ncycles = NCycles; -} - -/*! \fn static inline s32 PA_GetSpriteNCycles(u8 screen, u8 sprite) - \brief - \~english Returns the current number of animation cycles left - \~french Renvoie le nombre de cycles d'animation restants - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline s32 PA_GetSpriteNCycles(u8 screen, u8 sprite){ - return spriteanims[screen][sprite].ncycles; -} - -/*! \fn static inline u16 PA_SpriteAnimPause(u8 screen, u8 sprite, u8 pause) - \brief - \~english Pause or UnPause a sprite animation - \~french Mettre en Pause en remettre en lecture une animation de sprite - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param pause - \~english 1 for pause, 0 for unpause - \~french 1 pour pause, 0 pour reprendre la lecture... -*/ -static inline void PA_SpriteAnimPause(u8 screen, u8 sprite, u8 pause){ - if (pause&&spriteanims[screen][sprite].play) nspriteanims--; - else if ((!pause)&&(!spriteanims[screen][sprite].play)) nspriteanims++; - spriteanims[screen][sprite].play = !pause; -} - -/*! \fn static inline void PA_SetSpritePixel(u8 screen, u8 sprite, u8 x, u8 y, u8 color) - \brief - \~english Set a sprite's pixel to a given palette color. Like PA_SetSpritePixelEx, with less options, but a little slower - \~french Mettre un pixel d'un sprite à une couleur donnée. Comme PA_SetSpritePixelEx, avec moins d'options, mais un peu plus lent - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param x - \~english X coordinate of the pixel to change - \~french Coordonnée X du pixel à changer - \~\param y - \~english Y coordinate of the pixel to change - \~french Coordonnée Y du pixel à changer - \~\param color - \~english New palette color to put - \~french Nouvelle couleur de la palette à metrre -*/ -static inline void PA_SetSpritePixel(u8 screen, u8 sprite, u8 x, u8 y, u8 color){ - u8 hsize = spriteanims[screen][sprite].lx>>3; - - s32 pos = (x >> 3) + ((y >> 3) * hsize); - x&=7; y&=7; - - pos = (pos << 5) + (x >> 1) + (y << 2); - - u16 pixel = spriteanims[screen][sprite].gfx[pos]; - - if (x&1) - spriteanims[screen][sprite].gfx[pos] = (color << 8) | (pixel&0x00FF); - else - spriteanims[screen][sprite].gfx[pos] = color | (pixel&0xFF00); -} - -/*! \fn static inline u8 PA_GetSpritePixel(u8 screen, u8 sprite, u8 x, u8 y) - \brief - \~english Get a sprite's pixel color. Like PA_GetSpritePixelEx, with less options, but a little slower - \~french Récupérer la couleur d'un pixel d'un sprite. Comme PA_GetSpritePixelEx, avec moins d'options, mais un peu plus lent - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param x - \~english X coordinate of the pixel - \~french Coordonnée X du pixel - \~\param y - \~english Y coordinate of the pixel - \~french Coordonnée Y du pixel -*/ -static inline u8 PA_GetSpritePixel(u8 screen, u8 sprite, u8 x, u8 y) { - u8 hsize = spriteanims[screen][sprite].lx>>3; - - s32 pos = (x >> 3) + ((y >> 3) * hsize); - x&=7; y&=7; - - pos = (pos << 5) + (x >> 1) + (y << 2); - - u16 pixel = spriteanims[screen][sprite].gfx[pos]; - - if (x&1) - return ((pixel>>8)&255); - else - return (pixel&255); -} - -/*! \fn static inline u8 PA_GetSprite16cPixel(u8 screen, u8 sprite, u8 x, u8 y) - \brief - \~english Get a 16 color sprite's pixel color. - \~french Récupérer la couleur d'un pixel d'un sprite de 16 couleurs. - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param x - \~english X coordinate of the pixel - \~french Coordonnée X du pixel - \~\param y - \~english Y coordinate of the pixel - \~french Coordonnée Y du pixel -*/ -static inline u8 PA_GetSprite16cPixel(u8 screen, u8 sprite, u8 x, u8 y) { - u8 hsize = spriteanims[screen][sprite].lx>>3; - - s32 pos = (x >> 3) + ((y >> 3) * hsize); - x&=7; y&=7; - - pos = (pos << 4) + (x >> 2) + (y << 1); - - u16 pixel = spriteanims[screen][sprite].gfx[pos]; - return ((pixel>>(4*(x&3)))&15); -} - -/*! \fn void PA_InitSpriteDraw(u8 screen, u8 sprite) - \brief - \~english Initialise a sprite to be able to draw on it ! - \~french Initialise un sprite pour pouvoir dessiner dessus ! - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param sprite - \~english Sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -void PA_InitSpriteDraw(u8 screen, u8 sprite); - -/*! \fn static inline void PA_InitAllSpriteDraw(void) - \brief - \~english Initialise all the onscreen sprites to draw on them - \~french Initialise tous les sprites à l'écran pour dessiner dessus -*/ -static inline void PA_InitAllSpriteDraw(void){ - int i, j; - for (j = 0; j < 2; j++) - for (i = 0; i < 128; i++) - PA_InitSpriteDraw(j, i); -} - -/*! \fn void PA_InitSpriteExtPrio(u8 SpritePrio) - \brief - \~english Enable the PAlib sprite priority system. Slower than the normal priority system, but offering 256 levels of priority for the sprites (overrides the sprite number's priority) - \~french Activer le systeme de priorité de sprites PAlib. Plus lent que le systeme normal, il permet d'avoir 256 niveaux de priorité (supplante la priorité par numéro de sprites) - \~\param SpritePrio - \~english 1 for on, 0 for off... - \~french 1 pour on, 0 pour off... -*/ -void PA_InitSpriteExtPrio(u8 SpritePrio); - -static inline void PA_SetSpriteExtPrio(u8 screen, u8 sprite, u8 prio){ - PA_SpritePrio[screen][sprite] = prio; -} - -/** @} */ // end of Sprite - -void PA_UpdateSpriteAnims(); - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_Sprite +#define _PA_Sprite + +#ifdef __cplusplus +extern "C" { +#endif + +/*! \file PA_Sprite.h + \brief Everything concerning the sprite system + + This file contains all macros, variables, and prototypes regarding the sprite system (OAM, Sprite mouvement, Gfx loading...) +*/ + +#include "PA_Math.h" + +#define PA_Cos(angle) PA_SIN[((angle) + 128)&511] +#define PA_Sin(angle) PA_SIN[((angle))&511] + +extern const s16 PA_SIN[512]; + +#define MAX_DRAW 16 // Maximum 16 sprites dessinables... + +////////////////////////////////////////////////////////////////////// +// Système de sprites +////////////////////////////////////////////////////////////////////// + +#define OBJ_SIZE_8X8 0,0 +#define OBJ_SIZE_16X16 0,1 +#define OBJ_SIZE_32X32 0,2 +#define OBJ_SIZE_64X64 0,3 +#define OBJ_SIZE_16X8 1,0 +#define OBJ_SIZE_32X8 1,1 +#define OBJ_SIZE_32X16 1,2 +#define OBJ_SIZE_64X32 1,3 +#define OBJ_SIZE_8X16 2,0 +#define OBJ_SIZE_8X32 2,1 +#define OBJ_SIZE_16X32 2,2 +#define OBJ_SIZE_32X64 2,3 + +typedef struct { + u8 lx, ly; +} PA_sizes; + +extern const PA_sizes PA_size[3][4]; + +#define BITS_16 65535 +#define ALL_BUT(ATR) (BITS_16 - ATR) + +#define PA_OBJ_X 511 //511, debugging... +#define PA_OBJ_Y 255 +#define OBJ_ROT 256 +#define ALL_BUT_ROTSET 49663 // Numéro du rotset +#define ALL_BUT_PAL 4095 + +#define DBLSIZE 512 +#define N_COLORS (1 << 13) +#define OBJ_MODE 3072 +#define OBJ_MOSAIC 4096 +#define OBJ_HFLIP 4096 +#define OBJ_VFLIP 8192 + +#define OBJ_GFX 1023 +#define OBJ_PRIO 3072 + +#define COLORS_256 1 +#define COLORS_16 0 + +#define MEM_DECAL 5 +#define NUMBER_DECAL 7 + +// Mémoire gfx +typedef struct { + u16 mem_block; // Emplacement en mémoire, de 0 à 1023 + u16 free; // Doonées libres en ce point +} mem_usage; + +extern u16 n_free_mem[2]; // nombre d'emplacements libres +extern u8 used_mem[2][1024]; // Note la quantité de mémoire utilisée en chaque point de la mémoire pour pouvoir effacer les gfx... +extern u8 obj_per_gfx[2][1024]; // Nombre de sprites utilisant un gfx donné... +extern u8 pa_obj_created[2][128]; +extern mem_usage free_mem[2][1024]; + +extern u16 FirstGfx[2]; + +extern const u16 PA_obj_sizes[4][3]; + +typedef struct { + u16 atr0, atr1, atr2, atr3; +}obj_inf; +extern obj_inf PA_obj[2][128] __attribute__ ((aligned (4))); // Les 128 premiers pour l'écran du haut, et encore 128 pour l'écran du bas... + +extern u8 PA_SpritePrio[2][128]; // Set the sprite priorities... + +// Pour le dessin sur sprite +extern unsigned char *PA_SpriteBuffer[MAX_DRAW]; // Pointeurs vers les buffers que l'on créera à la volée + +extern u16 *PA_SpriteAnimP[2][1024]; + +#define ANIM_LOOP 0 // loop around +#define ANIM_UPDOWN 1 // back and forth animation + +#define ANIM_ONESHOT ANIM_LOOP, 1 +#define ANIM_INFINITE ANIM_LOOP, -1 + +extern s16 nspriteanims; // Number of animated sprites currently... +typedef struct{ + s32 firstframe, lastframe, currentframe; // frames... + s32 time; // Time... + s8 framechange; // 1 by default, -1 to go back... + u8 lx, ly; // Sprite sizes + u8 colors; + s16 speed; + u8 play; + u8 type; + u16 *gfx; // gfx pointer + s32 ncycles; + u32 HideX; +} spriteanim; +extern spriteanim spriteanims[2][128]; // Init the array on PAlib init... + +extern u8 PA_SpriteExtPrio; + +#define OAM0 0x07000000 +#define OAM1 0x07000400 + +/** @defgroup Sprite Sprite system + * Load Sprite, move them around, rotate them... + * @{ + */ + +/*! \def PA_UpdateOAM0() + \brief + \~english Update the sprite infos for screen 0 only. Do this in the VBL + \~french Mettre à jour les infos des sprites pour l'écran 0 uniquement. A faire dans le VBL +*/ +#define PA_UpdateOAM0() DMA_Copy((void*)PA_obj, (void*)OAM0, 256, DMA_32NOW) + +/*! \def PA_UpdateOAM1() + \brief + \~english Update the sprite infos for screen 1 only. Do this in the VBL + \~french Mettre à jour les infos des sprites pour l'écran 1 uniquement. A faire dans le VBL +*/ +#define PA_UpdateOAM1() DMA_Copy((void*)PA_obj + 256, (void*)OAM1, 256, DMA_32NOW) + +/*! \fn void PA_UpdateOAM(void) + \brief + \~english Update the sprite infos for both screens. Do this in the VBL + \~french Mettre à jour les infos des sprites pour les 2 écrans. A faire dans le VBL +*/ + +void PA_UpdateOAM(void); + +/*! \fn u16 PA_CreateGfx(u8 screen, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode) + \brief + \~english Load in mémory a gfx to use later on for a sprite. Returns the gfx's number in memory + \~french Charger en mémoire un gfx à utiliser plus tard pour un sprite. Renvoie le numéro en mémoire. + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_data + \~english Gfx to load + \~french Gfx à charger + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param color_mode + \~english 256 or 16 color mode (1 or 0), or 2 for 16bit + \~french Mode 256 ou 16 couleurs (1 ou 0), ou 2 pour 16 bits +*/ + +u16 PA_CreateGfx(u8 screen, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode); + +/*! \fn void PA_ResetSpriteSys(void) + \brief + \~english Reset the sprite system, memory, etc... + \~french Remise à 0 du système de sprite, de la mémoire... +*/ +void PA_ResetSpriteSysScreen(u8 screen); + + +/*! \fn void PA_ResetSpriteSys(void) + \brief + \~english Reset the sprite system, memory, etc... + \~french Remise à 0 du système de sprite, de la mémoire... +*/ +void PA_ResetSpriteSys(void); + +/*! \fn static inline void PA_CreateSprite(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) + \brief + \~english Create a sprite with it's gfx. This is the simple version of the function + \~french Creer un sprite avec ses gfx... Ceci est la version simple de la fonction + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_data + \~english Gfx to load + \~french Gfx à charger + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param color_mode + \~english 256 or 16 color mode (1 or 0). + \~french Mode 256 ou 16 couleurs (1 ou 0). + \~\param palette + \~english Palette to use (0-15). + \~french Palette à utiliser (0-15). + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ + +static inline void PA_CreateSprite(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) { + PA_obj[screen][obj_number].atr2 = PA_CreateGfx(screen, obj_data, obj_shape, obj_size, color_mode) + (palette << 12); + PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (color_mode << 13) + (obj_shape << 14); + PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (obj_size << 14); + obj_per_gfx[screen][PA_obj[screen][obj_number].atr2]++; + pa_obj_created[screen][obj_number]=1; +}; + +/*! \fn static inline void PA_CreateSpriteEx(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) + \brief + \~english Create a sprite with it's gfx. This is the complex version of the function + \~french Creer un sprite avec ses gfx... Ceci est la version complexe de la fonction + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_data + \~english Gfx to load + \~french Gfx à charger + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param color_mode + \~english 256 or 16 color mode (1 or 0). + \~french Mode 256 ou 16 couleurs (1 ou 0). + \~\param palette + \~english Palette to use (0-15). + \~french Palette à utiliser (0-15). + \~\param obj_mode + \~english Object mode (normal, transparent, window). Not functionnal yet, please leave to 0 for now + \~french Mode du sprite (normal, transparent, fenetre). Pas encore opérationnel, laisser à 0... + \~\param mosaic + \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p + \~french Activer le mode mosaique pour ce sprite. Pas encore au point... + \~\param hflip + \~english Horizontal flip on or off... + \~french Flip horizontal activé ou non. + \~\param vflip + \~english Vertical flip... + \~french Flip vertical... + \~\param prio + \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) + \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) + \~\param dblsize + \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite + \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_CreateSpriteEx(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) { + PA_obj[screen][obj_number].atr2 = PA_CreateGfx(screen, obj_data, obj_shape, obj_size, color_mode) + (prio << 10) + (palette << 12); + PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (dblsize << 9) + (obj_mode << 10) + (mosaic << 12) + ((color_mode) << 13) + (obj_shape << 14); + PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (hflip << 12) + (vflip << 13) + (obj_size << 14); + obj_per_gfx[screen][PA_obj[screen][obj_number].atr2]++; + pa_obj_created[screen][obj_number]=1; +}; + +/*! \fn static inline void PA_Create16bitSpriteEx(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) + \brief + \~english Create a 16 bit sprite with it's gfx. This is the complex version of the function. Warning : a 16bit sprite MUST be 128 pixels large, even if you sprite only takes up a small part on the left... + \~french Creer un sprite de 16 bits avec ses gfx... Ceci est la version complexe de la fonction. Attention : un sprite de 16 bits DOIT etre large de 128 pixels, meme si ce sprite ne prend qu'une petite partie sur la gauche + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_data + \~english Gfx to load + \~french Gfx à charger + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param mosaic + \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p + \~french Activer le mode mosaique pour ce sprite. Pas encore au point... + \~\param hflip + \~english Horizontal flip on or off... + \~french Flip horizontal activé ou non. + \~\param vflip + \~english Vertical flip... + \~french Flip vertical... + \~\param prio + \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) + \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) + \~\param dblsize + \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite + \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_Create16bitSpriteEx(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y){ + PA_obj[screen][obj_number].atr2 = PA_CreateGfx(screen, obj_data, obj_shape, obj_size, 2) + (prio << 10) + (15 << 12); + PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (dblsize << 9) + (3 << 10) + (mosaic << 12) + (0 << 13) + (obj_shape << 14); + PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (hflip << 12) + (vflip << 13) + (obj_size << 14); + obj_per_gfx[screen][PA_obj[screen][obj_number].atr2]++; + pa_obj_created[screen][obj_number]=1; +} + +/*! \fn static inline void PA_Create16bitSpriteFromGfx(u8 screen, u8 obj_number, u16 gfx, u8 obj_shape, u8 obj_size, s16 x, s16 y) + \brief + \~english Create a 16 bit sprite using a given gfx. + \~french Creer un sprite de 16 bits à partir de gfx... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param gfx + \~english Gfx to use + \~french Gfx à utiliser + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_Create16bitSpriteFromGfx(u8 screen, u8 obj_number, u16 gfx, u8 obj_shape, u8 obj_size, s16 x, s16 y){ + PA_obj[screen][obj_number].atr2 = gfx + (15 << 12); + PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (3 << 10) + (obj_shape << 14); + PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (obj_size << 14); + obj_per_gfx[screen][PA_obj[screen][obj_number].atr2]++; + pa_obj_created[screen][obj_number]=1; +} + +/*! \fn static inline void PA_Create16bitSprite(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, s16 x, s16 y) + \brief + \~english Create a 16 bit sprite with it's gfx. This is the simple version of the function. Warning : a 16bit sprite MUST be 128 pixels large, even if you sprite only takes up a small part on the left... + \~french Creer un sprite de 16 bits avec ses gfx... Ceci est la version simple de la fonction. Attention : un sprite de 16 bits DOIT etre large de 128 pixels, meme si ce sprite ne prend qu'une petite partie sur la gauche + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_data + \~english Gfx to load + \~french Gfx à charger + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_Create16bitSprite(u8 screen, u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, s16 x, s16 y){ + PA_Create16bitSpriteEx(screen, obj_number, obj_data, obj_shape, obj_size, 0, 0, 0, 0, 0, x, y); +} + +/*! \fn static inline void PA_CreateSpriteFromGfx(u8 screen, u8 obj_number, u16 obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) + \brief + \~english Create a sprite with it's gfx. This is the simple version of the function + \~french Creer un sprite avec ses gfx... Ceci est la version simple de la fonction + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_gfx + \~english Memory gfx to use. Get it by using PA_GetSpriteGfx or PA_CreateGfx + \~french Gfx en mémoire à utiliser. On peut en avoir avec PA_GetSpriteGfx ou PA_CreateGfx + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param color_mode + \~english 256 or 16 color mode (1 or 0). + \~french Mode 256 ou 16 couleurs (1 ou 0). + \~\param palette + \~english Palette to use (0-15). + \~french Palette à utiliser (0-15). + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_CreateSpriteFromGfx(u8 screen, u8 obj_number, u16 obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) { + PA_obj[screen][obj_number].atr2 = obj_gfx + (palette << 12); + PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (color_mode << 13) + (obj_shape << 14); + PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (obj_size << 14); + obj_per_gfx[screen][obj_gfx]++; + pa_obj_created[screen][obj_number]=1; +}; + +/*! \fn static inline void PA_CreateSpriteExFromGfx(u8 screen, u8 obj_number, u16 obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) + \brief + \~english Create a sprite with it's gfx. This is the complex version of the function + \~french Creer un sprite avec ses gfx... Ceci est la version complexe de la fonction + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_gfx + \~english Memory gfx to use. Get it by using PA_GetSpriteGfx or PA_CreateGfx + \~french Gfx en mémoire à utiliser. On peut en avoir avec PA_GetSpriteGfx ou PA_CreateGfx + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param color_mode + \~english 256 or 16 color mode (1 or 0). + \~french Mode 256 ou 16 couleurs (1 ou 0). + \~\param palette + \~english Palette to use (0-15). + \~french Palette à utiliser (0-15). + \~\param obj_mode + \~english Object mode (normal, transparent, window). Not functionnal yet, please leave to 0 for now + \~french Mode du sprite (normal, transparent, fenetre). Pas encore opérationnel, laisser à 0... + \~\param mosaic + \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p + \~french Activer le mode mosaique pour ce sprite. Pas encore au point... + \~\param hflip + \~english Horizontal flip on or off... + \~french Flip horizontal activé ou non. + \~\param vflip + \~english Vertical flip... + \~french Flip vertical... + \~\param prio + \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) + \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) + \~\param dblsize + \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite + \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_CreateSpriteExFromGfx(u8 screen, u8 obj_number, u16 obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) { + PA_obj[screen][obj_number].atr2 = obj_gfx + (prio << 10) + (palette << 12); + PA_obj[screen][obj_number].atr0 = (y&PA_OBJ_Y) + (dblsize << 9) + (obj_mode << 10) + (mosaic << 12) + (color_mode << 13) + (obj_shape << 14); + PA_obj[screen][obj_number].atr1 = (x & PA_OBJ_X) + (hflip << 12) + (vflip << 13) + (obj_size << 14); + obj_per_gfx[screen][obj_gfx]++; + pa_obj_created[screen][obj_number]=1; +}; + +/*! \def PA_UpdateSpriteGfx(screen, obj_number, obj_data) + \brief + \~english Update the Gfx of a given sprite + \~french Mettre à jour les Gfx d'un sprite donné + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_number + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param obj_data + \~english Gfx to load + \~french Graphisme à charger +*/ +#define PA_UpdateSpriteGfx(screen, obj_number, obj_data) PA_UpdateGfx(screen, PA_GetSpriteGfx(screen, obj_number), obj_data) + +/*! \fn static inline void PA_UpdateGfx(u8 screen, u16 gfx_number, void *obj_data) + \brief + \~english Update a given Gfx + \~french Mettre à jour les Gfx donnés + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param gfx_number + \~english Gfx number in memory + \~french Numéro du Gfx en mémoire + \~\param obj_data + \~english Gfx to load + \~french Graphisme à charger +*/ + +static inline void PA_UpdateGfx(u8 screen, u16 gfx_number, void *obj_data) { + DMA_Copy((obj_data), (void*)(SPRITE_GFX1 + (0x200000 * (screen)) + ((gfx_number) << NUMBER_DECAL)), (used_mem[screen][gfx_number] << (MEM_DECAL+1)), DMA_16NOW); +} + +/*! \fn static inline void PA_UpdateGfxAndMem(u8 screen, u8 gfx_number, void *obj_data) + \brief + \~english Update the Gfx of a given sprite and updates the PAlib animation pointer... Only for advanced users + \~french Mettre à jour les Gfx donnés et le pointer d'animation dans PAlib... Uniquement pour utilisateurs avertis + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param gfx_number + \~english Gfx number in memory + \~french Numéro du Gfx en mémoire + \~\param obj_data + \~english Gfx to load + \~french Graphisme à charger +*/ + +static inline void PA_UpdateGfxAndMem(u8 screen, u8 gfx_number, void *obj_data){ + DMA_Copy((obj_data), (void*)(SPRITE_GFX1 + (0x200000 * (screen)) + ((gfx_number) << NUMBER_DECAL)), (used_mem[screen][gfx_number] << MEM_DECAL), DMA_32NOW); + PA_SpriteAnimP[screen][gfx_number] = (u16*)obj_data; // mémorise la source de l'image... +} + +/*! \fn void PA_DeleteGfx(u8 screen, u16 obj_gfx) + \brief + \~english Delete a given Gfx. If a sprite uses this gfx, it'll become invisible + \~french Effacer un Gfx. Si un sprite l'utilisait, il deviendra invisible... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_gfx + \~english Gfx number in memory + \~french Numéro du Gfx en mémoire +*/ +void PA_DeleteGfx(u8 screen, u16 obj_gfx); + +/*! \fn void PA_DeleteSprite(u8 screen, u8 obj_number) + \brief + \~english Delete a given sprite. If it is the only one to use it's gfx, it'll be deleted too. + \~french Effacer un sprite. S'il était le seul à utiliser un gfx, il sera effacé lui aussi + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj_number + \~english Sprite number + \~french Numéro du sprite +*/ +void PA_DeleteSprite(u8 screen, u8 obj_number); + +/*! \def PA_SetSpriteRotEnable(screen, sprite, rotset) + \brief + \~english Rotate and zoom a sprite + \~french Faire tourner et zoomer un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Sprite you want to rotate + \~french Sprite que l'on veut faire tourner + \~\param rotset + \~english Rotset you want to give to that sprite (0-31). You can apparently use a rotset for multiple sprites if zoomed/rotated identically... + \~french Rotset que l'on veut pour un sprite donné (0-31). On peut a priori utiliser un rotset pour plusieurs sprites, s'ils sont zoomés/tournés pareil... +*/ +#define PA_SetSpriteRotEnable(screen, sprite, rotset) do{PA_obj[screen][sprite].atr0 |= OBJ_ROT; PA_obj[screen][sprite].atr1 = (PA_obj[screen][sprite].atr1 & ALL_BUT_ROTSET) + ((rotset) << 9);}while(0) + +/*! \def PA_SetSpriteRotDisable(screen, sprite) + \brief + \~english Stop rotating and zooming a sprite + \~french Arreter de faire tourner et zoomer un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Sprite you want to rotate + \~french Sprite que l'on veut faire tourner +*/ +#define PA_SetSpriteRotDisable(screen, sprite) do{PA_obj[screen][sprite].atr0 &= ALL_BUT(OBJ_ROT); PA_obj[screen][sprite].atr1 &= ALL_BUT_ROTSET;}while(0) + +/*! \fn static inline void PA_SetRotset(u8 screen, u8 rotset, s16 angle, u16 zoomx, u16 zoomy) + \brief + \~english Rotate and zoom a sprite + \~french Faire tourner et zoomer un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param rotset + \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... + \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable + \~\param angle + \~english Angle, between 0 and 512 (not 360, be carefull) + \~french Angle, entre 0 et 512 (et non 360, attention !) + \~\param zoomx + \~english Horizontal zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p + \~french Zoom horizontal. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p + \~\param zoomy + \~english Vertical zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p + \~french Zoom vertical. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p +*/ + +static inline void PA_SetRotset(u8 screen, u8 rotset, s16 angle, u16 zoomx, u16 zoomy) { + u8 obj_num = (rotset << 2); + PA_obj[screen][obj_num].atr3 = (PA_Cos(angle) * zoomx) >> 8; + PA_obj[screen][obj_num + 1].atr3 = (-PA_Sin(angle) * zoomy) >> 8; + PA_obj[screen][obj_num + 2].atr3 = (PA_Sin(angle) * zoomx) >> 8; + PA_obj[screen][obj_num + 3].atr3 = (PA_Cos(angle) * zoomy) >> 8; +} + +/*! \fn static inline void PA_SetRotsetNoZoom(u8 screen, u8 rotset, s16 angle) + \brief + \~english Rotate a sprite without zooming. It's a bit faster than the normal PA_SetRotset function + \~french Faire tourner un sprite sans zoomer. C'est un peu plus rapide que la fonction PA_SetRotset + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param rotset + \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... + \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable + \~\param angle + \~english Angle, between 0 and 512 (not 360, be carefull) + \~french Angle, entre 0 et 512 (et non 360, attention !) +*/ +static inline void PA_SetRotsetNoZoom(u8 screen, u8 rotset, s16 angle) { + u8 obj_num = (rotset << 2); + PA_obj[screen][obj_num].atr3 = PA_Cos(angle); + PA_obj[screen][obj_num + 1].atr3 = -PA_Sin(angle); + PA_obj[screen][obj_num + 2].atr3 = PA_Sin(angle); + PA_obj[screen][obj_num + 3].atr3 = PA_Cos(angle); +} + +/*! \fn static inline void PA_SetRotsetNoAngle(u8 screen, u8 rotset, u16 zoomx, u16 zoomy) + \brief + \~english Zoom a sprite without rotating. It's a bit faster than the normal PA_SetRotset function + \~french Zoomer un sprite sans le faire tourner. C'est un peu plus rapide que la fonction PA_SetRotset + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param rotset + \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... + \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable + \~\param zoomx + \~english Horizontal zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p + \~french Zoom horizontal. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p + \~\param zoomy + \~english Vertical zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p + \~french Zoom vertical. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p +*/ +static inline void PA_SetRotsetNoAngle(u8 screen, u8 rotset, u16 zoomx, u16 zoomy) { + u8 obj_num = (rotset << 2); + PA_obj[screen][obj_num].atr3 = zoomx; + PA_obj[screen][obj_num + 1].atr3 = 0; + PA_obj[screen][obj_num + 2].atr3 = 0; + PA_obj[screen][obj_num + 3].atr3 = zoomy; +} + +/*! \def PA_SetSpriteX(screen, obj, x) + \brief + \~english Set the X position of a sprite on screen + \~french Position X du sprite à l'écran + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param x + \~english X position + \~french Position X +*/ +#define PA_SetSpriteX(screen, obj, x) PA_obj[screen][obj].atr1 = (PA_obj[screen][obj].atr1 & ALL_BUT(PA_OBJ_X)) + ((x) & PA_OBJ_X) + +/*! \def PA_GetSpriteX(screen, obj) + \brief + \~english Get the X position of a sprite on screen + \~french Position X du sprite à l'écran + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ + +#define PA_GetSpriteX(screen, obj) (PA_obj[screen][obj].atr1 & (PA_OBJ_X)) + +/*! \def PA_SetSpriteY(screen, obj, y) + \brief + \~english Set the Y position of a sprite on screen + \~french Position Y du sprite à l'écran + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param y + \~english Y position + \~french Position Y +*/ +#define PA_SetSpriteY(screen, obj, y) PA_obj[screen][obj].atr0 = (PA_obj[screen][obj].atr0 & ALL_BUT(PA_OBJ_Y)) + ((y) & PA_OBJ_Y) + +/*! \def PA_GetSpriteY(screen, obj) + \brief + \~english Get the Y position of a sprite on screen + \~french Position Y du sprite à l'écran + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + +*/ +#define PA_GetSpriteY(screen, obj) (PA_obj[screen][obj].atr0 & PA_OBJ_Y) + +/*! \fn static inline void PA_SetSpriteXY(u8 screen, u8 sprite, s16 x, s16 y) + \brief + \~english Set the X and Y position of a sprite on screen + \~french Position X et Y du sprite à l'écran + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param x + \~english X position + \~french Position Y + \~\param y + \~english X position + \~french Position Y +*/ +static inline void PA_SetSpriteXY(u8 screen, u8 sprite, s16 x, s16 y) { + PA_SetSpriteX(screen, sprite, x); + PA_SetSpriteY(screen, sprite, y); +} + +/*! \def PA_SetSpritePal(screen, obj, pal) + \brief + \~english Set the sprite's palette number + \~french Changer la palette d'un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param pal + \~english Palette number (0 - 15) + \~french Numéro de la palette (de 0 à 15) +*/ +#define PA_SetSpritePal(screen, obj, pal) PA_obj[screen][obj].atr2 = (PA_obj[screen][obj].atr2 & ALL_BUT_PAL) + ((pal) << 12) + +/*! \fn static inline void PA_Set16bitSpriteAlpha(u8 screen, u8 sprite, u8 alpha) + \brief + \~english Set the X position of a sprite on screen + \~french Position X du sprite à l'écran + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Object number in the sprite system, only for 16bit sprites + \~french Numéro de l'objet dans le systeme de sprite, uniquement pour les sprites 16bit + \~\param alpha + \~english Alpha parameter, 0-15 + \~french Paramèter alpha, 0-15 +*/ + +static inline void PA_Set16bitSpriteAlpha(u8 screen, u8 sprite, u8 alpha){ + PA_SetSpritePal(screen, sprite, alpha&15); +} + +/*! \def PA_GetSpritePal(screen, obj) + \brief + \~english Get thepalette used by a sprite + \~french Palette d'un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpritePal(screen, obj) (PA_obj[screen][obj].atr2 >> 12) + +/*! \def PA_SetSpriteDblsize(screen, obj, dblsize) + \brief + \~english Enable or disable double size for a given sprite + \~french Activer ou désactiver le mode Doublesize pour un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param dblsize + \~english 1 to enable doublesize, 0 to disable it... + \~french 1 pour l'activer, 0 pour l'inactiver +*/ +#define PA_SetSpriteDblsize(screen, obj, dblsize) PA_obj[screen][obj].atr0 = (PA_obj[screen][obj].atr0 & ALL_BUT(DBLSIZE)) + ((dblsize) << 9) + +/*! \def PA_GetSpriteDblsize(screen, obj) + \brief + \~english Get the double size state for a given sprite + \~french Etat du mode Doublesize pour un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpriteDblsize(screen, obj) ((PA_obj[screen][obj].atr0 & DBLSIZE) >> 9) + +/*! \def PA_SetSpriteColors(screen, sprite, n_colors) + \brief + \~english Change the sprite's color mode + \~french Changer le mode de couleur du sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param n_colors + \~english 0 for 16 colors, 1 for 256 + \~french 0 pour 16 couleurs, 1 pour 256 +*/ +#define PA_SetSpriteColors(screen, sprite, n_colors) PA_obj[screen][sprite].atr0 = (PA_obj[screen][sprite].atr0 & ALL_BUT(N_COLORS)) + ((n_colors) << 13) + +/*! \def PA_GetSpriteColors(screen, sprite) + \brief + \~english Get a sprite's color mode + \~french Mode de couleur d'un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpriteColors(screen, sprite) ((PA_obj[screen][sprite].atr0 & N_COLORS) >> 13) + +/*! \def PA_SetSpriteMode(screen, sprite, obj_mode) + \brief + \~english Set the sprite's mode : 0 for normal, 1 for alpha blending, 2 for window + \~french Régler le mode d'un sprite : 0 pour normal, 1 pour transparent, 2 pour fenetre + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param obj_mode + \~english Object mode : 0 for normal, 1 for alpha blending, 2 for window ; not working yet + \~french Mode : 0 pour normal, 1 pour transparent, 2 pour fenetre ; ne marche pas encore +*/ +#define PA_SetSpriteMode(screen, sprite, obj_mode) PA_obj[screen][sprite].atr0 = (PA_obj[screen][sprite].atr0 & ALL_BUT(OBJ_MODE)) + ((obj_mode) << 10) + +/*! \def PA_GetSpriteMode(screen, obj) + \brief + \~english Get the sprite's mode : 0 for normal, 1 for alpha blending, 2 for window + \~french Mode d'un sprite : 0 pour normal, 1 pour transparent, 2 pour fenetre + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpriteMode(screen, obj) ((PA_obj[screen][obj].atr0 & OBJ_MODE) >> 10) + +/*! \def PA_SetSpriteMosaic(screen, obj, mosaic) + \brief + \~english Enable or disable mosaic mode for a given sprite + \~french Mettre ou non un sprite en mode mosaic + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param mosaic + \~english Set mosaic on (1) or off (0) + \~french Mode mosaic activé (1) ou désactivé (0) +*/ +#define PA_SetSpriteMosaic(screen, obj, mosaic) PA_obj[screen][obj].atr0 = (PA_obj[screen][obj].atr0 & ALL_BUT(OBJ_MOSAIC)) + ((mosaic) << 12) + +/*! \def PA_GetSpriteMosaic(screen, obj) + \brief + \~english Get the mosaic mode for a given sprite + \~french Si un sprite est en mode mosaic + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpriteMosaic(screen, obj) ((PA_obj[screen][obj].atr0 & OBJ_MOSAIC) >> 12) + +/*! \def PA_SetSpriteHflip(screen, obj, hflip) + \brief + \~english Enable or disable horizontal flip for a given sprite + \~french Utiliser ou non le flip horizontal pour un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param hflip + \~english Horizontal flip, 1 to enable, 0 to disable... + \~french Flip horizontal, 1 pour oui, 0 pour non... +*/ +#define PA_SetSpriteHflip(screen, obj, hflip) PA_obj[screen][obj].atr1 = (PA_obj[screen][obj].atr1 & ALL_BUT(OBJ_HFLIP)) + ((hflip) << 12) + +/*! \def PA_GetSpriteHflip(screen, obj) + \brief + \~english Get the horizontal flip state for a given sprite + \~french S'il y a un flip horizontal pour un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpriteHflip(screen, obj) ((PA_obj[screen][obj].atr1 & OBJ_HFLIP) >> 12) + +/*! \def PA_SetSpriteVflip(screen, obj, vflip) + \brief + \~english Enable or disable vertical flip for a given sprite + \~french Utiliser ou non le flip vertical pour un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param vflip + \~english Vertical flip, 1 to enable, 0 to disable... + \~french Flip vertical, 1 pour oui, 0 pour non... +*/ +#define PA_SetSpriteVflip(screen, obj, vflip) PA_obj[screen][obj].atr1 = (PA_obj[screen][obj].atr1 & ALL_BUT(OBJ_VFLIP)) + ((vflip) << 13) + +/*! \def PA_GetSpriteVflip(screen, obj) + \brief + \~english Get the vertical flip state for a given sprite + \~french Si le flip vertical est utilisé ou non pour un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpriteVflip(screen, obj) ((PA_obj[screen][obj].atr1 & OBJ_VFLIP) >> 13) + +/*! \def PA_SetSpriteGfx(screen, obj, gfx) + \brief + \~english Change the gfx used by a sprite + \~french Modifier les graphismes utilisés par un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param gfx + \~english Gfx number ; you can get one by using PA_CreateGfx or PA_GetSpriteGfx(obj_number); + \~french Numéro du gfx en mémoire ; on peut obtenir un numéro avec PA_CreateGfx ou PA_GetSpriteGfx(obj_number); +*/ +#define PA_SetSpriteGfx(screen, obj, gfx) PA_obj[screen][obj].atr2 = (PA_obj[screen][obj].atr2 & ALL_BUT(OBJ_GFX)) + ((gfx) & OBJ_GFX) + +/*! \def PA_GetSpriteGfx(screen, obj) + \brief + \~english Get the gfx used by a sprite + \~french Récupérer le gfx utilisés par un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpriteGfx(screen, obj) (PA_obj[screen][obj].atr2 & OBJ_GFX) + +/*! \def PA_SetSpritePrio(screen, obj, prio) + \brief + \~english Set a sprite's Background priority + \~french Régler la priorité d'un sprite par rapport au Bg. + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param prio + \~english Sprite priority : 0 is over background 0, 1 over Bg 1, etc... (0-3) + \~french Priorité du sprite : 0 est au-dessus du fond 0, 1 au-dessus du 1, etc... (0-3) +*/ +#define PA_SetSpritePrio(screen, obj, prio) PA_obj[screen][obj].atr2 = (PA_obj[screen][obj].atr2 & ALL_BUT(OBJ_PRIO)) + ((prio) << 10) + +/*! \def PA_GetSpritePrio(screen, obj) + \brief + \~english Get a sprite's Background priority + \~french Récupérer la priorité d'un sprite par rapport au Bg. + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpritePrio(screen, obj) ((PA_obj[screen][obj].atr2 & OBJ_PRIO) >> 10) + +/*! \def PA_GetSpriteLx(screen, sprite) + \brief + \~english Get a sprite's length + \~french Récupérer la largeur d'un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpriteLx(screen, sprite) PA_size[PA_obj[screen][sprite].atr0 >> 14][PA_obj[screen][sprite].atr1 >> 14].lx + +/*! \def PA_GetSpriteLy(screen, sprite) + \brief + \~english Get a sprite's height + \~french Récupérer la hauteur d'un sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite +*/ +#define PA_GetSpriteLy(screen, sprite)PA_size[PA_obj[screen][sprite].atr0 >> 14][PA_obj[screen][sprite].atr1 >> 14].ly + +/*! \def PA_CloneSprite(screen, obj, target) + \brief + \~english Clone a sprite. Works only for sprites on the same screen + \~french Cloner un sprite. Marche uniquement pour les sprites sur un meme écran + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param target + \~english Target sprite to clone + \~french Numéro de la cible à cloner +*/ +#define PA_CloneSprite(screen, obj, target) do{PA_obj[screen][obj].atr0 = PA_obj[screen][target].atr0; PA_obj[screen][obj].atr1 = PA_obj[screen][target].atr1; PA_obj[screen][obj].atr2 = PA_obj[screen][target].atr2; ++obj_per_gfx[screen][PA_GetSpriteGfx(screen, target)];}while(0) + +/*! \fn static inline void PA_SetSpriteAnimEx(u8 screen, u8 sprite, u8 lx, u8 ly, u8 ncolors, s16 animframe) + \brief + \~english Set the animation frame for a given sprite. This function is faster than the normal PA_SetSpriteAnim because it doesn't have to lookup the sprite dimensions... + \~french Régler l'image du sprite dans l'animation. Cette fonction est plus rapide que PA_SetSpriteAnim parce qu'elle n'a pas à rechercher les dimensions du sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param lx + \~english Sprite width (8, 16, 32, 64) + \~french Largeur du sprite (8, 16, 32, 64) + \~\param ly + \~english Sprite height (8, 16, 32, 64) + \~french Hauteur du sprite (8, 16, 32, 64) + \~\param ncolors + \~english Sprite color mode (0 for 16 colors, 1 for 256) + \~french Mode couleur du sprite (0 pour 16 couleurs, 1 pour 256) + \~\param animframe + \~english Sprite animation frame (0, 1, 2, etc...) + \~french Frame de l'animation du sprite (0, 1, 2, etc...) +*/ +static inline void PA_SetSpriteAnimEx(u8 screen, u8 sprite, u8 lx, u8 ly, u8 ncolors, s16 animframe){ + u16 gfx = PA_GetSpriteGfx(screen, sprite); + spriteanims[screen][sprite].currentframe = animframe; + PA_UpdateGfx(screen, gfx, (void*)(PA_SpriteAnimP[screen][gfx] + (animframe * (lx * ly) >> (2 - ncolors)))); +} + +/*! \fn static inline void PA_SetSpriteAnim(u8 screen, u8 sprite, s16 animframe) + \brief + \~english Set the animation frame for a given sprite. Same as PA_SetSpriteAnimEx, but a bit slower and easier to use... + \~french Régler l'image du sprite dans l'animation. Identique à PA_SetSpriteAnimEx, mais plus simple à utiliser, par contre plus lent + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param animframe + \~english Sprite animation frame (0, 1, 2, etc...) + \~french Frame de l'animation du sprite (0, 1, 2, etc...) +*/ +static inline void PA_SetSpriteAnim(u8 screen, u8 sprite, s16 animframe){ + PA_SetSpriteAnimEx(screen, sprite, PA_GetSpriteLx(screen, sprite), PA_GetSpriteLy(screen, sprite), PA_GetSpriteColors(screen, sprite), animframe); +} + +/*! \fn void PA_StartSpriteAnimEx(u8 screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles) + \brief + \~english Start a sprite animation. Once started, it continues on and on by itself until you stop it ! + \~french Démarre une animation de sprite. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param firstframe + \~english First frame of the animation sequence, most of the time 0... + \~french Premières image de l'animation, généralement 0.... + \~\param lastframe + \~english Last frame to be displayed. When it gets there, it loops back to the first frame + \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première + \~\param speed + \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame + \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... + \~\param type + \~english Defines how you want it to loop. ANIM_LOOP (0) for a normal loop, ANIM_UPDOWN (1) for back and forth animation. + \~french Défini de quelle manière on veut boucler. ANIM_LOOP (0) pour normal, et ANIM_UPDOWN (1) pour d'avant en arrière + \~\param ncycles + \~english Number of animation cycles before stopping. If using ANIM_UPDOWN, it takes 2 cycles to come back to the original image + \~french Nombres de cycles d'animations avant l'arrêt. Si on utilise ANIM_UPDOWN, il faut 2 cycles pour que l'animation revienne à l'image de base +*/ +void PA_StartSpriteAnimEx(u8 screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles); + +/*! \fn static inline void PA_StartSpriteAnim(u8 screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed) + \brief + \~english Start a sprite animation. Once started, it continues on and on by itself until you stop it ! + \~french Démarre une animation de sprite. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param firstframe + \~english First frame of the animation sequence, most of the time 0... + \~french Premières image de l'animation, généralement 0.... + \~\param lastframe + \~english Last frame to be displayed. When it gets there, it loops back to the first frame + \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première + \~\param speed + \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame + \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... +*/ +static inline void PA_StartSpriteAnim(u8 screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed){ + PA_StartSpriteAnimEx(screen, sprite, firstframe, lastframe, speed, ANIM_INFINITE); +} + +/*! \fn static inline void PA_StopSpriteAnim(u8 screen, u8 sprite) + \brief + \~english Stop a sprite animation + \~french Arrêter une animation de sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline void PA_StopSpriteAnim(u8 screen, u8 sprite){ + if (spriteanims[screen][sprite].play) nspriteanims--; + spriteanims[screen][sprite].play = 0; +} + +/*! \fn static inline void PA_SetSpriteAnimFrame(u8 screen, u8 sprite, u16 frame) + \brief + \~english Set the current animation frame number + \~french Changer le numéro actuel de la frame d'animation + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param frame + \~english Frame number to use... + \~french Numéro de frame... +*/ +static inline void PA_SetSpriteAnimFrame(u8 screen, u8 sprite, u16 frame){ + if(spriteanims[screen][sprite].currentframe != frame){ + spriteanims[screen][sprite].currentframe = frame; + PA_SetSpriteAnimEx(screen, sprite, spriteanims[screen][sprite].lx, spriteanims[screen][sprite].ly, spriteanims[screen][sprite].colors, spriteanims[screen][sprite].currentframe); + } +} + +/*! \fn static inline u16 PA_GetSpriteAnimFrame(u8 screen, u8 sprite) + \brief + \~english Returns the current animation frame number + \~french Renvoie le numéro actuel de la frame d'animation + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline u16 PA_GetSpriteAnimFrame(u8 screen, u8 sprite){ + return spriteanims[screen][sprite].currentframe; +} + +/*! \fn static inline void PA_SetSpriteAnimSpeed(u8 screen, u8 sprite, s16 speed) + \brief + \~english Set the current animation speed + \~french Changer la vitesse de l'animation + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param speed + \~english Speed, in fps... + \~french Vitesse, en fps... +*/ +static inline void PA_SetSpriteAnimSpeed(u8 screen, u8 sprite, s16 speed){ + spriteanims[screen][sprite].speed = speed; +} + +/*! \fn static inline u16 PA_GetSpriteAnimSpeed(u8 screen, u8 sprite) + \brief + \~english Returns the current animation speed + \~french Renvoie la vitesse de l'animation + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline u16 PA_GetSpriteAnimSpeed(u8 screen, u8 sprite){ + return spriteanims[screen][sprite].speed; +} + +/*! \fn static inline void PA_SetSpriteNCycles(u8 screen, u8 sprite, s32 NCycles) + \brief + \~english Set the current animation cycles left (-1 for inifinite loop) + \~french Changer le nombre de cycles d'animation restant (-1 pour inifini) + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param NCycles + \~english Number of cycles + \~french Nombre de cycles +*/ +static inline void PA_SetSpriteNCycles(u8 screen, u8 sprite, s32 NCycles){ + spriteanims[screen][sprite].ncycles = NCycles; +} + +/*! \fn static inline s32 PA_GetSpriteNCycles(u8 screen, u8 sprite) + \brief + \~english Returns the current number of animation cycles left + \~french Renvoie le nombre de cycles d'animation restants + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline s32 PA_GetSpriteNCycles(u8 screen, u8 sprite){ + return spriteanims[screen][sprite].ncycles; +} + +/*! \fn static inline u16 PA_SpriteAnimPause(u8 screen, u8 sprite, u8 pause) + \brief + \~english Pause or UnPause a sprite animation + \~french Mettre en Pause en remettre en lecture une animation de sprite + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param pause + \~english 1 for pause, 0 for unpause + \~french 1 pour pause, 0 pour reprendre la lecture... +*/ +static inline void PA_SpriteAnimPause(u8 screen, u8 sprite, u8 pause){ + if (pause&&spriteanims[screen][sprite].play) nspriteanims--; + else if ((!pause)&&(!spriteanims[screen][sprite].play)) nspriteanims++; + spriteanims[screen][sprite].play = !pause; +} + +/*! \fn static inline void PA_SetSpritePixel(u8 screen, u8 sprite, u8 x, u8 y, u8 color) + \brief + \~english Set a sprite's pixel to a given palette color. Like PA_SetSpritePixelEx, with less options, but a little slower + \~french Mettre un pixel d'un sprite à une couleur donnée. Comme PA_SetSpritePixelEx, avec moins d'options, mais un peu plus lent + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param x + \~english X coordinate of the pixel to change + \~french Coordonnée X du pixel à changer + \~\param y + \~english Y coordinate of the pixel to change + \~french Coordonnée Y du pixel à changer + \~\param color + \~english New palette color to put + \~french Nouvelle couleur de la palette à metrre +*/ +static inline void PA_SetSpritePixel(u8 screen, u8 sprite, u8 x, u8 y, u8 color){ + u8 hsize = spriteanims[screen][sprite].lx>>3; + + s32 pos = (x >> 3) + ((y >> 3) * hsize); + x&=7; y&=7; + + pos = (pos << 5) + (x >> 1) + (y << 2); + + u16 pixel = spriteanims[screen][sprite].gfx[pos]; + + if (x&1) + spriteanims[screen][sprite].gfx[pos] = (color << 8) | (pixel&0x00FF); + else + spriteanims[screen][sprite].gfx[pos] = color | (pixel&0xFF00); +} + +/*! \fn static inline u8 PA_GetSpritePixel(u8 screen, u8 sprite, u8 x, u8 y) + \brief + \~english Get a sprite's pixel color. Like PA_GetSpritePixelEx, with less options, but a little slower + \~french Récupérer la couleur d'un pixel d'un sprite. Comme PA_GetSpritePixelEx, avec moins d'options, mais un peu plus lent + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param x + \~english X coordinate of the pixel + \~french Coordonnée X du pixel + \~\param y + \~english Y coordinate of the pixel + \~french Coordonnée Y du pixel +*/ +static inline u8 PA_GetSpritePixel(u8 screen, u8 sprite, u8 x, u8 y) { + u8 hsize = spriteanims[screen][sprite].lx>>3; + + s32 pos = (x >> 3) + ((y >> 3) * hsize); + x&=7; y&=7; + + pos = (pos << 5) + (x >> 1) + (y << 2); + + u16 pixel = spriteanims[screen][sprite].gfx[pos]; + + if (x&1) + return ((pixel>>8)&255); + else + return (pixel&255); +} + +/*! \fn static inline u8 PA_GetSprite16cPixel(u8 screen, u8 sprite, u8 x, u8 y) + \brief + \~english Get a 16 color sprite's pixel color. + \~french Récupérer la couleur d'un pixel d'un sprite de 16 couleurs. + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param x + \~english X coordinate of the pixel + \~french Coordonnée X du pixel + \~\param y + \~english Y coordinate of the pixel + \~french Coordonnée Y du pixel +*/ +static inline u8 PA_GetSprite16cPixel(u8 screen, u8 sprite, u8 x, u8 y) { + u8 hsize = spriteanims[screen][sprite].lx>>3; + + s32 pos = (x >> 3) + ((y >> 3) * hsize); + x&=7; y&=7; + + pos = (pos << 4) + (x >> 2) + (y << 1); + + u16 pixel = spriteanims[screen][sprite].gfx[pos]; + return ((pixel>>(4*(x&3)))&15); +} + +/*! \fn void PA_InitSpriteDraw(u8 screen, u8 sprite) + \brief + \~english Initialise a sprite to be able to draw on it ! + \~french Initialise un sprite pour pouvoir dessiner dessus ! + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param sprite + \~english Sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +void PA_InitSpriteDraw(u8 screen, u8 sprite); + +/*! \fn static inline void PA_InitAllSpriteDraw(void) + \brief + \~english Initialise all the onscreen sprites to draw on them + \~french Initialise tous les sprites à l'écran pour dessiner dessus +*/ +static inline void PA_InitAllSpriteDraw(void){ + int i, j; + for (j = 0; j < 2; j++) + for (i = 0; i < 128; i++) + PA_InitSpriteDraw(j, i); +} + +/*! \fn void PA_InitSpriteExtPrio(u8 SpritePrio) + \brief + \~english Enable the PAlib sprite priority system. Slower than the normal priority system, but offering 256 levels of priority for the sprites (overrides the sprite number's priority) + \~french Activer le systeme de priorité de sprites PAlib. Plus lent que le systeme normal, il permet d'avoir 256 niveaux de priorité (supplante la priorité par numéro de sprites) + \~\param SpritePrio + \~english 1 for on, 0 for off... + \~french 1 pour on, 0 pour off... +*/ +void PA_InitSpriteExtPrio(u8 SpritePrio); + +static inline void PA_SetSpriteExtPrio(u8 screen, u8 sprite, u8 prio){ + PA_SpritePrio[screen][sprite] = prio; +} + +/** @} */ // end of Sprite + +void PA_UpdateSpriteAnims(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_SpriteDual.h b/include/arm9/PA_SpriteDual.h index cc78b81..8b4fdbd 100644 --- a/include/arm9/PA_SpriteDual.h +++ b/include/arm9/PA_SpriteDual.h @@ -1,833 +1,833 @@ -#ifndef _PA_SpriteDual -#define _PA_SpriteDual - -extern s16 DualSpriteX[128]; - -/*! \file PA_SpriteDual.h - \brief Everything concerning the sprite system, but for 2 screens ! - - This file contains all macros, variables, and prototypes regarding the sprite system (OAM, Sprite mouvement, Gfx loading...) on 2 screens, easily, like if it was just one screen -*/ - -#include "PA_Sprite.h" - -/** @defgroup SpriteDual Sprite system for Dual Screen - * Load Sprite, move them around, rotate them... - * @{ - */ - -/*! \fn static inline void PA_SetScreenSpace(s16 ScreenSpace) - \brief - \~english Set the space between the 2 screens for the Dual Fonctions. 48 pixels by default - \~french Désigner l'espace entre les 2 écrans, 48 pixels par défaut - \~\param ScreenSpace - \~english Space in pixels - \~french Espace en pixels -*/ -static inline void PA_SetScreenSpace(s16 ScreenSpace){ - PA_ScreenSpace = 192 + ScreenSpace; -} - -/*! \fn static inline void PA_DualSetSpriteX(u8 obj, s16 x) - \brief - \~english Set the X position of a sprite on screen - \~french Position X du sprite à l'écran - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param x - \~english X position - \~french Position X -*/ -static inline void PA_DualSetSpriteX(u8 obj, s16 x){ - PA_obj[0][obj].atr1 = PA_obj[1][obj].atr1 = (PA_obj[0][obj].atr1 & ALL_BUT(PA_OBJ_X)) + ((x) & PA_OBJ_X); - DualSpriteX[obj] = x; // Memorize X, as moving out will be used to hide sprites -} - -/*! \fn static inline void PA_DualSetSpriteY(u8 obj, s16 y) - \brief - \~english Set the Y position of a sprite on screen - \~french Position Y du sprite à l'écran - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param y - \~english Y position - \~french Position Y -*/ -static inline void PA_DualSetSpriteY(u8 obj, s16 y){ - if (y < 192) { - PA_SetSpriteY(1, obj, y); - PA_SetSpriteX(1, obj, DualSpriteX[obj]); - } - else PA_SetSpriteX(1, obj, 256); // hide sprite if not on screen... - if (y > PA_ScreenSpace-64) { - PA_SetSpriteY(0, obj, y - PA_ScreenSpace); - PA_SetSpriteX(0, obj, DualSpriteX[obj]); - } - else PA_SetSpriteX(0, obj, 256); -} - -/*! \fn static inline void PA_DualSetSpriteXY(u8 sprite, s16 x, s16 y) - \brief - \~english Set the X and Y position of a sprite on screen - \~french Position X et Y du sprite à l'écran - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param x - \~english X position - \~french Position Y - \~\param y - \~english X position - \~french Position Y -*/ -static inline void PA_DualSetSpriteXY(u8 sprite, s16 x, s16 y) { - PA_DualSetSpriteX(sprite, x); - PA_DualSetSpriteY(sprite, y); -} - -/*! \fn static inline void PA_DualCreateSprite(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) - \brief - \~english Create a sprite with it's gfx, on 2 screens - \~french Creer un sprite avec ses gfxsur les 2 écrans - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_data - \~english Gfx to load - \~french Gfx à charger - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param color_mode - \~english 256 or 16 color mode (1 or 0). - \~french Mode 256 ou 16 couleurs (1 ou 0). - \~\param palette - \~english Palette to use (0-15). - \~french Palette à utiliser (0-15). - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_DualCreateSprite(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) { - PA_CreateSprite(0, obj_number, obj_data, obj_shape, obj_size, color_mode, palette, x, 192); - PA_CreateSprite(1, obj_number, obj_data, obj_shape, obj_size, color_mode, palette, x, 192); - PA_DualSetSpriteXY(obj_number, x, y); -}; - -/*! \fn static inline void PA_DualCreateSpriteEx(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) - \brief - \~english Create a sprite with it's gfx. This is the complex version of the function - \~french Creer un sprite avec ses gfx... Ceci est la version complexe de la fonction - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_data - \~english Gfx to load - \~french Gfx à charger - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param color_mode - \~english 256 or 16 color mode (1 or 0). - \~french Mode 256 ou 16 couleurs (1 ou 0). - \~\param palette - \~english Palette to use (0-15). - \~french Palette à utiliser (0-15). - \~\param obj_mode - \~english Object mode (normal, transparent, window). Not functionnal yet, please leave to 0 for now - \~french Mode du sprite (normal, transparent, fenetre). Pas encore opérationnel, laisser à 0... - \~\param mosaic - \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p - \~french Activer le mode mosaique pour ce sprite. Pas encore au point... - \~\param hflip - \~english Horizontal flip on or off... - \~french Flip horizontal activé ou non. - \~\param vflip - \~english Vertical flip... - \~french Flip vertical... - \~\param prio - \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) - \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) - \~\param dblsize - \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite - \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_DualCreateSpriteEx(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y){ - PA_CreateSpriteEx(0, obj_number, obj_data, obj_shape, obj_size, color_mode, palette, obj_mode, mosaic, hflip, vflip, prio, dblsize, x, 192); - PA_CreateSpriteEx(1, obj_number, obj_data, obj_shape, obj_size, color_mode, palette, obj_mode, mosaic, hflip, vflip, prio, dblsize, x, 192); - PA_DualSetSpriteXY(obj_number, x, y); -} - -/*! \fn static inline void PA_DualCreate16bitSpriteEx(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) - \brief - \~english Create a 16 bit sprite with it's gfx. This is the complex version of the function. Warning : a 16bit sprite MUST be 128 pixels large, even if you sprite only takes up a small part on the left... - \~french Creer un sprite de 16 bits avec ses gfx... Ceci est la version complexe de la fonction. Attention : un sprite de 16 bits DOIT etre large de 128 pixels, meme si ce sprite ne prend qu'une petite partie sur la gauche - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_data - \~english Gfx to load - \~french Gfx à charger - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param mosaic - \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p - \~french Activer le mode mosaique pour ce sprite. Pas encore au point... - \~\param hflip - \~english Horizontal flip on or off... - \~french Flip horizontal activé ou non. - \~\param vflip - \~english Vertical flip... - \~french Flip vertical... - \~\param prio - \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) - \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) - \~\param dblsize - \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite - \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ - -static inline void PA_DualCreate16bitSpriteEx(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y){ - u16 mem_size = PA_obj_sizes[obj_size][obj_shape] << 1; - u16 *gfx = (u16*)malloc(mem_size); - mem_size = mem_size >> 1; - s32 i; - u16 *data = (u16*)obj_data; - for (i = 0; i < mem_size; i++) gfx[i] = data[i] + (1 << 15); - PA_obj[0][obj_number].atr2 = PA_CreateGfx(0, gfx, obj_shape, obj_size, 2) + (prio << 10) + (15 << 12); - PA_obj[1][obj_number].atr2 = PA_CreateGfx(1, gfx, obj_shape, obj_size, 2) + (prio << 10) + (15 << 12); - PA_obj[1][obj_number].atr0 = PA_obj[0][obj_number].atr0 = (192 & PA_OBJ_Y) + (dblsize << 9) + (3 << 10) + (mosaic << 12) + (0 << 13) + (obj_shape << 14); - PA_obj[1][obj_number].atr1 = PA_obj[0][obj_number].atr1 = (x & PA_OBJ_X) + (hflip << 12) + (vflip << 13) + (obj_size << 14); - PA_DualSetSpriteXY(obj_number, x, y); - - free(gfx); -} - -/*! \fn static inline void PA_DualCreate16bitSprite(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, s16 x, s16 y) - \brief - \~english Create a 16 bit sprite with it's gfx. This is the simple version of the function. Warning : a 16bit sprite MUST be 128 pixels large, even if you sprite only takes up a small part on the left... - \~french Creer un sprite de 16 bits avec ses gfx... Ceci est la version simple de la fonction. Attention : un sprite de 16 bits DOIT etre large de 128 pixels, meme si ce sprite ne prend qu'une petite partie sur la gauche - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_data - \~english Gfx to load - \~french Gfx à charger - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_DualCreate16bitSprite(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, s16 x, s16 y){ - PA_DualCreate16bitSpriteEx(obj_number, obj_data, obj_shape, obj_size, 0, 0, 0, 0, 0, x, y); -} - -/*! \fn static inline void PA_DualCreateSpriteFromGfx(u8 obj_number, u16 *obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) - \brief - \~english Create a sprite with it's gfx. This is the simple version of the function - \~french Creer un sprite avec ses gfx... Ceci est la version simple de la fonction - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_gfx - \~english Memory gfx to use. Get it by using PA_GetSpriteGfx or PA_CreateGfx - \~french Gfx en mémoire à utiliser. On peut en avoir avec PA_GetSpriteGfx ou PA_CreateGfx - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param color_mode - \~english 256 or 16 color mode (1 or 0). - \~french Mode 256 ou 16 couleurs (1 ou 0). - \~\param palette - \~english Palette to use (0-15). - \~french Palette à utiliser (0-15). - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_DualCreateSpriteFromGfx(u8 obj_number, u16 *obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) { - PA_CreateSpriteFromGfx(0, obj_number, obj_gfx[0], obj_shape, obj_size, color_mode, palette, x, 192); - PA_CreateSpriteFromGfx(1, obj_number, obj_gfx[1], obj_shape, obj_size, color_mode, palette, x, 192); - PA_DualSetSpriteXY(obj_number, x, y); -} - -/*! \fn static inline void PA_DualCreateSpriteExFromGfx(u8 obj_number, u16 *obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) - \brief - \~english Create a sprite with it's gfx. This is the complex version of the function - \~french Creer un sprite avec ses gfx... Ceci est la version complexe de la fonction - \~\param obj_number - \~english Object number you want to use (0-127 for each screen seperately). - \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). - \~\param obj_gfx - \~english Memory gfx to use. Get it by using PA_GetSpriteGfx or PA_CreateGfx - \~french Gfx en mémoire à utiliser. On peut en avoir avec PA_GetSpriteGfx ou PA_CreateGfx - \~\param obj_shape - \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param obj_size - \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... - \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... - \~\param color_mode - \~english 256 or 16 color mode (1 or 0). - \~french Mode 256 ou 16 couleurs (1 ou 0). - \~\param palette - \~english Palette to use (0-15). - \~french Palette à utiliser (0-15). - \~\param obj_mode - \~english Object mode (normal, transparent, window). Not functionnal yet, please leave to 0 for now - \~french Mode du sprite (normal, transparent, fenetre). Pas encore opérationnel, laisser à 0... - \~\param mosaic - \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p - \~french Activer le mode mosaique pour ce sprite. Pas encore au point... - \~\param hflip - \~english Horizontal flip on or off... - \~french Flip horizontal activé ou non. - \~\param vflip - \~english Vertical flip... - \~french Flip vertical... - \~\param prio - \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) - \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) - \~\param dblsize - \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite - \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite - \~\param x - \~english X position of the sprite - \~french Position X du sprite - \~\param y - \~english Y position of the sprite - \~french Position Y du sprite -*/ -static inline void PA_DualCreateSpriteExFromGfx(u8 obj_number, u16 *obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) { - PA_CreateSpriteExFromGfx(0, obj_number, obj_gfx[0], obj_shape, obj_size, color_mode, palette, obj_mode, mosaic, hflip, vflip, prio, dblsize, x, 192); - PA_CreateSpriteExFromGfx(1, obj_number, obj_gfx[1], obj_shape, obj_size, color_mode, palette, obj_mode, mosaic, hflip, vflip, prio, dblsize, x, 192); - PA_DualSetSpriteXY(obj_number, x, y); -} - - -/*! \fn static inline void PA_DualUpdateSpriteGfx(u8 obj_number, void *obj_data) - \brief - \~english Update the Gfx of a given sprite - \~french Mettre à jour les Gfx d'un sprite donné - \~\param obj_number - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param obj_data - \~english Gfx to load - \~french Graphisme à charger -*/ -static inline void PA_DualUpdateSpriteGfx(u8 obj_number, void *obj_data){ - PA_UpdateSpriteGfx(0, obj_number, obj_data); - PA_UpdateSpriteGfx(1, obj_number, obj_data); -} - - -/*! \fn static inline void PA_DualUpdateGfx(u16 gfx_number, void *obj_data) - \brief - \~english Update the Gfx of a given sprite - \~french Mettre à jour les Gfx d'un sprite donné - \~\param gfx_number - \~english Gfx number in memory - \~french Numéro du Gfx en mémoire - \~\param obj_data - \~english Gfx to load - \~french Graphisme à charger -*/ -static inline void PA_DualUpdateGfx(u16 gfx_number, void *obj_data){ - PA_UpdateGfx(0, gfx_number, obj_data); - PA_UpdateGfx(1, gfx_number, obj_data); -} - -/*! \fn static inline void PA_DualDeleteSprite(u8 obj_number) - \brief - \~english Delete a given sprite. If it is the only one to use it's gfx, it'll be deleted too. - \~french Effacer un sprite. S'il était le seul à utiliser un gfx, il sera effacé lui aussi - \~\param obj_number - \~english Sprite number - \~french Numéro du sprite -*/ -static inline void PA_DualDeleteSprite(u8 obj_number){ - PA_DeleteSprite(0, obj_number); - PA_DeleteSprite(1, obj_number); -} - -/*! \fn static inline void PA_DualSetSpriteRotEnable(u8 sprite, u8 rotset) - \brief - \~english Rotate and zoom a sprite - \~french Faire tourner et zoomer un sprite - \~\param sprite - \~english Sprite you want to rotate - \~french Sprite que l'on veut faire tourner - \~\param rotset - \~english Rotset you want to give to that sprite (0-31). You can apparently use a rotset for multiple sprites if zoomed/rotated identically... - \~french Rotset que l'on veut pour un sprite donné (0-31). On peut a priori utiliser un rotset pour plusieurs sprites, s'ils sont zoomés/tournés pareil... -*/ -static inline void PA_DualSetSpriteRotEnable(u8 sprite, u8 rotset){ - PA_SetSpriteRotEnable(0, sprite, rotset); - PA_SetSpriteRotEnable(1, sprite, rotset); -} - -/*! \fn static inline void PA_DualSetSpriteRotDisable(u8 sprite) - \brief - \~english Stop rotating and zooming a sprite - \~french Arreter de faire tourner et zoomer un sprite - \~\param sprite - \~english Sprite you want to rotate - \~french Sprite que l'on veut faire tourner -*/ -static inline void PA_DualSetSpriteRotDisable(u8 sprite){ - PA_SetSpriteRotDisable(0, sprite); - PA_SetSpriteRotDisable(1, sprite); -} - -/*! \fn static inline void PA_DualSetRotset(u8 rotset, s16 angle, u16 zoomx, u16 zoomy) - \brief - \~english Rotate and zoom a sprite - \~french Faire tourner et zoomer un sprite - \~\param rotset - \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... - \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable - \~\param angle - \~english Angle, between 0 and 512 (not 360, be carefull) - \~french Angle, entre 0 et 512 (et non 360, attention !) - \~\param zoomx - \~english Horizontal zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p - \~french Zoom horizontal. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p - \~\param zoomy - \~english Vertical zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p - \~french Zoom vertical. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p -*/ - -static inline void PA_DualSetRotset(u8 rotset, s16 angle, u16 zoomx, u16 zoomy) { - u8 obj_num = (rotset << 2); - PA_obj[0][obj_num].atr3 = PA_obj[1][obj_num].atr3 = (PA_Cos(angle) * zoomx) >> 8; - PA_obj[0][obj_num + 1].atr3 = PA_obj[1][obj_num + 1].atr3 = (-PA_Sin(angle) * zoomy) >> 8; - PA_obj[0][obj_num + 2].atr3 = PA_obj[1][obj_num + 2].atr3 = (PA_Sin(angle) * zoomx) >> 8; - PA_obj[0][obj_num + 2].atr3 = PA_obj[1][obj_num + 2].atr3 = (PA_Sin(angle) * zoomx) >> 8; - PA_obj[0][obj_num + 3].atr3 = PA_obj[1][obj_num + 3].atr3 = (PA_Cos(angle) * zoomy) >> 8; -} - -/*! \fn static inline void PA_DualSetRotsetNoZoom(u8 rotset, s16 angle) - \brief - \~english Rotate a sprite without zooming. It's a bit faster than the normal PA_SetRotset function - \~french Faire tourner un sprite sans zoomer. C'est un peu plus rapide que la fonction PA_SetRotset - \~\param rotset - \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... - \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable - \~\param angle - \~english Angle, between 0 and 512 (not 360, be carefull) - \~french Angle, entre 0 et 512 (et non 360, attention !) -*/ -static inline void PA_DualSetRotsetNoZoom(u8 rotset, s16 angle) { - u8 obj_num = (rotset << 2); - PA_obj[0][obj_num].atr3 = PA_obj[1][obj_num].atr3 = PA_Cos(angle); - PA_obj[0][obj_num + 1].atr3 = PA_obj[1][obj_num + 1].atr3 = -PA_Sin(angle); - PA_obj[0][obj_num + 2].atr3 = PA_obj[1][obj_num + 2].atr3 = PA_Sin(angle); - PA_obj[0][obj_num + 3].atr3 = PA_obj[1][obj_num + 3].atr3 = PA_Cos(angle); -} - -/*! \fn static inline void PA_DualSetRotsetNoAngle(u8 rotset, u16 zoomx, u16 zoomy) - \brief - \~english Zoom a sprite without rotating. It's a bit faster than the normal PA_SetRotset function - \~french Zoomer un sprite sans le faire tourner. C'est un peu plus rapide que la fonction PA_SetRotset - \~\param rotset - \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... - \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable - \~\param zoomx - \~english Horizontal zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p - \~french Zoom horizontal. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p - \~\param zoomy - \~english Vertical zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p - \~french Zoom vertical. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p -*/ -static inline void PA_DualSetRotsetNoAngle(u8 rotset, u16 zoomx, u16 zoomy) { - u8 obj_num = (rotset << 2); - PA_obj[0][obj_num].atr3 = PA_obj[1][obj_num].atr3 = zoomx; - PA_obj[0][obj_num + 1].atr3 = PA_obj[1][obj_num + 1].atr3 = 0; - PA_obj[0][obj_num + 2].atr3 = PA_obj[1][obj_num + 2].atr3 = 0; - PA_obj[0][obj_num + 3].atr3 = PA_obj[1][obj_num + 3].atr3 = zoomy; -} - -/*! \fn static inline void PA_DualSetSpritePal(u8 obj, u8 pal) - \brief - \~english Set the color palette used by a sprite - \~french Changer la palette d'un sprite - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param pal - \~english Palette number (0 - 15) - \~french Numéro de la palette (de 0 à 15) -*/ -static inline void PA_DualSetSpritePal(u8 obj, u8 pal){ - PA_SetSpritePal(0, obj, pal); - PA_SetSpritePal(1, obj, pal); -} - -/*! \fn static inline void PA_DualSetSpriteDblsize(u8 obj, u8 dblsize) - \brief - \~english Enable or disable double size for a given sprite - \~french Activer ou désactiver le mode Doublesize pour un sprite - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param dblsize - \~english 1 to enable doublesize, 0 to disable it... - \~french 1 pour l'activer, 0 pour l'inactiver -*/ -static inline void PA_DualSetSpriteDblsize(u8 obj, u8 dblsize){ - PA_SetSpriteDblsize(0, obj, dblsize); - PA_SetSpriteDblsize(1, obj, dblsize); -} - -/*! \fn static inline void PA_DualSetSpriteColors(u8 sprite, u8 n_colors) - \brief - \~english Change the sprite's color mode - \~french Changer le mode de couleur du sprite - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param n_colors - \~english 0 for 16 colors, 1 for 256 - \~french 0 pour 16 couleurs, 1 pour 256 -*/ -static inline void PA_DualSetSpriteColors(u8 sprite, u8 n_colors){ - PA_SetSpriteColors(0, sprite, n_colors); - PA_SetSpriteColors(1, sprite, n_colors); - -} - -/*! \fn static inline void PA_DualSetSpriteMode(u8 sprite, u8 obj_mode) - \brief - \~english Set the sprite's mode : 0 for normal, 1 for alpha blending, 2 for window - \~french Régler le mode d'un sprite : 0 pour normal, 1 pour transparent, 2 pour fenetre - \~\param sprite - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param obj_mode - \~english Object mode : 0 for normal, 1 for alpha blending, 2 for window ; not working yet - \~french Mode : 0 pour normal, 1 pour transparent, 2 pour fenetre ; ne marche pas encore -*/ -static inline void PA_DualSetSpriteMode(u8 sprite, u8 obj_mode){ - PA_SetSpriteMode(0, sprite, obj_mode); - PA_SetSpriteMode(1, sprite, obj_mode); -} - -/*! \fn static inline void PA_DualSetSpriteMosaic(u8 obj, u8 mosaic) - \brief - \~english Enable or disable mosaic mode for a given sprite - \~french Mettre ou non un sprite en mode mosaic - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param mosaic - \~english Set mosaic on (1) or off (0) - \~french Mode mosaic activé (1) ou désactivé (0) -*/ -static inline void PA_DualSetSpriteMosaic(u8 obj, u8 mosaic){ - PA_SetSpriteMosaic(0, obj, mosaic); - PA_SetSpriteMosaic(1, obj, mosaic); -} - -/*! \fn static inline void PA_DualSetSpriteHflip(u8 obj, u8 hflip) - \brief - \~english Enable or disable horizontal flip for a given sprite - \~french Utiliser ou non le flip horizontal pour un sprite - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param hflip - \~english Horizontal flip, 1 to enable, 0 to disable... - \~french Flip horizontal, 1 pour oui, 0 pour non... -*/ -static inline void PA_DualSetSpriteHflip(u8 obj, u8 hflip){ - PA_SetSpriteHflip(0, obj, hflip); - PA_SetSpriteHflip(1, obj, hflip); -} - -/*! \fn static inline void PA_DualSetSpriteVflip(u8 obj, u8 vflip) - \brief - \~english Enable or disable vertical flip for a given sprite - \~french Utiliser ou non le flip vertical pour un sprite - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param vflip - \~english Vertical flip, 1 to enable, 0 to disable... - \~french Flip vertical, 1 pour oui, 0 pour non... -*/ -static inline void PA_DualSetSpriteVflip(u8 obj, u8 vflip){ - PA_SetSpriteVflip(0, obj, vflip); - PA_SetSpriteVflip(1, obj, vflip); -} - -/*! \fn static inline void PA_DualSetSpriteGfx(u8 obj, u16 *gfx) - \brief - \~english Change the gfx used by a sprite - \~french Modifier les graphismes utilisés par un sprite - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param gfx - \~english Gfx number ; you can get one by using PA_CreateGfx or PA_GetSpriteGfx(obj_number); - \~french Numéro du gfx en mémoire ; on peut obtenir un numéro avec PA_CreateGfx ou PA_GetSpriteGfx(obj_number); -*/ -static inline void PA_DualSetSpriteGfx(u8 obj, u16 *gfx){ - PA_SetSpriteGfx(0, obj, gfx[0]); - PA_SetSpriteGfx(1, obj, gfx[1]); -} - -/*! \fn static inline void PA_DualSetSpritePrio(u8 obj, u8 prio) - \brief - \~english Set a sprite's Background priority - \~french Régler la priorité d'un sprite par rapport au Bg. - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param prio - \~english Sprite priority : 0 is over background 0, 1 over Bg 1, etc... (0-3) - \~french Priorité du sprite : 0 est au-dessus du fond 0, 1 au-dessus du 1, etc... (0-3) -*/ -static inline void PA_DualSetSpritePrio(u8 obj, u8 prio){ - PA_SetSpritePrio(0, obj, prio); - PA_SetSpritePrio(1, obj, prio); -} - -/*! \fn static inline void PA_DualCloneSprite(u8 obj, u8 target) - \brief - \~english Clone a sprite. Works only for sprites on the same screen - \~french Cloner un sprite. Marche uniquement pour les sprites sur un meme écran - \~\param obj - \~english Object number in the sprite system - \~french Numéro de l'objet dans le systeme de sprite - \~\param target - \~english Target sprite to clone - \~french Numéro de la cible à cloner -*/ -static inline void PA_DualCloneSprite(u8 obj, u8 target){ - PA_CloneSprite(0, obj, target); - PA_CloneSprite(1, obj, target); -} - -/*! \fn static inline void PA_DualSetSpriteAnimEx(u8 sprite, u8 lx, u8 ly, u8 ncolors, s16 animframe) - \brief - \~english Set the animation frame for a given sprite. This function is faster than the normal PA_SetSpriteAnim because it doesn't have to lookup the sprite dimensions... - \~french Régler l'image du sprite dans l'animation. Cette fonction est plus rapide que PA_SetSpriteAnim parce qu'elle n'a pas à rechercher les dimensions du sprite - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param lx - \~english Sprite width (8, 16, 32, 64) - \~french Largeur du sprite (8, 16, 32, 64) - \~\param ly - \~english Sprite height (8, 16, 32, 64) - \~french Hauteur du sprite (8, 16, 32, 64) - \~\param ncolors - \~english Sprite color mode (0 for 16 colors, 1 for 256) - \~french Mode couleur du sprite (0 pour 16 couleurs, 1 pour 256) - \~\param animframe - \~english Sprite animation frame (0, 1, 2, etc...) - \~french Frame de l'animation du sprite (0, 1, 2, etc...) -*/ -static inline void PA_DualSetSpriteAnimEx(u8 sprite, u8 lx, u8 ly, u8 ncolors, s16 animframe){ - PA_SetSpriteAnimEx(0, sprite, lx, ly, ncolors, animframe); - PA_SetSpriteAnimEx(1, sprite, lx, ly, ncolors, animframe); -} - -/*! \fn static inline void PA_DualSetSpriteAnim(u8 sprite, s16 animframe) - \brief - \~english Set the animation frame for a given sprite. Same as PA_SetSpriteAnimEx, but a bit slower and easier to use... - \~french Régler l'image du sprite dans l'animation. Identique à PA_SetSpriteAnimEx, mais plus simple à utiliser, par contre plus lent - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param animframe - \~english Sprite animation frame (0, 1, 2, etc...) - \~french Frame de l'animation du sprite (0, 1, 2, etc...) -*/ -static inline void PA_DualSetSpriteAnim(u8 sprite, s16 animframe){ - u8 lx = PA_GetSpriteLx(0, sprite); u8 ly = PA_GetSpriteLy(0, sprite); - u8 ncolors = PA_GetSpriteColors(0, sprite); - PA_SetSpriteAnimEx(0, sprite, lx, ly, ncolors, animframe); - PA_SetSpriteAnimEx(1, sprite, lx, ly, ncolors, animframe); -} - -/*! \fn static inline void PA_DualStartSpriteAnimEx(u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles) - \brief - \~english Start a sprite animation for DualSprites. Once started, it continues on and on by itself until you stop it ! - \~french Démarre une animation de sprite pour DualSprites. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param firstframe - \~english First frame of the animation sequence, most of the time 0... - \~french Premières image de l'animation, généralement 0.... - \~\param lastframe - \~english Last frame to be displayed. When it gets there, it loops back to the first frame - \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première - \~\param speed - \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame - \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... - \~\param type - \~english Defines how you want it to loop. ANIM_LOOP (0) for a normal loop, ANIM_UPDOWN (1) for back and forth animation. - \~french Défini de quelle manière on veut boucler. ANIM_LOOP (0) pour normal, et ANIM_UPDOWN (1) pour d'avant en arrière - \~\param ncycles - \~english Number of animation cycles before stopping. If using ANIM_UPDOWN, it takes 2 cycles to come back to the original image - \~french Nombres de cycles d'animations avant l'arrêt. Si on utilise ANIM_UPDOWN, il faut 2 cycles pour que l'animation revienne à l'image de base -*/ -static inline void PA_DualStartSpriteAnimEx(u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles){ - PA_StartSpriteAnimEx(0, sprite, firstframe, lastframe, speed, type, ncycles); - PA_StartSpriteAnimEx(1, sprite, firstframe, lastframe, speed, type, ncycles); -} - -/*! \fn static inline void PA_DualStartSpriteAnim(u8 sprite, s16 firstframe, s16 lastframe, s16 speed) - \brief - \~english Start a sprite animation for DualSprite. Once started, it continues on and on by itself until you stop it ! - \~french Démarre une animation de sprite pour DualSprite. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param firstframe - \~english First frame of the animation sequence, most of the time 0... - \~french Premières image de l'animation, généralement 0.... - \~\param lastframe - \~english Last frame to be displayed. When it gets there, it loops back to the first frame - \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première - \~\param speed - \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame - \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... -*/ -static inline void PA_DualStartSpriteAnim(u8 sprite, s16 firstframe, s16 lastframe, s16 speed){ - PA_StartSpriteAnim(0, sprite, firstframe, lastframe, speed); - PA_StartSpriteAnim(1, sprite, firstframe, lastframe, speed); -} - -/*! \fn static inline void PA_DualStopSpriteAnim(u8 sprite) - \brief - \~english Stop a sprite animation for DualSprites - \~french Arrêter une animation de sprite pour les DualSprites - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline void PA_DualStopSpriteAnim(u8 sprite){ - PA_StopSpriteAnim(0, sprite); - PA_StopSpriteAnim(1, sprite); -} - -/*! \fn static inline void PA_DualSetSpriteAnimFrame(u8 sprite, u16 frame) - \brief - \~english Set the current animation frame number for DualSprites - \~french Changer le numéro actuel de la frame d'animation pour les DualSprites - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param frame - \~english Frame number to use... - \~french Numéro de frame... -*/ -static inline void PA_DualSetSpriteAnimFrame(u8 sprite, u16 frame){ - PA_SetSpriteAnimFrame(0, sprite, frame); - PA_SetSpriteAnimFrame(1, sprite, frame); -} - -/*! \fn static inline u16 PA_DualGetSpriteAnimFrame(u8 sprite) - \brief - \~english Returns the current animation frame number for DualSprites - \~french Renvoie le numéro actuel de la frame d'animation pour les DualSprites - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline u16 PA_DualGetSpriteAnimFrame(u8 sprite){ - return spriteanims[0][sprite].currentframe; -} - -/*! \fn static inline void PA_DualSetSpriteAnimSpeed(u8 sprite, s16 speed) - \brief - \~english Set the current animation speed for DualSprites - \~french Changer la vitesse de l'animation pour les DualSprites - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param speed - \~english Speed, in fps... - \~french Vitesse, en fps... -*/ -static inline void PA_DualSetSpriteAnimSpeed(u8 sprite, s16 speed){ - PA_SetSpriteAnimSpeed(0, sprite, speed); - PA_SetSpriteAnimSpeed(1, sprite, speed); -} - -/*! \fn static inline u16 PA_DualGetSpriteAnimSpeed(u8 sprite) - \brief - \~english Returns the current animation speed for DualSprites - \~french Renvoie la vitesse de l'animation pour les DualSprites - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite -*/ -static inline u16 PA_DualGetSpriteAnimSpeed(u8 sprite){ - return spriteanims[0][sprite].speed; -} - -/*! \fn static inline void PA_DualSpriteAnimPause(u8 sprite, u8 pause) - \brief - \~english Pause or UnPause a sprite animation for DualSprites - \~french Mettre en Pause en remettre en lecture une animation de sprite pour les DualSprites - \~\param sprite - \~english sprite number in the sprite system - \~french Numéro du sprite dans le systeme de sprite - \~\param pause - \~english 1 for pause, 0 for unpause - \~french 1 pour pause, 0 pour reprendre la lecture... -*/ -static inline void PA_DualSpriteAnimPause(u8 sprite, u8 pause){ - PA_SpriteAnimPause(0, sprite, pause); - PA_SpriteAnimPause(1, sprite, pause); -} - -/** @} */ // end of Sprite - -#endif +#ifndef _PA_SpriteDual +#define _PA_SpriteDual + +extern s16 DualSpriteX[128]; + +/*! \file PA_SpriteDual.h + \brief Everything concerning the sprite system, but for 2 screens ! + + This file contains all macros, variables, and prototypes regarding the sprite system (OAM, Sprite mouvement, Gfx loading...) on 2 screens, easily, like if it was just one screen +*/ + +#include "PA_Sprite.h" + +/** @defgroup SpriteDual Sprite system for Dual Screen + * Load Sprite, move them around, rotate them... + * @{ + */ + +/*! \fn static inline void PA_SetScreenSpace(s16 ScreenSpace) + \brief + \~english Set the space between the 2 screens for the Dual Fonctions. 48 pixels by default + \~french Désigner l'espace entre les 2 écrans, 48 pixels par défaut + \~\param ScreenSpace + \~english Space in pixels + \~french Espace en pixels +*/ +static inline void PA_SetScreenSpace(s16 ScreenSpace){ + PA_ScreenSpace = 192 + ScreenSpace; +} + +/*! \fn static inline void PA_DualSetSpriteX(u8 obj, s16 x) + \brief + \~english Set the X position of a sprite on screen + \~french Position X du sprite à l'écran + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param x + \~english X position + \~french Position X +*/ +static inline void PA_DualSetSpriteX(u8 obj, s16 x){ + PA_obj[0][obj].atr1 = PA_obj[1][obj].atr1 = (PA_obj[0][obj].atr1 & ALL_BUT(PA_OBJ_X)) + ((x) & PA_OBJ_X); + DualSpriteX[obj] = x; // Memorize X, as moving out will be used to hide sprites +} + +/*! \fn static inline void PA_DualSetSpriteY(u8 obj, s16 y) + \brief + \~english Set the Y position of a sprite on screen + \~french Position Y du sprite à l'écran + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param y + \~english Y position + \~french Position Y +*/ +static inline void PA_DualSetSpriteY(u8 obj, s16 y){ + if (y < 192) { + PA_SetSpriteY(1, obj, y); + PA_SetSpriteX(1, obj, DualSpriteX[obj]); + } + else PA_SetSpriteX(1, obj, 256); // hide sprite if not on screen... + if (y > PA_ScreenSpace-64) { + PA_SetSpriteY(0, obj, y - PA_ScreenSpace); + PA_SetSpriteX(0, obj, DualSpriteX[obj]); + } + else PA_SetSpriteX(0, obj, 256); +} + +/*! \fn static inline void PA_DualSetSpriteXY(u8 sprite, s16 x, s16 y) + \brief + \~english Set the X and Y position of a sprite on screen + \~french Position X et Y du sprite à l'écran + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param x + \~english X position + \~french Position Y + \~\param y + \~english X position + \~french Position Y +*/ +static inline void PA_DualSetSpriteXY(u8 sprite, s16 x, s16 y) { + PA_DualSetSpriteX(sprite, x); + PA_DualSetSpriteY(sprite, y); +} + +/*! \fn static inline void PA_DualCreateSprite(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) + \brief + \~english Create a sprite with it's gfx, on 2 screens + \~french Creer un sprite avec ses gfxsur les 2 écrans + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_data + \~english Gfx to load + \~french Gfx à charger + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param color_mode + \~english 256 or 16 color mode (1 or 0). + \~french Mode 256 ou 16 couleurs (1 ou 0). + \~\param palette + \~english Palette to use (0-15). + \~french Palette à utiliser (0-15). + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_DualCreateSprite(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) { + PA_CreateSprite(0, obj_number, obj_data, obj_shape, obj_size, color_mode, palette, x, 192); + PA_CreateSprite(1, obj_number, obj_data, obj_shape, obj_size, color_mode, palette, x, 192); + PA_DualSetSpriteXY(obj_number, x, y); +}; + +/*! \fn static inline void PA_DualCreateSpriteEx(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) + \brief + \~english Create a sprite with it's gfx. This is the complex version of the function + \~french Creer un sprite avec ses gfx... Ceci est la version complexe de la fonction + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_data + \~english Gfx to load + \~french Gfx à charger + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param color_mode + \~english 256 or 16 color mode (1 or 0). + \~french Mode 256 ou 16 couleurs (1 ou 0). + \~\param palette + \~english Palette to use (0-15). + \~french Palette à utiliser (0-15). + \~\param obj_mode + \~english Object mode (normal, transparent, window). Not functionnal yet, please leave to 0 for now + \~french Mode du sprite (normal, transparent, fenetre). Pas encore opérationnel, laisser à 0... + \~\param mosaic + \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p + \~french Activer le mode mosaique pour ce sprite. Pas encore au point... + \~\param hflip + \~english Horizontal flip on or off... + \~french Flip horizontal activé ou non. + \~\param vflip + \~english Vertical flip... + \~french Flip vertical... + \~\param prio + \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) + \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) + \~\param dblsize + \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite + \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_DualCreateSpriteEx(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y){ + PA_CreateSpriteEx(0, obj_number, obj_data, obj_shape, obj_size, color_mode, palette, obj_mode, mosaic, hflip, vflip, prio, dblsize, x, 192); + PA_CreateSpriteEx(1, obj_number, obj_data, obj_shape, obj_size, color_mode, palette, obj_mode, mosaic, hflip, vflip, prio, dblsize, x, 192); + PA_DualSetSpriteXY(obj_number, x, y); +} + +/*! \fn static inline void PA_DualCreate16bitSpriteEx(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) + \brief + \~english Create a 16 bit sprite with it's gfx. This is the complex version of the function. Warning : a 16bit sprite MUST be 128 pixels large, even if you sprite only takes up a small part on the left... + \~french Creer un sprite de 16 bits avec ses gfx... Ceci est la version complexe de la fonction. Attention : un sprite de 16 bits DOIT etre large de 128 pixels, meme si ce sprite ne prend qu'une petite partie sur la gauche + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_data + \~english Gfx to load + \~french Gfx à charger + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param mosaic + \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p + \~french Activer le mode mosaique pour ce sprite. Pas encore au point... + \~\param hflip + \~english Horizontal flip on or off... + \~french Flip horizontal activé ou non. + \~\param vflip + \~english Vertical flip... + \~french Flip vertical... + \~\param prio + \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) + \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) + \~\param dblsize + \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite + \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ + +static inline void PA_DualCreate16bitSpriteEx(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y){ + u16 mem_size = PA_obj_sizes[obj_size][obj_shape] << 1; + u16 *gfx = (u16*)malloc(mem_size); + mem_size = mem_size >> 1; + s32 i; + u16 *data = (u16*)obj_data; + for (i = 0; i < mem_size; i++) gfx[i] = data[i] + (1 << 15); + PA_obj[0][obj_number].atr2 = PA_CreateGfx(0, gfx, obj_shape, obj_size, 2) + (prio << 10) + (15 << 12); + PA_obj[1][obj_number].atr2 = PA_CreateGfx(1, gfx, obj_shape, obj_size, 2) + (prio << 10) + (15 << 12); + PA_obj[1][obj_number].atr0 = PA_obj[0][obj_number].atr0 = (192 & PA_OBJ_Y) + (dblsize << 9) + (3 << 10) + (mosaic << 12) + (0 << 13) + (obj_shape << 14); + PA_obj[1][obj_number].atr1 = PA_obj[0][obj_number].atr1 = (x & PA_OBJ_X) + (hflip << 12) + (vflip << 13) + (obj_size << 14); + PA_DualSetSpriteXY(obj_number, x, y); + + free(gfx); +} + +/*! \fn static inline void PA_DualCreate16bitSprite(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, s16 x, s16 y) + \brief + \~english Create a 16 bit sprite with it's gfx. This is the simple version of the function. Warning : a 16bit sprite MUST be 128 pixels large, even if you sprite only takes up a small part on the left... + \~french Creer un sprite de 16 bits avec ses gfx... Ceci est la version simple de la fonction. Attention : un sprite de 16 bits DOIT etre large de 128 pixels, meme si ce sprite ne prend qu'une petite partie sur la gauche + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_data + \~english Gfx to load + \~french Gfx à charger + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_DualCreate16bitSprite(u8 obj_number, void* obj_data, u8 obj_shape, u8 obj_size, s16 x, s16 y){ + PA_DualCreate16bitSpriteEx(obj_number, obj_data, obj_shape, obj_size, 0, 0, 0, 0, 0, x, y); +} + +/*! \fn static inline void PA_DualCreateSpriteFromGfx(u8 obj_number, u16 *obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) + \brief + \~english Create a sprite with it's gfx. This is the simple version of the function + \~french Creer un sprite avec ses gfx... Ceci est la version simple de la fonction + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_gfx + \~english Memory gfx to use. Get it by using PA_GetSpriteGfx or PA_CreateGfx + \~french Gfx en mémoire à utiliser. On peut en avoir avec PA_GetSpriteGfx ou PA_CreateGfx + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param color_mode + \~english 256 or 16 color mode (1 or 0). + \~french Mode 256 ou 16 couleurs (1 ou 0). + \~\param palette + \~english Palette to use (0-15). + \~french Palette à utiliser (0-15). + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_DualCreateSpriteFromGfx(u8 obj_number, u16 *obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, s16 x, s16 y) { + PA_CreateSpriteFromGfx(0, obj_number, obj_gfx[0], obj_shape, obj_size, color_mode, palette, x, 192); + PA_CreateSpriteFromGfx(1, obj_number, obj_gfx[1], obj_shape, obj_size, color_mode, palette, x, 192); + PA_DualSetSpriteXY(obj_number, x, y); +} + +/*! \fn static inline void PA_DualCreateSpriteExFromGfx(u8 obj_number, u16 *obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) + \brief + \~english Create a sprite with it's gfx. This is the complex version of the function + \~french Creer un sprite avec ses gfx... Ceci est la version complexe de la fonction + \~\param obj_number + \~english Object number you want to use (0-127 for each screen seperately). + \~french Numéro du sprite que vous voulez utiliser (de 0 à 127 pour chaque écran séparemment). + \~\param obj_gfx + \~english Memory gfx to use. Get it by using PA_GetSpriteGfx or PA_CreateGfx + \~french Gfx en mémoire à utiliser. On peut en avoir avec PA_GetSpriteGfx ou PA_CreateGfx + \~\param obj_shape + \~english Object shape, from 0 to 2. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Forme du sprite à charger, de 0 à 2. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param obj_size + \~english Object size. Use the OBJ_SIZE_32X32 (...) macros for object shape and obj_size... + \~french Taille du sprite. Utiliser la macro OBJ_SIZE_32X32 (...) pour charger la forme et la taille... + \~\param color_mode + \~english 256 or 16 color mode (1 or 0). + \~french Mode 256 ou 16 couleurs (1 ou 0). + \~\param palette + \~english Palette to use (0-15). + \~french Palette à utiliser (0-15). + \~\param obj_mode + \~english Object mode (normal, transparent, window). Not functionnal yet, please leave to 0 for now + \~french Mode du sprite (normal, transparent, fenetre). Pas encore opérationnel, laisser à 0... + \~\param mosaic + \~english Activate Mosaic for the sprite or not. Not yet functionnal either :p + \~french Activer le mode mosaique pour ce sprite. Pas encore au point... + \~\param hflip + \~english Horizontal flip on or off... + \~french Flip horizontal activé ou non. + \~\param vflip + \~english Vertical flip... + \~french Flip vertical... + \~\param prio + \~english Sprite priority regarding backgrounds : in front of which background to show it (0-3) + \~french Priorité du sprite vis-à-vis des fonds : devant quel fond l'afficher... (0-3) + \~\param dblsize + \~english Double the possible sprite size. Activate only if you are going to rotate and zoom in the sprite + \~french Doubler la taille possible du sprite. A activer uniquement si on compte grossir et faire tourner le sprite + \~\param x + \~english X position of the sprite + \~french Position X du sprite + \~\param y + \~english Y position of the sprite + \~french Position Y du sprite +*/ +static inline void PA_DualCreateSpriteExFromGfx(u8 obj_number, u16 *obj_gfx, u8 obj_shape, u8 obj_size, u8 color_mode, u8 palette, u8 obj_mode, u8 mosaic, u8 hflip, u8 vflip, u8 prio, u8 dblsize, s16 x, s16 y) { + PA_CreateSpriteExFromGfx(0, obj_number, obj_gfx[0], obj_shape, obj_size, color_mode, palette, obj_mode, mosaic, hflip, vflip, prio, dblsize, x, 192); + PA_CreateSpriteExFromGfx(1, obj_number, obj_gfx[1], obj_shape, obj_size, color_mode, palette, obj_mode, mosaic, hflip, vflip, prio, dblsize, x, 192); + PA_DualSetSpriteXY(obj_number, x, y); +} + + +/*! \fn static inline void PA_DualUpdateSpriteGfx(u8 obj_number, void *obj_data) + \brief + \~english Update the Gfx of a given sprite + \~french Mettre à jour les Gfx d'un sprite donné + \~\param obj_number + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param obj_data + \~english Gfx to load + \~french Graphisme à charger +*/ +static inline void PA_DualUpdateSpriteGfx(u8 obj_number, void *obj_data){ + PA_UpdateSpriteGfx(0, obj_number, obj_data); + PA_UpdateSpriteGfx(1, obj_number, obj_data); +} + + +/*! \fn static inline void PA_DualUpdateGfx(u16 gfx_number, void *obj_data) + \brief + \~english Update the Gfx of a given sprite + \~french Mettre à jour les Gfx d'un sprite donné + \~\param gfx_number + \~english Gfx number in memory + \~french Numéro du Gfx en mémoire + \~\param obj_data + \~english Gfx to load + \~french Graphisme à charger +*/ +static inline void PA_DualUpdateGfx(u16 gfx_number, void *obj_data){ + PA_UpdateGfx(0, gfx_number, obj_data); + PA_UpdateGfx(1, gfx_number, obj_data); +} + +/*! \fn static inline void PA_DualDeleteSprite(u8 obj_number) + \brief + \~english Delete a given sprite. If it is the only one to use it's gfx, it'll be deleted too. + \~french Effacer un sprite. S'il était le seul à utiliser un gfx, il sera effacé lui aussi + \~\param obj_number + \~english Sprite number + \~french Numéro du sprite +*/ +static inline void PA_DualDeleteSprite(u8 obj_number){ + PA_DeleteSprite(0, obj_number); + PA_DeleteSprite(1, obj_number); +} + +/*! \fn static inline void PA_DualSetSpriteRotEnable(u8 sprite, u8 rotset) + \brief + \~english Rotate and zoom a sprite + \~french Faire tourner et zoomer un sprite + \~\param sprite + \~english Sprite you want to rotate + \~french Sprite que l'on veut faire tourner + \~\param rotset + \~english Rotset you want to give to that sprite (0-31). You can apparently use a rotset for multiple sprites if zoomed/rotated identically... + \~french Rotset que l'on veut pour un sprite donné (0-31). On peut a priori utiliser un rotset pour plusieurs sprites, s'ils sont zoomés/tournés pareil... +*/ +static inline void PA_DualSetSpriteRotEnable(u8 sprite, u8 rotset){ + PA_SetSpriteRotEnable(0, sprite, rotset); + PA_SetSpriteRotEnable(1, sprite, rotset); +} + +/*! \fn static inline void PA_DualSetSpriteRotDisable(u8 sprite) + \brief + \~english Stop rotating and zooming a sprite + \~french Arreter de faire tourner et zoomer un sprite + \~\param sprite + \~english Sprite you want to rotate + \~french Sprite que l'on veut faire tourner +*/ +static inline void PA_DualSetSpriteRotDisable(u8 sprite){ + PA_SetSpriteRotDisable(0, sprite); + PA_SetSpriteRotDisable(1, sprite); +} + +/*! \fn static inline void PA_DualSetRotset(u8 rotset, s16 angle, u16 zoomx, u16 zoomy) + \brief + \~english Rotate and zoom a sprite + \~french Faire tourner et zoomer un sprite + \~\param rotset + \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... + \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable + \~\param angle + \~english Angle, between 0 and 512 (not 360, be carefull) + \~french Angle, entre 0 et 512 (et non 360, attention !) + \~\param zoomx + \~english Horizontal zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p + \~french Zoom horizontal. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p + \~\param zoomy + \~english Vertical zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p + \~french Zoom vertical. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p +*/ + +static inline void PA_DualSetRotset(u8 rotset, s16 angle, u16 zoomx, u16 zoomy) { + u8 obj_num = (rotset << 2); + PA_obj[0][obj_num].atr3 = PA_obj[1][obj_num].atr3 = (PA_Cos(angle) * zoomx) >> 8; + PA_obj[0][obj_num + 1].atr3 = PA_obj[1][obj_num + 1].atr3 = (-PA_Sin(angle) * zoomy) >> 8; + PA_obj[0][obj_num + 2].atr3 = PA_obj[1][obj_num + 2].atr3 = (PA_Sin(angle) * zoomx) >> 8; + PA_obj[0][obj_num + 2].atr3 = PA_obj[1][obj_num + 2].atr3 = (PA_Sin(angle) * zoomx) >> 8; + PA_obj[0][obj_num + 3].atr3 = PA_obj[1][obj_num + 3].atr3 = (PA_Cos(angle) * zoomy) >> 8; +} + +/*! \fn static inline void PA_DualSetRotsetNoZoom(u8 rotset, s16 angle) + \brief + \~english Rotate a sprite without zooming. It's a bit faster than the normal PA_SetRotset function + \~french Faire tourner un sprite sans zoomer. C'est un peu plus rapide que la fonction PA_SetRotset + \~\param rotset + \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... + \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable + \~\param angle + \~english Angle, between 0 and 512 (not 360, be carefull) + \~french Angle, entre 0 et 512 (et non 360, attention !) +*/ +static inline void PA_DualSetRotsetNoZoom(u8 rotset, s16 angle) { + u8 obj_num = (rotset << 2); + PA_obj[0][obj_num].atr3 = PA_obj[1][obj_num].atr3 = PA_Cos(angle); + PA_obj[0][obj_num + 1].atr3 = PA_obj[1][obj_num + 1].atr3 = -PA_Sin(angle); + PA_obj[0][obj_num + 2].atr3 = PA_obj[1][obj_num + 2].atr3 = PA_Sin(angle); + PA_obj[0][obj_num + 3].atr3 = PA_obj[1][obj_num + 3].atr3 = PA_Cos(angle); +} + +/*! \fn static inline void PA_DualSetRotsetNoAngle(u8 rotset, u16 zoomx, u16 zoomy) + \brief + \~english Zoom a sprite without rotating. It's a bit faster than the normal PA_SetRotset function + \~french Zoomer un sprite sans le faire tourner. C'est un peu plus rapide que la fonction PA_SetRotset + \~\param rotset + \~english Rotset you want to change. To give a sprite a rotset, use PA_SetSpriteRotEnable... + \~french Rotset que l'on veut changer. Pour attribuer un rotset à un sprite, utiliser PA_SetSpriteRotEnable + \~\param zoomx + \~english Horizontal zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p + \~french Zoom horizontal. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p + \~\param zoomy + \~english Vertical zoom. 256 is unzoomed, 512 is 2 times smaller, and 128 twice as big... So adjust at will ! :p + \~french Zoom vertical. 256 est pas de zoom, 512 2 fois plus petit, et 128 2 fois plus grand... Ajuster au mieux ! :p +*/ +static inline void PA_DualSetRotsetNoAngle(u8 rotset, u16 zoomx, u16 zoomy) { + u8 obj_num = (rotset << 2); + PA_obj[0][obj_num].atr3 = PA_obj[1][obj_num].atr3 = zoomx; + PA_obj[0][obj_num + 1].atr3 = PA_obj[1][obj_num + 1].atr3 = 0; + PA_obj[0][obj_num + 2].atr3 = PA_obj[1][obj_num + 2].atr3 = 0; + PA_obj[0][obj_num + 3].atr3 = PA_obj[1][obj_num + 3].atr3 = zoomy; +} + +/*! \fn static inline void PA_DualSetSpritePal(u8 obj, u8 pal) + \brief + \~english Set the color palette used by a sprite + \~french Changer la palette d'un sprite + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param pal + \~english Palette number (0 - 15) + \~french Numéro de la palette (de 0 à 15) +*/ +static inline void PA_DualSetSpritePal(u8 obj, u8 pal){ + PA_SetSpritePal(0, obj, pal); + PA_SetSpritePal(1, obj, pal); +} + +/*! \fn static inline void PA_DualSetSpriteDblsize(u8 obj, u8 dblsize) + \brief + \~english Enable or disable double size for a given sprite + \~french Activer ou désactiver le mode Doublesize pour un sprite + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param dblsize + \~english 1 to enable doublesize, 0 to disable it... + \~french 1 pour l'activer, 0 pour l'inactiver +*/ +static inline void PA_DualSetSpriteDblsize(u8 obj, u8 dblsize){ + PA_SetSpriteDblsize(0, obj, dblsize); + PA_SetSpriteDblsize(1, obj, dblsize); +} + +/*! \fn static inline void PA_DualSetSpriteColors(u8 sprite, u8 n_colors) + \brief + \~english Change the sprite's color mode + \~french Changer le mode de couleur du sprite + \~\param sprite + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param n_colors + \~english 0 for 16 colors, 1 for 256 + \~french 0 pour 16 couleurs, 1 pour 256 +*/ +static inline void PA_DualSetSpriteColors(u8 sprite, u8 n_colors){ + PA_SetSpriteColors(0, sprite, n_colors); + PA_SetSpriteColors(1, sprite, n_colors); + +} + +/*! \fn static inline void PA_DualSetSpriteMode(u8 sprite, u8 obj_mode) + \brief + \~english Set the sprite's mode : 0 for normal, 1 for alpha blending, 2 for window + \~french Régler le mode d'un sprite : 0 pour normal, 1 pour transparent, 2 pour fenetre + \~\param sprite + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param obj_mode + \~english Object mode : 0 for normal, 1 for alpha blending, 2 for window ; not working yet + \~french Mode : 0 pour normal, 1 pour transparent, 2 pour fenetre ; ne marche pas encore +*/ +static inline void PA_DualSetSpriteMode(u8 sprite, u8 obj_mode){ + PA_SetSpriteMode(0, sprite, obj_mode); + PA_SetSpriteMode(1, sprite, obj_mode); +} + +/*! \fn static inline void PA_DualSetSpriteMosaic(u8 obj, u8 mosaic) + \brief + \~english Enable or disable mosaic mode for a given sprite + \~french Mettre ou non un sprite en mode mosaic + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param mosaic + \~english Set mosaic on (1) or off (0) + \~french Mode mosaic activé (1) ou désactivé (0) +*/ +static inline void PA_DualSetSpriteMosaic(u8 obj, u8 mosaic){ + PA_SetSpriteMosaic(0, obj, mosaic); + PA_SetSpriteMosaic(1, obj, mosaic); +} + +/*! \fn static inline void PA_DualSetSpriteHflip(u8 obj, u8 hflip) + \brief + \~english Enable or disable horizontal flip for a given sprite + \~french Utiliser ou non le flip horizontal pour un sprite + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param hflip + \~english Horizontal flip, 1 to enable, 0 to disable... + \~french Flip horizontal, 1 pour oui, 0 pour non... +*/ +static inline void PA_DualSetSpriteHflip(u8 obj, u8 hflip){ + PA_SetSpriteHflip(0, obj, hflip); + PA_SetSpriteHflip(1, obj, hflip); +} + +/*! \fn static inline void PA_DualSetSpriteVflip(u8 obj, u8 vflip) + \brief + \~english Enable or disable vertical flip for a given sprite + \~french Utiliser ou non le flip vertical pour un sprite + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param vflip + \~english Vertical flip, 1 to enable, 0 to disable... + \~french Flip vertical, 1 pour oui, 0 pour non... +*/ +static inline void PA_DualSetSpriteVflip(u8 obj, u8 vflip){ + PA_SetSpriteVflip(0, obj, vflip); + PA_SetSpriteVflip(1, obj, vflip); +} + +/*! \fn static inline void PA_DualSetSpriteGfx(u8 obj, u16 *gfx) + \brief + \~english Change the gfx used by a sprite + \~french Modifier les graphismes utilisés par un sprite + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param gfx + \~english Gfx number ; you can get one by using PA_CreateGfx or PA_GetSpriteGfx(obj_number); + \~french Numéro du gfx en mémoire ; on peut obtenir un numéro avec PA_CreateGfx ou PA_GetSpriteGfx(obj_number); +*/ +static inline void PA_DualSetSpriteGfx(u8 obj, u16 *gfx){ + PA_SetSpriteGfx(0, obj, gfx[0]); + PA_SetSpriteGfx(1, obj, gfx[1]); +} + +/*! \fn static inline void PA_DualSetSpritePrio(u8 obj, u8 prio) + \brief + \~english Set a sprite's Background priority + \~french Régler la priorité d'un sprite par rapport au Bg. + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param prio + \~english Sprite priority : 0 is over background 0, 1 over Bg 1, etc... (0-3) + \~french Priorité du sprite : 0 est au-dessus du fond 0, 1 au-dessus du 1, etc... (0-3) +*/ +static inline void PA_DualSetSpritePrio(u8 obj, u8 prio){ + PA_SetSpritePrio(0, obj, prio); + PA_SetSpritePrio(1, obj, prio); +} + +/*! \fn static inline void PA_DualCloneSprite(u8 obj, u8 target) + \brief + \~english Clone a sprite. Works only for sprites on the same screen + \~french Cloner un sprite. Marche uniquement pour les sprites sur un meme écran + \~\param obj + \~english Object number in the sprite system + \~french Numéro de l'objet dans le systeme de sprite + \~\param target + \~english Target sprite to clone + \~french Numéro de la cible à cloner +*/ +static inline void PA_DualCloneSprite(u8 obj, u8 target){ + PA_CloneSprite(0, obj, target); + PA_CloneSprite(1, obj, target); +} + +/*! \fn static inline void PA_DualSetSpriteAnimEx(u8 sprite, u8 lx, u8 ly, u8 ncolors, s16 animframe) + \brief + \~english Set the animation frame for a given sprite. This function is faster than the normal PA_SetSpriteAnim because it doesn't have to lookup the sprite dimensions... + \~french Régler l'image du sprite dans l'animation. Cette fonction est plus rapide que PA_SetSpriteAnim parce qu'elle n'a pas à rechercher les dimensions du sprite + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param lx + \~english Sprite width (8, 16, 32, 64) + \~french Largeur du sprite (8, 16, 32, 64) + \~\param ly + \~english Sprite height (8, 16, 32, 64) + \~french Hauteur du sprite (8, 16, 32, 64) + \~\param ncolors + \~english Sprite color mode (0 for 16 colors, 1 for 256) + \~french Mode couleur du sprite (0 pour 16 couleurs, 1 pour 256) + \~\param animframe + \~english Sprite animation frame (0, 1, 2, etc...) + \~french Frame de l'animation du sprite (0, 1, 2, etc...) +*/ +static inline void PA_DualSetSpriteAnimEx(u8 sprite, u8 lx, u8 ly, u8 ncolors, s16 animframe){ + PA_SetSpriteAnimEx(0, sprite, lx, ly, ncolors, animframe); + PA_SetSpriteAnimEx(1, sprite, lx, ly, ncolors, animframe); +} + +/*! \fn static inline void PA_DualSetSpriteAnim(u8 sprite, s16 animframe) + \brief + \~english Set the animation frame for a given sprite. Same as PA_SetSpriteAnimEx, but a bit slower and easier to use... + \~french Régler l'image du sprite dans l'animation. Identique à PA_SetSpriteAnimEx, mais plus simple à utiliser, par contre plus lent + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param animframe + \~english Sprite animation frame (0, 1, 2, etc...) + \~french Frame de l'animation du sprite (0, 1, 2, etc...) +*/ +static inline void PA_DualSetSpriteAnim(u8 sprite, s16 animframe){ + u8 lx = PA_GetSpriteLx(0, sprite); u8 ly = PA_GetSpriteLy(0, sprite); + u8 ncolors = PA_GetSpriteColors(0, sprite); + PA_SetSpriteAnimEx(0, sprite, lx, ly, ncolors, animframe); + PA_SetSpriteAnimEx(1, sprite, lx, ly, ncolors, animframe); +} + +/*! \fn static inline void PA_DualStartSpriteAnimEx(u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles) + \brief + \~english Start a sprite animation for DualSprites. Once started, it continues on and on by itself until you stop it ! + \~french Démarre une animation de sprite pour DualSprites. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param firstframe + \~english First frame of the animation sequence, most of the time 0... + \~french Premières image de l'animation, généralement 0.... + \~\param lastframe + \~english Last frame to be displayed. When it gets there, it loops back to the first frame + \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première + \~\param speed + \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame + \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... + \~\param type + \~english Defines how you want it to loop. ANIM_LOOP (0) for a normal loop, ANIM_UPDOWN (1) for back and forth animation. + \~french Défini de quelle manière on veut boucler. ANIM_LOOP (0) pour normal, et ANIM_UPDOWN (1) pour d'avant en arrière + \~\param ncycles + \~english Number of animation cycles before stopping. If using ANIM_UPDOWN, it takes 2 cycles to come back to the original image + \~french Nombres de cycles d'animations avant l'arrêt. Si on utilise ANIM_UPDOWN, il faut 2 cycles pour que l'animation revienne à l'image de base +*/ +static inline void PA_DualStartSpriteAnimEx(u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles){ + PA_StartSpriteAnimEx(0, sprite, firstframe, lastframe, speed, type, ncycles); + PA_StartSpriteAnimEx(1, sprite, firstframe, lastframe, speed, type, ncycles); +} + +/*! \fn static inline void PA_DualStartSpriteAnim(u8 sprite, s16 firstframe, s16 lastframe, s16 speed) + \brief + \~english Start a sprite animation for DualSprite. Once started, it continues on and on by itself until you stop it ! + \~french Démarre une animation de sprite pour DualSprite. Une fois démarrée, elle continue tant qu'on ne l'arrête pas ! + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param firstframe + \~english First frame of the animation sequence, most of the time 0... + \~french Premières image de l'animation, généralement 0.... + \~\param lastframe + \~english Last frame to be displayed. When it gets there, it loops back to the first frame + \~french Dernière image à afficher. Une fois atteinte, ca retourne à la première + \~\param speed + \~english Speed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame + \~french Vitesse, en frames par seconde (fps). 1 signifie donc 1 image par seconde... +*/ +static inline void PA_DualStartSpriteAnim(u8 sprite, s16 firstframe, s16 lastframe, s16 speed){ + PA_StartSpriteAnim(0, sprite, firstframe, lastframe, speed); + PA_StartSpriteAnim(1, sprite, firstframe, lastframe, speed); +} + +/*! \fn static inline void PA_DualStopSpriteAnim(u8 sprite) + \brief + \~english Stop a sprite animation for DualSprites + \~french Arrêter une animation de sprite pour les DualSprites + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline void PA_DualStopSpriteAnim(u8 sprite){ + PA_StopSpriteAnim(0, sprite); + PA_StopSpriteAnim(1, sprite); +} + +/*! \fn static inline void PA_DualSetSpriteAnimFrame(u8 sprite, u16 frame) + \brief + \~english Set the current animation frame number for DualSprites + \~french Changer le numéro actuel de la frame d'animation pour les DualSprites + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param frame + \~english Frame number to use... + \~french Numéro de frame... +*/ +static inline void PA_DualSetSpriteAnimFrame(u8 sprite, u16 frame){ + PA_SetSpriteAnimFrame(0, sprite, frame); + PA_SetSpriteAnimFrame(1, sprite, frame); +} + +/*! \fn static inline u16 PA_DualGetSpriteAnimFrame(u8 sprite) + \brief + \~english Returns the current animation frame number for DualSprites + \~french Renvoie le numéro actuel de la frame d'animation pour les DualSprites + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline u16 PA_DualGetSpriteAnimFrame(u8 sprite){ + return spriteanims[0][sprite].currentframe; +} + +/*! \fn static inline void PA_DualSetSpriteAnimSpeed(u8 sprite, s16 speed) + \brief + \~english Set the current animation speed for DualSprites + \~french Changer la vitesse de l'animation pour les DualSprites + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param speed + \~english Speed, in fps... + \~french Vitesse, en fps... +*/ +static inline void PA_DualSetSpriteAnimSpeed(u8 sprite, s16 speed){ + PA_SetSpriteAnimSpeed(0, sprite, speed); + PA_SetSpriteAnimSpeed(1, sprite, speed); +} + +/*! \fn static inline u16 PA_DualGetSpriteAnimSpeed(u8 sprite) + \brief + \~english Returns the current animation speed for DualSprites + \~french Renvoie la vitesse de l'animation pour les DualSprites + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite +*/ +static inline u16 PA_DualGetSpriteAnimSpeed(u8 sprite){ + return spriteanims[0][sprite].speed; +} + +/*! \fn static inline void PA_DualSpriteAnimPause(u8 sprite, u8 pause) + \brief + \~english Pause or UnPause a sprite animation for DualSprites + \~french Mettre en Pause en remettre en lecture une animation de sprite pour les DualSprites + \~\param sprite + \~english sprite number in the sprite system + \~french Numéro du sprite dans le systeme de sprite + \~\param pause + \~english 1 for pause, 0 for unpause + \~french 1 pour pause, 0 pour reprendre la lecture... +*/ +static inline void PA_DualSpriteAnimPause(u8 sprite, u8 pause){ + PA_SpriteAnimPause(0, sprite, pause); + PA_SpriteAnimPause(1, sprite, pause); +} + +/** @} */ // end of Sprite + +#endif diff --git a/include/arm9/PA_Text.h b/include/arm9/PA_Text.h index 9a410fb..2a81a4a 100644 --- a/include/arm9/PA_Text.h +++ b/include/arm9/PA_Text.h @@ -1,520 +1,520 @@ -#ifndef _PA_TEXT -#define _PA_TEXT - - -#ifdef __cplusplus -extern "C" { -#endif - -#include "PA_BgTiles.h" - -extern u8 *bit8_tiles[10]; - -// DEPRECATED -#define PA_InitCustomTextEx(screen, bg_select, tiles, map, pal) do{\ - PA_DEPRECATED_MACRO;\ - PAbgtext[screen] = bg_select;\ - PA_LoadSimpleBg(screen, bg_select, tiles, NULL, BG_256X256, 0, 1);\ - PA_LoadBgPal(screen, bg_select, (void*)pal);\ - PA_textmap[screen] = (u16*)map;PA_textpal[screen] = (u16*)pal;PAtext_pal[screen]=0;\ - u32 PAtexttempvar = 0; for (PAtexttempvar = 0; PAtexttempvar < 32*24; PAtexttempvar++) PA_SetTileLetter(screen, PAtexttempvar, 0, 0);\ -}while(0) - -void PA_CreateTextPal(u8 screen, u8 pal_number, u16 r, u16 g, u16 b); - -extern u32 pa_printx[2]; -extern u32 pa_printy[2]; -extern s16 pa_printscroll[2]; - -void PA_PrintYPlus(u8 screen); - -/*! \file PA_Text.h - \brief Text system in tile mode - - Not much to say, just a good debug option... -*/ - -#define TEXT_WHITE 0 -#define TEXT_RED 1 -#define TEXT_GREEN 2 -#define TEXT_BLUE 3 -#define TEXT_MAGENTA 4 -#define TEXT_CYAN 5 -#define TEXT_YELLOW 6 -#define TEXT_LGRAY 7 -#define TEXT_DGRAY 8 -#define TEXT_BLACK 9 - -////////////////////////////////////////////////////////////////////// -// Système pour le texte -////////////////////////////////////////////////////////////////////// - -extern u16 textcol[2]; // Garde en mémoire la couleur du texte -extern u8 PAbgtext[2]; - -extern u16 *PA_textmap[2]; //Pointeur vers la map et les tiles... -extern u8 *PA_texttiles[2]; -extern u16 *PA_textpal[2]; - -extern s8 PA_font[2]; // 0 pour normal, 1 pour dégradé, -1 pour custom - -extern const u8 *textData[10]; -extern u8 policeheight[10]; -extern u16 policewidth[10]; -extern u8 *policesize[10]; - -extern u8 *text_tiles[10]; -extern u16 *text_maps[10]; - -extern u8 *pa8bitdefaultsize[10]; -extern u8 police8bitheight[10]; - -typedef void(*letterfp)(u8 size, u8 screen, u16 x, u16 y, char lettertemp, u8 color); -typedef void(*letterfp16bit)(u8 size, u8 screen, u16 x, u16 y, char lettertemp, u16 color); - -extern letterfp letters[5]; - -extern u16 PAtext_pal[2]; - -typedef struct{ - u8 x1, x2, y1, y2; -} textborders; -extern textborders PA_TextBox[2]; - -/** @defgroup Text Text output system - * Allows you to output text... - * @{ - */ - -/// Old name for PA_LoadDefaultText(). -#define PA_InitText PA_LoadDefaultText - -/*! \fn void PA_LoadDefaultText(u8 screen, u8 bg_select) - \brief - \~english Load and initialize the default text. Works only in modes 0-2 - \~french Charger et initialiser le texte. Ne marche qu'en modes 0-2 - \~\param screen - \~english Choose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) -*/ - -void PA_LoadDefaultText(u8 screen, u8 bg_select); - - -/*! \def PA_SetTileLetter(screen, x, y, letter) - \brief - \~english Output a letter on the DS screen. - \~french Ecrire une lettre à l'écran. - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X coordinate in TILES (0-31) where to write the letter - \~french Coordonnée X en TILES (0-31) où afficher la lettre - \~\param y - \~english Y coordinate in TILES (0-19) where to write the letter - \~french Coordonnée Y en TILES (0-19) où afficher la lettre - \~\param letter - \~english Letter... 'a', 'Z', etc... - \~french Lettre... 'a', 'Z', etc... -*/ -#define PA_SetTileLetter(screen, x, y, letter) PA_SetMapTileAll(screen, PAbgtext[screen], x, y, (PA_textmap[screen][(u16)letter]&((1<<12)-1)) + (PAtext_pal[screen] << 12)) - - - -/*! \fn static inline void PA_SetTextTileCol(u8 screen, u8 color) - \brief - \~english Change the text writing color (does not change the current text's color) - \~french Change la couleur du texte à écrire (ne change pas la couleur du texte déjà écrit) - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param color - \~english Color, from 0 to 6, just test to see the result... - \~french Couleur de 0 à 6, suffit de tester pour voir le résultat :) -*/ -static inline void PA_SetTextTileCol(u8 screen, u8 color){ - PAtext_pal[screen] = color; -} - -/*! \fn void PA_OutputText(u8 screen, u16 x, u16 y, const char* text, ...) - \brief - \~english Output text on the DS screen. Works only in modes 0-2 - \~french Ecrire du texte à l'écran. Ne marche qu'en modes 0-2 - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X coordinate in TILES (0-31) where to begin writing the text - \~french Coordonnée X en TILES (0-31) où commencer à afficher le text - \~\param y - \~english Y coordinate in TILES (0-19) where to begin writing the text - \~french Coordonnée Y en TILES (0-19) où commencer à afficher le text - \~\param text - \~english String to output. The following commands are avaiblable : \%s to output another string, \%d to output a value, \%fX to output a float with X digits, \\n to go to the line. Here's an example : PA_OutputText(0, 0, 1, "My name is %s and I have only %d teeth", "Mollusk", 20); - \~french Chaine de caractère à écrire. On dispose des commandes suivantes : \%s pour une autre chaine de caractères, \%d pour écrire la valeur d'une variables, \%fX pour afficher un nombre avec X chiffres après la virgule, \\n pour aller à la ligne. Voici un exemple : PA_OutputText(0, 0, 1, "Mon nom est %s et je n'ai que %d dents...", "Mollusk", 20); -*/ -void PA_OutputText(u8 screen, u16 x, u16 y, const char* text, ...); - -/*! \fn u16 PA_OutputSimpleText(u8 screen, u16 x, u16 y, const char *text) - \brief - \~english Output simple text on the DS screen. Works only in modes 0-2. Much faster than PA_OutputText, but much more limited... Returns the number of letters - \~french Ecrire du texte tout simple à l'écran. Ne marche qu'en modes 0-2. Beaucoup plus rapide que PA_OutputText, masi aussi beaucoup plus limité... Renvoie le nombre de lettres - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x - \~english X coordinate in TILES (0-31) where to begin writing the text - \~french Coordonnée X en TILES (0-31) où commencer à afficher le text - \~\param y - \~english Y coordinate in TILES (0-19) where to begin writing the text - \~french Coordonnée Y en TILES (0-19) où commencer à afficher le text - \~\param text - \~english String to output. - \~french Chaine de caractère à écrire. -*/ -u16 PA_OutputSimpleText(u8 screen, u16 x, u16 y, const char *text); - -/*! \fn u32 PA_BoxText(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit) - \brief - \~english Output text on the DS screen. This text is limited to a chosen box, and you can chose the number of letters to output (can be used to show 'typed' text, just put 10000 if you want to show all the text...). Returns the number of letters outputed - \~french Permet d'écrire du texte à l'écran, dans une boite délimitée au choix, et en choisissant le nombre de lettres à afficher (peut être utile pour afficher du texte en train de se taper, sinon suffit de mettre 10000 pour afficher tout d'un coup) Renvoie le nmobre de lettre écrites - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param basex - \~english X coordinate in TILES (0-31) where to begin writing the text - \~french Coordonnée X en TILES (0-31) où commencer à afficher le text - \~\param basey - \~english Y coordinate in TILES (0-19) where to begin writing the text - \~french Coordonnée Y en TILES (0-19) où commencer à afficher le text - \~\param maxx - \~english X coordinate in TILES (0-31) where to stop writing the text - \~french Coordonnée X en TILES (0-31) où finir d'afficher le text - \~\param maxy - \~english Y coordinate in TILES (0-19) where to stop writing the text - \~french Coordonnée Y en TILES (0-19) où finir d'afficher le text - \~\param text - \~english String to output. - \~french Chaine de caractère à écrire. - \~\param limit - \~english Maximum number of letters to show this time - \~french Nombre maximum de lettres à afficher pour ce coup-ci -*/ -u32 PA_BoxText(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit); - -/*! \fn u32 PA_BoxTextNoWrap(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit) - \brief - \~english Output text on the DS screen. This text is limited to a chosen box, and you can chose the number of letters to output (can be used to show 'typed' text, just put 10000 if you want to show all the text...). Returns the number of letters outputed. This function does not support word wrapping - \~french Permet d'écrire du texte à l'écran, dans une boite délimitée au choix, et en choisissant le nombre de lettres à afficher (peut être utile pour afficher du texte en train de se taper, sinon suffit de mettre 10000 pour afficher tout d'un coup) Renvoie le nombre de lettre écrites. Cette fonction coupe les mots... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param basex - \~english X coordinate in TILES (0-31) where to begin writing the text - \~french Coordonnée X en TILES (0-31) où commencer à afficher le text - \~\param basey - \~english Y coordinate in TILES (0-19) where to begin writing the text - \~french Coordonnée Y en TILES (0-19) où commencer à afficher le text - \~\param maxx - \~english X coordinate in TILES (0-31) where to stop writing the text - \~french Coordonnée X en TILES (0-31) où finir d'afficher le text - \~\param maxy - \~english Y coordinate in TILES (0-19) where to stop writing the text - \~french Coordonnée Y en TILES (0-19) où finir d'afficher le text - \~\param text - \~english String to output. - \~french Chaine de caractère à écrire. - \~\param limit - \~english Maximum number of letters to show this time - \~french Nombre maximum de lettres à afficher pour ce coup-ci -*/ -u32 PA_BoxTextNoWrap(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit); - -/*! - \fn static inline void PA_SetTextCol(u8 screen, u16 r, u16 g, u16 b) - \brief - \~english Change the screen text's default color - \~french Changer la couleur de base du texte à l'écran - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param r - \~english Red amount (0-31) - \~french Quantité de rouge (0-31) - \~\param g - \~english Green amount (0-31) - \~french Quantité de vert (0-31) - \~\param b - \~english Blue amount (0-31) - \~french Quantité de bleu (0-31) -*/ -static inline void PA_SetTextCol(u8 screen, u16 r, u16 g, u16 b){ - PA_CreateTextPal(screen, 0, r, g, b); -} - -/*! - \def PA_InitCustomText(screen, bg_select, text) - \deprecated - \brief - \~english [DEPRECATED] Init the text using one of your own fonts ! - \~french [DEPRECATED] Initialiser le texte en utilisant une police perso - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number... - \~french Numéro du fond... - \~\param text - \~english Font image file name converted with PAGfx - \~french Image de la police, converti avec PAGfx - -*/ -#define PA_InitCustomText(screen, bg_select, text) PA_InitCustomTextEx(screen, bg_select, text##_Tiles, text##_Map, text##_Pal) - -/*! - \fn void PA_LoadText(u8 screen, u8 bg_select, const PA_BgStruct* font) - \brief - \~english Load and initialize a custom font. - \~french Initialiser le texte en utilisant une police perso - \~\param screen - \~english Chose the screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param bg_select - \~english Background number... - \~french Numéro du fond... - \~\param font - \~english Pointer to the font - \~french Pointeur vers la police -*/ - -void PA_LoadText(u8 screen, u8 bg_number, const PA_BgStruct* font); - -/*! - \def PA_ShowFont(screen) - \brief - \~english Show the current font used. This is just for debug, no real use ingame - \~french Affiche la police utilisée. C'est juste utile pour du débuggage, aucun intéret autrement - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) -*/ -#define PA_ShowFont(screen) PA_LoadBgMap(screen, PAbgtext[screen], (void*)PA_textmap[screen], BG_256X256) - -/*! \fn s16 PA_8bitText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp, s32 limit) - \brief - \~english This is a variable width and variable size function to draw text on the screen. It draws on an 8 bit background (see PA_Init8bitBg for more info), and has options such as size, transaprency, and box limits, as well as the color. Only problem : it does not take commands such as %d, etc... The function returns the number of characters it outputed - \~french Cette fonction permet d'écrire du texte à chasse variable à l'écran. Elle nécessite d'avoir un fond dessinable de 8 bits (cf PA_Init8bitBg). Les options sont la taille, la transparence, et les limites, ainsi que la couleur. Seul inconvénient : il n'accepte pas les commande comme %d, etc... La fonction renvoie le nombre de charactères écrits - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param basex - \~english X coordinate of the top left corner - \~french Coordonnée X du coin supérieur gauche - \~\param basey - \~english Y coordinate of the top left corner - \~french Coordonnée Y du coin supérieur gauche - \~\param maxx - \~english X coordinate of the down right corner - \~french Coordonnée X du coin inférieur droit - \~\param maxy - \~english Y coordinate of the down right corner - \~french Coordonnée Y du coin inférieur droit - \~\param text - \~english Text, such as "Hello World" - \~french Texte, tel que "Hello World" - \~\param color - \~english Palette color to use (0-255) - \~french Couleur de la palette à utiliser (0-255) - \~\param size - \~english Size of the text, from 0 (really small) to 4 (pretty big) - \~french Taille du texte, de 0 (vraiment petit) à 4 (assez grand) - \~\param transp - \~english Transparency. Setting this to 0 will overwrite all drawing in the text zone. 1 will write the text without erasing the drawing. 2 won't output anything (just to count the letters), 3 is rotated one way, 4 rotated the other way - \~french Transparence. Mettre à 0 effecera tout dessin de la zone de texte. 1 écrira le texte par-dessus le dessin sans l'effacer. 2 n'écrira rien (juste pour compter les lettres). 3 fera un texte tourné à 90°. 4 est un texte tourné dans l'autre sens. - \~\param limit - \~english You can give a maximum number of characters to output. This can be usefull to have a slowing drawing text (allow to draw 1 more character each frame...) - \~french On peut fixer une limite au nombre de caractères. Ceci peut etre utile pour dessiner un texte progressivement, en augmentant de 1 le nombre de caractères à chaque boucle.... -*/ -s16 PA_8bitText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp, s32 limit); -s16 PA_16bitText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u16 color, u8 size, u8 transp, s32 limit); - -/*! \fn s16 PA_CenterSmartText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp) - \brief - \~english Basicaly the same as the SmartText function, but this time centered... - \~french En gros la meme chose que SmartText, mais en centré... - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param basex - \~english X coordinate of the top left corner - \~french Coordonnée X du coin supérieur gauche - \~\param basey - \~english Y coordinate of the top left corner - \~french Coordonnée Y du coin supérieur gauche - \~\param maxx - \~english X coordinate of the down right corner - \~french Coordonnée X du coin inférieur droit - \~\param maxy - \~english Y coordinate of the down right corner - \~french Coordonnée Y du coin inférieur droit - \~\param text - \~english Text, such as "Hello World" - \~french Texte, tel que "Hello World" - \~\param color - \~english Palette color to use (0-255) - \~french Couleur de la palette à utiliser (0-255) - \~\param size - \~english Size of the text, from 0 (really small) to 4 (pretty big) - \~french Taille du texte, de 0 (vraiment petit) à 4 (assez grand) - \~\param transp - \~english Transparency. Setting this to 0 will overwrite all drawing in the text zone. 1 will write the text without erasing the drawing. 2 won't output anything (just to count the letters), 3 is rotated one way, 4 rotated the other way - \~french Transparence. Mettre à 0 effecera tout dessin de la zone de texte. 1 écrira le texte par-dessus le dessin sans l'effacer. 2 n'écrira rien (juste pour compter les lettres). 3 fera un texte tourné à 90°. 4 est un texte tourné dans l'autre sens. -*/ -s16 PA_CenterSmartText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp); - -/*! \def PA_8bitCustomFont(bit8_slot, bit8_font) - \deprecated - \brief - \~english [DEPRECATED] Add custom fonts to the 8bit Font system !! Font must be converted with PAGfx - \~french [DEPRECATED] Ajouter une police perso dans le systeme de texte 8bit !! Doit être convertie avec PAGfx - \~\param bit8_slot - \~english Font slot... 0-4 are used by the defaut PAlib fonts, 5-9 are free to use. You can freely overwrite the PAlib fonts if you want - \~french Slot pour ajouter la police. Les slots 0-4 sont utilisés pour les polices par défaut de PAlib, et 5-9 sont libres. On peut néanmoins charger par-dessus les polices PAlib si on veut - \~\param bit8_font - \~english Font name;.. - \~french Nom de la police... -*/ -#define PA_8bitCustomFont(bit8_slot, bit8_font)do{\ - PA_DEPRECATED_MACRO;\ - bittext_maps[bit8_slot] = (u16*)(void*)bit8_font##_Map; \ - bit8_tiles[bit8_slot] = (u8*)bit8_font##_Tiles; \ - pa_bittextdefaultsize[bit8_slot] = (u8*)bit8_font##_Sizes; \ - pa_bittextpoliceheight[bit8_slot] = bit8_font##_Height;\ -}while(0) - -/*! \fn void PA_AddBitmapFont(int slot, const PA_BgStruct* font) - \brief - \~english Add a custom font to the 8bit/16bit font system. - \~french Ajouter une police perso dans le système de texte 8bit/16bit. - \~\param slot - \~english Font slot. 0-4 are used by the default PAlib fonts, 5-9 are free to use. You can freely overwrite the PAlib fonts if you want. - \~french Slot pour ajouter la police. Les slots 0-4 sont utilisés pour les polices par défaut de PAlib, et 5-9 sont libres. On peut néanmoins charger par-dessus les polices PAlib si on veut. - \~\param font - \~english Pointer to the font. - \~french Pointeur vers le police perso. -*/ -void PA_AddBitmapFont(int slot, const PA_BgStruct* font); - -/*! \fn void PA_InitTextBorders(u8 screen, u8 x1, u8 y1, u8 x2, u8 y2) - \brief - \~english Initialise a text box with it's borders. This makes writing in a delimited area much easier... - \~french Initialise une boite à texte, avec la bordure. Ceci rend l'utilisation des textes délimités bien plus simple - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param x1 - \~english Left limit in tiles - \~french Limite gauche en tiles - \~\param y1 - \~english Top - \~french Haut - \~\param x2 - \~english Right - \~french Droite - \~\param y2 - \~english Bottom - \~french Bas -*/ -void PA_InitTextBorders(u8 screen, u8 x1, u8 y1, u8 x2, u8 y2); - -/*! \fn void PA_EraseTextBox(u8 screen) - \brief - \~english Erases the text in a textbox. Requires that that box be initialized with PA_InitTextBorders - \~french Efface le text d'un boite à texte... Nécessite qu'il ait été initialisé avec PA_InitTextBorders - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) -*/ -void PA_EraseTextBox(u8 screen); - -/*! \fn static inline u32 PA_SimpleBoxText(u8 screen, const char *text, u32 limit) - \brief - \~english Write text in an initiliazed textbox. Similar to PA_BoxText, but without needing the text limits - \~french Ecrit du texte dans une zone délimitée. Similaire à PA_BoxText, mais sans avoir besoin de délimiter - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param text - \~english String to output. - \~french Chaine de caractère à écrire. - \~\param limit - \~english Maximum number of letters to show this time - \~french Nombre maximum de lettres à afficher pour ce coup-ci -*/ -static inline u32 PA_SimpleBoxText(u8 screen, const char *text, u32 limit){ - return PA_BoxText(screen, PA_TextBox[screen].x1+1, PA_TextBox[screen].y1+1, PA_TextBox[screen].x2-1, PA_TextBox[screen].y2-1, text, limit); -} - -/*! \fn void PA_ClearTextBg(u8 screen) - \brief - \~english Erase all the text on a given screen - \~french Effacer tout le texte sur un écran donné - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) -*/ -void PA_ClearTextBg(u8 screen); - -/*! \fn void PA_Print(u8 screen, const char* text, ...) - \brief - \~english Output text on the DS screen. Works like a printf function - \~french Ecrire du texte à l'écran. Marche comme la fonction printf - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param text - \~english String to output. The following commands are avaiblable : \%s to output another string, \%d to output a value, \%fX to output a float with X digits, \\n to go to the line. Here's an example : PA_OutputText(0, 0, 1, "My name is %s and I have only %d teeth", "Mollusk", 20); - \~french Chaine de caractère à écrire. On dispose des commandes suivantes : \%s pour une autre chaine de caractères, \%d pour écrire la valeur d'une variables, \%fX pour afficher un nombre avec X chiffres après la virgule, \\n pour aller à la ligne. Voici un exemple : PA_OutputText(0, 0, 1, "Mon nom est %s et je n'ai que %d dents...", "Mollusk", 20); -*/ -void PA_Print(u8 screen, const char* text, ...); - -/*! \fn static inline void PA_PrintLetter(u8 screen, char letter) - \brief - \~english Like PA_Print, but for a letter - \~french Comme PA_Print, mais juste pour une lettre - \~\param screen - \~english Chose de screen (0 or 1) - \~french Choix de l'écran (0 ou 1) - \~\param letter - \~english Any letter... - \~french Une lettre... -*/ -static inline void PA_PrintLetter(u8 screen, char letter){ - PA_SetTileLetter(screen, pa_printx[screen], pa_printy[screen]&31, letter); - pa_printx[screen]++; - if(pa_printx[screen] >= 32){ - PA_PrintYPlus(screen); - } -} - -void PA_OutputTextSpecial0(u8 screen, int x1, int y,const char *text); -void PA_OutputTextSpecial1(u8 screen, int x1, int y,const char *text); -void PA_OutputTextSpecial2(u8 screen, int x1, int y,const char *text); -void PA_OutputTextSpecial3(u8 screen, int x1, int y,const char *text); -void PA_OutputTextSpecial4(u8 screen, int x1, int y,const char *text); -void PA_OutputTextSpecial5(u8 screen, int x1, int y,const char *text); - -/** @} */ // end of Text - -// Backwards compatibility -#define PA_SmartText PA_8bitText - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_TEXT +#define _PA_TEXT + + +#ifdef __cplusplus +extern "C" { +#endif + +#include "PA_BgTiles.h" + +extern u8 *bit8_tiles[10]; + +// DEPRECATED +#define PA_InitCustomTextEx(screen, bg_select, tiles, map, pal) do{\ + PA_DEPRECATED_MACRO;\ + PAbgtext[screen] = bg_select;\ + PA_LoadSimpleBg(screen, bg_select, tiles, NULL, BG_256X256, 0, 1);\ + PA_LoadBgPal(screen, bg_select, (void*)pal);\ + PA_textmap[screen] = (u16*)map;PA_textpal[screen] = (u16*)pal;PAtext_pal[screen]=0;\ + u32 PAtexttempvar = 0; for (PAtexttempvar = 0; PAtexttempvar < 32*24; PAtexttempvar++) PA_SetTileLetter(screen, PAtexttempvar, 0, 0);\ +}while(0) + +void PA_CreateTextPal(u8 screen, u8 pal_number, u16 r, u16 g, u16 b); + +extern u32 pa_printx[2]; +extern u32 pa_printy[2]; +extern s16 pa_printscroll[2]; + +void PA_PrintYPlus(u8 screen); + +/*! \file PA_Text.h + \brief Text system in tile mode + + Not much to say, just a good debug option... +*/ + +#define TEXT_WHITE 0 +#define TEXT_RED 1 +#define TEXT_GREEN 2 +#define TEXT_BLUE 3 +#define TEXT_MAGENTA 4 +#define TEXT_CYAN 5 +#define TEXT_YELLOW 6 +#define TEXT_LGRAY 7 +#define TEXT_DGRAY 8 +#define TEXT_BLACK 9 + +////////////////////////////////////////////////////////////////////// +// Système pour le texte +////////////////////////////////////////////////////////////////////// + +extern u16 textcol[2]; // Garde en mémoire la couleur du texte +extern u8 PAbgtext[2]; + +extern u16 *PA_textmap[2]; //Pointeur vers la map et les tiles... +extern u8 *PA_texttiles[2]; +extern u16 *PA_textpal[2]; + +extern s8 PA_font[2]; // 0 pour normal, 1 pour dégradé, -1 pour custom + +extern const u8 *textData[10]; +extern u8 policeheight[10]; +extern u16 policewidth[10]; +extern u8 *policesize[10]; + +extern u8 *text_tiles[10]; +extern u16 *text_maps[10]; + +extern u8 *pa8bitdefaultsize[10]; +extern u8 police8bitheight[10]; + +typedef void(*letterfp)(u8 size, u8 screen, u16 x, u16 y, char lettertemp, u8 color); +typedef void(*letterfp16bit)(u8 size, u8 screen, u16 x, u16 y, char lettertemp, u16 color); + +extern letterfp letters[5]; + +extern u16 PAtext_pal[2]; + +typedef struct{ + u8 x1, x2, y1, y2; +} textborders; +extern textborders PA_TextBox[2]; + +/** @defgroup Text Text output system + * Allows you to output text... + * @{ + */ + +/// Old name for PA_LoadDefaultText(). +#define PA_InitText PA_LoadDefaultText + +/*! \fn void PA_LoadDefaultText(u8 screen, u8 bg_select) + \brief + \~english Load and initialize the default text. Works only in modes 0-2 + \~french Charger et initialiser le texte. Ne marche qu'en modes 0-2 + \~\param screen + \~english Choose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) +*/ + +void PA_LoadDefaultText(u8 screen, u8 bg_select); + + +/*! \def PA_SetTileLetter(screen, x, y, letter) + \brief + \~english Output a letter on the DS screen. + \~french Ecrire une lettre à l'écran. + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X coordinate in TILES (0-31) where to write the letter + \~french Coordonnée X en TILES (0-31) où afficher la lettre + \~\param y + \~english Y coordinate in TILES (0-19) where to write the letter + \~french Coordonnée Y en TILES (0-19) où afficher la lettre + \~\param letter + \~english Letter... 'a', 'Z', etc... + \~french Lettre... 'a', 'Z', etc... +*/ +#define PA_SetTileLetter(screen, x, y, letter) PA_SetMapTileAll(screen, PAbgtext[screen], x, y, (PA_textmap[screen][(u16)letter]&((1<<12)-1)) + (PAtext_pal[screen] << 12)) + + + +/*! \fn static inline void PA_SetTextTileCol(u8 screen, u8 color) + \brief + \~english Change the text writing color (does not change the current text's color) + \~french Change la couleur du texte à écrire (ne change pas la couleur du texte déjà écrit) + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param color + \~english Color, from 0 to 6, just test to see the result... + \~french Couleur de 0 à 6, suffit de tester pour voir le résultat :) +*/ +static inline void PA_SetTextTileCol(u8 screen, u8 color){ + PAtext_pal[screen] = color; +} + +/*! \fn void PA_OutputText(u8 screen, u16 x, u16 y, const char* text, ...) + \brief + \~english Output text on the DS screen. Works only in modes 0-2 + \~french Ecrire du texte à l'écran. Ne marche qu'en modes 0-2 + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X coordinate in TILES (0-31) where to begin writing the text + \~french Coordonnée X en TILES (0-31) où commencer à afficher le text + \~\param y + \~english Y coordinate in TILES (0-19) where to begin writing the text + \~french Coordonnée Y en TILES (0-19) où commencer à afficher le text + \~\param text + \~english String to output. The following commands are avaiblable : \%s to output another string, \%d to output a value, \%fX to output a float with X digits, \\n to go to the line. Here's an example : PA_OutputText(0, 0, 1, "My name is %s and I have only %d teeth", "Mollusk", 20); + \~french Chaine de caractère à écrire. On dispose des commandes suivantes : \%s pour une autre chaine de caractères, \%d pour écrire la valeur d'une variables, \%fX pour afficher un nombre avec X chiffres après la virgule, \\n pour aller à la ligne. Voici un exemple : PA_OutputText(0, 0, 1, "Mon nom est %s et je n'ai que %d dents...", "Mollusk", 20); +*/ +void PA_OutputText(u8 screen, u16 x, u16 y, const char* text, ...); + +/*! \fn u16 PA_OutputSimpleText(u8 screen, u16 x, u16 y, const char *text) + \brief + \~english Output simple text on the DS screen. Works only in modes 0-2. Much faster than PA_OutputText, but much more limited... Returns the number of letters + \~french Ecrire du texte tout simple à l'écran. Ne marche qu'en modes 0-2. Beaucoup plus rapide que PA_OutputText, masi aussi beaucoup plus limité... Renvoie le nombre de lettres + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x + \~english X coordinate in TILES (0-31) where to begin writing the text + \~french Coordonnée X en TILES (0-31) où commencer à afficher le text + \~\param y + \~english Y coordinate in TILES (0-19) where to begin writing the text + \~french Coordonnée Y en TILES (0-19) où commencer à afficher le text + \~\param text + \~english String to output. + \~french Chaine de caractère à écrire. +*/ +u16 PA_OutputSimpleText(u8 screen, u16 x, u16 y, const char *text); + +/*! \fn u32 PA_BoxText(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit) + \brief + \~english Output text on the DS screen. This text is limited to a chosen box, and you can chose the number of letters to output (can be used to show 'typed' text, just put 10000 if you want to show all the text...). Returns the number of letters outputed + \~french Permet d'écrire du texte à l'écran, dans une boite délimitée au choix, et en choisissant le nombre de lettres à afficher (peut être utile pour afficher du texte en train de se taper, sinon suffit de mettre 10000 pour afficher tout d'un coup) Renvoie le nmobre de lettre écrites + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param basex + \~english X coordinate in TILES (0-31) where to begin writing the text + \~french Coordonnée X en TILES (0-31) où commencer à afficher le text + \~\param basey + \~english Y coordinate in TILES (0-19) where to begin writing the text + \~french Coordonnée Y en TILES (0-19) où commencer à afficher le text + \~\param maxx + \~english X coordinate in TILES (0-31) where to stop writing the text + \~french Coordonnée X en TILES (0-31) où finir d'afficher le text + \~\param maxy + \~english Y coordinate in TILES (0-19) where to stop writing the text + \~french Coordonnée Y en TILES (0-19) où finir d'afficher le text + \~\param text + \~english String to output. + \~french Chaine de caractère à écrire. + \~\param limit + \~english Maximum number of letters to show this time + \~french Nombre maximum de lettres à afficher pour ce coup-ci +*/ +u32 PA_BoxText(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit); + +/*! \fn u32 PA_BoxTextNoWrap(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit) + \brief + \~english Output text on the DS screen. This text is limited to a chosen box, and you can chose the number of letters to output (can be used to show 'typed' text, just put 10000 if you want to show all the text...). Returns the number of letters outputed. This function does not support word wrapping + \~french Permet d'écrire du texte à l'écran, dans une boite délimitée au choix, et en choisissant le nombre de lettres à afficher (peut être utile pour afficher du texte en train de se taper, sinon suffit de mettre 10000 pour afficher tout d'un coup) Renvoie le nombre de lettre écrites. Cette fonction coupe les mots... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param basex + \~english X coordinate in TILES (0-31) where to begin writing the text + \~french Coordonnée X en TILES (0-31) où commencer à afficher le text + \~\param basey + \~english Y coordinate in TILES (0-19) where to begin writing the text + \~french Coordonnée Y en TILES (0-19) où commencer à afficher le text + \~\param maxx + \~english X coordinate in TILES (0-31) where to stop writing the text + \~french Coordonnée X en TILES (0-31) où finir d'afficher le text + \~\param maxy + \~english Y coordinate in TILES (0-19) where to stop writing the text + \~french Coordonnée Y en TILES (0-19) où finir d'afficher le text + \~\param text + \~english String to output. + \~french Chaine de caractère à écrire. + \~\param limit + \~english Maximum number of letters to show this time + \~french Nombre maximum de lettres à afficher pour ce coup-ci +*/ +u32 PA_BoxTextNoWrap(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit); + +/*! + \fn static inline void PA_SetTextCol(u8 screen, u16 r, u16 g, u16 b) + \brief + \~english Change the screen text's default color + \~french Changer la couleur de base du texte à l'écran + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param r + \~english Red amount (0-31) + \~french Quantité de rouge (0-31) + \~\param g + \~english Green amount (0-31) + \~french Quantité de vert (0-31) + \~\param b + \~english Blue amount (0-31) + \~french Quantité de bleu (0-31) +*/ +static inline void PA_SetTextCol(u8 screen, u16 r, u16 g, u16 b){ + PA_CreateTextPal(screen, 0, r, g, b); +} + +/*! + \def PA_InitCustomText(screen, bg_select, text) + \deprecated + \brief + \~english [DEPRECATED] Init the text using one of your own fonts ! + \~french [DEPRECATED] Initialiser le texte en utilisant une police perso + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number... + \~french Numéro du fond... + \~\param text + \~english Font image file name converted with PAGfx + \~french Image de la police, converti avec PAGfx + +*/ +#define PA_InitCustomText(screen, bg_select, text) PA_InitCustomTextEx(screen, bg_select, text##_Tiles, text##_Map, text##_Pal) + +/*! + \fn void PA_LoadText(u8 screen, u8 bg_select, const PA_BgStruct* font) + \brief + \~english Load and initialize a custom font. + \~french Initialiser le texte en utilisant une police perso + \~\param screen + \~english Chose the screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param bg_select + \~english Background number... + \~french Numéro du fond... + \~\param font + \~english Pointer to the font + \~french Pointeur vers la police +*/ + +void PA_LoadText(u8 screen, u8 bg_number, const PA_BgStruct* font); + +/*! + \def PA_ShowFont(screen) + \brief + \~english Show the current font used. This is just for debug, no real use ingame + \~french Affiche la police utilisée. C'est juste utile pour du débuggage, aucun intéret autrement + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) +*/ +#define PA_ShowFont(screen) PA_LoadBgMap(screen, PAbgtext[screen], (void*)PA_textmap[screen], BG_256X256) + +/*! \fn s16 PA_8bitText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp, s32 limit) + \brief + \~english This is a variable width and variable size function to draw text on the screen. It draws on an 8 bit background (see PA_Init8bitBg for more info), and has options such as size, transaprency, and box limits, as well as the color. Only problem : it does not take commands such as %d, etc... The function returns the number of characters it outputed + \~french Cette fonction permet d'écrire du texte à chasse variable à l'écran. Elle nécessite d'avoir un fond dessinable de 8 bits (cf PA_Init8bitBg). Les options sont la taille, la transparence, et les limites, ainsi que la couleur. Seul inconvénient : il n'accepte pas les commande comme %d, etc... La fonction renvoie le nombre de charactères écrits + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param basex + \~english X coordinate of the top left corner + \~french Coordonnée X du coin supérieur gauche + \~\param basey + \~english Y coordinate of the top left corner + \~french Coordonnée Y du coin supérieur gauche + \~\param maxx + \~english X coordinate of the down right corner + \~french Coordonnée X du coin inférieur droit + \~\param maxy + \~english Y coordinate of the down right corner + \~french Coordonnée Y du coin inférieur droit + \~\param text + \~english Text, such as "Hello World" + \~french Texte, tel que "Hello World" + \~\param color + \~english Palette color to use (0-255) + \~french Couleur de la palette à utiliser (0-255) + \~\param size + \~english Size of the text, from 0 (really small) to 4 (pretty big) + \~french Taille du texte, de 0 (vraiment petit) à 4 (assez grand) + \~\param transp + \~english Transparency. Setting this to 0 will overwrite all drawing in the text zone. 1 will write the text without erasing the drawing. 2 won't output anything (just to count the letters), 3 is rotated one way, 4 rotated the other way + \~french Transparence. Mettre à 0 effecera tout dessin de la zone de texte. 1 écrira le texte par-dessus le dessin sans l'effacer. 2 n'écrira rien (juste pour compter les lettres). 3 fera un texte tourné à 90°. 4 est un texte tourné dans l'autre sens. + \~\param limit + \~english You can give a maximum number of characters to output. This can be usefull to have a slowing drawing text (allow to draw 1 more character each frame...) + \~french On peut fixer une limite au nombre de caractères. Ceci peut etre utile pour dessiner un texte progressivement, en augmentant de 1 le nombre de caractères à chaque boucle.... +*/ +s16 PA_8bitText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp, s32 limit); +s16 PA_16bitText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u16 color, u8 size, u8 transp, s32 limit); + +/*! \fn s16 PA_CenterSmartText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp) + \brief + \~english Basicaly the same as the SmartText function, but this time centered... + \~french En gros la meme chose que SmartText, mais en centré... + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param basex + \~english X coordinate of the top left corner + \~french Coordonnée X du coin supérieur gauche + \~\param basey + \~english Y coordinate of the top left corner + \~french Coordonnée Y du coin supérieur gauche + \~\param maxx + \~english X coordinate of the down right corner + \~french Coordonnée X du coin inférieur droit + \~\param maxy + \~english Y coordinate of the down right corner + \~french Coordonnée Y du coin inférieur droit + \~\param text + \~english Text, such as "Hello World" + \~french Texte, tel que "Hello World" + \~\param color + \~english Palette color to use (0-255) + \~french Couleur de la palette à utiliser (0-255) + \~\param size + \~english Size of the text, from 0 (really small) to 4 (pretty big) + \~french Taille du texte, de 0 (vraiment petit) à 4 (assez grand) + \~\param transp + \~english Transparency. Setting this to 0 will overwrite all drawing in the text zone. 1 will write the text without erasing the drawing. 2 won't output anything (just to count the letters), 3 is rotated one way, 4 rotated the other way + \~french Transparence. Mettre à 0 effecera tout dessin de la zone de texte. 1 écrira le texte par-dessus le dessin sans l'effacer. 2 n'écrira rien (juste pour compter les lettres). 3 fera un texte tourné à 90°. 4 est un texte tourné dans l'autre sens. +*/ +s16 PA_CenterSmartText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp); + +/*! \def PA_8bitCustomFont(bit8_slot, bit8_font) + \deprecated + \brief + \~english [DEPRECATED] Add custom fonts to the 8bit Font system !! Font must be converted with PAGfx + \~french [DEPRECATED] Ajouter une police perso dans le systeme de texte 8bit !! Doit être convertie avec PAGfx + \~\param bit8_slot + \~english Font slot... 0-4 are used by the defaut PAlib fonts, 5-9 are free to use. You can freely overwrite the PAlib fonts if you want + \~french Slot pour ajouter la police. Les slots 0-4 sont utilisés pour les polices par défaut de PAlib, et 5-9 sont libres. On peut néanmoins charger par-dessus les polices PAlib si on veut + \~\param bit8_font + \~english Font name;.. + \~french Nom de la police... +*/ +#define PA_8bitCustomFont(bit8_slot, bit8_font)do{\ + PA_DEPRECATED_MACRO;\ + bittext_maps[bit8_slot] = (u16*)(void*)bit8_font##_Map; \ + bit8_tiles[bit8_slot] = (u8*)bit8_font##_Tiles; \ + pa_bittextdefaultsize[bit8_slot] = (u8*)bit8_font##_Sizes; \ + pa_bittextpoliceheight[bit8_slot] = bit8_font##_Height;\ +}while(0) + +/*! \fn void PA_AddBitmapFont(int slot, const PA_BgStruct* font) + \brief + \~english Add a custom font to the 8bit/16bit font system. + \~french Ajouter une police perso dans le système de texte 8bit/16bit. + \~\param slot + \~english Font slot. 0-4 are used by the default PAlib fonts, 5-9 are free to use. You can freely overwrite the PAlib fonts if you want. + \~french Slot pour ajouter la police. Les slots 0-4 sont utilisés pour les polices par défaut de PAlib, et 5-9 sont libres. On peut néanmoins charger par-dessus les polices PAlib si on veut. + \~\param font + \~english Pointer to the font. + \~french Pointeur vers le police perso. +*/ +void PA_AddBitmapFont(int slot, const PA_BgStruct* font); + +/*! \fn void PA_InitTextBorders(u8 screen, u8 x1, u8 y1, u8 x2, u8 y2) + \brief + \~english Initialise a text box with it's borders. This makes writing in a delimited area much easier... + \~french Initialise une boite à texte, avec la bordure. Ceci rend l'utilisation des textes délimités bien plus simple + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param x1 + \~english Left limit in tiles + \~french Limite gauche en tiles + \~\param y1 + \~english Top + \~french Haut + \~\param x2 + \~english Right + \~french Droite + \~\param y2 + \~english Bottom + \~french Bas +*/ +void PA_InitTextBorders(u8 screen, u8 x1, u8 y1, u8 x2, u8 y2); + +/*! \fn void PA_EraseTextBox(u8 screen) + \brief + \~english Erases the text in a textbox. Requires that that box be initialized with PA_InitTextBorders + \~french Efface le text d'un boite à texte... Nécessite qu'il ait été initialisé avec PA_InitTextBorders + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) +*/ +void PA_EraseTextBox(u8 screen); + +/*! \fn static inline u32 PA_SimpleBoxText(u8 screen, const char *text, u32 limit) + \brief + \~english Write text in an initiliazed textbox. Similar to PA_BoxText, but without needing the text limits + \~french Ecrit du texte dans une zone délimitée. Similaire à PA_BoxText, mais sans avoir besoin de délimiter + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param text + \~english String to output. + \~french Chaine de caractère à écrire. + \~\param limit + \~english Maximum number of letters to show this time + \~french Nombre maximum de lettres à afficher pour ce coup-ci +*/ +static inline u32 PA_SimpleBoxText(u8 screen, const char *text, u32 limit){ + return PA_BoxText(screen, PA_TextBox[screen].x1+1, PA_TextBox[screen].y1+1, PA_TextBox[screen].x2-1, PA_TextBox[screen].y2-1, text, limit); +} + +/*! \fn void PA_ClearTextBg(u8 screen) + \brief + \~english Erase all the text on a given screen + \~french Effacer tout le texte sur un écran donné + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) +*/ +void PA_ClearTextBg(u8 screen); + +/*! \fn void PA_Print(u8 screen, const char* text, ...) + \brief + \~english Output text on the DS screen. Works like a printf function + \~french Ecrire du texte à l'écran. Marche comme la fonction printf + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param text + \~english String to output. The following commands are avaiblable : \%s to output another string, \%d to output a value, \%fX to output a float with X digits, \\n to go to the line. Here's an example : PA_OutputText(0, 0, 1, "My name is %s and I have only %d teeth", "Mollusk", 20); + \~french Chaine de caractère à écrire. On dispose des commandes suivantes : \%s pour une autre chaine de caractères, \%d pour écrire la valeur d'une variables, \%fX pour afficher un nombre avec X chiffres après la virgule, \\n pour aller à la ligne. Voici un exemple : PA_OutputText(0, 0, 1, "Mon nom est %s et je n'ai que %d dents...", "Mollusk", 20); +*/ +void PA_Print(u8 screen, const char* text, ...); + +/*! \fn static inline void PA_PrintLetter(u8 screen, char letter) + \brief + \~english Like PA_Print, but for a letter + \~french Comme PA_Print, mais juste pour une lettre + \~\param screen + \~english Chose de screen (0 or 1) + \~french Choix de l'écran (0 ou 1) + \~\param letter + \~english Any letter... + \~french Une lettre... +*/ +static inline void PA_PrintLetter(u8 screen, char letter){ + PA_SetTileLetter(screen, pa_printx[screen], pa_printy[screen]&31, letter); + pa_printx[screen]++; + if(pa_printx[screen] >= 32){ + PA_PrintYPlus(screen); + } +} + +void PA_OutputTextSpecial0(u8 screen, int x1, int y,const char *text); +void PA_OutputTextSpecial1(u8 screen, int x1, int y,const char *text); +void PA_OutputTextSpecial2(u8 screen, int x1, int y,const char *text); +void PA_OutputTextSpecial3(u8 screen, int x1, int y,const char *text); +void PA_OutputTextSpecial4(u8 screen, int x1, int y,const char *text); +void PA_OutputTextSpecial5(u8 screen, int x1, int y,const char *text); + +/** @} */ // end of Text + +// Backwards compatibility +#define PA_SmartText PA_8bitText + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_TextBits.h b/include/arm9/PA_TextBits.h index 8dfbddb..29a0dfa 100644 --- a/include/arm9/PA_TextBits.h +++ b/include/arm9/PA_TextBits.h @@ -1,57 +1,57 @@ -#ifndef _PA_TEXTBITS -#define _PA_TEXTBITS - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef struct{ - u8 linespacing; - u8 letterspacing; - u8 align; - u8 rot; -} textinfo_type; -extern textinfo_type textinfo; - -//extern textinfo_type textinfo; - -extern const u16 *bittext_maps[10]; -extern const u8 *bittext_tiles_blank[10]; -extern u32 *c16_tiles[10]; -extern const u8 *pa_bittextdefaultsize[10]; -extern u16 pa_bittextsizes[5]; - -extern u8 pa_bittextpoliceheight[10]; - -typedef struct{ - s32 NLetters; - struct{ - char Letter; - u8 X, Y; - u8 Size; - u16 Color; - }Letter[2048]; -} LetterPos; -extern LetterPos PA_LetterPos; - -void PA_DoAlign(u16 start, s16 x, s16 maxx, u8 justify); -void PA_DoLetterPos(s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u16 color, u8 size, s32 limit); - -static inline void PA_TextAlign(u8 align){ - textinfo.align = align; -} - -static inline void PA_TextLineSpacing(u8 spacing){ - textinfo.linespacing = spacing; -} -static inline void PA_TextLetterSpacing(u8 spacing){ - textinfo.letterspacing = spacing; -} - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef _PA_TEXTBITS +#define _PA_TEXTBITS + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct{ + u8 linespacing; + u8 letterspacing; + u8 align; + u8 rot; +} textinfo_type; +extern textinfo_type textinfo; + +//extern textinfo_type textinfo; + +extern const u16 *bittext_maps[10]; +extern const u8 *bittext_tiles_blank[10]; +extern u32 *c16_tiles[10]; +extern const u8 *pa_bittextdefaultsize[10]; +extern u16 pa_bittextsizes[5]; + +extern u8 pa_bittextpoliceheight[10]; + +typedef struct{ + s32 NLetters; + struct{ + char Letter; + u8 X, Y; + u8 Size; + u16 Color; + }Letter[2048]; +} LetterPos; +extern LetterPos PA_LetterPos; + +void PA_DoAlign(u16 start, s16 x, s16 maxx, u8 justify); +void PA_DoLetterPos(s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u16 color, u8 size, s32 limit); + +static inline void PA_TextAlign(u8 align){ + textinfo.align = align; +} + +static inline void PA_TextLineSpacing(u8 spacing){ + textinfo.linespacing = spacing; +} +static inline void PA_TextLetterSpacing(u8 spacing){ + textinfo.letterspacing = spacing; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/arm9/PA_TileDual.h b/include/arm9/PA_TileDual.h index a9a1d7f..30c624f 100644 --- a/include/arm9/PA_TileDual.h +++ b/include/arm9/PA_TileDual.h @@ -1,646 +1,646 @@ -#ifndef _PA_TileDual -#define _PA_TileDual - - - -/*! \file PA_TileDual.h - \brief Everything concerning the Bg Tile modes on 2 screens - - This file contains all the macros and variables regarding Tile modes (0-2), loading tiles and Bg, etc... on 2 screens ! -*/ - -#include "PA_BgTiles.h" - -/** @defgroup TileDual Bg Modes on 2 Screens - * Load tiles, a map, scroll it... and 2 screens automatically - * @{ - */ - -/*! - \fn static inline void PA_DualHideBg(u8 bg_select) - \brief - \~english Hide a background on both screens - \~french Cacher un fond sur les 2 écrans - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) -*/ -static inline void PA_DualHideBg(u8 bg_select){ - PA_HideBg(0, bg_select); - PA_HideBg(1, bg_select); -} - -/*! - \fn static inline void PA_DualShowBg(u8 bg_select) - \brief - \~english Show a hidden background, on both screens - \~french Afficher un fond auparavant caché sur les 2 écrans - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) -*/ -static inline void PA_DualShowBg(u8 bg_select){ - PA_ShowBg(0, bg_select); - PA_ShowBg(1, bg_select); -} - -/*! - \fn static inline void PA_DualResetBg(void) - \brief - \~english Reinitialize de Bg system - \~french Reinitialiser les fonds d'un écran. En fait ca ne fait que cacher tous les fonds -*/ -static inline void PA_DualResetBg(void){ - PA_ResetBg(0); - PA_ResetBg(1); -} - -/*! - \fn static inline void PA_DualDeleteBg(u8 bg_select) - \brief - \~english Delete a complete background (tiles + map + hide it...) - \~french Effacer un fond complètement (tiles + map + cacher) - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) -*/ -static inline void PA_DualDeleteBg(u8 bg_select){ - PA_DeleteBg(0, bg_select); - PA_DeleteBg(1, bg_select); -} - -/*! - \def PA_DualLoadTiledBg(bg_number, bg_name) - \deprecated - \brief - \~english [DEPRECATED] This will never get easier... Loads a background TiledBg converted with PAGfx, with it's tiles, map, and palette. Only 256 color mode available. On 2 screens as 1... - \~french [DEPRECATED] On ne pourra jamais rendre ca plus simple... Charge un fond de type TiledBg converti avec PAGfx, en mettant les tiles, la map, et meme la palette ! Seulement en mode 256 couleurs. Sur 2 écrans, comme un seul grand - \~\param bg_number - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_name - \~english Background name, like bg0 - \~french Nom du fond, comme bg0 -*/ -#define PA_DualLoadTiledBg(bg_number, bg_name)do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadTiledBg(0, bg_number, bg_name);\ - PA_LoadTiledBg(1, bg_number, bg_name);\ - PA_DualBGScrollY(bg_number, 0);}while(0) - -/*! - \def PA_DualLoadSimpleBg(bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode) - \deprecated - \brief - \~english [DEPRECATED] Simplest way to load a Background on both screens - \~french [DEPRECATED] Facon la plus simple de cahrger un fond sur les 2 écrans - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param bg_map - \~english Name of the map's info (example : ship_Map) - \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) - \~\param bg_size - \~english Background size. To use a normal background, use the macros BG_256X256, BG_256X512, etc... - \~french Taille du fond. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... - \~\param wraparound - \~english If the background wraps around or not. More important for rotating backgrounds. - \~french Si le fond boucle ou non. C'est plus important pour les fonds rotatifs... - \~\param color_mode - \~english Color mode : 0 for 16 color mode, 1 for 256... - \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 -*/ - -#define PA_DualLoadSimpleBg(bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode) do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadSimpleBg(0, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode);\ - PA_LoadSimpleBg(1, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode);\ - PA_DualBGScrollY(bg_select, 0);}while(0) - -/*! - \def PA_DualLoadRotBg(bg_select, bg_tiles, bg_map, bg_size, wraparound) - \deprecated - \brief - \~english [DEPRECATED] Load a background fit for rotating/scaling ! Warning, you must use PA_SetVideoMode to 1 if you want 1 rotating background (Bg3 only !), or 2 for 2 rotating backgrounds (Bg2 and 3). The background MUST be in 256 colors - \~french [DEPRECATED] Charger un fond pour les rotations/zoom ! Attention, il faut avant utiliser PA_SetVideoMode avec 1 pour utiliser un fond rotatif (le fond 3 uniquement !), ou 2 pour 2 fonds (2 et 3). Le fond DOIT etre de 256 couleurs - \~\param bg_select - \~english Background number to load - \~french Numéro du fond que l'on veut charger - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param bg_map - \~english Name of the map's info (example : ship_Map) - \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) - \~\param bg_size - \~english Background size. Use the following macros : BG_ROT_128X128, or 256X256, 512X512, or 1024X1024 - \~french Taille du fond. Utiliser les macros suivantes : BG_ROT_128X128, ou 256X256, 512X512, ou enfin 1024X1024 - \~\param wraparound - \~english If the background wraps around or not. - \~french Si le fond boucle ou non. -*/ -#define PA_DualLoadRotBg(bg_select, bg_tiles, bg_map, bg_size, wraparound) do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadRotBg(0, bg_select, bg_tiles, bg_map, bg_size, wraparound);\ - PA_LoadRotBg(1, bg_select, bg_tiles, bg_map, bg_size, wraparound);\ - PA_DualBGScrollY(bg_select, 0);}while(0) - -static inline void PA_DualSetBgRot(u8 bg_select, s32 x_scroll, s32 y_scroll, s32 x_rotcentre, s32 y_rotcentre, s16 bg_angle, s32 bg_zoom){ - PA_SetBgRot(0, bg_select, x_scroll, y_scroll, x_rotcentre, y_rotcentre, bg_angle, bg_zoom); - PA_SetBgRot(1, bg_select, x_scroll, y_scroll, x_rotcentre, y_rotcentre, bg_angle, bg_zoom); -} - -/*! - \def PA_DualLoadBg(bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode) - \deprecated - \brief - \~english [DEPRECATED] Simplest way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap - \~french [DEPRECATED] Facon la plus simple de cahrger un fond. Combine PA_InitBg, PA_LoadBgTiles, et PA_LoadBgMap - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param tile_size - \~english Size of your tileset - \~french Taille du tilset - \~\param bg_map - \~english Name of the map's info (example : ship_Map) - \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) - \~\param bg_size - \~english Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... For a rotatable Bg, use the macros BG_ROT_128X128... - \~french Taille du fond. Ceci est très important, car ça détermine aussi si le Bg est rotatif ou non. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... Por un fond rotatif, il suffit d'utiliser BG_ROT_128X128... - \~\param wraparound - \~english If the background wraps around or not. More important for rotating backgrounds. - \~french Si le fond boucle ou non. C'est plus important pour les fonds rotatifs... - \~\param color_mode - \~english Color mode : 0 for 16 color mode, 1 for 256... - \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 -*/ - -#define PA_DualLoadBg(bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode) do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadBg(0, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode);\ - PA_LoadBg(1, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode);\ - PA_DualBGScrollY(bg_select, 0);}while(0) - -/*! - \fn static inline void PA_DualBGScrollX(u8 bg_number, s16 x) - \brief - \~english Scroll horizontaly any background, on both screens - \~french Scroll horizontal de n'importe quel fond, sur les 2 écrans - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer, horizontalement... -*/ -static inline void PA_DualBGScrollX(u8 bg_number, s16 x){ - PA_BGScrollX(0, bg_number, x); - PA_BGScrollX(1, bg_number, x); -} - -/*! - \fn static inline void PA_DualBGScrollY(u8 bg_number, s16 y) - \brief - \~english Scroll vertically any background - \~french Scroll vertical de n'importe quel fond - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer, verticalement... -*/ -static inline void PA_DualBGScrollY(u8 bg_number, s16 y){ - PA_BGScrollY(0, bg_number, y+PA_ScreenSpace); - PA_BGScrollY(1, bg_number, y); -} - -/*! - \fn static inline void PA_DualBGScrollXY(u8 bg_number, s16 x, s16 y) - \brief - \~english Scroll horizontaly and vertically any background - \~french Scroll horizontal et vertical de n'importe quel fond - \~\param bg_number - \~english Background number (0-3) - \~french Numéro du fond que l'on veut tourner (0-3) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer, horizontalement... - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer, verticalement... -*/ -static inline void PA_DualBGScrollXY(u8 bg_number, s16 x, s16 y) { - PA_DualBGScrollX(bg_number, x); - PA_DualBGScrollY(bg_number, y); -} - -/*! - \def PA_DualLoadPAGfxLargeBg(bg_number, bg_name) - \deprecated - \brief - \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), converted with PAGfx. Background on both screens, as one - \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large), converti avec PAGfx. Fond sur les 2 écrans comme un seul - \~\param bg_number - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (0-3) - \~\param bg_name - \~english Background name, in PAGfx - \~french Nom du fond dans PAGfx -*/ -#define PA_DualLoadPAGfxLargeBg(bg_number, bg_name)do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadPAGfxLargeBg(0, bg_number, bg_name);\ - PA_LoadPAGfxLargeBg(1, bg_number, bg_name);\ - PA_DualInfLargeScrollY(bg_number, 0);}while(0) - -/*! - \def PA_DualLoadLargeBg(bg_select, bg_tiles, bg_map, color_mode, lx, ly) - \deprecated - \brief - \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), on both screens - \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large), sur les 2 écrans - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param bg_map - \~english Name of the map's info (example : ship_Map) - \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) - \~\param color_mode - \~english Color mode : 0 for 16 color mode, 1 for 256... - \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 - \~\param lx - \~english Width, in tiles. So a 512 pixel wide map is 64 tiles wide... - \~french Largeur, en tiles. Un fond de 512 pixels de large fera 64 tiles de large. - \~\param ly - \~english Height, in tiles. So a 512 pixel high map is 64 tiles high... - \~french Hauteur, en tiles. Un fond de 512 pixels de hauy fera 64 tiles de haut. -*/ -#define PA_DualLoadLargeBg(bg_select, bg_tiles, bg_map, color_mode, lx, ly)do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadLargeBg(0, bg_select, bg_tiles, bg_map, color_mode, lx, ly);\ - PA_LoadLargeBg(1, bg_select, bg_tiles, bg_map, color_mode, lx, ly);\ - PA_DualInfLargeScrollY(bg_select, 0);}while(0) - -/*! - \def PA_DualLoadLargeBgEx(bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly) - \deprecated - \brief - \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), but here you can put yourself the tile size... - \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large), mais ici on met soi-meme la taille des tiles - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param bg_tiles - \~english Name of the tiles' info (example: ship_Tiles) - \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) - \~\param tile_size - \~english Size of your tileset - \~french Taille du tilset - \~\param bg_map - \~english Name of the map's info (example : ship_Map) - \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) - \~\param color_mode - \~english Color mode : 0 for 16 color mode, 1 for 256... - \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 - \~\param lx - \~english Width, in tiles. So a 512 pixel wide map is 64 tiles wide... - \~french Largeur, en tiles. Un fond de 512 pixels de large fera 64 tiles de large. - \~\param ly - \~english Height, in tiles. So a 512 pixel high map is 64 tiles high... - \~french Hauteur, en tiles. Un fond de 512 pixels de hauy fera 64 tiles de haut. -*/ -#define PA_DualLoadLargeBgEx(bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly) do{\ - PA_DEPRECATED_MACRO;\ - PA_LoadLargeBgEx(0, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly);\ - PA_LoadLargeBgEx(1, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly);\ - PA_DualInfLargeScrollY(bg_select, 0);}while(0) - -/*! - \def PA_DualEasyBgLoad(bg_number, bg_name) - \deprecated - \brief - \~english [DEPRECATED] EasyBg load, but for Dual screen... - \~french [DEPRECATED] Chargement de fond EasyBg, mais pour le Dual Screen... - \~\param bg_number - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (0-3) - \~\param bg_name - \~english Background name, in PAGfx - \~french Nom du fond dans PAGfx -*/ -#define PA_DualEasyBgLoad(bg_number, bg_name)do{\ - PA_DEPRECATED_MACRO;\ - PA_EasyBgLoad(0, bg_number, bg_name);\ - PA_EasyBgLoad(1, bg_number, bg_name);\ - PA_DualEasyBgScrollY(bg_number, 0);}while(0) - -/*! - \fn static inline void PA_DualEasyBgScrollX(u8 bg_select, s32 x) - \brief - \~english Scroll an EasyBg horizontaly. It must have been initialised with PA_LoadLargeBg. - \~french Déplacer un fond EasyBg horizontalement. Doit etre initialisé avec PA_LoadLargeBg. - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer -*/ -static inline void PA_DualEasyBgScrollX(u8 bg_select, s32 x){ - PA_EasyBgScrollX(0, bg_select, x); - PA_EasyBgScrollX(1, bg_select, x); -} - -/*! - \fn static inline void PA_DualEasyBgScrollY(u8 bg_select, s32 y) - \brief - \~english Scroll an EasyBg vertically. - \~french Déplacer un fond EasyBg verticalement. - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_DualEasyBgScrollY(u8 bg_select, s32 y){ - PA_EasyBgScrollY(0, bg_select, y+PA_ScreenSpace); - PA_EasyBgScrollY(1, bg_select, y); -} - -/*! - \fn static inline void PA_DualLoadBackground(u8 bg_number, const PA_BgStruct* bg) - \brief - \~english Load a background (EasyBg, RotBg or UnlimitedBg), but for Dual screen... - \~french Charger un fond (EasyBg, RotBg or UnlimitedBg), mais pour le Dual Screen... - \~\param bg_number - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (0-3) - \~\param bg - \~english Pointer to the background (struct) - \~french Pointeur vers le fond -*/ - -static inline void PA_DualLoadBackground(u8 bg_number, const PA_BgStruct* bg){ - PA_LoadBackground(0, bg_number, bg); - PA_LoadBackground(1, bg_number, bg); - PA_DualEasyBgScrollY(bg_number, 0); -} - -/*! - \fn static inline void PA_DualEasyBgScrollXY(u8 bg_select, s32 x, s32 y) - \brief - \~english Scroll a Dual EasyBg. - \~french Déplacer un fond EasyBg en Dual Screen. - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_DualEasyBgScrollXY(u8 bg_select, s32 x, s32 y){ - PA_DualEasyBgScrollX(bg_select, x); - PA_DualEasyBgScrollY(bg_select, y); -} - -/*! - \fn static inline void PA_DualInfLargeScrollX(u8 bg_select, s32 x) - \brief - \~english Scroll a large infinite scrolling background horizontaly. It must have been initialised with PA_LoadLargeBg. - \~french Déplacer un fond à scrolling 'infini' horizontalement. Doit etre initialisé avec PA_LoadLargeBg. - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer -*/ -static inline void PA_DualInfLargeScrollX(u8 bg_select, s32 x){ - PA_InfLargeScrollX(0, bg_select, x); - PA_InfLargeScrollX(1, bg_select, x); -} - -/*! - \fn static inline void PA_DualInfLargeScrollY(u8 bg_select, s32 y) - \brief - \~english Scroll a large infinite scrolling background vertically. It must have been initialised with PA_LoadLargeBg. - \~french Déplacer un fond à scrolling 'infini' verticalement. Doit etre initialisé avec PA_LoadLargeBg. - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_DualInfLargeScrollY(u8 bg_select, s32 y){ - PA_InfLargeScrollY(0, bg_select, y+PA_ScreenSpace); - PA_InfLargeScrollY(1, bg_select, y); -} - -/*! - \fn static inline void PA_DualInfLargeScrollXY(u8 bg_select, s32 x, s32 y) - \brief - \~english Scroll a large infinite scrolling background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. - \~french Déplacer un fond à scrolling 'infini' horizontalement et verticalement. Doit etre initialisé avec PA_LoadLargeBg. - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_DualInfLargeScrollXY(u8 bg_select, s32 x, s32 y){ - PA_DualInfLargeScrollX(bg_select, x); - PA_DualInfLargeScrollY(bg_select, y); -} - -/*! - \fn static inline void PA_DualLargeScrollX(u8 bg_select, s32 x) - \brief - \~english Scroll a large background horizontaly. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... - \~french Déplacer un grand fond à scrolling horizontalement.Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer -*/ -static inline void PA_DualLargeScrollX(u8 bg_select, s32 x){ - PA_LargeScrollX(0, bg_select, x); - PA_LargeScrollX(1, bg_select, x); -} - -/*! - \fn static inline void PA_DualLargeScrollY(u8 bg_select, s32 y) - \brief - \~english Scroll a large background vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... - \~french Déplacer un grand fond à scrolling verticalement. Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_DualLargeScrollY(u8 bg_select, s32 y){ - PA_LargeScrollY(0, bg_select, y+PA_ScreenSpace); - PA_LargeScrollY(1, bg_select, y); -} - -/*! - \fn static inline void PA_DualLargeScrollXY(u8 bg_select, s32 x, s32 y) - \brief - \~english Scroll a large background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... - \~french Déplacer un grand fond à scrolling horizontalement et verticalement. Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... - \~\param bg_select - \~english Background number to load (from 0 to 3) - \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_DualLargeScrollXY(u8 bg_select, s32 x, s32 y){ - PA_DualLargeScrollX(bg_select, x); - PA_DualLargeScrollY(bg_select, y); -} - -/*! - \fn static inline void PA_DualInitParallaxX(s32 bg0, s32 bg1, s32 bg2, s32 bg3) - \brief - \~english Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... - \~french Initialiser le Parallax Scrolling pour plusieurs fonds, horizontalement. Choix de la vitesse à laquelle les fonds vont défiler par rapport aux autres... Utiliser PA_ParallaxScrollX par la suite pour scroller - \~\param bg0 - \~english Value for the first background (0). Set to 256 for normal scroll speed, lower for lower speed (128 is half speed...), higher for faster (512 is twice as fast...). You can set negative values. 0 inactivates parallax scrolling for this background - \~french Valeur pour le premier fond (0). 256 met en vitesse normal, moins pour moins lent (128 pour moitié de vitesse), plus pour plus rapide (512 équivaut à 2 fois plus vite). On peut utiliser des valeurs négatives. 0 désactive le scrolling parallax pour ce fond - \~\param bg1 - \~english Same thing for Background 1 - \~french Idem, pour le Fond 1 - \~\param bg2 - \~english Same thing for Background 2 - \~french Idem, pour le Fond 2 - \~\param bg3 - \~english Same thing for Background 3 - \~french Idem, pour le Fond 3 -*/ -static inline void PA_DualInitParallaxX(s32 bg0, s32 bg1, s32 bg2, s32 bg3) { - PA_InitParallaxX(0, bg0, bg1, bg2, bg3); - PA_InitParallaxX(1, bg0, bg1, bg2, bg3); -} - -/*! - \fn static inline void PA_DualInitParallaxY(s32 bg0, s32 bg1, s32 bg2, s32 bg3) - \brief - \~english Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... - \~french Initialiser le Parallax Scrolling pour plusieurs fonds, horizontalement. Choix de la vitesse à laquelle les fonds vont défiler par rapport aux autres... Utiliser PA_ParallaxScrollX par la suite pour scroller - \~\param bg0 - \~english Value for the first background (0). Set to 256 for normal scroll speed, lower for lower speed (128 is half speed...), higher for faster (512 is twice as fast...). You can set negative values. 0 inactivates parallax scrolling for this background - \~french Valeur pour le premier fond (0). 256 met en vitesse normal, moins pour moins lent (128 pour moitié de vitesse), plus pour plus rapide (512 équivaut à 2 fois plus vite). On peut utiliser des valeurs négatives. 0 désactive le scrolling parallax pour ce fond - \~\param bg1 - \~english Same thing for Background 1 - \~french Idem, pour le Fond 1 - \~\param bg2 - \~english Same thing for Background 2 - \~french Idem, pour le Fond 2 - \~\param bg3 - \~english Same thing for Background 3 - \~french Idem, pour le Fond 3 -*/ -static inline void PA_DualInitParallaxY(s32 bg0, s32 bg1, s32 bg2, s32 bg3) { - PA_InitParallaxY(0, bg0, bg1, bg2, bg3); - PA_InitParallaxY(1, bg0, bg1, bg2, bg3); -} - -/*! - \fn static inline void PA_DualParallaxScrollX(s32 x) - \brief - \~english Scroll the backgrounds - \~french Déplacer les fonds activés pour le parallax... - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer -*/ -static inline void PA_DualParallaxScrollX(s32 x){ - int i; - for(i = 0; i < 4; i++) - if (PA_parallaxX[0][i]) - PA_DualEasyBgScrollX(i, (PA_parallaxX[0][i] * x) >> 8); -} - -/*! - \fn static inline void PA_DualParallaxScrollY(s32 y) - \brief - \~english Scroll the backgrounds - \~french Déplacer les fonds activés pour le parallax... - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_DualParallaxScrollY(s32 y){ - int i; - for(i = 0; i < 4; i++) - if (PA_parallaxY[0][i]) - PA_DualEasyBgScrollY(i, (PA_parallaxY[0][i] * y) >> 8); -} - -/*! - \fn static inline void PA_DualParallaxScrollXY(s32 x, s32 y) - \brief - \~english Scroll the backgrounds - \~french Déplacer les fonds activés pour le parallax... - \~\param x - \~english X value to scroll - \~french Valeur X à déplacer - \~\param y - \~english Y value to scroll - \~french Valeur Y à déplacer -*/ -static inline void PA_DualParallaxScrollXY(s32 x, s32 y){ - PA_DualParallaxScrollX(x); - PA_DualParallaxScrollY(y); -} - -/*! - \fn static inline void PA_DualSetBgPrio(u8 bg, u8 prio) - \brief - \~english Change a backgrounds priority - \~french Changer la priorité d'un fond - \~\param bg - \~english Background... - \~french Numéro du fond... - \~\param prio - \~english Priority level (0-3, 0 being the highest) - \~french Niveau de priorité, de 0 à 3, 0 étant priorité la plus élevée -*/ -static inline void PA_DualSetBgPrio(u8 bg, u8 prio) { - PA_SetBgPrio(0, bg, prio); - PA_SetBgPrio(1, bg, prio); -} - -/** @} */ // end of Backgrounds - -// Pas utilisé en direct par le programmeur -void PA_InitLargeBg(u8 screen, u8 bg_select, s32 lx, s32 ly, void* bg_map); - -#endif +#ifndef _PA_TileDual +#define _PA_TileDual + + + +/*! \file PA_TileDual.h + \brief Everything concerning the Bg Tile modes on 2 screens + + This file contains all the macros and variables regarding Tile modes (0-2), loading tiles and Bg, etc... on 2 screens ! +*/ + +#include "PA_BgTiles.h" + +/** @defgroup TileDual Bg Modes on 2 Screens + * Load tiles, a map, scroll it... and 2 screens automatically + * @{ + */ + +/*! + \fn static inline void PA_DualHideBg(u8 bg_select) + \brief + \~english Hide a background on both screens + \~french Cacher un fond sur les 2 écrans + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) +*/ +static inline void PA_DualHideBg(u8 bg_select){ + PA_HideBg(0, bg_select); + PA_HideBg(1, bg_select); +} + +/*! + \fn static inline void PA_DualShowBg(u8 bg_select) + \brief + \~english Show a hidden background, on both screens + \~french Afficher un fond auparavant caché sur les 2 écrans + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) +*/ +static inline void PA_DualShowBg(u8 bg_select){ + PA_ShowBg(0, bg_select); + PA_ShowBg(1, bg_select); +} + +/*! + \fn static inline void PA_DualResetBg(void) + \brief + \~english Reinitialize de Bg system + \~french Reinitialiser les fonds d'un écran. En fait ca ne fait que cacher tous les fonds +*/ +static inline void PA_DualResetBg(void){ + PA_ResetBg(0); + PA_ResetBg(1); +} + +/*! + \fn static inline void PA_DualDeleteBg(u8 bg_select) + \brief + \~english Delete a complete background (tiles + map + hide it...) + \~french Effacer un fond complètement (tiles + map + cacher) + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) +*/ +static inline void PA_DualDeleteBg(u8 bg_select){ + PA_DeleteBg(0, bg_select); + PA_DeleteBg(1, bg_select); +} + +/*! + \def PA_DualLoadTiledBg(bg_number, bg_name) + \deprecated + \brief + \~english [DEPRECATED] This will never get easier... Loads a background TiledBg converted with PAGfx, with it's tiles, map, and palette. Only 256 color mode available. On 2 screens as 1... + \~french [DEPRECATED] On ne pourra jamais rendre ca plus simple... Charge un fond de type TiledBg converti avec PAGfx, en mettant les tiles, la map, et meme la palette ! Seulement en mode 256 couleurs. Sur 2 écrans, comme un seul grand + \~\param bg_number + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_name + \~english Background name, like bg0 + \~french Nom du fond, comme bg0 +*/ +#define PA_DualLoadTiledBg(bg_number, bg_name)do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadTiledBg(0, bg_number, bg_name);\ + PA_LoadTiledBg(1, bg_number, bg_name);\ + PA_DualBGScrollY(bg_number, 0);}while(0) + +/*! + \def PA_DualLoadSimpleBg(bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode) + \deprecated + \brief + \~english [DEPRECATED] Simplest way to load a Background on both screens + \~french [DEPRECATED] Facon la plus simple de cahrger un fond sur les 2 écrans + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param bg_map + \~english Name of the map's info (example : ship_Map) + \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) + \~\param bg_size + \~english Background size. To use a normal background, use the macros BG_256X256, BG_256X512, etc... + \~french Taille du fond. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... + \~\param wraparound + \~english If the background wraps around or not. More important for rotating backgrounds. + \~french Si le fond boucle ou non. C'est plus important pour les fonds rotatifs... + \~\param color_mode + \~english Color mode : 0 for 16 color mode, 1 for 256... + \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 +*/ + +#define PA_DualLoadSimpleBg(bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode) do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadSimpleBg(0, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode);\ + PA_LoadSimpleBg(1, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode);\ + PA_DualBGScrollY(bg_select, 0);}while(0) + +/*! + \def PA_DualLoadRotBg(bg_select, bg_tiles, bg_map, bg_size, wraparound) + \deprecated + \brief + \~english [DEPRECATED] Load a background fit for rotating/scaling ! Warning, you must use PA_SetVideoMode to 1 if you want 1 rotating background (Bg3 only !), or 2 for 2 rotating backgrounds (Bg2 and 3). The background MUST be in 256 colors + \~french [DEPRECATED] Charger un fond pour les rotations/zoom ! Attention, il faut avant utiliser PA_SetVideoMode avec 1 pour utiliser un fond rotatif (le fond 3 uniquement !), ou 2 pour 2 fonds (2 et 3). Le fond DOIT etre de 256 couleurs + \~\param bg_select + \~english Background number to load + \~french Numéro du fond que l'on veut charger + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param bg_map + \~english Name of the map's info (example : ship_Map) + \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) + \~\param bg_size + \~english Background size. Use the following macros : BG_ROT_128X128, or 256X256, 512X512, or 1024X1024 + \~french Taille du fond. Utiliser les macros suivantes : BG_ROT_128X128, ou 256X256, 512X512, ou enfin 1024X1024 + \~\param wraparound + \~english If the background wraps around or not. + \~french Si le fond boucle ou non. +*/ +#define PA_DualLoadRotBg(bg_select, bg_tiles, bg_map, bg_size, wraparound) do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadRotBg(0, bg_select, bg_tiles, bg_map, bg_size, wraparound);\ + PA_LoadRotBg(1, bg_select, bg_tiles, bg_map, bg_size, wraparound);\ + PA_DualBGScrollY(bg_select, 0);}while(0) + +static inline void PA_DualSetBgRot(u8 bg_select, s32 x_scroll, s32 y_scroll, s32 x_rotcentre, s32 y_rotcentre, s16 bg_angle, s32 bg_zoom){ + PA_SetBgRot(0, bg_select, x_scroll, y_scroll, x_rotcentre, y_rotcentre, bg_angle, bg_zoom); + PA_SetBgRot(1, bg_select, x_scroll, y_scroll, x_rotcentre, y_rotcentre, bg_angle, bg_zoom); +} + +/*! + \def PA_DualLoadBg(bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode) + \deprecated + \brief + \~english [DEPRECATED] Simplest way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap + \~french [DEPRECATED] Facon la plus simple de cahrger un fond. Combine PA_InitBg, PA_LoadBgTiles, et PA_LoadBgMap + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param tile_size + \~english Size of your tileset + \~french Taille du tilset + \~\param bg_map + \~english Name of the map's info (example : ship_Map) + \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) + \~\param bg_size + \~english Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... For a rotatable Bg, use the macros BG_ROT_128X128... + \~french Taille du fond. Ceci est très important, car ça détermine aussi si le Bg est rotatif ou non. Pour un fond normal, on utilise les macros BG_256X256, BG_256X512, etc... Por un fond rotatif, il suffit d'utiliser BG_ROT_128X128... + \~\param wraparound + \~english If the background wraps around or not. More important for rotating backgrounds. + \~french Si le fond boucle ou non. C'est plus important pour les fonds rotatifs... + \~\param color_mode + \~english Color mode : 0 for 16 color mode, 1 for 256... + \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 +*/ + +#define PA_DualLoadBg(bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode) do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadBg(0, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode);\ + PA_LoadBg(1, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode);\ + PA_DualBGScrollY(bg_select, 0);}while(0) + +/*! + \fn static inline void PA_DualBGScrollX(u8 bg_number, s16 x) + \brief + \~english Scroll horizontaly any background, on both screens + \~french Scroll horizontal de n'importe quel fond, sur les 2 écrans + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer, horizontalement... +*/ +static inline void PA_DualBGScrollX(u8 bg_number, s16 x){ + PA_BGScrollX(0, bg_number, x); + PA_BGScrollX(1, bg_number, x); +} + +/*! + \fn static inline void PA_DualBGScrollY(u8 bg_number, s16 y) + \brief + \~english Scroll vertically any background + \~french Scroll vertical de n'importe quel fond + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer, verticalement... +*/ +static inline void PA_DualBGScrollY(u8 bg_number, s16 y){ + PA_BGScrollY(0, bg_number, y+PA_ScreenSpace); + PA_BGScrollY(1, bg_number, y); +} + +/*! + \fn static inline void PA_DualBGScrollXY(u8 bg_number, s16 x, s16 y) + \brief + \~english Scroll horizontaly and vertically any background + \~french Scroll horizontal et vertical de n'importe quel fond + \~\param bg_number + \~english Background number (0-3) + \~french Numéro du fond que l'on veut tourner (0-3) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer, horizontalement... + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer, verticalement... +*/ +static inline void PA_DualBGScrollXY(u8 bg_number, s16 x, s16 y) { + PA_DualBGScrollX(bg_number, x); + PA_DualBGScrollY(bg_number, y); +} + +/*! + \def PA_DualLoadPAGfxLargeBg(bg_number, bg_name) + \deprecated + \brief + \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), converted with PAGfx. Background on both screens, as one + \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large), converti avec PAGfx. Fond sur les 2 écrans comme un seul + \~\param bg_number + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (0-3) + \~\param bg_name + \~english Background name, in PAGfx + \~french Nom du fond dans PAGfx +*/ +#define PA_DualLoadPAGfxLargeBg(bg_number, bg_name)do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadPAGfxLargeBg(0, bg_number, bg_name);\ + PA_LoadPAGfxLargeBg(1, bg_number, bg_name);\ + PA_DualInfLargeScrollY(bg_number, 0);}while(0) + +/*! + \def PA_DualLoadLargeBg(bg_select, bg_tiles, bg_map, color_mode, lx, ly) + \deprecated + \brief + \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), on both screens + \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large), sur les 2 écrans + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param bg_map + \~english Name of the map's info (example : ship_Map) + \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) + \~\param color_mode + \~english Color mode : 0 for 16 color mode, 1 for 256... + \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 + \~\param lx + \~english Width, in tiles. So a 512 pixel wide map is 64 tiles wide... + \~french Largeur, en tiles. Un fond de 512 pixels de large fera 64 tiles de large. + \~\param ly + \~english Height, in tiles. So a 512 pixel high map is 64 tiles high... + \~french Hauteur, en tiles. Un fond de 512 pixels de hauy fera 64 tiles de haut. +*/ +#define PA_DualLoadLargeBg(bg_select, bg_tiles, bg_map, color_mode, lx, ly)do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadLargeBg(0, bg_select, bg_tiles, bg_map, color_mode, lx, ly);\ + PA_LoadLargeBg(1, bg_select, bg_tiles, bg_map, color_mode, lx, ly);\ + PA_DualInfLargeScrollY(bg_select, 0);}while(0) + +/*! + \def PA_DualLoadLargeBgEx(bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly) + \deprecated + \brief + \~english [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), but here you can put yourself the tile size... + \~french [DEPRECATED] Charger et initialiser un fond pour le scrolling infini (pour les fonds de plus de 512 pixels de haut ou de large), mais ici on met soi-meme la taille des tiles + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param bg_tiles + \~english Name of the tiles' info (example: ship_Tiles) + \~french Nom du tableau contenant les tiles (exemple: ship_Tiles) + \~\param tile_size + \~english Size of your tileset + \~french Taille du tilset + \~\param bg_map + \~english Name of the map's info (example : ship_Map) + \~french Nom du tableau contenant les infos sur la map (exemple : ship_Map) + \~\param color_mode + \~english Color mode : 0 for 16 color mode, 1 for 256... + \~french Nombre de couleurs : 0 pour 16 couleurs, 1 pour 256 + \~\param lx + \~english Width, in tiles. So a 512 pixel wide map is 64 tiles wide... + \~french Largeur, en tiles. Un fond de 512 pixels de large fera 64 tiles de large. + \~\param ly + \~english Height, in tiles. So a 512 pixel high map is 64 tiles high... + \~french Hauteur, en tiles. Un fond de 512 pixels de hauy fera 64 tiles de haut. +*/ +#define PA_DualLoadLargeBgEx(bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly) do{\ + PA_DEPRECATED_MACRO;\ + PA_LoadLargeBgEx(0, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly);\ + PA_LoadLargeBgEx(1, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly);\ + PA_DualInfLargeScrollY(bg_select, 0);}while(0) + +/*! + \def PA_DualEasyBgLoad(bg_number, bg_name) + \deprecated + \brief + \~english [DEPRECATED] EasyBg load, but for Dual screen... + \~french [DEPRECATED] Chargement de fond EasyBg, mais pour le Dual Screen... + \~\param bg_number + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (0-3) + \~\param bg_name + \~english Background name, in PAGfx + \~french Nom du fond dans PAGfx +*/ +#define PA_DualEasyBgLoad(bg_number, bg_name)do{\ + PA_DEPRECATED_MACRO;\ + PA_EasyBgLoad(0, bg_number, bg_name);\ + PA_EasyBgLoad(1, bg_number, bg_name);\ + PA_DualEasyBgScrollY(bg_number, 0);}while(0) + +/*! + \fn static inline void PA_DualEasyBgScrollX(u8 bg_select, s32 x) + \brief + \~english Scroll an EasyBg horizontaly. It must have been initialised with PA_LoadLargeBg. + \~french Déplacer un fond EasyBg horizontalement. Doit etre initialisé avec PA_LoadLargeBg. + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer +*/ +static inline void PA_DualEasyBgScrollX(u8 bg_select, s32 x){ + PA_EasyBgScrollX(0, bg_select, x); + PA_EasyBgScrollX(1, bg_select, x); +} + +/*! + \fn static inline void PA_DualEasyBgScrollY(u8 bg_select, s32 y) + \brief + \~english Scroll an EasyBg vertically. + \~french Déplacer un fond EasyBg verticalement. + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_DualEasyBgScrollY(u8 bg_select, s32 y){ + PA_EasyBgScrollY(0, bg_select, y+PA_ScreenSpace); + PA_EasyBgScrollY(1, bg_select, y); +} + +/*! + \fn static inline void PA_DualLoadBackground(u8 bg_number, const PA_BgStruct* bg) + \brief + \~english Load a background (EasyBg, RotBg or UnlimitedBg), but for Dual screen... + \~french Charger un fond (EasyBg, RotBg or UnlimitedBg), mais pour le Dual Screen... + \~\param bg_number + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (0-3) + \~\param bg + \~english Pointer to the background (struct) + \~french Pointeur vers le fond +*/ + +static inline void PA_DualLoadBackground(u8 bg_number, const PA_BgStruct* bg){ + PA_LoadBackground(0, bg_number, bg); + PA_LoadBackground(1, bg_number, bg); + PA_DualEasyBgScrollY(bg_number, 0); +} + +/*! + \fn static inline void PA_DualEasyBgScrollXY(u8 bg_select, s32 x, s32 y) + \brief + \~english Scroll a Dual EasyBg. + \~french Déplacer un fond EasyBg en Dual Screen. + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_DualEasyBgScrollXY(u8 bg_select, s32 x, s32 y){ + PA_DualEasyBgScrollX(bg_select, x); + PA_DualEasyBgScrollY(bg_select, y); +} + +/*! + \fn static inline void PA_DualInfLargeScrollX(u8 bg_select, s32 x) + \brief + \~english Scroll a large infinite scrolling background horizontaly. It must have been initialised with PA_LoadLargeBg. + \~french Déplacer un fond à scrolling 'infini' horizontalement. Doit etre initialisé avec PA_LoadLargeBg. + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer +*/ +static inline void PA_DualInfLargeScrollX(u8 bg_select, s32 x){ + PA_InfLargeScrollX(0, bg_select, x); + PA_InfLargeScrollX(1, bg_select, x); +} + +/*! + \fn static inline void PA_DualInfLargeScrollY(u8 bg_select, s32 y) + \brief + \~english Scroll a large infinite scrolling background vertically. It must have been initialised with PA_LoadLargeBg. + \~french Déplacer un fond à scrolling 'infini' verticalement. Doit etre initialisé avec PA_LoadLargeBg. + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_DualInfLargeScrollY(u8 bg_select, s32 y){ + PA_InfLargeScrollY(0, bg_select, y+PA_ScreenSpace); + PA_InfLargeScrollY(1, bg_select, y); +} + +/*! + \fn static inline void PA_DualInfLargeScrollXY(u8 bg_select, s32 x, s32 y) + \brief + \~english Scroll a large infinite scrolling background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. + \~french Déplacer un fond à scrolling 'infini' horizontalement et verticalement. Doit etre initialisé avec PA_LoadLargeBg. + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_DualInfLargeScrollXY(u8 bg_select, s32 x, s32 y){ + PA_DualInfLargeScrollX(bg_select, x); + PA_DualInfLargeScrollY(bg_select, y); +} + +/*! + \fn static inline void PA_DualLargeScrollX(u8 bg_select, s32 x) + \brief + \~english Scroll a large background horizontaly. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... + \~french Déplacer un grand fond à scrolling horizontalement.Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer +*/ +static inline void PA_DualLargeScrollX(u8 bg_select, s32 x){ + PA_LargeScrollX(0, bg_select, x); + PA_LargeScrollX(1, bg_select, x); +} + +/*! + \fn static inline void PA_DualLargeScrollY(u8 bg_select, s32 y) + \brief + \~english Scroll a large background vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... + \~french Déplacer un grand fond à scrolling verticalement. Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_DualLargeScrollY(u8 bg_select, s32 y){ + PA_LargeScrollY(0, bg_select, y+PA_ScreenSpace); + PA_LargeScrollY(1, bg_select, y); +} + +/*! + \fn static inline void PA_DualLargeScrollXY(u8 bg_select, s32 x, s32 y) + \brief + \~english Scroll a large background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... + \~french Déplacer un grand fond à scrolling horizontalement et verticalement. Doit etre initialisé avec PA_LoadLargeBg. Cette fonction ne permet pas au fond de 'boucler' sur lui-meme, mais est bien plus rapide que InfLargeScroll... + \~\param bg_select + \~english Background number to load (from 0 to 3) + \~french Numéro du fond que l'on veut charger (de 0 à 3 en mode 0, uniquement 2 et 3 en mode 2) + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_DualLargeScrollXY(u8 bg_select, s32 x, s32 y){ + PA_DualLargeScrollX(bg_select, x); + PA_DualLargeScrollY(bg_select, y); +} + +/*! + \fn static inline void PA_DualInitParallaxX(s32 bg0, s32 bg1, s32 bg2, s32 bg3) + \brief + \~english Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... + \~french Initialiser le Parallax Scrolling pour plusieurs fonds, horizontalement. Choix de la vitesse à laquelle les fonds vont défiler par rapport aux autres... Utiliser PA_ParallaxScrollX par la suite pour scroller + \~\param bg0 + \~english Value for the first background (0). Set to 256 for normal scroll speed, lower for lower speed (128 is half speed...), higher for faster (512 is twice as fast...). You can set negative values. 0 inactivates parallax scrolling for this background + \~french Valeur pour le premier fond (0). 256 met en vitesse normal, moins pour moins lent (128 pour moitié de vitesse), plus pour plus rapide (512 équivaut à 2 fois plus vite). On peut utiliser des valeurs négatives. 0 désactive le scrolling parallax pour ce fond + \~\param bg1 + \~english Same thing for Background 1 + \~french Idem, pour le Fond 1 + \~\param bg2 + \~english Same thing for Background 2 + \~french Idem, pour le Fond 2 + \~\param bg3 + \~english Same thing for Background 3 + \~french Idem, pour le Fond 3 +*/ +static inline void PA_DualInitParallaxX(s32 bg0, s32 bg1, s32 bg2, s32 bg3) { + PA_InitParallaxX(0, bg0, bg1, bg2, bg3); + PA_InitParallaxX(1, bg0, bg1, bg2, bg3); +} + +/*! + \fn static inline void PA_DualInitParallaxY(s32 bg0, s32 bg1, s32 bg2, s32 bg3) + \brief + \~english Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... + \~french Initialiser le Parallax Scrolling pour plusieurs fonds, horizontalement. Choix de la vitesse à laquelle les fonds vont défiler par rapport aux autres... Utiliser PA_ParallaxScrollX par la suite pour scroller + \~\param bg0 + \~english Value for the first background (0). Set to 256 for normal scroll speed, lower for lower speed (128 is half speed...), higher for faster (512 is twice as fast...). You can set negative values. 0 inactivates parallax scrolling for this background + \~french Valeur pour le premier fond (0). 256 met en vitesse normal, moins pour moins lent (128 pour moitié de vitesse), plus pour plus rapide (512 équivaut à 2 fois plus vite). On peut utiliser des valeurs négatives. 0 désactive le scrolling parallax pour ce fond + \~\param bg1 + \~english Same thing for Background 1 + \~french Idem, pour le Fond 1 + \~\param bg2 + \~english Same thing for Background 2 + \~french Idem, pour le Fond 2 + \~\param bg3 + \~english Same thing for Background 3 + \~french Idem, pour le Fond 3 +*/ +static inline void PA_DualInitParallaxY(s32 bg0, s32 bg1, s32 bg2, s32 bg3) { + PA_InitParallaxY(0, bg0, bg1, bg2, bg3); + PA_InitParallaxY(1, bg0, bg1, bg2, bg3); +} + +/*! + \fn static inline void PA_DualParallaxScrollX(s32 x) + \brief + \~english Scroll the backgrounds + \~french Déplacer les fonds activés pour le parallax... + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer +*/ +static inline void PA_DualParallaxScrollX(s32 x){ + int i; + for(i = 0; i < 4; i++) + if (PA_parallaxX[0][i]) + PA_DualEasyBgScrollX(i, (PA_parallaxX[0][i] * x) >> 8); +} + +/*! + \fn static inline void PA_DualParallaxScrollY(s32 y) + \brief + \~english Scroll the backgrounds + \~french Déplacer les fonds activés pour le parallax... + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_DualParallaxScrollY(s32 y){ + int i; + for(i = 0; i < 4; i++) + if (PA_parallaxY[0][i]) + PA_DualEasyBgScrollY(i, (PA_parallaxY[0][i] * y) >> 8); +} + +/*! + \fn static inline void PA_DualParallaxScrollXY(s32 x, s32 y) + \brief + \~english Scroll the backgrounds + \~french Déplacer les fonds activés pour le parallax... + \~\param x + \~english X value to scroll + \~french Valeur X à déplacer + \~\param y + \~english Y value to scroll + \~french Valeur Y à déplacer +*/ +static inline void PA_DualParallaxScrollXY(s32 x, s32 y){ + PA_DualParallaxScrollX(x); + PA_DualParallaxScrollY(y); +} + +/*! + \fn static inline void PA_DualSetBgPrio(u8 bg, u8 prio) + \brief + \~english Change a backgrounds priority + \~french Changer la priorité d'un fond + \~\param bg + \~english Background... + \~french Numéro du fond... + \~\param prio + \~english Priority level (0-3, 0 being the highest) + \~french Niveau de priorité, de 0 à 3, 0 étant priorité la plus élevée +*/ +static inline void PA_DualSetBgPrio(u8 bg, u8 prio) { + PA_SetBgPrio(0, bg, prio); + PA_SetBgPrio(1, bg, prio); +} + +/** @} */ // end of Backgrounds + +// Pas utilisé en direct par le programmeur +void PA_InitLargeBg(u8 screen, u8 bg_select, s32 lx, s32 ly, void* bg_map); + +#endif diff --git a/include/arm9/PA_Timer.h b/include/arm9/PA_Timer.h index f0d0f87..ab9bdcf 100644 --- a/include/arm9/PA_Timer.h +++ b/include/arm9/PA_Timer.h @@ -1,36 +1,36 @@ -#ifndef TIMER_H -#define TIMER_H - -/* - * this is a millisecond timer - */ - -#include "PA9.h" - -#define TIME_MGR_CAPACITY 16 - -struct tTimer -{ - u32 nPauseTick; - u32 nRefTick; - u8 bRunning; -}; - -struct tTimeMgr -{ - /* timer 0 as master timer */ - struct tTimer rBank[TIME_MGR_CAPACITY]; - u8 nCount; -}; - -extern void StartTime(u8 bNew); -extern void PauseTime(); - -extern u8 NewTimer(u8 bStarted); -extern void StartTimer(u8 nTimerId); -extern u32 Tick(u8 nTimerId); -extern void PauseTimer(u8 nTimerId); -extern void UnpauseTimer(u8 nTimerId); -extern void ResetTimer(u8); - -#endif // TIMER_H +#ifndef TIMER_H +#define TIMER_H + +/* + * this is a millisecond timer + */ + +#include "PA9.h" + +#define TIME_MGR_CAPACITY 16 + +struct tTimer +{ + u32 nPauseTick; + u32 nRefTick; + u8 bRunning; +}; + +struct tTimeMgr +{ + /* timer 0 as master timer */ + struct tTimer rBank[TIME_MGR_CAPACITY]; + u8 nCount; +}; + +extern void StartTime(u8 bNew); +extern void PauseTime(); + +extern u8 NewTimer(u8 bStarted); +extern void StartTimer(u8 nTimerId); +extern u32 Tick(u8 nTimerId); +extern void PauseTimer(u8 nTimerId); +extern void UnpauseTimer(u8 nTimerId); +extern void ResetTimer(u8); + +#endif // TIMER_H diff --git a/include/arm9/PA_Wifi.h b/include/arm9/PA_Wifi.h index cac9ef9..f622e42 100644 --- a/include/arm9/PA_Wifi.h +++ b/include/arm9/PA_Wifi.h @@ -1,25 +1,25 @@ -#ifndef _PA_WIFI -#define _PA_WIFI - - -#include - -#include -#include -#include - -#define IPADDR(d,c,b,a) ((unsigned long)((((a)&0xff)<<24)|(((b)&0xff)<<16)|(((c)&0xff)<<8)|(((d)&0xff)))) - -#define PA_NORMAL_TCP 1 -#define PA_NONBLOCKING_TCP 2 - -#define PA_InitWifi() Wifi_InitDefault(INIT_ONLY) - -bool PA_ConnectWifiWFC(); -unsigned long PA_chartoip(char *message); -int PA_InitSocket(int* socket, char* host, int port, int mode); -int PA_InitServer(int* sock, int port, int mode, int num_connect); - -bool PA_SubmitScore(char *response, char *gamekey, char *playername, int score, char *level, u8 responsetype); - -#endif +#ifndef _PA_WIFI +#define _PA_WIFI + + +#include + +#include +#include +#include + +#define IPADDR(d,c,b,a) ((unsigned long)((((a)&0xff)<<24)|(((b)&0xff)<<16)|(((c)&0xff)<<8)|(((d)&0xff)))) + +#define PA_NORMAL_TCP 1 +#define PA_NONBLOCKING_TCP 2 + +#define PA_InitWifi() Wifi_InitDefault(INIT_ONLY) + +bool PA_ConnectWifiWFC(); +unsigned long PA_chartoip(char *message); +int PA_InitSocket(int* socket, char* host, int port, int mode); +int PA_InitServer(int* sock, int port, int mode, int num_connect); + +bool PA_SubmitScore(char *response, char *gamekey, char *playername, int score, char *level, u8 responsetype); + +#endif diff --git a/include/arm9/PA_Window.h b/include/arm9/PA_Window.h index 284acb6..f42fcbc 100644 --- a/include/arm9/PA_Window.h +++ b/include/arm9/PA_Window.h @@ -1,200 +1,200 @@ -#ifndef _PA_Window -#define _PA_Window - - -/*! \file PA_Window.h - \brief Window options... - - Window options, nothing much to say. -*/ - -// utilisé pour activer ou non les fenetres... -#define WIN_BG0 1 -#define WIN_BG1 2 -#define WIN_BG2 4 -#define WIN_BG3 8 -#define WIN_OBJ 16 -#define WIN_SFX 32 - -#define DISPCNTL(screen) _REG16(0x04000000 + (screen * 0x1000)) -#define DISPCNTH(screen) _REG16(0x04000002 + (screen * 0x1000)) - -#define WINDOW0 (1 << 13) -#define WINDOW1 (1 << 14) -#define WINDOWOBJ (1 << 15) - -#define WIN0X(screen) _REG16(0x04000040 + (screen * 0x1000)) -#define WIN0Y(screen) _REG16(0x04000044 + (screen * 0x1000)) -#define WIN1X(screen) _REG16(0x04000042 + (screen * 0x1000)) -#define WIN1Y(screen) _REG16(0x04000046 + (screen * 0x1000)) - -#define WININ(screen) _REG16(0x04000048 + (screen * 0x1000)) -#define WINOUT(screen) _REG16(0x0400004A + (screen * 0x1000)) - -extern const s16 winfades[][4]; - -/** @defgroup Window Window system - * Set up 2 windows and a possible object window... - * @{ - */ - -/*! \def PA_SetWin0XY(screen, x1, y1, x2, y2) - \brief - \~english Set the X et Y coordinates of the rectangular first window. You'll also have to use PA_SetWin0 to chose which Backgrounds are visible and if sprites are too... - \~french Régler les coordonnées X et Y du rectangle de la première fenetre. Il faudra aussi utiliser PA_SetWin0 pour choisir quels fonds sont visibles et si les sprites le sont ou non... - \~\param screen - \~english Screen... - \~french Ecran... - \~\param x1 - \~english X coordinate of the top left point - \~french Coordonnée X du coin supérieur gauche - \~\param y1 - \~english Y coordinate of the top left point - \~french Coordonnée Y du coin supérieur gauche - \~\param x2 - \~english X coordinate of the bottom right point - \~french Coordonnée X du coin inférieur droit - \~\param y2 - \~english Y coordinate of the bottom right point - \~french Coordonnée Y du coin inférieur droit -*/ -static inline void PA_SetWin0XY(u8 screen, u8 x1, u8 y1, u8 x2, u8 y2) { - WIN0X(screen) = x2 + ((x1) << 8); - WIN0Y(screen) = y2 + ((y1) << 8); -} - -/*! \def PA_SetWin1XY(screen, x1, y1, x2, y2) - \brief - \~english Set the X et Y coordinates of the rectangular second window. You'll also have to use PA_SetWin1 to chose which Backgrounds are visible and if sprites are too... - \~french Régler les coordonnées X et Y du rectangle de la deuxième fenetre. Il faudra aussi utiliser PA_SetWin1 pour choisir quels fonds sont visibles et si les sprites le sont ou non... - \~\param screen - \~english Screen... - \~french Ecran... - \~\param x1 - \~english X coordinate of the top left point - \~french Coordonnée X du coin supérieur gauche - \~\param y1 - \~english Y coordinate of the top left point - \~french Coordonnée Y du coin supérieur gauche - \~\param x2 - \~english X coordinate of the bottom right point - \~french Coordonnée X du coin inférieur droit - \~\param y2 - \~english Y coordinate of the bottom right point - \~french Coordonnée Y du coin inférieur droit -*/ -#define PA_SetWin1XY(screen, x1, y1, x2, y2) do{WIN1X(screen) = x2 + ((x1) << 8); WIN1Y(screen) = y2 + ((y1) << 8);}while(0) - -/*! \def PA_EnableWin0(screen, bg_sprites) - \brief - \~english Enable and set which backgrounds will be visible and whether sprites will too or not, for Window 0. You'll then have to configure it with PA_SetWin0XY - \~french Activer et choisir quels fonds seront visibles dans la fenetre, et si les sprites le seront ou pas, pour la fenetre 0. Il faudra ensuite régler la taille avec PA_SetWin0XY - \~\param screen - \~english Screen... - \~french Ecran... - \~\param bg_sprites - \~english Backgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (for special effects) - \~french Fond et sprites à afficher, que l'on choisi de la facon suivante : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (pour les effets spéciaux) -*/ -#define PA_EnableWin0(screen, bg_sprites) do{DISPCNTL(screen) |= WINDOW0; WININ(screen) &= 255; WININ(screen) |= (bg_sprites);}while(0) - -/*! \def PA_DisableWin0(screen) - \brief - \~english Disable the first window... - \~french Désactiver la première fenetre... - \~\param screen - \~english Screen... - \~french Ecran... -*/ -#define PA_DisableWin0(screen) DISPCNTL(screen) &= ~WINDOW0 - -/*! \def PA_EnableWin1(screen, bg_sprites) - \brief - \~english Enable and set which backgrounds will be visible and whether sprites will too or not, for Window 1. You'll then have to configure it with PA_SetWin1XY - \~french Activer et choisir quels fonds seront visibles dans la fenetre, et si les sprites le seront ou pas, pour la fenetre 1. Il faudra ensuite régler la taille avec PA_SetWin1X - \~\param screen - \~english Screen... - \~french Ecran... - \~\param bg_sprites - \~english Backgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (for special effects) - \~french Fond et sprites à afficher, que l'on choisi de la facon suivante : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (pour les effets spéciaux) -*/ -#define PA_EnableWin1(screen, bg_sprites) do{DISPCNTL(screen) |= WINDOW1; WININ(screen) &= 255; WININ(screen) |= ((bg_sprites) << 8);}while(0) - -/*! \def PA_DisableWin1(screen) - \brief - \~english Disable the second window... - \~french Désactiver la deuxième fenetre... - \~\param screen - \~english Screen... - \~french Ecran... -*/ -#define PA_DisableWin1(screen) DISPCNTL(screen) &= ~WINDOW1 - -/*! \fn static inline void PA_EnableWinObj(u8 screen, u16 bg_sprites) - \brief - \~english Enable and set which backgrounds will be visible and whether sprites will too or not, for Object Winodw (created from sprites in Window mode). - \~french Activer et choisir quels fonds seront visibles dans la fenetre, et si les sprites le seront ou pas, pour la fenetre objets (créée à partir des sprites en mode Window). - \~\param screen - \~english Screen... - \~french Ecran... - \~\param bg_sprites - \~english Backgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (for special effects) - \~french Fond et sprites à afficher, que l'on choisi de la facon suivante : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (pour les effets spéciaux) -*/ -static inline void PA_EnableWinObj(u8 screen, u16 bg_sprites) { - DISPCNTL(screen) |= WINDOWOBJ; - WINOUT(screen) &= 255; - WINOUT(screen) |= (bg_sprites << 8); -} - -/*! \def PA_DisableWinObj(screen) - \brief - \~english Disable the object window... - \~french Désactiver la fenetre objet... - \~\param screen - \~english Screen... - \~french Ecran... -*/ -#define PA_DisableWinObj(screen) DISPCNTL(screen) &= ~WINDOWOBJ - -/*! \def PA_SetOutWin(screen, bg_sprites) - \brief - \~english Set which backgrounds will be visible and whether sprites will too or not, outside of the windows - \~french Choisir quels fonds seront visibles dans la fenetre, et si les sprites le seront ou pas, en dehors des fenetres - \~\param screen - \~english Screen... - \~french Ecran... - \~\param bg_sprites - \~english Backgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ - \~french Fond et sprites à afficher, que l'on choisi de la facon suivante : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ -*/ -#define PA_SetOutWin(screen, bg_sprites) do{WINOUT(screen) &= ~255; WINOUT(screen) |= bg_sprites;}while(0) - -/*! \fn static inline void PA_WindowFade(u8 screen, u8 type, u8 time) - \brief - \~english This allows you to do fade in and out, using the window system - \~french Permet de faire des entrées/sorties en utilisant le systeme de fenetre - \~\param screen - \~english Screen... - \~french Ecran... - \~\param type - \~english Type... 8 different types are available (0-7) - \~french Type... 8 différents types sont disponibles (0-7) - \~\param time - \~english Time, from 0 to 32 (included). 0 is a completely viewable screen, 32 is completely out - \~french Temps, de 0 à 32 (inclus). 0 est écran visisble, 32 invisible -*/ -static inline void PA_WindowFade(u8 screen, u8 type, u8 time){ - PA_EnableWin0(screen, WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ); - PA_SetWin0XY(screen, ((time*winfades[type][0])*255)>>8, - (time*winfades[type][1]), - (((time*winfades[type][2]) + 256)*255)>>8, - (time*winfades[type][3]) + 192); - if (time == 0) PA_DisableWin0(screen); -} - -/** @} */ // end of Window -////////////////////////////////////////////////////////////////////// - -#endif +#ifndef _PA_Window +#define _PA_Window + + +/*! \file PA_Window.h + \brief Window options... + + Window options, nothing much to say. +*/ + +// utilisé pour activer ou non les fenetres... +#define WIN_BG0 1 +#define WIN_BG1 2 +#define WIN_BG2 4 +#define WIN_BG3 8 +#define WIN_OBJ 16 +#define WIN_SFX 32 + +#define DISPCNTL(screen) _REG16(0x04000000 + (screen * 0x1000)) +#define DISPCNTH(screen) _REG16(0x04000002 + (screen * 0x1000)) + +#define WINDOW0 (1 << 13) +#define WINDOW1 (1 << 14) +#define WINDOWOBJ (1 << 15) + +#define WIN0X(screen) _REG16(0x04000040 + (screen * 0x1000)) +#define WIN0Y(screen) _REG16(0x04000044 + (screen * 0x1000)) +#define WIN1X(screen) _REG16(0x04000042 + (screen * 0x1000)) +#define WIN1Y(screen) _REG16(0x04000046 + (screen * 0x1000)) + +#define WININ(screen) _REG16(0x04000048 + (screen * 0x1000)) +#define WINOUT(screen) _REG16(0x0400004A + (screen * 0x1000)) + +extern const s16 winfades[][4]; + +/** @defgroup Window Window system + * Set up 2 windows and a possible object window... + * @{ + */ + +/*! \def PA_SetWin0XY(screen, x1, y1, x2, y2) + \brief + \~english Set the X et Y coordinates of the rectangular first window. You'll also have to use PA_SetWin0 to chose which Backgrounds are visible and if sprites are too... + \~french Régler les coordonnées X et Y du rectangle de la première fenetre. Il faudra aussi utiliser PA_SetWin0 pour choisir quels fonds sont visibles et si les sprites le sont ou non... + \~\param screen + \~english Screen... + \~french Ecran... + \~\param x1 + \~english X coordinate of the top left point + \~french Coordonnée X du coin supérieur gauche + \~\param y1 + \~english Y coordinate of the top left point + \~french Coordonnée Y du coin supérieur gauche + \~\param x2 + \~english X coordinate of the bottom right point + \~french Coordonnée X du coin inférieur droit + \~\param y2 + \~english Y coordinate of the bottom right point + \~french Coordonnée Y du coin inférieur droit +*/ +static inline void PA_SetWin0XY(u8 screen, u8 x1, u8 y1, u8 x2, u8 y2) { + WIN0X(screen) = x2 + ((x1) << 8); + WIN0Y(screen) = y2 + ((y1) << 8); +} + +/*! \def PA_SetWin1XY(screen, x1, y1, x2, y2) + \brief + \~english Set the X et Y coordinates of the rectangular second window. You'll also have to use PA_SetWin1 to chose which Backgrounds are visible and if sprites are too... + \~french Régler les coordonnées X et Y du rectangle de la deuxième fenetre. Il faudra aussi utiliser PA_SetWin1 pour choisir quels fonds sont visibles et si les sprites le sont ou non... + \~\param screen + \~english Screen... + \~french Ecran... + \~\param x1 + \~english X coordinate of the top left point + \~french Coordonnée X du coin supérieur gauche + \~\param y1 + \~english Y coordinate of the top left point + \~french Coordonnée Y du coin supérieur gauche + \~\param x2 + \~english X coordinate of the bottom right point + \~french Coordonnée X du coin inférieur droit + \~\param y2 + \~english Y coordinate of the bottom right point + \~french Coordonnée Y du coin inférieur droit +*/ +#define PA_SetWin1XY(screen, x1, y1, x2, y2) do{WIN1X(screen) = x2 + ((x1) << 8); WIN1Y(screen) = y2 + ((y1) << 8);}while(0) + +/*! \def PA_EnableWin0(screen, bg_sprites) + \brief + \~english Enable and set which backgrounds will be visible and whether sprites will too or not, for Window 0. You'll then have to configure it with PA_SetWin0XY + \~french Activer et choisir quels fonds seront visibles dans la fenetre, et si les sprites le seront ou pas, pour la fenetre 0. Il faudra ensuite régler la taille avec PA_SetWin0XY + \~\param screen + \~english Screen... + \~french Ecran... + \~\param bg_sprites + \~english Backgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (for special effects) + \~french Fond et sprites à afficher, que l'on choisi de la facon suivante : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (pour les effets spéciaux) +*/ +#define PA_EnableWin0(screen, bg_sprites) do{DISPCNTL(screen) |= WINDOW0; WININ(screen) &= 255; WININ(screen) |= (bg_sprites);}while(0) + +/*! \def PA_DisableWin0(screen) + \brief + \~english Disable the first window... + \~french Désactiver la première fenetre... + \~\param screen + \~english Screen... + \~french Ecran... +*/ +#define PA_DisableWin0(screen) DISPCNTL(screen) &= ~WINDOW0 + +/*! \def PA_EnableWin1(screen, bg_sprites) + \brief + \~english Enable and set which backgrounds will be visible and whether sprites will too or not, for Window 1. You'll then have to configure it with PA_SetWin1XY + \~french Activer et choisir quels fonds seront visibles dans la fenetre, et si les sprites le seront ou pas, pour la fenetre 1. Il faudra ensuite régler la taille avec PA_SetWin1X + \~\param screen + \~english Screen... + \~french Ecran... + \~\param bg_sprites + \~english Backgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (for special effects) + \~french Fond et sprites à afficher, que l'on choisi de la facon suivante : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (pour les effets spéciaux) +*/ +#define PA_EnableWin1(screen, bg_sprites) do{DISPCNTL(screen) |= WINDOW1; WININ(screen) &= 255; WININ(screen) |= ((bg_sprites) << 8);}while(0) + +/*! \def PA_DisableWin1(screen) + \brief + \~english Disable the second window... + \~french Désactiver la deuxième fenetre... + \~\param screen + \~english Screen... + \~french Ecran... +*/ +#define PA_DisableWin1(screen) DISPCNTL(screen) &= ~WINDOW1 + +/*! \fn static inline void PA_EnableWinObj(u8 screen, u16 bg_sprites) + \brief + \~english Enable and set which backgrounds will be visible and whether sprites will too or not, for Object Winodw (created from sprites in Window mode). + \~french Activer et choisir quels fonds seront visibles dans la fenetre, et si les sprites le seront ou pas, pour la fenetre objets (créée à partir des sprites en mode Window). + \~\param screen + \~english Screen... + \~french Ecran... + \~\param bg_sprites + \~english Backgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (for special effects) + \~french Fond et sprites à afficher, que l'on choisi de la facon suivante : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ | WIN_SFX (pour les effets spéciaux) +*/ +static inline void PA_EnableWinObj(u8 screen, u16 bg_sprites) { + DISPCNTL(screen) |= WINDOWOBJ; + WINOUT(screen) &= 255; + WINOUT(screen) |= (bg_sprites << 8); +} + +/*! \def PA_DisableWinObj(screen) + \brief + \~english Disable the object window... + \~french Désactiver la fenetre objet... + \~\param screen + \~english Screen... + \~french Ecran... +*/ +#define PA_DisableWinObj(screen) DISPCNTL(screen) &= ~WINDOWOBJ + +/*! \def PA_SetOutWin(screen, bg_sprites) + \brief + \~english Set which backgrounds will be visible and whether sprites will too or not, outside of the windows + \~french Choisir quels fonds seront visibles dans la fenetre, et si les sprites le seront ou pas, en dehors des fenetres + \~\param screen + \~english Screen... + \~french Ecran... + \~\param bg_sprites + \~english Backgrounds and sprites, use the following macro : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ + \~french Fond et sprites à afficher, que l'on choisi de la facon suivante : WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ +*/ +#define PA_SetOutWin(screen, bg_sprites) do{WINOUT(screen) &= ~255; WINOUT(screen) |= bg_sprites;}while(0) + +/*! \fn static inline void PA_WindowFade(u8 screen, u8 type, u8 time) + \brief + \~english This allows you to do fade in and out, using the window system + \~french Permet de faire des entrées/sorties en utilisant le systeme de fenetre + \~\param screen + \~english Screen... + \~french Ecran... + \~\param type + \~english Type... 8 different types are available (0-7) + \~french Type... 8 différents types sont disponibles (0-7) + \~\param time + \~english Time, from 0 to 32 (included). 0 is a completely viewable screen, 32 is completely out + \~french Temps, de 0 à 32 (inclus). 0 est écran visisble, 32 invisible +*/ +static inline void PA_WindowFade(u8 screen, u8 type, u8 time){ + PA_EnableWin0(screen, WIN_BG0 | WIN_BG1 | WIN_BG2 | WIN_BG3 | WIN_OBJ); + PA_SetWin0XY(screen, ((time*winfades[type][0])*255)>>8, + (time*winfades[type][1]), + (((time*winfades[type][2]) + 256)*255)>>8, + (time*winfades[type][3]) + 192); + if (time == 0) PA_DisableWin0(screen); +} + +/** @} */ // end of Window +////////////////////////////////////////////////////////////////////// + +#endif diff --git a/include/arm9/as_lib9.h b/include/arm9/as_lib9.h index bd55eac..3fc3d58 100644 --- a/include/arm9/as_lib9.h +++ b/include/arm9/as_lib9.h @@ -1,474 +1,474 @@ -/* - - Advanced Sound Library (ASlib) - ------------------------------ - - file : sound9.h - author : Lasorsa Yohan (Noda) - description : ARM9 sound functions - - history : - - 29/11/2007 - v1.0 - = Original release - - 21/12/2007 - v1.1 - = corrected arm7/arm9 initialization (fix M3S/R4 problems) - = fixed stereo detection problem (thanks to ThomasS) - - 27/03/2008 - v1.2 - = corrected bug with AS_SetMP3Loop, wasn't working correctly - = corrected bug with stereo panning for sounds when surround is off - TODO: allocate memory on main RAM - -*/ - -#ifndef __SOUND9_H__ -#define __SOUND9_H__ - -//---- ASlib options ------------------------------------------ -// uncomment the defines below to activate the desired option - -// use the EFSlib to stream mp3 files instead of libfat -//#define AS_USE_EFS - -// use expanded stereo panning separation in surround mode, but decrease volume -//#define AS_USE_EXPANDED_SURROUND_STEREO - -//----------------------------------------------------------- - -// Replaced // with /// -#include -#include -#include "../PA_Transfer.h" - -#ifndef AS_USE_EFS -#include -#else -#include "efs_lib.h" -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - -// mp3 static defines -#define MAX_NGRAN 2 // max granules -#define MAX_NCHAN 2 // max channels -#define MAX_NSAMP 576 // max samples per channel, per granule - -// buffer sizes, should fit any usage (feel free to adjust if needed) -#define AS_AUDIOBUFFER_SIZE 8 * MAX_NCHAN * MAX_NGRAN * MAX_NSAMP // audio buffer size -#define AS_FILEBUFFER_SIZE 8 * 1024 // file buffer size - -// locate the IPC structure after the libnds one -#define IPC_Sound ((IPC_SoundSystem*)((u32)(PA_Transfer) + sizeof(PA_TransferRegion))) // the second - -// file access functions -#define MP3FILE FILE -#define FILE_CLOSE(f) fclose(f) -#define FILE_OPEN(f) fopen(f, "rb") -#define FILE_READ(buf, size, num, f) fread(buf, size, num, f) -#define FILE_SEEK(f, pos, off) fseek(f, pos, off) -#define FILE_TELL(f) ftell(f) - - -// set up the surround stereo panning mode -#ifdef AS_USE_EXPANDED_SURROUND_STEREO - -#define AS_BASE_VOLUME 64 -#define AS_VOL_NORMALIZE 65 -#define AS_PANNING_SHIFT 0 - -#else - -#define AS_BASE_VOLUME 96 -#define AS_VOL_NORMALIZE 97 -#define AS_PANNING_SHIFT 1 - -#endif - -// -/** @addtogroup ASlib ASlib functions - * Functions to play RAW sounds and *shrug* MP3s. - * @{ - */ - -/// MP3 commands -typedef enum -{ - MP3CMD_ARM9ALLOCDONE = 256, - MP3CMD_NONE = 0, - MP3CMD_MIX = 1, - MP3CMD_MIXING = 2, - MP3CMD_WAITING = 4, - - /// Initialize - MP3CMD_INIT = 8, - /// Stop - MP3CMD_STOP = 16, - /// Play - MP3CMD_PLAY = 32, - /// Pause - MP3CMD_PAUSE = 64, - /// Set rate - MP3CMD_SETRATE = 128 - -} MP3Command; - -/// Sound commands -typedef enum -{ - SNDCMD_ARM7READY = 128, - SNDCMD_NONE = 0, - SNDCMD_DELAY = 1, - - /// Stop - SNDCMD_STOP = 2, - /// Play - SNDCMD_PLAY = 4, - /// Set volume - SNDCMD_SETVOLUME = 8, - /// Set pan - SNDCMD_SETPAN = 16, - /// Set rate - SNDCMD_SETRATE = 32, - /// Set master volume - SNDCMD_SETMASTERVOLUME = 64 - -} SoundCommand; - -/// MP3 states -typedef enum -{ - /// Stopped - MP3ST_STOPPED = 0, - /// Playing - MP3ST_PLAYING = 1, - /// Paused - MP3ST_PAUSED = 2, - /// Out of data - MP3ST_OUT_OF_DATA = 4, - /// Decoding error - MP3ST_DECODE_ERROR = 8, - /// Initialization failed - MP3ST_INITFAILED = 16, // - -} MP3Status; - -/// ASlib modes -typedef enum -{ - /// use mp3 - AS_MODE_MP3 = 1, - /// use surround - AS_MODE_SURROUND = 2, - /// use all DS channels - AS_MODE_16CH = 4, - /// use DS channels 1-8 only - AS_MODE_8CH = 8 - -} AS_MODE; - -/// Delay values -typedef enum -{ - /// 0 ms delay - AS_NO_DELAY = 0, - /// 16 ms delay - AS_SURROUND = 1, - /// 66 ms delay - AS_REVERB = 4, - -} AS_DELAY; - -/// Sound formats -typedef enum -{ - /// 8-bit PCM - AS_PCM_8BIT = 0, - /// 16-bit PCM - AS_PCM_16BIT = 1, - /// 4-bit ADPCM - AS_ADPCM = 2 - -} AS_SOUNDFORMAT; - -/// Sound info -typedef struct -{ - /// Pointer to data - u8 *data; - /// Size in bytes - u32 size; - /// Format (see AS_SOUNDFORMAT) - u8 format; - /// Rate in Hz - s32 rate; - /// Volume (0-127) - u8 volume; - /// Pan (0-64-127) - u8 pan; - /// Loop (0 or 1) - u8 loop; - /// Priority - u8 priority; - /// Delay - u8 delay; - -} SoundInfo; - -// sound info !![PAlib change] Word alignment!! -typedef struct -{ - u8 *data; - u32 size; - s32 rate; - u8 format; - u8 volume; - s8 pan; - u8 loop; - u8 priority; - u8 delay; - -} SoundInfoAlign; - -// sound channel info -typedef struct -{ - SoundInfoAlign snd; // !![PAlib change] Word alignment!! - u8 busy; - u8 reserved; - s8 volume; - s8 pan; - u8 cmd; - -} SoundChannel; - -// MP3 player info -typedef struct -{ - u8 *alloc_ram; - s8 *mixbuffer; - u32 buffersize; - s32 rate; - u32 state; - u32 soundcursor; - u32 numsamples; - s32 prevtimer; - u8 *mp3buffer; - u32 mp3buffersize; - u32 mp3filesize; - u32 cmd; - u8 channelL, channelR; - u8 loop; - u8 stream; - u8 needdata; - u8 delay; - -} MP3Player; - -// IPC structure for the sound system -typedef struct -{ - MP3Player mp3; - u8 surround; // !![PAlib change] Word alignment!! - u8 num_chan; // !![PAlib change] Word alignment!! - SoundChannel chan[16]; - u8 volume; -} IPC_SoundSystem; - -/// Easiest way to play a sound, using default settings -#define AS_SoundQuickPlay(name) AS_SoundDefaultPlay((u8*)name, (u32)name##_size, 127, 64, false, 0) - -/// Initialize ASlib -/// Returns true on success, false on failure. -bool AS_Init(u8 mode); - -/// Reserve a particular DS channel (so it won't be used for the sound pool) -static inline void AS_ReserveChannel(u8 channel); - -/// Set the master volume (0..127) -static inline void AS_SetMasterVolume(u8 volume); - -/// Set the default sound settings -static inline void AS_SetDefaultSettings(u8 format, s32 rate, u8 delay); - -/// Play a sound using the priority system. -/// Returns the sound channel allocated or -1 if the sound was skipped. -int AS_SoundPlay(SoundInfo sound); - -/// Play a sound using the priority system with the default settings. -/// Returns the sound channel allocated or -1 if the sound was skipped. -static inline int AS_SoundDefaultPlay(u8 *data, u32 size, u8 volume, u8 pan, u8 loop, u8 prio); - -/// Set the panning of a sound (0=left, 64=center, 127=right) -void AS_SetSoundPan(u8 chan, u8 pan); - -/// Set the volume of a sound (0..127) -void AS_SetSoundVolume(u8 chan, u8 volume); - -/// Set the sound sample rate -void AS_SetSoundRate(u8 chan, u32 rate); - -/// Stop playing a sound -static inline void AS_SoundStop(u8 chan); - -/// Play a sound directly using the given channel -void AS_SoundDirectPlay(u8 chan, SoundInfo sound); - -/// Play a MP3 directly from memory -void AS_MP3DirectPlay(u8 *buffer, u32 size); - -/// Play a MP3 stream -bool AS_MP3StreamPlay(const char *path); - -/// Pause a MP3 -static inline void AS_MP3Pause(); - -/// Unpause a MP3 -static inline void AS_MP3Unpause(); - -/// Stop a MP3 -void AS_MP3Stop(); - -/// Get the current MP3 status -static inline int AS_GetMP3Status(); - -/// Set the MP3 volume (0..127) -static inline void AS_SetMP3Volume(u8 volume); - -/// Set the MP3 panning (0=left, 64=center, 127=right) -void AS_SetMP3Pan(u8 pan); - -/// Set the default MP3 delay mode (warning: high values can cause glitches) -static inline void AS_SetMP3Delay(u8 delay); - -/// Set the MP3 loop mode (false = one shot, true = loop indefinitely) -static inline void AS_SetMP3Loop(u8 loop); - -/// Set the MP3 sample rate -static inline void AS_SetMP3Rate(s32 rate); - -/// Regenerate buffers for MP3 stream. -/// Must be called each VBlank (only needed if mp3 is used) -void AS_SoundVBL(); - - -//------------------------------------------------------------------------------- -// definition of inlined functions -//------------------------------------------------------------------------------- - -// variables defined in as_lib9.cpp -extern u8 as_default_format; -extern s32 as_default_rate; -extern u8 as_default_delay; - -// private functions, defined in as_lib9.cpp -bool AS_MP3FillBuffer(u8 *buffer, u32 bytes); - - -// reserve a particular DS channel (so it won't be used for the sound pool) -static inline void AS_ReserveChannel(u8 channel) -{ - IPC_Sound->chan[channel].reserved = true; -} - -// set the master volume (0..127) -static inline void AS_SetMasterVolume(u8 volume) -{ - IPC_Sound->volume = volume; - IPC_Sound->chan[0].cmd |= SNDCMD_SETMASTERVOLUME; -} - -// set the default sound settings -static inline void AS_SetDefaultSettings(u8 format, s32 rate, u8 delay) -{ - as_default_format = format; - as_default_rate = rate; - as_default_delay = delay; -} - -// play a sound using the priority system with the default settings -// return the sound channel allocated or -1 if the sound was skipped -static inline int AS_SoundDefaultPlay(u8 *data, u32 size, u8 volume, u8 pan, u8 loop, u8 prio) -{ - SoundInfo snd = { - data, - size, - as_default_format, - as_default_rate, - volume, - pan, - loop, - prio, - as_default_delay - }; - return AS_SoundPlay(snd); -} - -// stop playing a sound -static inline void AS_SoundStop(u8 chan) -{ - IPC_Sound->chan[chan].cmd = SNDCMD_STOP; - - if(IPC_Sound->surround) - IPC_Sound->chan[chan + IPC_Sound->num_chan].cmd = SNDCMD_STOP; -} - -// pause an mp3 -static inline void AS_MP3Pause() -{ - if(IPC_Sound->mp3.state & MP3ST_PLAYING) - IPC_Sound->mp3.cmd = MP3CMD_PAUSE; -} - -// unpause an mp3 -static inline void AS_MP3Unpause() -{ - if(IPC_Sound->mp3.state & MP3ST_PAUSED) - IPC_Sound->mp3.cmd = MP3CMD_PLAY; -} - -// get the current mp3 status -static inline int AS_GetMP3Status() -{ - return IPC_Sound->mp3.state; -} - -// set the mp3 volume (0..127) -static inline void AS_SetMP3Volume(u8 volume) -{ - IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.volume = volume * AS_BASE_VOLUME / 127; - AS_SetMP3Pan(IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan); -} - -// set the default mp3 delay mode (warning: high values can cause glitches) -static inline void AS_SetMP3Delay(u8 delay) -{ - IPC_Sound->mp3.delay = delay; -} - -// set the mp3 loop mode (false = one shot, true = loop indefinitely) -static inline void AS_SetMP3Loop(u8 loop) -{ - IPC_Sound->mp3.loop = loop; -} - -// set the mp3 sample rate -static inline void AS_SetMP3Rate(s32 rate) -{ - IPC_Sound->mp3.rate = rate; - IPC_Sound->mp3.cmd |= MP3CMD_SETRATE; -} - -/** @} */ // end of ASlib - - -#ifdef __cplusplus -} -#endif - -#endif - +/* + + Advanced Sound Library (ASlib) + ------------------------------ + + file : sound9.h + author : Lasorsa Yohan (Noda) + description : ARM9 sound functions + + history : + + 29/11/2007 - v1.0 + = Original release + + 21/12/2007 - v1.1 + = corrected arm7/arm9 initialization (fix M3S/R4 problems) + = fixed stereo detection problem (thanks to ThomasS) + + 27/03/2008 - v1.2 + = corrected bug with AS_SetMP3Loop, wasn't working correctly + = corrected bug with stereo panning for sounds when surround is off + TODO: allocate memory on main RAM + +*/ + +#ifndef __SOUND9_H__ +#define __SOUND9_H__ + +//---- ASlib options ------------------------------------------ +// uncomment the defines below to activate the desired option + +// use the EFSlib to stream mp3 files instead of libfat +//#define AS_USE_EFS + +// use expanded stereo panning separation in surround mode, but decrease volume +//#define AS_USE_EXPANDED_SURROUND_STEREO + +//----------------------------------------------------------- + +// Replaced // with /// +#include +#include +#include "../PA_Transfer.h" + +#ifndef AS_USE_EFS +#include +#else +#include "efs_lib.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +// mp3 static defines +#define MAX_NGRAN 2 // max granules +#define MAX_NCHAN 2 // max channels +#define MAX_NSAMP 576 // max samples per channel, per granule + +// buffer sizes, should fit any usage (feel free to adjust if needed) +#define AS_AUDIOBUFFER_SIZE 8 * MAX_NCHAN * MAX_NGRAN * MAX_NSAMP // audio buffer size +#define AS_FILEBUFFER_SIZE 8 * 1024 // file buffer size + +// locate the IPC structure after the libnds one +#define IPC_Sound ((IPC_SoundSystem*)((u32)(PA_Transfer) + sizeof(PA_TransferRegion))) // the second + +// file access functions +#define MP3FILE FILE +#define FILE_CLOSE(f) fclose(f) +#define FILE_OPEN(f) fopen(f, "rb") +#define FILE_READ(buf, size, num, f) fread(buf, size, num, f) +#define FILE_SEEK(f, pos, off) fseek(f, pos, off) +#define FILE_TELL(f) ftell(f) + + +// set up the surround stereo panning mode +#ifdef AS_USE_EXPANDED_SURROUND_STEREO + +#define AS_BASE_VOLUME 64 +#define AS_VOL_NORMALIZE 65 +#define AS_PANNING_SHIFT 0 + +#else + +#define AS_BASE_VOLUME 96 +#define AS_VOL_NORMALIZE 97 +#define AS_PANNING_SHIFT 1 + +#endif + +// +/** @addtogroup ASlib ASlib functions + * Functions to play RAW sounds and *shrug* MP3s. + * @{ + */ + +/// MP3 commands +typedef enum +{ + MP3CMD_ARM9ALLOCDONE = 256, + MP3CMD_NONE = 0, + MP3CMD_MIX = 1, + MP3CMD_MIXING = 2, + MP3CMD_WAITING = 4, + + /// Initialize + MP3CMD_INIT = 8, + /// Stop + MP3CMD_STOP = 16, + /// Play + MP3CMD_PLAY = 32, + /// Pause + MP3CMD_PAUSE = 64, + /// Set rate + MP3CMD_SETRATE = 128 + +} MP3Command; + +/// Sound commands +typedef enum +{ + SNDCMD_ARM7READY = 128, + SNDCMD_NONE = 0, + SNDCMD_DELAY = 1, + + /// Stop + SNDCMD_STOP = 2, + /// Play + SNDCMD_PLAY = 4, + /// Set volume + SNDCMD_SETVOLUME = 8, + /// Set pan + SNDCMD_SETPAN = 16, + /// Set rate + SNDCMD_SETRATE = 32, + /// Set master volume + SNDCMD_SETMASTERVOLUME = 64 + +} SoundCommand; + +/// MP3 states +typedef enum +{ + /// Stopped + MP3ST_STOPPED = 0, + /// Playing + MP3ST_PLAYING = 1, + /// Paused + MP3ST_PAUSED = 2, + /// Out of data + MP3ST_OUT_OF_DATA = 4, + /// Decoding error + MP3ST_DECODE_ERROR = 8, + /// Initialization failed + MP3ST_INITFAILED = 16, // + +} MP3Status; + +/// ASlib modes +typedef enum +{ + /// use mp3 + AS_MODE_MP3 = 1, + /// use surround + AS_MODE_SURROUND = 2, + /// use all DS channels + AS_MODE_16CH = 4, + /// use DS channels 1-8 only + AS_MODE_8CH = 8 + +} AS_MODE; + +/// Delay values +typedef enum +{ + /// 0 ms delay + AS_NO_DELAY = 0, + /// 16 ms delay + AS_SURROUND = 1, + /// 66 ms delay + AS_REVERB = 4, + +} AS_DELAY; + +/// Sound formats +typedef enum +{ + /// 8-bit PCM + AS_PCM_8BIT = 0, + /// 16-bit PCM + AS_PCM_16BIT = 1, + /// 4-bit ADPCM + AS_ADPCM = 2 + +} AS_SOUNDFORMAT; + +/// Sound info +typedef struct +{ + /// Pointer to data + u8 *data; + /// Size in bytes + u32 size; + /// Format (see AS_SOUNDFORMAT) + u8 format; + /// Rate in Hz + s32 rate; + /// Volume (0-127) + u8 volume; + /// Pan (0-64-127) + u8 pan; + /// Loop (0 or 1) + u8 loop; + /// Priority + u8 priority; + /// Delay + u8 delay; + +} SoundInfo; + +// sound info !![PAlib change] Word alignment!! +typedef struct +{ + u8 *data; + u32 size; + s32 rate; + u8 format; + u8 volume; + s8 pan; + u8 loop; + u8 priority; + u8 delay; + +} SoundInfoAlign; + +// sound channel info +typedef struct +{ + SoundInfoAlign snd; // !![PAlib change] Word alignment!! + u8 busy; + u8 reserved; + s8 volume; + s8 pan; + u8 cmd; + +} SoundChannel; + +// MP3 player info +typedef struct +{ + u8 *alloc_ram; + s8 *mixbuffer; + u32 buffersize; + s32 rate; + u32 state; + u32 soundcursor; + u32 numsamples; + s32 prevtimer; + u8 *mp3buffer; + u32 mp3buffersize; + u32 mp3filesize; + u32 cmd; + u8 channelL, channelR; + u8 loop; + u8 stream; + u8 needdata; + u8 delay; + +} MP3Player; + +// IPC structure for the sound system +typedef struct +{ + MP3Player mp3; + u8 surround; // !![PAlib change] Word alignment!! + u8 num_chan; // !![PAlib change] Word alignment!! + SoundChannel chan[16]; + u8 volume; +} IPC_SoundSystem; + +/// Easiest way to play a sound, using default settings +#define AS_SoundQuickPlay(name) AS_SoundDefaultPlay((u8*)name, (u32)name##_size, 127, 64, false, 0) + +/// Initialize ASlib +/// Returns true on success, false on failure. +bool AS_Init(u8 mode); + +/// Reserve a particular DS channel (so it won't be used for the sound pool) +static inline void AS_ReserveChannel(u8 channel); + +/// Set the master volume (0..127) +static inline void AS_SetMasterVolume(u8 volume); + +/// Set the default sound settings +static inline void AS_SetDefaultSettings(u8 format, s32 rate, u8 delay); + +/// Play a sound using the priority system. +/// Returns the sound channel allocated or -1 if the sound was skipped. +int AS_SoundPlay(SoundInfo sound); + +/// Play a sound using the priority system with the default settings. +/// Returns the sound channel allocated or -1 if the sound was skipped. +static inline int AS_SoundDefaultPlay(u8 *data, u32 size, u8 volume, u8 pan, u8 loop, u8 prio); + +/// Set the panning of a sound (0=left, 64=center, 127=right) +void AS_SetSoundPan(u8 chan, u8 pan); + +/// Set the volume of a sound (0..127) +void AS_SetSoundVolume(u8 chan, u8 volume); + +/// Set the sound sample rate +void AS_SetSoundRate(u8 chan, u32 rate); + +/// Stop playing a sound +static inline void AS_SoundStop(u8 chan); + +/// Play a sound directly using the given channel +void AS_SoundDirectPlay(u8 chan, SoundInfo sound); + +/// Play a MP3 directly from memory +void AS_MP3DirectPlay(u8 *buffer, u32 size); + +/// Play a MP3 stream +bool AS_MP3StreamPlay(const char *path); + +/// Pause a MP3 +static inline void AS_MP3Pause(); + +/// Unpause a MP3 +static inline void AS_MP3Unpause(); + +/// Stop a MP3 +void AS_MP3Stop(); + +/// Get the current MP3 status +static inline int AS_GetMP3Status(); + +/// Set the MP3 volume (0..127) +static inline void AS_SetMP3Volume(u8 volume); + +/// Set the MP3 panning (0=left, 64=center, 127=right) +void AS_SetMP3Pan(u8 pan); + +/// Set the default MP3 delay mode (warning: high values can cause glitches) +static inline void AS_SetMP3Delay(u8 delay); + +/// Set the MP3 loop mode (false = one shot, true = loop indefinitely) +static inline void AS_SetMP3Loop(u8 loop); + +/// Set the MP3 sample rate +static inline void AS_SetMP3Rate(s32 rate); + +/// Regenerate buffers for MP3 stream. +/// Must be called each VBlank (only needed if mp3 is used) +void AS_SoundVBL(); + + +//------------------------------------------------------------------------------- +// definition of inlined functions +//------------------------------------------------------------------------------- + +// variables defined in as_lib9.cpp +extern u8 as_default_format; +extern s32 as_default_rate; +extern u8 as_default_delay; + +// private functions, defined in as_lib9.cpp +bool AS_MP3FillBuffer(u8 *buffer, u32 bytes); + + +// reserve a particular DS channel (so it won't be used for the sound pool) +static inline void AS_ReserveChannel(u8 channel) +{ + IPC_Sound->chan[channel].reserved = true; +} + +// set the master volume (0..127) +static inline void AS_SetMasterVolume(u8 volume) +{ + IPC_Sound->volume = volume; + IPC_Sound->chan[0].cmd |= SNDCMD_SETMASTERVOLUME; +} + +// set the default sound settings +static inline void AS_SetDefaultSettings(u8 format, s32 rate, u8 delay) +{ + as_default_format = format; + as_default_rate = rate; + as_default_delay = delay; +} + +// play a sound using the priority system with the default settings +// return the sound channel allocated or -1 if the sound was skipped +static inline int AS_SoundDefaultPlay(u8 *data, u32 size, u8 volume, u8 pan, u8 loop, u8 prio) +{ + SoundInfo snd = { + data, + size, + as_default_format, + as_default_rate, + volume, + pan, + loop, + prio, + as_default_delay + }; + return AS_SoundPlay(snd); +} + +// stop playing a sound +static inline void AS_SoundStop(u8 chan) +{ + IPC_Sound->chan[chan].cmd = SNDCMD_STOP; + + if(IPC_Sound->surround) + IPC_Sound->chan[chan + IPC_Sound->num_chan].cmd = SNDCMD_STOP; +} + +// pause an mp3 +static inline void AS_MP3Pause() +{ + if(IPC_Sound->mp3.state & MP3ST_PLAYING) + IPC_Sound->mp3.cmd = MP3CMD_PAUSE; +} + +// unpause an mp3 +static inline void AS_MP3Unpause() +{ + if(IPC_Sound->mp3.state & MP3ST_PAUSED) + IPC_Sound->mp3.cmd = MP3CMD_PLAY; +} + +// get the current mp3 status +static inline int AS_GetMP3Status() +{ + return IPC_Sound->mp3.state; +} + +// set the mp3 volume (0..127) +static inline void AS_SetMP3Volume(u8 volume) +{ + IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.volume = volume * AS_BASE_VOLUME / 127; + AS_SetMP3Pan(IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan); +} + +// set the default mp3 delay mode (warning: high values can cause glitches) +static inline void AS_SetMP3Delay(u8 delay) +{ + IPC_Sound->mp3.delay = delay; +} + +// set the mp3 loop mode (false = one shot, true = loop indefinitely) +static inline void AS_SetMP3Loop(u8 loop) +{ + IPC_Sound->mp3.loop = loop; +} + +// set the mp3 sample rate +static inline void AS_SetMP3Rate(s32 rate) +{ + IPC_Sound->mp3.rate = rate; + IPC_Sound->mp3.cmd |= MP3CMD_SETRATE; +} + +/** @} */ // end of ASlib + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/include/arm9/cpp/PA_Application.h b/include/arm9/cpp/PA_Application.h index 1ae3ba3..6e74bde 100644 --- a/include/arm9/cpp/PA_Application.h +++ b/include/arm9/cpp/PA_Application.h @@ -1,46 +1,46 @@ -#pragma once - -///////////////////////////////////////////////////////////////// -// Simple application abstraction layer for PAlib C++ programs // -///////////////////////////////////////////////////////////////// - -/*! \file PA_Application.h - \brief Simple application abstraction layer for PAlib C++ programs -*/ - -namespace PA{ - /// Simple application abstraction layer for PAlib C++ programs - class Application{ - protected: - // Methods to be implemented by the user - - /// Initialization function - virtual void init(); - /// Update function - virtual bool update(); - /// Render function - virtual void render(); - /// Cleanup function (optional) - virtual void cleanup(){}; - - public: - /// Runs the application. - inline void run(){ - // Call the init function - init(); - - for(;;){ - // Render at each VBlank - PA_WaitForVBlank(); - render(); - - // Update the program - if(!update()) - break; - } - - // Call the cleanup function - cleanup(); - } - }; -}; +#pragma once + +///////////////////////////////////////////////////////////////// +// Simple application abstraction layer for PAlib C++ programs // +///////////////////////////////////////////////////////////////// + +/*! \file PA_Application.h + \brief Simple application abstraction layer for PAlib C++ programs +*/ + +namespace PA{ + /// Simple application abstraction layer for PAlib C++ programs + class Application{ + protected: + // Methods to be implemented by the user + + /// Initialization function + virtual void init(); + /// Update function + virtual bool update(); + /// Render function + virtual void render(); + /// Cleanup function (optional) + virtual void cleanup(){}; + + public: + /// Runs the application. + inline void run(){ + // Call the init function + init(); + + for(;;){ + // Render at each VBlank + PA_WaitForVBlank(); + render(); + + // Update the program + if(!update()) + break; + } + + // Call the cleanup function + cleanup(); + } + }; +}; diff --git a/include/arm9/cpp/PA_CppHeader.h b/include/arm9/cpp/PA_CppHeader.h index 8eb5d07..3ac1b90 100644 --- a/include/arm9/cpp/PA_CppHeader.h +++ b/include/arm9/cpp/PA_CppHeader.h @@ -1,18 +1,18 @@ -#pragma once - -/** @defgroup cxx C++ wrappers - * C++ wrappers for PAlib - * @{ - */ - -/// PAlib C++ namespace -namespace PA{}; - -#include "PA_Wrappers.h" - -#include "PA_FixedPointClass.h" - -#include "PA_Application.h" -#include "PA_SpriteClass.h" - -/** @} */ +#pragma once + +/** @defgroup cxx C++ wrappers + * C++ wrappers for PAlib + * @{ + */ + +/// PAlib C++ namespace +namespace PA{}; + +#include "PA_Wrappers.h" + +#include "PA_FixedPointClass.h" + +#include "PA_Application.h" +#include "PA_SpriteClass.h" + +/** @} */ diff --git a/include/arm9/cpp/PA_FixedPointClass.h b/include/arm9/cpp/PA_FixedPointClass.h index f0ed502..4f07e6f 100644 --- a/include/arm9/cpp/PA_FixedPointClass.h +++ b/include/arm9/cpp/PA_FixedPointClass.h @@ -1,274 +1,274 @@ -#pragma once - -////////////////////////////// -// Fixed point number class // -// - fincs // -////////////////////////////// - -#include - -// Simple fixed point macros -#define PA_FIXED_PRECISION 12 -#define PA_FIXED_ONE (1 << PA_FIXED_PRECISION) -#define PA_TOFIXED(a) ((a) << PA_FIXED_PRECISION) -#define PA_TOINTEGER(a) ((a) >> PA_FIXED_PRECISION) - -// Internal declaration macros -// NOTE: POD stands for Plain Old Data. - -#define _PA_FIXED_POD_OP(op) \ - inline Fixed operator op(int a) const{ return *this op Fixed(a); } \ - inline Fixed operator op(float a) const{ return *this op Fixed(a); } - -#define _PA_LOGICAL_POD_OP(op) \ - inline bool operator op(int a) const{ return *this op Fixed(a); } \ - inline bool operator op(float a) const{ return *this op Fixed(a); } - -#define _PA_FIXED_ASSIGN_POD_OP(op) \ - inline Fixed& operator op(int a){ *this op Fixed(a); return *this; } \ - inline Fixed& operator op(float a){ *this op Fixed(a); return *this; } - -#define _PA_INV_OP(op) \ - inline int operator op(int a, const Fixed& b){ return a op int(b); } \ - inline float operator op(float a, const Fixed& b){ return a op float(b); } - -#define _PA_INV_MUL_OP(op) \ - inline int operator op(int a, const Fixed& b){ return int(Fixed(a) op b); } \ - inline float operator op(float a, const Fixed& b){ return a op float(b); } - -#define _PA_INV_MOD_OP \ - inline int operator %(int a, const Fixed& b){ return int(Fixed(a) % b); } - -#define _PA_INV_ASSIGN_OP(op) \ - inline int& operator op(int& a, const Fixed& b){ return a op int(b); } \ - inline float& operator op(float& a, const Fixed& b){ return a op float(b); } - -#define _PA_INV_MULASSIGN_OP(op1,op2) \ - inline int& operator op1(int& a, const Fixed& b){ return a = int(Fixed(a) op2 b); } \ - inline float& operator op1(float& a, const Fixed& b){ return a op1 float(b); } - -#define _PA_INV_MODASSIGN_OP \ - inline int& operator %=(int& a, const Fixed& b){ return a = int(Fixed(a) % b); } - -#define _PA_INV_LOGICAL_OP(op) \ - inline bool operator op(int a, const Fixed& b){ return a op int(b); } \ - inline bool operator op(float a, const Fixed& b){ return a op float(b); } - -// Multiplication/division/modulo/square root macros - -#ifdef __thumb__ -// When compiling for THUMB: -// Use the supporting code for fixed point multiplications -#define PA_MULF32(a, b) PA_mulf32(a, b) -// Use the supporting code for fixed point divisions -#define PA_DIVF32(a, b) PA_divf32(a, b) -// Use the supporting code for integer divisions -#define PA_DIV32(a, b) div32(a, b) -// Use the supporting code for fixed point modulo -#define PA_MODF32(a, b) PA_modf32(a, b) -// Use the supporting code for fixed point square roots -#define PA_SQRTF32(a) PA_sqrtf32(a) -#else -// When compiling for ARM: -// Use an inline function that does the fixed point multiplication -static inline int PA_MULF32(int a, int b){ - long long result = (a * b) >> PA_FIXED_PRECISION; - return (int) result; -} -// Use the supporting code for fixed point divisions -#define PA_DIVF32(a, b) PA_divf32(a, b) -// Use the supporting code for integer divisions -#define PA_DIV32(a, b) div32(a, b) -// Use the supporting code for fixed point modulo -#define PA_MODF32(a, b) PA_modf32(a, b) -// Use the supporting code for fixed point square roots -#define PA_SQRTF32(a) PA_sqrtf32(a) -#endif - -/*! \file PA_FixedPointClass.h - \brief Contains a fixed point wrapper class. -*/ - -namespace PA{ - /// Fixed-point wrapper class. - class Fixed{ - int value; - - // Private constructors - inline Fixed(int dummy, int a){ value = a; } - - public: - /// Empty constructor. - inline Fixed() : value(0) { } - /// Copy constructor. - inline Fixed(const Fixed& a){ value = a.value; } - /// int constructor. - inline Fixed(int a){ value = PA_TOFIXED(a); } - /// float constructor. - inline Fixed(float a){ value = int(a * PA_FIXED_ONE); } - - /// int cast. - inline operator int() const{ return PA_TOINTEGER(value); } - /// float cast. - inline operator float() const{ return float(value) / PA_FIXED_ONE; } - /// bool cast. - inline operator bool() const{ return value != 0; } - /// char cast. - inline operator char() const{ return char(int(*this)); } - /// short cast. - inline operator short() const{ return short(int(*this)); } - /// long long cast. - inline operator long long() const{ return (long long)(int(*this)); } - - /// Assignment operator. - inline Fixed& operator =(const Fixed& a){ value = a.value; return *this; } _PA_FIXED_ASSIGN_POD_OP(=); - - // Arithmetic operators - /// Addition operator. int and float versions also available. - inline Fixed operator +(const Fixed& a) const{ return Fixed(0, value + a.value); } _PA_FIXED_POD_OP(+); - /// Subtraction operator. int and float versions also available. - inline Fixed operator -(const Fixed& a) const{ return Fixed(0, value - a.value); } _PA_FIXED_POD_OP(-); - /// Multiplication operator. int and float versions also available. - inline Fixed operator *(const Fixed& a) const{ return Fixed(0, PA_MULF32(value, a.value)); } - /// Division operator. int and float versions also available. - inline Fixed operator /(const Fixed& a) const{ return Fixed(0, PA_DIVF32(value, a.value)); } - /// Modulo operator. int and float versions also available. - inline Fixed operator %(const Fixed& a) const{ return Fixed(0, PA_MODF32(value, a.value)); } - - // Special POD versions of the multiplication and division operators - inline Fixed operator *(int a) const{ return Fixed(0, value * a); } - inline Fixed operator /(int a) const{ return Fixed(0, PA_DIV32(value, a)); } - inline Fixed operator %(int a) const{ return Fixed(0, PA_MODF32(value, PA_TOFIXED(a))); } - inline Fixed operator *(float a) const{ return *this * Fixed(a); } - inline Fixed operator /(float a) const{ return *this / Fixed(a);} - inline Fixed operator %(float a) const{ return *this % Fixed(a);} - - // Unary operators - /// Pre-increment operator. - inline Fixed operator ++(){ return Fixed(0, value += PA_FIXED_ONE); } - /// Pre-decrement operator. - inline Fixed operator --(){ return Fixed(0, value -= PA_FIXED_ONE); } - /// Post-increment operator. - inline Fixed operator ++(int){ return Fixed(0, value += PA_FIXED_ONE); } - /// Post-decrement operator. - inline Fixed operator --(int){ return Fixed(0, value -= PA_FIXED_ONE); } - /// Negation operator. - inline Fixed operator -() const{ return Fixed(0, -value); } - /// Binary negation operator. - inline Fixed operator ~() const{ return Fixed(0, ~value); } - - // Arithmetic assignement operators - /// Addition and assignment operator. int and float versions also available. - inline Fixed& operator +=(const Fixed& a){ value += a.value; return *this; } _PA_FIXED_ASSIGN_POD_OP(+=); - /// Subtraction and assignment operator. int and float versions also available. - inline Fixed& operator -=(const Fixed& a){ value -= a.value; return *this; } _PA_FIXED_ASSIGN_POD_OP(-=); - /// Multiplication and assignment operator. int and float versions also available. - inline Fixed& operator *=(const Fixed& a){ value = PA_MULF32(value, a.value); return *this; } _PA_FIXED_ASSIGN_POD_OP(*=); - /// Division and assignment operator. int and float versions also available. - inline Fixed& operator /=(const Fixed& a){ value = PA_DIVF32(value, a.value); return *this; } _PA_FIXED_ASSIGN_POD_OP(/=); - /// Modulo and assignment operator. int and float versions also available. - inline Fixed& operator %=(const Fixed& a){ value = PA_MODF32(value, a.value); return *this; } _PA_FIXED_ASSIGN_POD_OP(%=); - - // Comparison operators - /// Equals operator. int and float versions also available. - inline bool operator ==(const Fixed& a) const{ return value == a.value; } _PA_LOGICAL_POD_OP(==); - /// Not-equals operator. int and float versions also available. - inline bool operator !=(const Fixed& a) const{ return value != a.value; } _PA_LOGICAL_POD_OP(!=); - /// Less-or-equal operator. int and float versions also available. - inline bool operator <=(const Fixed& a) const{ return value <= a.value; } _PA_LOGICAL_POD_OP(<=); - /// Greater-or-equal operator. int and float versions also available. - inline bool operator >=(const Fixed& a) const{ return value >= a.value; } _PA_LOGICAL_POD_OP(>=); - /// Less-than operator. int and float versions also available. - inline bool operator <(const Fixed& a) const{ return value < a.value; } _PA_LOGICAL_POD_OP(<); - /// Greater-than operator. int and float versions also available. - inline bool operator >(const Fixed& a) const{ return value > a.value; } _PA_LOGICAL_POD_OP(>); - - // Shifting operators - /// Left shift operator. - inline Fixed operator <<(int a) const{ return Fixed(0, value << a); } - /// Right shift operator. - inline Fixed operator >>(int a) const{ return Fixed(0, value >> a); } - /// Left shift and assign operator. - inline Fixed& operator <<=(int a){ value <<= a; return *this; } - /// Right shift and assign operator. - inline Fixed& operator >>=(int a){ value >>= a; return *this; } - - // Binary operators - /// Binary AND operator, u32 version. - inline Fixed operator &(u32 a) const{ return Fixed(0, int(u32(value) & PA_TOFIXED(a))); } - /// Binary OR operator, u32 version. - inline Fixed operator |(u32 a) const{ return Fixed(0, int(u32(value) | PA_TOFIXED(a))); } - /// Binary XOR operator, u32 version. - inline Fixed operator ^(u32 a) const{ return Fixed(0, int(u32(value) ^ PA_TOFIXED(a))); } - /// Binary AND operator, Fixed version. - inline Fixed operator &(const Fixed& a) const{ return Fixed(0, int(u32(value) & u32(a.value))); } - /// Binary OR operator, Fixed version. - inline Fixed operator |(const Fixed& a) const{ return Fixed(0, int(u32(value) | u32(a.value))); } - /// Binary XOR operator, Fixed version. - inline Fixed operator ^(const Fixed& a) const{ return Fixed(0, int(u32(value) ^ u32(a.value))); } - - // Binary assignment operators - /// Binary AND assignment, u32 version. - inline Fixed& operator &=(u32 a){ value = int(u32(value) & PA_TOFIXED(a)); return *this; } - /// Binary OR assignment, u32 version. - inline Fixed& operator |=(u32 a){ value = int(u32(value) | PA_TOFIXED(a)); return *this; } - /// Binary XOR assignment, u32 version. - inline Fixed& operator ^=(u32 a){ value = int(u32(value) ^ PA_TOFIXED(a)); return *this; } - /// Binary AND assignment, Fixed version. - inline Fixed& operator &=(const Fixed& a){ value = int(u32(value) & u32(a.value)); return *this; } - /// Binary OR assignment, Fixed version. - inline Fixed& operator |=(const Fixed& a){ value = int(u32(value) | u32(a.value)); return *this; } - /// Binary XOR assignment, Fixed version. - inline Fixed& operator ^=(const Fixed& a){ value = int(u32(value) ^ u32(a.value)); return *this; } - - /// Gets the square root. - inline Fixed sqrt() const{ return Fixed(0, PA_SQRTF32(value)); } - /// Gets the absolute value. - inline Fixed abs() const{ return Fixed(0, (value < 0) ? (-value) : value); } - /// Gets the raw Q12 fixed point number. - inline int raw() const{ return value; } - /// Creates a Fixed object using a raw Q12 fixed point number. - static inline Fixed r2f(int a){ return Fixed(0, a); } - }; - - // Inverse operators - _PA_INV_OP(+); - _PA_INV_OP(-); - _PA_INV_MUL_OP(*); - _PA_INV_MUL_OP(/); - _PA_INV_MOD_OP; - _PA_INV_ASSIGN_OP(+=); - _PA_INV_ASSIGN_OP(-=); - _PA_INV_MULASSIGN_OP(*=,*); - _PA_INV_MULASSIGN_OP(/=,/); - _PA_INV_MODASSIGN_OP; - _PA_INV_LOGICAL_OP(==); - _PA_INV_LOGICAL_OP(!=); - _PA_INV_LOGICAL_OP(<=); - _PA_INV_LOGICAL_OP(>=); - _PA_INV_LOGICAL_OP(<); - _PA_INV_LOGICAL_OP(>); - - /// Fixed-point point class - class Point{ - public: - /// X value. - Fixed x; - /// Y value. - Fixed y; - /// Convert the object to a PA_Point structure. - inline operator PA_Point() const{ PA_Point a = {x, y}; return a; } - }; -}; - -// Undefine internal macros -#undef _PA_FIXED_POD_OP -#undef _PA_LOGICAL_POD_OP -#undef _PA_FIXED_ASSIGN_POD_OP -#undef _PA_INV_OP -#undef _PA_INV_MUL_OP -#undef _PA_INV_MOD_OP -#undef _PA_INV_ASSIGN_OP -#undef _PA_INV_MULASSIGN_OP -#undef _PA_INV_MODASSIGN_OP -#undef _PA_INV_LOGICAL_OP +#pragma once + +////////////////////////////// +// Fixed point number class // +// - fincs // +////////////////////////////// + +#include + +// Simple fixed point macros +#define PA_FIXED_PRECISION 12 +#define PA_FIXED_ONE (1 << PA_FIXED_PRECISION) +#define PA_TOFIXED(a) ((a) << PA_FIXED_PRECISION) +#define PA_TOINTEGER(a) ((a) >> PA_FIXED_PRECISION) + +// Internal declaration macros +// NOTE: POD stands for Plain Old Data. + +#define _PA_FIXED_POD_OP(op) \ + inline Fixed operator op(int a) const{ return *this op Fixed(a); } \ + inline Fixed operator op(float a) const{ return *this op Fixed(a); } + +#define _PA_LOGICAL_POD_OP(op) \ + inline bool operator op(int a) const{ return *this op Fixed(a); } \ + inline bool operator op(float a) const{ return *this op Fixed(a); } + +#define _PA_FIXED_ASSIGN_POD_OP(op) \ + inline Fixed& operator op(int a){ *this op Fixed(a); return *this; } \ + inline Fixed& operator op(float a){ *this op Fixed(a); return *this; } + +#define _PA_INV_OP(op) \ + inline int operator op(int a, const Fixed& b){ return a op int(b); } \ + inline float operator op(float a, const Fixed& b){ return a op float(b); } + +#define _PA_INV_MUL_OP(op) \ + inline int operator op(int a, const Fixed& b){ return int(Fixed(a) op b); } \ + inline float operator op(float a, const Fixed& b){ return a op float(b); } + +#define _PA_INV_MOD_OP \ + inline int operator %(int a, const Fixed& b){ return int(Fixed(a) % b); } + +#define _PA_INV_ASSIGN_OP(op) \ + inline int& operator op(int& a, const Fixed& b){ return a op int(b); } \ + inline float& operator op(float& a, const Fixed& b){ return a op float(b); } + +#define _PA_INV_MULASSIGN_OP(op1,op2) \ + inline int& operator op1(int& a, const Fixed& b){ return a = int(Fixed(a) op2 b); } \ + inline float& operator op1(float& a, const Fixed& b){ return a op1 float(b); } + +#define _PA_INV_MODASSIGN_OP \ + inline int& operator %=(int& a, const Fixed& b){ return a = int(Fixed(a) % b); } + +#define _PA_INV_LOGICAL_OP(op) \ + inline bool operator op(int a, const Fixed& b){ return a op int(b); } \ + inline bool operator op(float a, const Fixed& b){ return a op float(b); } + +// Multiplication/division/modulo/square root macros + +#ifdef __thumb__ +// When compiling for THUMB: +// Use the supporting code for fixed point multiplications +#define PA_MULF32(a, b) PA_mulf32(a, b) +// Use the supporting code for fixed point divisions +#define PA_DIVF32(a, b) PA_divf32(a, b) +// Use the supporting code for integer divisions +#define PA_DIV32(a, b) div32(a, b) +// Use the supporting code for fixed point modulo +#define PA_MODF32(a, b) PA_modf32(a, b) +// Use the supporting code for fixed point square roots +#define PA_SQRTF32(a) PA_sqrtf32(a) +#else +// When compiling for ARM: +// Use an inline function that does the fixed point multiplication +static inline int PA_MULF32(int a, int b){ + long long result = (a * b) >> PA_FIXED_PRECISION; + return (int) result; +} +// Use the supporting code for fixed point divisions +#define PA_DIVF32(a, b) PA_divf32(a, b) +// Use the supporting code for integer divisions +#define PA_DIV32(a, b) div32(a, b) +// Use the supporting code for fixed point modulo +#define PA_MODF32(a, b) PA_modf32(a, b) +// Use the supporting code for fixed point square roots +#define PA_SQRTF32(a) PA_sqrtf32(a) +#endif + +/*! \file PA_FixedPointClass.h + \brief Contains a fixed point wrapper class. +*/ + +namespace PA{ + /// Fixed-point wrapper class. + class Fixed{ + int value; + + // Private constructors + inline Fixed(int dummy, int a){ value = a; } + + public: + /// Empty constructor. + inline Fixed() : value(0) { } + /// Copy constructor. + inline Fixed(const Fixed& a){ value = a.value; } + /// int constructor. + inline Fixed(int a){ value = PA_TOFIXED(a); } + /// float constructor. + inline Fixed(float a){ value = int(a * PA_FIXED_ONE); } + + /// int cast. + inline operator int() const{ return PA_TOINTEGER(value); } + /// float cast. + inline operator float() const{ return float(value) / PA_FIXED_ONE; } + /// bool cast. + inline operator bool() const{ return value != 0; } + /// char cast. + inline operator char() const{ return char(int(*this)); } + /// short cast. + inline operator short() const{ return short(int(*this)); } + /// long long cast. + inline operator long long() const{ return (long long)(int(*this)); } + + /// Assignment operator. + inline Fixed& operator =(const Fixed& a){ value = a.value; return *this; } _PA_FIXED_ASSIGN_POD_OP(=); + + // Arithmetic operators + /// Addition operator. int and float versions also available. + inline Fixed operator +(const Fixed& a) const{ return Fixed(0, value + a.value); } _PA_FIXED_POD_OP(+); + /// Subtraction operator. int and float versions also available. + inline Fixed operator -(const Fixed& a) const{ return Fixed(0, value - a.value); } _PA_FIXED_POD_OP(-); + /// Multiplication operator. int and float versions also available. + inline Fixed operator *(const Fixed& a) const{ return Fixed(0, PA_MULF32(value, a.value)); } + /// Division operator. int and float versions also available. + inline Fixed operator /(const Fixed& a) const{ return Fixed(0, PA_DIVF32(value, a.value)); } + /// Modulo operator. int and float versions also available. + inline Fixed operator %(const Fixed& a) const{ return Fixed(0, PA_MODF32(value, a.value)); } + + // Special POD versions of the multiplication and division operators + inline Fixed operator *(int a) const{ return Fixed(0, value * a); } + inline Fixed operator /(int a) const{ return Fixed(0, PA_DIV32(value, a)); } + inline Fixed operator %(int a) const{ return Fixed(0, PA_MODF32(value, PA_TOFIXED(a))); } + inline Fixed operator *(float a) const{ return *this * Fixed(a); } + inline Fixed operator /(float a) const{ return *this / Fixed(a);} + inline Fixed operator %(float a) const{ return *this % Fixed(a);} + + // Unary operators + /// Pre-increment operator. + inline Fixed operator ++(){ return Fixed(0, value += PA_FIXED_ONE); } + /// Pre-decrement operator. + inline Fixed operator --(){ return Fixed(0, value -= PA_FIXED_ONE); } + /// Post-increment operator. + inline Fixed operator ++(int){ return Fixed(0, value += PA_FIXED_ONE); } + /// Post-decrement operator. + inline Fixed operator --(int){ return Fixed(0, value -= PA_FIXED_ONE); } + /// Negation operator. + inline Fixed operator -() const{ return Fixed(0, -value); } + /// Binary negation operator. + inline Fixed operator ~() const{ return Fixed(0, ~value); } + + // Arithmetic assignement operators + /// Addition and assignment operator. int and float versions also available. + inline Fixed& operator +=(const Fixed& a){ value += a.value; return *this; } _PA_FIXED_ASSIGN_POD_OP(+=); + /// Subtraction and assignment operator. int and float versions also available. + inline Fixed& operator -=(const Fixed& a){ value -= a.value; return *this; } _PA_FIXED_ASSIGN_POD_OP(-=); + /// Multiplication and assignment operator. int and float versions also available. + inline Fixed& operator *=(const Fixed& a){ value = PA_MULF32(value, a.value); return *this; } _PA_FIXED_ASSIGN_POD_OP(*=); + /// Division and assignment operator. int and float versions also available. + inline Fixed& operator /=(const Fixed& a){ value = PA_DIVF32(value, a.value); return *this; } _PA_FIXED_ASSIGN_POD_OP(/=); + /// Modulo and assignment operator. int and float versions also available. + inline Fixed& operator %=(const Fixed& a){ value = PA_MODF32(value, a.value); return *this; } _PA_FIXED_ASSIGN_POD_OP(%=); + + // Comparison operators + /// Equals operator. int and float versions also available. + inline bool operator ==(const Fixed& a) const{ return value == a.value; } _PA_LOGICAL_POD_OP(==); + /// Not-equals operator. int and float versions also available. + inline bool operator !=(const Fixed& a) const{ return value != a.value; } _PA_LOGICAL_POD_OP(!=); + /// Less-or-equal operator. int and float versions also available. + inline bool operator <=(const Fixed& a) const{ return value <= a.value; } _PA_LOGICAL_POD_OP(<=); + /// Greater-or-equal operator. int and float versions also available. + inline bool operator >=(const Fixed& a) const{ return value >= a.value; } _PA_LOGICAL_POD_OP(>=); + /// Less-than operator. int and float versions also available. + inline bool operator <(const Fixed& a) const{ return value < a.value; } _PA_LOGICAL_POD_OP(<); + /// Greater-than operator. int and float versions also available. + inline bool operator >(const Fixed& a) const{ return value > a.value; } _PA_LOGICAL_POD_OP(>); + + // Shifting operators + /// Left shift operator. + inline Fixed operator <<(int a) const{ return Fixed(0, value << a); } + /// Right shift operator. + inline Fixed operator >>(int a) const{ return Fixed(0, value >> a); } + /// Left shift and assign operator. + inline Fixed& operator <<=(int a){ value <<= a; return *this; } + /// Right shift and assign operator. + inline Fixed& operator >>=(int a){ value >>= a; return *this; } + + // Binary operators + /// Binary AND operator, u32 version. + inline Fixed operator &(u32 a) const{ return Fixed(0, int(u32(value) & PA_TOFIXED(a))); } + /// Binary OR operator, u32 version. + inline Fixed operator |(u32 a) const{ return Fixed(0, int(u32(value) | PA_TOFIXED(a))); } + /// Binary XOR operator, u32 version. + inline Fixed operator ^(u32 a) const{ return Fixed(0, int(u32(value) ^ PA_TOFIXED(a))); } + /// Binary AND operator, Fixed version. + inline Fixed operator &(const Fixed& a) const{ return Fixed(0, int(u32(value) & u32(a.value))); } + /// Binary OR operator, Fixed version. + inline Fixed operator |(const Fixed& a) const{ return Fixed(0, int(u32(value) | u32(a.value))); } + /// Binary XOR operator, Fixed version. + inline Fixed operator ^(const Fixed& a) const{ return Fixed(0, int(u32(value) ^ u32(a.value))); } + + // Binary assignment operators + /// Binary AND assignment, u32 version. + inline Fixed& operator &=(u32 a){ value = int(u32(value) & PA_TOFIXED(a)); return *this; } + /// Binary OR assignment, u32 version. + inline Fixed& operator |=(u32 a){ value = int(u32(value) | PA_TOFIXED(a)); return *this; } + /// Binary XOR assignment, u32 version. + inline Fixed& operator ^=(u32 a){ value = int(u32(value) ^ PA_TOFIXED(a)); return *this; } + /// Binary AND assignment, Fixed version. + inline Fixed& operator &=(const Fixed& a){ value = int(u32(value) & u32(a.value)); return *this; } + /// Binary OR assignment, Fixed version. + inline Fixed& operator |=(const Fixed& a){ value = int(u32(value) | u32(a.value)); return *this; } + /// Binary XOR assignment, Fixed version. + inline Fixed& operator ^=(const Fixed& a){ value = int(u32(value) ^ u32(a.value)); return *this; } + + /// Gets the square root. + inline Fixed sqrt() const{ return Fixed(0, PA_SQRTF32(value)); } + /// Gets the absolute value. + inline Fixed abs() const{ return Fixed(0, (value < 0) ? (-value) : value); } + /// Gets the raw Q12 fixed point number. + inline int raw() const{ return value; } + /// Creates a Fixed object using a raw Q12 fixed point number. + static inline Fixed r2f(int a){ return Fixed(0, a); } + }; + + // Inverse operators + _PA_INV_OP(+); + _PA_INV_OP(-); + _PA_INV_MUL_OP(*); + _PA_INV_MUL_OP(/); + _PA_INV_MOD_OP; + _PA_INV_ASSIGN_OP(+=); + _PA_INV_ASSIGN_OP(-=); + _PA_INV_MULASSIGN_OP(*=,*); + _PA_INV_MULASSIGN_OP(/=,/); + _PA_INV_MODASSIGN_OP; + _PA_INV_LOGICAL_OP(==); + _PA_INV_LOGICAL_OP(!=); + _PA_INV_LOGICAL_OP(<=); + _PA_INV_LOGICAL_OP(>=); + _PA_INV_LOGICAL_OP(<); + _PA_INV_LOGICAL_OP(>); + + /// Fixed-point point class + class Point{ + public: + /// X value. + Fixed x; + /// Y value. + Fixed y; + /// Convert the object to a PA_Point structure. + inline operator PA_Point() const{ PA_Point a = {x, y}; return a; } + }; +}; + +// Undefine internal macros +#undef _PA_FIXED_POD_OP +#undef _PA_LOGICAL_POD_OP +#undef _PA_FIXED_ASSIGN_POD_OP +#undef _PA_INV_OP +#undef _PA_INV_MUL_OP +#undef _PA_INV_MOD_OP +#undef _PA_INV_ASSIGN_OP +#undef _PA_INV_MULASSIGN_OP +#undef _PA_INV_MODASSIGN_OP +#undef _PA_INV_LOGICAL_OP diff --git a/include/arm9/cpp/PA_SpriteClass.h b/include/arm9/cpp/PA_SpriteClass.h index 1860f07..79281a1 100644 --- a/include/arm9/cpp/PA_SpriteClass.h +++ b/include/arm9/cpp/PA_SpriteClass.h @@ -1,139 +1,139 @@ -#pragma once - -///////////////////////////////////// -// Simple sprite abstraction class // -///////////////////////////////////// - -namespace PA{ - /// Wrapper class for sprites. - class Sprite{ - public: - // Variables - int screen, sprid, rotsetid; - Point pos; - - /// Empty constructor - inline Sprite() : screen(0), sprid(0), rotsetid(0){ move(0, 0); } - - /// Normal constructor - inline Sprite(int scr, int sprn) : screen(scr), sprid(sprn), rotsetid(0){ move(0, 0); } - - /// Initialize function. - inline void init(int scr, int sprn){ - screen = scr; - sprid = sprn; - rotsetid = 0; - } - - /// Create sprite. - inline void create(void* gfx, int shape, int size, int paln){ - PA_CreateSprite(screen, sprid, gfx, shape, size, 1, paln, pos.x, pos.y); - } - - /// Create sprite from existing GFX. - inline void create(u16 gfx, int shape, int size, int paln){ - PA_CreateSpriteFromGfx(screen, sprid, gfx, shape, size, 1, paln, pos.x, pos.y); - } - - /// Delete sprite. - inline void remove(){ - PA_DeleteSprite(screen, sprid); - } - - /// Set palette. - inline void setpalette(int paln){ - PA_SetSpritePal(screen, sprid, paln); - } - - /// Set GFX. - inline void setgfx(int gfxn){ - PA_SetSpriteGfx(screen, sprid, gfxn); - } - - /// Render (more like update position). - inline void render(){ - PA_SetSpriteXY(screen, sprid, pos.x, pos.y); - } - - /// Move (fixed point version). - inline void move(const Fixed& x, const Fixed& y){ - pos.x = x, pos.y = y; - } - - /// Move (integer version). - inline void move(int x, int y){ - pos.x = x, pos.y = y; - } - - /// Set HFlip. - inline void hflip(bool flip){ - PA_SetSpriteHflip(screen, sprid, flip != false); - } - - /// Set VFlip. - inline void vflip(bool flip){ - PA_SetSpriteVflip(screen, sprid, flip != false); - } - - /// Set doublesize. - inline void dblsize(bool dblsize){ - PA_SetSpriteDblsize(screen, sprid, dblsize != false); - } - - /// Set priority. - inline void priority(int prio){ - PA_SetSpritePrio(screen, sprid, prio); - } - - /// Bind rotset. - inline void bindrotset(int rotset){ - rotsetid = rotset; - PA_SetSpriteRotEnable(screen, sprid, rotset); - } - - /// Debind rotset. - inline void debindrotset(){ - PA_SetSpriteRotDisable(screen, sprid); - } - - /// Rotate. - inline void rotate(int angle){ - PA_SetRotsetNoZoom(screen, rotsetid, angle); - } - - /// Zoom. - inline void zoom(int zx, int zy){ - PA_SetRotsetNoAngle(screen, rotsetid, zx, zy); - } - - /// Rotate and zoom. - inline void rotozoom(int angle, int zx, int zy){ - PA_SetRotset(screen, rotsetid, angle, zx, zy); - } - - /// Set frame. - inline void frame(int frame){ - PA_SetSpriteAnimFrame(screen, sprid, frame); - } - - /// Start animation. - inline void startanim(int begin, int end, int speed, int animtype = ANIM_LOOP, int ncycles = -1){ - PA_StartSpriteAnimEx(screen, sprid, begin, end, speed, animtype, ncycles); - } - - /// Pause animation. - inline void pauseanim(bool pause = true){ - PA_SpriteAnimPause(screen, sprid, pause != false); - } - - /// Stop animation. - inline void stopanim(){ - PA_StopSpriteAnim(screen, sprid); - } - - /// Set animation speed. - inline void animspeed(int speed){ - PA_SetSpriteAnimSpeed(screen, sprid, speed); - } - }; -}; +#pragma once + +///////////////////////////////////// +// Simple sprite abstraction class // +///////////////////////////////////// + +namespace PA{ + /// Wrapper class for sprites. + class Sprite{ + public: + // Variables + int screen, sprid, rotsetid; + Point pos; + + /// Empty constructor + inline Sprite() : screen(0), sprid(0), rotsetid(0){ move(0, 0); } + + /// Normal constructor + inline Sprite(int scr, int sprn) : screen(scr), sprid(sprn), rotsetid(0){ move(0, 0); } + + /// Initialize function. + inline void init(int scr, int sprn){ + screen = scr; + sprid = sprn; + rotsetid = 0; + } + + /// Create sprite. + inline void create(void* gfx, int shape, int size, int paln){ + PA_CreateSprite(screen, sprid, gfx, shape, size, 1, paln, pos.x, pos.y); + } + + /// Create sprite from existing GFX. + inline void create(u16 gfx, int shape, int size, int paln){ + PA_CreateSpriteFromGfx(screen, sprid, gfx, shape, size, 1, paln, pos.x, pos.y); + } + + /// Delete sprite. + inline void remove(){ + PA_DeleteSprite(screen, sprid); + } + + /// Set palette. + inline void setpalette(int paln){ + PA_SetSpritePal(screen, sprid, paln); + } + + /// Set GFX. + inline void setgfx(int gfxn){ + PA_SetSpriteGfx(screen, sprid, gfxn); + } + + /// Render (more like update position). + inline void render(){ + PA_SetSpriteXY(screen, sprid, pos.x, pos.y); + } + + /// Move (fixed point version). + inline void move(const Fixed& x, const Fixed& y){ + pos.x = x, pos.y = y; + } + + /// Move (integer version). + inline void move(int x, int y){ + pos.x = x, pos.y = y; + } + + /// Set HFlip. + inline void hflip(bool flip){ + PA_SetSpriteHflip(screen, sprid, flip != false); + } + + /// Set VFlip. + inline void vflip(bool flip){ + PA_SetSpriteVflip(screen, sprid, flip != false); + } + + /// Set doublesize. + inline void dblsize(bool dblsize){ + PA_SetSpriteDblsize(screen, sprid, dblsize != false); + } + + /// Set priority. + inline void priority(int prio){ + PA_SetSpritePrio(screen, sprid, prio); + } + + /// Bind rotset. + inline void bindrotset(int rotset){ + rotsetid = rotset; + PA_SetSpriteRotEnable(screen, sprid, rotset); + } + + /// Debind rotset. + inline void debindrotset(){ + PA_SetSpriteRotDisable(screen, sprid); + } + + /// Rotate. + inline void rotate(int angle){ + PA_SetRotsetNoZoom(screen, rotsetid, angle); + } + + /// Zoom. + inline void zoom(int zx, int zy){ + PA_SetRotsetNoAngle(screen, rotsetid, zx, zy); + } + + /// Rotate and zoom. + inline void rotozoom(int angle, int zx, int zy){ + PA_SetRotset(screen, rotsetid, angle, zx, zy); + } + + /// Set frame. + inline void frame(int frame){ + PA_SetSpriteAnimFrame(screen, sprid, frame); + } + + /// Start animation. + inline void startanim(int begin, int end, int speed, int animtype = ANIM_LOOP, int ncycles = -1){ + PA_StartSpriteAnimEx(screen, sprid, begin, end, speed, animtype, ncycles); + } + + /// Pause animation. + inline void pauseanim(bool pause = true){ + PA_SpriteAnimPause(screen, sprid, pause != false); + } + + /// Stop animation. + inline void stopanim(){ + PA_StopSpriteAnim(screen, sprid); + } + + /// Set animation speed. + inline void animspeed(int speed){ + PA_SetSpriteAnimSpeed(screen, sprid, speed); + } + }; +}; diff --git a/include/arm9/cpp/PA_Wrappers.h b/include/arm9/cpp/PA_Wrappers.h index 6bcc866..e01d609 100644 --- a/include/arm9/cpp/PA_Wrappers.h +++ b/include/arm9/cpp/PA_Wrappers.h @@ -1,63 +1,63 @@ -// C++ wrappers for some PAlib functionality - -#pragma once - -/*! \file PA_Wrappers.h - \brief Simple C++ wrappers -*/ - -/*! \addtogroup cxx - @{ -*/ - -// Replacements for new and delete because the standard ones use exceptions. - -/// Lightweight new operator -inline void* operator new(size_t size){ - return malloc(size); -} - -/// Lightweight new operator -inline void* operator new[](size_t size){ - return malloc(size); -} - -/// Lightweight delete operator -inline void operator delete(void* p){ - free(p); -} - -/// Lightweight delete operator -inline void operator delete[](void* p){ - free(p); -} - -namespace PA{ - /// Handle provider, use it to get dynamic sprite numbers for example - template - class HandleProvider{ - int stack[NHANDLES]; - int sp; - public: - /// Constructor. - inline HandleProvider(){ - for(int i = 0; i < NHANDLES; i ++) - stack[i] = i; - sp = NHANDLES; - } - - /// Get a new handle. - inline int newhandle(){ - PA_Assert((sp - 1) >= 0, "Out of free handles"); - return stack[--sp]; - } - - /// Delete a handle. - inline void deletehandle(int handle){ - stack[sp++] = handle; - PA_Assert(sp <= NHANDLES, "Too many handles"); - } - }; -}; - -/*! @} */ +// C++ wrappers for some PAlib functionality + +#pragma once + +/*! \file PA_Wrappers.h + \brief Simple C++ wrappers +*/ + +/*! \addtogroup cxx + @{ +*/ + +// Replacements for new and delete because the standard ones use exceptions. + +/// Lightweight new operator +inline void* operator new(size_t size){ + return malloc(size); +} + +/// Lightweight new operator +inline void* operator new[](size_t size){ + return malloc(size); +} + +/// Lightweight delete operator +inline void operator delete(void* p){ + free(p); +} + +/// Lightweight delete operator +inline void operator delete[](void* p){ + free(p); +} + +namespace PA{ + /// Handle provider, use it to get dynamic sprite numbers for example + template + class HandleProvider{ + int stack[NHANDLES]; + int sp; + public: + /// Constructor. + inline HandleProvider(){ + for(int i = 0; i < NHANDLES; i ++) + stack[i] = i; + sp = NHANDLES; + } + + /// Get a new handle. + inline int newhandle(){ + PA_Assert((sp - 1) >= 0, "Out of free handles"); + return stack[--sp]; + } + + /// Delete a handle. + inline void deletehandle(int handle){ + stack[sp++] = handle; + PA_Assert(sp <= NHANDLES, "Too many handles"); + } + }; +}; + +/*! @} */ diff --git a/include/arm9/jpeg.h b/include/arm9/jpeg.h index 4f234d5..6f7d4b3 100644 --- a/include/arm9/jpeg.h +++ b/include/arm9/jpeg.h @@ -1,482 +1,482 @@ -/* - * - * A JPEG decompressor, targeted for the GameBoy Advance (although there - * should be no machine-specific aspects if you disable JPEG_USE_IWRAM - * and JPEG_MARK_TIME). On the GBA it consumes, all with slight potential - * variance: - * - * 3348 bytes of IWRAM, temporary - * 7756 bytes of ROM - * 4720 bytes of stack space, usually in IWRAM - * 350 milliseconds for decompressing a representative image - * - * Unlike before when IWRAM was permanently used, it's now loaded in just - * before decompression, allowing you to spend IWRAM on more tools called - * constantly rather than one you call only once in awhile. There is no - * permanent IWRAM usage with this library. - * - * It has a low capacitance for unusual JPEGs. They cannot be progressive, - * use arithmetic coding, have more than 4 components in a scan, and must be - * 8-bit. They can be colour or grayscale, and any component scaling factors - * are valid (unless if JPEG_HANDLE_ANY_FACTORS is reset, in which case only - * 2:1:1 is allowed). The maximum component scale factors cannot be three. In - * general, you'll be all right, but if it doesn't like your input it will not - * react sensibly in embedded. - * - * This code is in the public domain. JPEG is used for both its standard - * meaning and for JFIF. - * - * Revision 1: Inflicted stricter warnings, fixed C99-using code, and reduced - * allocation footprint (6144 bytes less). - * Revision 2: Reduced ROM usage by 276 bytes, with the body going to 832 bytes - * of IWRAM. I made it more configurable, particularly in YCbCr->RGB - * conversion. Some brute force ROM usage reduction. - * Revision 3: Removed all memset, malloc, and free dependencies. This - * increases stack use drastically but also makes it completely - * self-sufficient. - * Revision 4: Saved 6176 bytes of JPEG_Decoder state by exploiting an - * allowance of baseline JPEG decoding. This requires 3088 more bytes of - * stack space, however. - * Revision 5: Made the fixed-point shift configurable. Can now be compiled - * with -ansi -pedantic, and fixed stack usage so that it is always - * predictable by exploiting a JPEG restriction. - * Revision 6: A fixed type has been added and is configurable. 16-bit - * fixed is valid if you reduce JPEG_FIXSHIFT to 4 or lower. - * Revision 7: Inserted assertions for when you're not on the embedded - * environment; good for confirming that a given file is compatible with - * the decompressor. "this" is no longer used as a variable name. Added - * necessary fluff for dealing with C++. - * - * - Burton Radons (loth@users.sourceforge.net) - */ - -#ifndef GBA_JPEG_DECODE_H -#define GBA_IMAGE_JPEG_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifndef JPEG_DEBUG -#define JPEG_DEBUG 0 - /**< Enable assertion checks for input. This is useful if you want to use - * the library in non-embedded environments, such as to confirm that a - * JPEG file will be compliant. - * - * Enabling this will define JPEG_Assert(TEST) if it's not predefined. - * The default prints some information on the error to stderr and then - * returns zero. - */ -#endif /* JPEG_DEBUG */ - -#ifndef JPEG_HANDLE_ANY_FACTORS -#define JPEG_HANDLE_ANY_FACTORS 1 - /**< If this is set, any component factors are valid. Otherwise - * it will only handle 2:1:1 (the typical form that sacrifices colour - * resolution). Note that Photoshop will only generate such files if you - * use Save for Web. Resetting this saves 508 bytes of IWRAM. - */ -#endif /* JPEG_HANDLE_ANY_FACTORS */ - -#ifndef JPEG_FASTER_M211 -#define JPEG_FASTER_M211 1 - /**< If this is set, then the most common JPEG format is not given - * special, faster treatment. You must set JPEG_HANDLE_ANY_FACTORS - * in this case, or you will not see anything. Resetting this saves - * 532 bytes of IWRAM, at the cost of speed. - */ -#endif /* JPEG_FASTER_M211 */ - -#ifndef JPEG_USE_IWRAM -#define JPEG_USE_IWRAM 0 - /**< If this is set, the JPEG decompressor will use IWRAM for huge - * benefits to decompression speed (249% faster than reset). Resetting - * this saves up to 3348 bytes of IWRAM, depending upon - * JPEG_HANDLE_ANY_FACTORS and JPEG_FASTER_M211. - */ -#endif /* JPEG_USE_IWRAM */ - -#define JPEG_DCTSIZE 8 - /**< The number of samples across and down a JPEG DCT. This cannot be - * configured, as the inverse DCT only handles 8x8. - */ - -#define JPEG_DCTSIZE2 (JPEG_DCTSIZE * JPEG_DCTSIZE) - /**< The number of samples in a full 2-D DCT. */ - -#ifndef JPEG_MAXIMUM_COMPONENTS -#define JPEG_MAXIMUM_COMPONENTS 4 - /**< The maximum number of components that can be involved in an image. - * Each value costs 8 bytes of stack space and 8 bytes of allocations. - */ -#endif /* JPEG_MAXIMUM_SCAN_COMPONENTS */ - -#ifndef JPEG_FIXSHIFT -#define JPEG_FIXSHIFT 8 - /**< The shift used for converting to and from fixed point. A higher value - * here (up to 10 for 32-bit) results in better quality; a lower value - * (down to 2) results in lesser quality. Lower values can be somewhat - * faster depending upon the hardware's clockings for multiplication. - */ -#endif /* JPEG_FIXSHIFT */ - -#ifndef JPEG_MAXIMUM_SCAN_COMPONENT_FACTORS -#define JPEG_MAXIMUM_SCAN_COMPONENT_FACTORS 10 - /**< The limit of the sum of the multiplied horizontal scaling factors in - * the components. For example, if Y is 1x1, Cb is 2x2, and Cr is 2x2, - * that comes out to (1 * 1 + 2 * 2 + 2 * 2), or 9. The limit here is - * what is specified in the standard (B.2.3). - */ -#endif /* JPEG_MAXIMUM_SCAN_COMPONENT_FACTORS */ - -#ifndef JPEG_FIXED_TYPE -#define JPEG_FIXED_TYPE long int - /**< The fixed data type. This requires a minimum size of - * JPEG_FIXSHIFT plus 12. - */ -#endif /* JPEG_FIXED_TYPE */ - -/* If this value is defined as 1, then it outputs to RGB in 32-bit words, with - * red in the first eight bits, green in the second eight bits, and blue in the - * third eight bits. - */ - -#if JPEG_OUTPUT_RGB8 - #define JPEG_OUTPUT_TYPE unsigned int - - #define JPEG_Convert_Limit(VALUE) ((VALUE) < 0 ? 0 : (VALUE) > 255 ? 255 : (VALUE)) - - #define JPEG_Convert(OUT, Y, Cb, Cr) \ - do { \ - int eY = (Y) + 63; \ - int R = ((eY) + ((Cr) * 359 >> 8)) * 2; \ - int G = ((eY) - ((Cb) * 88 >> 8) - ((Cr) * 183 >> 8)) * 2; \ - int B = ((eY) + ((Cb) * 454 >> 8)) * 2; \ - \ - R = JPEG_Convert_Limit (R); \ - G = JPEG_Convert_Limit (G) << 8; \ - B = JPEG_Convert_Limit (B) << 16; \ - (OUT) = R | G | B; \ - } while (0) - - #define JPEG_Convert_From(IN, Y, Cb, Cr) \ - do { \ - int R = IN & 255; \ - int G = (IN >> 8) & 255; \ - int B = (IN >> 16) & 255; \ - \ - Y = (((R * 66 >> 8) + (G * 129 >> 8) + (B * 25 >> 8)) >> 1) - 63; \ - Cb = ((R * -38 >> 8) + (G * -74 >> 8) + (B * 112 >> 8)) >> 1; \ - Cr = ((R * 112 >> 8) + (G * -94 >> 8) + (B * 18 >> 8)) >> 1; \ - } while (0) -#endif /* JPEG_OUTPUT_RGB8 */ - -#ifndef JPEG_OUTPUT_TYPE -#define JPEG_OUTPUT_TYPE unsigned short - /**< This is the data type that JPEG outputs to. The interpretation of - * this type is dependent upon JPEG_Convert. - */ -#endif /* JPEG_OUTPUT_TYPE */ - -#ifndef JPEG_Convert -/** Convert YCbCr values (each in the nominal range -64 to 63) to RGB and store - * in the output value (of type JPEG_OUTPUT_TYPE). By default this stores to - * 15-bit RGB. - */ - -#define JPEG_Convert(OUT, Y, Cb, Cr) \ - do { \ - int eY = (Y) + 63; \ - int R = (eY) + ((Cr) * 359 >> 8); \ - int G = (eY) - ((Cb) * 88 >> 8) - ((Cr) * 183 >> 8); \ - int B = (eY) + ((Cb) * 454 >> 8); \ - \ - R = ComponentRange [R >> 2]; \ - G = ComponentRange [G >> 2] << 5; \ - B = ComponentRange [B >> 2] << 10; \ - (OUT) = R | G | B | (1 << 15); \ - } while (0) - -#endif /* JPEG_Convert */ - -#ifndef JPEG_Assert - #if JPEG_DEBUG - #include - #include - #define JPEG_Assert(TEST) \ - do { \ - if (TEST) \ - break; \ - fprintf (stderr, __FILE__ "(%d): " #TEST "\n", __LINE__); \ - return 0; \ - } while (0) - #else - #define JPEG_Assert(TEST) do { } while (0) - #endif /* JPEG_DEBUG */ -#endif /* JPEG_Assert */ - -/** The markers that can appear in a JPEG stream. */ -enum JPEG_Marker -{ - JPEG_Marker_APP0 = 0xFFE0, /**< Reserved application segment 0. */ - JPEG_Marker_APP1 = 0xFFE1, /**< Reserved application segment 1. */ - JPEG_Marker_APP2 = 0xFFE2, /**< Reserved application segment 2. */ - JPEG_Marker_APP3 = 0xFFE3, /**< Reserved application segment 3. */ - JPEG_Marker_APP4 = 0xFFE4, /**< Reserved application segment 4. */ - JPEG_Marker_APP5 = 0xFFE5, /**< Reserved application segment 5. */ - JPEG_Marker_APP6 = 0xFFE6, /**< Reserved application segment 6. */ - JPEG_Marker_APP7 = 0xFFE7, /**< Reserved application segment 7. */ - JPEG_Marker_APP8 = 0xFFE8, /**< Reserved application segment 8. */ - JPEG_Marker_APP9 = 0xFFE9, /**< Reserved application segment 9. */ - JPEG_Marker_APP10 = 0xFFEA, /**< Reserved application segment 10. */ - JPEG_Marker_APP11 = 0xFFEB, /**< Reserved application segment 11. */ - JPEG_Marker_APP12 = 0xFFEC, /**< Reserved application segment 12. */ - JPEG_Marker_APP13 = 0xFFED, /**< Reserved application segment 13. */ - JPEG_Marker_APP14 = 0xFFEE, /**< Reserved application segment 14. */ - JPEG_Marker_APP15 = 0xFFEF, /**< Reserved application segment 15. */ - JPEG_Marker_COM = 0xFFFE, /**< Comment. */ - JPEG_Marker_DHT = 0xFFC4, /**< Define huffman table. */ - JPEG_Marker_DQT = 0xFFDB, /**< Define quantization table(s). */ - JPEG_Marker_DRI = 0xFFDD, /**< Define restart interval. */ - JPEG_Marker_EOI = 0xFFD9, /**< End of image. */ - JPEG_Marker_SOF0 = 0xFFC0, /**< Start of Frame, non-differential, Huffman coding, baseline DCT. */ - JPEG_Marker_SOI = 0xFFD8, /**< Start of image. */ - JPEG_Marker_SOS = 0xFFDA /**< Start of scan. */ -}; - -typedef enum JPEG_Marker JPEG_Marker; -typedef JPEG_FIXED_TYPE JPEG_QuantizationTable [JPEG_DCTSIZE2]; /**< Quantization table elements, in zigzag order, fixed. */ - -/** Compute the multiplication of two fixed-point values. */ -#define JPEG_FIXMUL(A, B) ((A) * (B) >> JPEG_FIXSHIFT) - -/** Convert a fixed-point value to an integer. */ -#define JPEG_FIXTOI(A) ((A) >> JPEG_FIXSHIFT) - -/** Convert an integer to a fixed-point value. */ -#define JPEG_ITOFIX(A) ((A) << JPEG_FIXSHIFT) - -/** Convert a floating-point value to fixed-point. */ -#define JPEG_FTOFIX(A) ((int) ((A) * JPEG_ITOFIX (1))) - -/** Convert a fixed-point value to floating-point. */ -#define JPEG_FIXTOF(A) ((A) / (float) JPEG_ITOFIX (1)) - -typedef struct JPEG_HuffmanTable JPEG_HuffmanTable; -typedef struct JPEG_Decoder JPEG_Decoder; -typedef struct JPEG_FrameHeader JPEG_FrameHeader; -typedef struct JPEG_FrameHeader_Component JPEG_FrameHeader_Component; -typedef struct JPEG_ScanHeader JPEG_ScanHeader; -typedef struct JPEG_ScanHeader_Component JPEG_ScanHeader_Component; - -/** A huffman table. */ -struct JPEG_HuffmanTable -{ - const unsigned char *huffval; /**< Pointer to values in the table (256 entries). */ - int maxcode [16]; /**< The maximum code for each length - 1. */ - const unsigned char *valptr [16]; /**< Items are subtracted by mincode and then indexed into huffval. */ - - unsigned char look_nbits [256]; /**< The lookahead buffer lengths. */ - unsigned char look_sym [256]; /**< The lookahead buffer values. */ -}; - -/** An image component in the frame. */ -struct JPEG_FrameHeader_Component -{ - unsigned char selector; /**< Component identifier, must be unique amongst the identifiers (C). */ - unsigned char horzFactor; /**< Horizontal sampling factor. */ - unsigned char vertFactor; /**< Vertical sampling factor. */ - unsigned char quantTable; /**< Quantization table destination selector. */ -}; - -/** The frame header state. */ -struct JPEG_FrameHeader -{ - JPEG_Marker marker; /**< The marker that began this frame header, one of JPEG_Marker_SOFn. */ - int encoding; /**< 0 for Huffman coding, 1 for arithmetic coding. */ - char differential; /**< Differential (1) or non-differential (0). */ - - unsigned char precision; /**< Sample precision - precision in bits for the samples of the components in the frame. */ - unsigned short height; /**< Maximum number of lines in the source image, equal to the number of lines in the component with the maximum number of vertical samples. 0 indicates that the number of lines shall be defined by the DNL marker and parameters at the end of the first scan. */ - unsigned short width; /**< Number of samples per line in the source image, equal to the number of samples per line in the component with the maximum number of horizontal samples. */ - JPEG_FrameHeader_Component componentList [JPEG_MAXIMUM_COMPONENTS]; /**< Components. */ - int componentCount; /**< Number of components. */ -}; - -/** A component involved in this scan. */ -struct JPEG_ScanHeader_Component -{ - unsigned char selector; /**< Selector index corresponding to one specified in the frame header (Csj). */ - unsigned char dcTable; /**< DC entropy coding table destination selector (Tdj). */ - unsigned char acTable; /**< AC entropy coding table destination selector (Taj). */ -}; - -/** Scan header state. */ -struct JPEG_ScanHeader -{ - JPEG_ScanHeader_Component componentList [JPEG_MAXIMUM_COMPONENTS]; /**< Components involved in this scan. */ - int componentCount; /**< Number of components involved in this scan. */ - unsigned char spectralStart; /**< In DCT modes of operation, the first DCT coefficient in each block in zig-zag order which shall be coded in the scan (Ss). For sequential DCT this is zero. */ - unsigned char spectralEnd; /**< Specify the last DCT coefficient in each block in zig-zag order which shall be coded in the scan. */ - unsigned char successiveApproximationBitPositionHigh; /**< (Ah). */ - unsigned char successiveApproximationBitPositionLow; /**< (Al). */ -}; - -/** The complete decoder state. */ -struct JPEG_Decoder -{ - const unsigned char *acTables [4]; /**< The AC huffman table slots. */ - const unsigned char *dcTables [4]; /**< The DC huffman table slots. */ - JPEG_QuantizationTable quantTables [4]; /**< The quantization table slots. */ - unsigned int restartInterval; /**< Number of MCU in the restart interval (Ri). */ - JPEG_FrameHeader frame; /**< Current frame. */ - JPEG_ScanHeader scan; /**< Current scan. */ -}; - -/** Start reading bits. */ -#define JPEG_BITS_START() \ - unsigned int bits_left = 0; \ - unsigned long int bits_data = 0 - -/** Rewind any bytes that have not been read from and reset the state. */ -#define JPEG_BITS_REWIND() \ - do { \ - int count = bits_left >> 3; \ - \ - while (count --) \ - { \ - data --; \ - if (data [-1] == 0xFF) \ - data --; \ - } \ - \ - bits_left = 0; \ - bits_data = 0; \ - } while (0) - -/** Fill the buffer. */ -#define JPEG_BITS_CHECK() \ - do { \ - while (bits_left < 32 - 7) \ - { \ - bits_data = (bits_data << 8) | (*data ++); \ - if (data [-1] == 0xFF) \ - data ++; \ - bits_left += 8; \ - } \ - } while (0) - -/** Return and consume a number of bits. */ -#define JPEG_BITS_GET(COUNT) \ - ((bits_data >> (bits_left -= (COUNT))) & ((1 << (COUNT)) - 1)) - -/** Return a number of bits without consuming them. */ -#define JPEG_BITS_PEEK(COUNT) \ - ((bits_data >> (bits_left - (COUNT))) & ((1 << (COUNT)) - 1)) - -/** Drop a number of bits from the stream. */ -#define JPEG_BITS_DROP(COUNT) \ - (bits_left -= (COUNT)) - -/** Read a single unsigned char from the current bit-stream by using the provided table. */ -#define JPEG_HuffmanTable_Decode(TABLE, OUT) \ - do { \ - int bitcount, result; \ - \ - result = JPEG_BITS_PEEK (8); \ - \ - if ((bitcount = (TABLE)->look_nbits [result]) != 0) \ - { \ - JPEG_BITS_DROP (bitcount); \ - result = (TABLE)->look_sym [result]; \ - } \ - else \ - { \ - int i = 7; \ - \ - JPEG_BITS_DROP (8); \ - do result = (result << 1) | JPEG_BITS_GET (1); \ - while (result > (TABLE)->maxcode [++ i]); \ - \ - result = (TABLE)->valptr [i] [result]; \ - } \ - \ - (OUT) = result; \ - } while (0) - -//extern const unsigned char JPEG_ToZigZag [JPEG_DCTSIZE2]; /* Converts row-major indices to zig-zagged order. */ -//extern const unsigned char JPEG_FromZigZag [JPEG_DCTSIZE2]; /* Converts zig-zagged indices to row-major order. */ -//extern const JPEG_FIXED_TYPE JPEG_AANScaleFactor [JPEG_DCTSIZE2]; /* AA&N scaling factors for quantisation in fixed point. */ -//extern const unsigned char JPEG_ComponentRange [32 * 3]; /* A limited component clamp that keeps values in the 0..31 range if incremented by 32. */ - -/** Return whether this data matches as a JPEG input stream. You only need - * to read four bytes. - */ - -extern int JPEG_Match (const unsigned char *data, int length); - -/** Read a FrameHeader segment (SOFn) and store the new data pointer in - * *data. Returns true on success and false on failure (failure isn't - * possible if JPEG_DEBUG is reset). - */ - -extern int JPEG_FrameHeader_Read (JPEG_FrameHeader *frame, const unsigned char **data, JPEG_Marker marker); - -/** Read a HuffmanTable segment (DHT) and store the new data pointer in - * *data. Returns true on success and false on failure (failure isn't - * possible if JPEG_DEBUG is reset). - */ - -extern int JPEG_HuffmanTable_Read (JPEG_HuffmanTable *table, const unsigned char **data); - -/** Skip a HuffmanTable segment (DHT) and store the new data pointer in - * *data on success. Returns true on success and false on failure (failure - * isn't possible if JPEG_DEBUG is reset). - */ - -extern int JPEG_HuffmanTable_Skip (const unsigned char **data); - -/** Read a ScanHeader segment (SOS) and store the new data pointer in - * *data. Returns true on success and false on failure (failure isn't - * possible if JPEG_DEBUG is reset). - */ - -extern int JPEG_ScanHeader_Read (JPEG_ScanHeader *scan, const unsigned char **data); - -/** Read all headers up to the start of the image and store the new data - * pointer in *data. Returns true on success and false on failure (failure - * isn't possible if JPEG_DEBUG is reset). - */ - -extern int JPEG_Decoder_ReadHeaders (JPEG_Decoder *decoder, const unsigned char **data); - -/** Read the entire image from the *data value and then store the new data pointer. - * Returns true on success and false on failure (failure isn't possible if - * JPEG_DEBUG is reset). - */ - -extern int JPEG_Decoder_ReadImage (JPEG_Decoder *decoder, const unsigned char **data, volatile JPEG_OUTPUT_TYPE *out, int outWidth, int outHeight); - -/** Perform a 2D inverse DCT computation on the input. - * - * @param zz The coefficients to process, JPEG_DCTSIZE2 in length. The - * contents will be destroyed in the computations. - * @param chunk The chunk to store the results in, nominally from -64 to 63, - * although some error is expected. - * @param chunkStride The number of values in a row for the chunk array. - */ - -extern void JPEG_IDCT (JPEG_FIXED_TYPE *zz, signed char *chunk, int chunkStride); - -/** Create a decompressor, read the headers from the provided data, and then - * read the image into the buffer given. Returns true on success and false on - * failure (failure isn't possible if JPEG_DEBUG is reset). - */ - -extern int JPEG_DecompressImage (const unsigned char *data, volatile JPEG_OUTPUT_TYPE *out, int outWidth, int outHeight); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* GBA_IMAGE_JPEG_H */ +/* + * + * A JPEG decompressor, targeted for the GameBoy Advance (although there + * should be no machine-specific aspects if you disable JPEG_USE_IWRAM + * and JPEG_MARK_TIME). On the GBA it consumes, all with slight potential + * variance: + * + * 3348 bytes of IWRAM, temporary + * 7756 bytes of ROM + * 4720 bytes of stack space, usually in IWRAM + * 350 milliseconds for decompressing a representative image + * + * Unlike before when IWRAM was permanently used, it's now loaded in just + * before decompression, allowing you to spend IWRAM on more tools called + * constantly rather than one you call only once in awhile. There is no + * permanent IWRAM usage with this library. + * + * It has a low capacitance for unusual JPEGs. They cannot be progressive, + * use arithmetic coding, have more than 4 components in a scan, and must be + * 8-bit. They can be colour or grayscale, and any component scaling factors + * are valid (unless if JPEG_HANDLE_ANY_FACTORS is reset, in which case only + * 2:1:1 is allowed). The maximum component scale factors cannot be three. In + * general, you'll be all right, but if it doesn't like your input it will not + * react sensibly in embedded. + * + * This code is in the public domain. JPEG is used for both its standard + * meaning and for JFIF. + * + * Revision 1: Inflicted stricter warnings, fixed C99-using code, and reduced + * allocation footprint (6144 bytes less). + * Revision 2: Reduced ROM usage by 276 bytes, with the body going to 832 bytes + * of IWRAM. I made it more configurable, particularly in YCbCr->RGB + * conversion. Some brute force ROM usage reduction. + * Revision 3: Removed all memset, malloc, and free dependencies. This + * increases stack use drastically but also makes it completely + * self-sufficient. + * Revision 4: Saved 6176 bytes of JPEG_Decoder state by exploiting an + * allowance of baseline JPEG decoding. This requires 3088 more bytes of + * stack space, however. + * Revision 5: Made the fixed-point shift configurable. Can now be compiled + * with -ansi -pedantic, and fixed stack usage so that it is always + * predictable by exploiting a JPEG restriction. + * Revision 6: A fixed type has been added and is configurable. 16-bit + * fixed is valid if you reduce JPEG_FIXSHIFT to 4 or lower. + * Revision 7: Inserted assertions for when you're not on the embedded + * environment; good for confirming that a given file is compatible with + * the decompressor. "this" is no longer used as a variable name. Added + * necessary fluff for dealing with C++. + * + * - Burton Radons (loth@users.sourceforge.net) + */ + +#ifndef GBA_JPEG_DECODE_H +#define GBA_IMAGE_JPEG_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef JPEG_DEBUG +#define JPEG_DEBUG 0 + /**< Enable assertion checks for input. This is useful if you want to use + * the library in non-embedded environments, such as to confirm that a + * JPEG file will be compliant. + * + * Enabling this will define JPEG_Assert(TEST) if it's not predefined. + * The default prints some information on the error to stderr and then + * returns zero. + */ +#endif /* JPEG_DEBUG */ + +#ifndef JPEG_HANDLE_ANY_FACTORS +#define JPEG_HANDLE_ANY_FACTORS 1 + /**< If this is set, any component factors are valid. Otherwise + * it will only handle 2:1:1 (the typical form that sacrifices colour + * resolution). Note that Photoshop will only generate such files if you + * use Save for Web. Resetting this saves 508 bytes of IWRAM. + */ +#endif /* JPEG_HANDLE_ANY_FACTORS */ + +#ifndef JPEG_FASTER_M211 +#define JPEG_FASTER_M211 1 + /**< If this is set, then the most common JPEG format is not given + * special, faster treatment. You must set JPEG_HANDLE_ANY_FACTORS + * in this case, or you will not see anything. Resetting this saves + * 532 bytes of IWRAM, at the cost of speed. + */ +#endif /* JPEG_FASTER_M211 */ + +#ifndef JPEG_USE_IWRAM +#define JPEG_USE_IWRAM 0 + /**< If this is set, the JPEG decompressor will use IWRAM for huge + * benefits to decompression speed (249% faster than reset). Resetting + * this saves up to 3348 bytes of IWRAM, depending upon + * JPEG_HANDLE_ANY_FACTORS and JPEG_FASTER_M211. + */ +#endif /* JPEG_USE_IWRAM */ + +#define JPEG_DCTSIZE 8 + /**< The number of samples across and down a JPEG DCT. This cannot be + * configured, as the inverse DCT only handles 8x8. + */ + +#define JPEG_DCTSIZE2 (JPEG_DCTSIZE * JPEG_DCTSIZE) + /**< The number of samples in a full 2-D DCT. */ + +#ifndef JPEG_MAXIMUM_COMPONENTS +#define JPEG_MAXIMUM_COMPONENTS 4 + /**< The maximum number of components that can be involved in an image. + * Each value costs 8 bytes of stack space and 8 bytes of allocations. + */ +#endif /* JPEG_MAXIMUM_SCAN_COMPONENTS */ + +#ifndef JPEG_FIXSHIFT +#define JPEG_FIXSHIFT 8 + /**< The shift used for converting to and from fixed point. A higher value + * here (up to 10 for 32-bit) results in better quality; a lower value + * (down to 2) results in lesser quality. Lower values can be somewhat + * faster depending upon the hardware's clockings for multiplication. + */ +#endif /* JPEG_FIXSHIFT */ + +#ifndef JPEG_MAXIMUM_SCAN_COMPONENT_FACTORS +#define JPEG_MAXIMUM_SCAN_COMPONENT_FACTORS 10 + /**< The limit of the sum of the multiplied horizontal scaling factors in + * the components. For example, if Y is 1x1, Cb is 2x2, and Cr is 2x2, + * that comes out to (1 * 1 + 2 * 2 + 2 * 2), or 9. The limit here is + * what is specified in the standard (B.2.3). + */ +#endif /* JPEG_MAXIMUM_SCAN_COMPONENT_FACTORS */ + +#ifndef JPEG_FIXED_TYPE +#define JPEG_FIXED_TYPE long int + /**< The fixed data type. This requires a minimum size of + * JPEG_FIXSHIFT plus 12. + */ +#endif /* JPEG_FIXED_TYPE */ + +/* If this value is defined as 1, then it outputs to RGB in 32-bit words, with + * red in the first eight bits, green in the second eight bits, and blue in the + * third eight bits. + */ + +#if JPEG_OUTPUT_RGB8 + #define JPEG_OUTPUT_TYPE unsigned int + + #define JPEG_Convert_Limit(VALUE) ((VALUE) < 0 ? 0 : (VALUE) > 255 ? 255 : (VALUE)) + + #define JPEG_Convert(OUT, Y, Cb, Cr) \ + do { \ + int eY = (Y) + 63; \ + int R = ((eY) + ((Cr) * 359 >> 8)) * 2; \ + int G = ((eY) - ((Cb) * 88 >> 8) - ((Cr) * 183 >> 8)) * 2; \ + int B = ((eY) + ((Cb) * 454 >> 8)) * 2; \ + \ + R = JPEG_Convert_Limit (R); \ + G = JPEG_Convert_Limit (G) << 8; \ + B = JPEG_Convert_Limit (B) << 16; \ + (OUT) = R | G | B; \ + } while (0) + + #define JPEG_Convert_From(IN, Y, Cb, Cr) \ + do { \ + int R = IN & 255; \ + int G = (IN >> 8) & 255; \ + int B = (IN >> 16) & 255; \ + \ + Y = (((R * 66 >> 8) + (G * 129 >> 8) + (B * 25 >> 8)) >> 1) - 63; \ + Cb = ((R * -38 >> 8) + (G * -74 >> 8) + (B * 112 >> 8)) >> 1; \ + Cr = ((R * 112 >> 8) + (G * -94 >> 8) + (B * 18 >> 8)) >> 1; \ + } while (0) +#endif /* JPEG_OUTPUT_RGB8 */ + +#ifndef JPEG_OUTPUT_TYPE +#define JPEG_OUTPUT_TYPE unsigned short + /**< This is the data type that JPEG outputs to. The interpretation of + * this type is dependent upon JPEG_Convert. + */ +#endif /* JPEG_OUTPUT_TYPE */ + +#ifndef JPEG_Convert +/** Convert YCbCr values (each in the nominal range -64 to 63) to RGB and store + * in the output value (of type JPEG_OUTPUT_TYPE). By default this stores to + * 15-bit RGB. + */ + +#define JPEG_Convert(OUT, Y, Cb, Cr) \ + do { \ + int eY = (Y) + 63; \ + int R = (eY) + ((Cr) * 359 >> 8); \ + int G = (eY) - ((Cb) * 88 >> 8) - ((Cr) * 183 >> 8); \ + int B = (eY) + ((Cb) * 454 >> 8); \ + \ + R = ComponentRange [R >> 2]; \ + G = ComponentRange [G >> 2] << 5; \ + B = ComponentRange [B >> 2] << 10; \ + (OUT) = R | G | B | (1 << 15); \ + } while (0) + +#endif /* JPEG_Convert */ + +#ifndef JPEG_Assert + #if JPEG_DEBUG + #include + #include + #define JPEG_Assert(TEST) \ + do { \ + if (TEST) \ + break; \ + fprintf (stderr, __FILE__ "(%d): " #TEST "\n", __LINE__); \ + return 0; \ + } while (0) + #else + #define JPEG_Assert(TEST) do { } while (0) + #endif /* JPEG_DEBUG */ +#endif /* JPEG_Assert */ + +/** The markers that can appear in a JPEG stream. */ +enum JPEG_Marker +{ + JPEG_Marker_APP0 = 0xFFE0, /**< Reserved application segment 0. */ + JPEG_Marker_APP1 = 0xFFE1, /**< Reserved application segment 1. */ + JPEG_Marker_APP2 = 0xFFE2, /**< Reserved application segment 2. */ + JPEG_Marker_APP3 = 0xFFE3, /**< Reserved application segment 3. */ + JPEG_Marker_APP4 = 0xFFE4, /**< Reserved application segment 4. */ + JPEG_Marker_APP5 = 0xFFE5, /**< Reserved application segment 5. */ + JPEG_Marker_APP6 = 0xFFE6, /**< Reserved application segment 6. */ + JPEG_Marker_APP7 = 0xFFE7, /**< Reserved application segment 7. */ + JPEG_Marker_APP8 = 0xFFE8, /**< Reserved application segment 8. */ + JPEG_Marker_APP9 = 0xFFE9, /**< Reserved application segment 9. */ + JPEG_Marker_APP10 = 0xFFEA, /**< Reserved application segment 10. */ + JPEG_Marker_APP11 = 0xFFEB, /**< Reserved application segment 11. */ + JPEG_Marker_APP12 = 0xFFEC, /**< Reserved application segment 12. */ + JPEG_Marker_APP13 = 0xFFED, /**< Reserved application segment 13. */ + JPEG_Marker_APP14 = 0xFFEE, /**< Reserved application segment 14. */ + JPEG_Marker_APP15 = 0xFFEF, /**< Reserved application segment 15. */ + JPEG_Marker_COM = 0xFFFE, /**< Comment. */ + JPEG_Marker_DHT = 0xFFC4, /**< Define huffman table. */ + JPEG_Marker_DQT = 0xFFDB, /**< Define quantization table(s). */ + JPEG_Marker_DRI = 0xFFDD, /**< Define restart interval. */ + JPEG_Marker_EOI = 0xFFD9, /**< End of image. */ + JPEG_Marker_SOF0 = 0xFFC0, /**< Start of Frame, non-differential, Huffman coding, baseline DCT. */ + JPEG_Marker_SOI = 0xFFD8, /**< Start of image. */ + JPEG_Marker_SOS = 0xFFDA /**< Start of scan. */ +}; + +typedef enum JPEG_Marker JPEG_Marker; +typedef JPEG_FIXED_TYPE JPEG_QuantizationTable [JPEG_DCTSIZE2]; /**< Quantization table elements, in zigzag order, fixed. */ + +/** Compute the multiplication of two fixed-point values. */ +#define JPEG_FIXMUL(A, B) ((A) * (B) >> JPEG_FIXSHIFT) + +/** Convert a fixed-point value to an integer. */ +#define JPEG_FIXTOI(A) ((A) >> JPEG_FIXSHIFT) + +/** Convert an integer to a fixed-point value. */ +#define JPEG_ITOFIX(A) ((A) << JPEG_FIXSHIFT) + +/** Convert a floating-point value to fixed-point. */ +#define JPEG_FTOFIX(A) ((int) ((A) * JPEG_ITOFIX (1))) + +/** Convert a fixed-point value to floating-point. */ +#define JPEG_FIXTOF(A) ((A) / (float) JPEG_ITOFIX (1)) + +typedef struct JPEG_HuffmanTable JPEG_HuffmanTable; +typedef struct JPEG_Decoder JPEG_Decoder; +typedef struct JPEG_FrameHeader JPEG_FrameHeader; +typedef struct JPEG_FrameHeader_Component JPEG_FrameHeader_Component; +typedef struct JPEG_ScanHeader JPEG_ScanHeader; +typedef struct JPEG_ScanHeader_Component JPEG_ScanHeader_Component; + +/** A huffman table. */ +struct JPEG_HuffmanTable +{ + const unsigned char *huffval; /**< Pointer to values in the table (256 entries). */ + int maxcode [16]; /**< The maximum code for each length - 1. */ + const unsigned char *valptr [16]; /**< Items are subtracted by mincode and then indexed into huffval. */ + + unsigned char look_nbits [256]; /**< The lookahead buffer lengths. */ + unsigned char look_sym [256]; /**< The lookahead buffer values. */ +}; + +/** An image component in the frame. */ +struct JPEG_FrameHeader_Component +{ + unsigned char selector; /**< Component identifier, must be unique amongst the identifiers (C). */ + unsigned char horzFactor; /**< Horizontal sampling factor. */ + unsigned char vertFactor; /**< Vertical sampling factor. */ + unsigned char quantTable; /**< Quantization table destination selector. */ +}; + +/** The frame header state. */ +struct JPEG_FrameHeader +{ + JPEG_Marker marker; /**< The marker that began this frame header, one of JPEG_Marker_SOFn. */ + int encoding; /**< 0 for Huffman coding, 1 for arithmetic coding. */ + char differential; /**< Differential (1) or non-differential (0). */ + + unsigned char precision; /**< Sample precision - precision in bits for the samples of the components in the frame. */ + unsigned short height; /**< Maximum number of lines in the source image, equal to the number of lines in the component with the maximum number of vertical samples. 0 indicates that the number of lines shall be defined by the DNL marker and parameters at the end of the first scan. */ + unsigned short width; /**< Number of samples per line in the source image, equal to the number of samples per line in the component with the maximum number of horizontal samples. */ + JPEG_FrameHeader_Component componentList [JPEG_MAXIMUM_COMPONENTS]; /**< Components. */ + int componentCount; /**< Number of components. */ +}; + +/** A component involved in this scan. */ +struct JPEG_ScanHeader_Component +{ + unsigned char selector; /**< Selector index corresponding to one specified in the frame header (Csj). */ + unsigned char dcTable; /**< DC entropy coding table destination selector (Tdj). */ + unsigned char acTable; /**< AC entropy coding table destination selector (Taj). */ +}; + +/** Scan header state. */ +struct JPEG_ScanHeader +{ + JPEG_ScanHeader_Component componentList [JPEG_MAXIMUM_COMPONENTS]; /**< Components involved in this scan. */ + int componentCount; /**< Number of components involved in this scan. */ + unsigned char spectralStart; /**< In DCT modes of operation, the first DCT coefficient in each block in zig-zag order which shall be coded in the scan (Ss). For sequential DCT this is zero. */ + unsigned char spectralEnd; /**< Specify the last DCT coefficient in each block in zig-zag order which shall be coded in the scan. */ + unsigned char successiveApproximationBitPositionHigh; /**< (Ah). */ + unsigned char successiveApproximationBitPositionLow; /**< (Al). */ +}; + +/** The complete decoder state. */ +struct JPEG_Decoder +{ + const unsigned char *acTables [4]; /**< The AC huffman table slots. */ + const unsigned char *dcTables [4]; /**< The DC huffman table slots. */ + JPEG_QuantizationTable quantTables [4]; /**< The quantization table slots. */ + unsigned int restartInterval; /**< Number of MCU in the restart interval (Ri). */ + JPEG_FrameHeader frame; /**< Current frame. */ + JPEG_ScanHeader scan; /**< Current scan. */ +}; + +/** Start reading bits. */ +#define JPEG_BITS_START() \ + unsigned int bits_left = 0; \ + unsigned long int bits_data = 0 + +/** Rewind any bytes that have not been read from and reset the state. */ +#define JPEG_BITS_REWIND() \ + do { \ + int count = bits_left >> 3; \ + \ + while (count --) \ + { \ + data --; \ + if (data [-1] == 0xFF) \ + data --; \ + } \ + \ + bits_left = 0; \ + bits_data = 0; \ + } while (0) + +/** Fill the buffer. */ +#define JPEG_BITS_CHECK() \ + do { \ + while (bits_left < 32 - 7) \ + { \ + bits_data = (bits_data << 8) | (*data ++); \ + if (data [-1] == 0xFF) \ + data ++; \ + bits_left += 8; \ + } \ + } while (0) + +/** Return and consume a number of bits. */ +#define JPEG_BITS_GET(COUNT) \ + ((bits_data >> (bits_left -= (COUNT))) & ((1 << (COUNT)) - 1)) + +/** Return a number of bits without consuming them. */ +#define JPEG_BITS_PEEK(COUNT) \ + ((bits_data >> (bits_left - (COUNT))) & ((1 << (COUNT)) - 1)) + +/** Drop a number of bits from the stream. */ +#define JPEG_BITS_DROP(COUNT) \ + (bits_left -= (COUNT)) + +/** Read a single unsigned char from the current bit-stream by using the provided table. */ +#define JPEG_HuffmanTable_Decode(TABLE, OUT) \ + do { \ + int bitcount, result; \ + \ + result = JPEG_BITS_PEEK (8); \ + \ + if ((bitcount = (TABLE)->look_nbits [result]) != 0) \ + { \ + JPEG_BITS_DROP (bitcount); \ + result = (TABLE)->look_sym [result]; \ + } \ + else \ + { \ + int i = 7; \ + \ + JPEG_BITS_DROP (8); \ + do result = (result << 1) | JPEG_BITS_GET (1); \ + while (result > (TABLE)->maxcode [++ i]); \ + \ + result = (TABLE)->valptr [i] [result]; \ + } \ + \ + (OUT) = result; \ + } while (0) + +//extern const unsigned char JPEG_ToZigZag [JPEG_DCTSIZE2]; /* Converts row-major indices to zig-zagged order. */ +//extern const unsigned char JPEG_FromZigZag [JPEG_DCTSIZE2]; /* Converts zig-zagged indices to row-major order. */ +//extern const JPEG_FIXED_TYPE JPEG_AANScaleFactor [JPEG_DCTSIZE2]; /* AA&N scaling factors for quantisation in fixed point. */ +//extern const unsigned char JPEG_ComponentRange [32 * 3]; /* A limited component clamp that keeps values in the 0..31 range if incremented by 32. */ + +/** Return whether this data matches as a JPEG input stream. You only need + * to read four bytes. + */ + +extern int JPEG_Match (const unsigned char *data, int length); + +/** Read a FrameHeader segment (SOFn) and store the new data pointer in + * *data. Returns true on success and false on failure (failure isn't + * possible if JPEG_DEBUG is reset). + */ + +extern int JPEG_FrameHeader_Read (JPEG_FrameHeader *frame, const unsigned char **data, JPEG_Marker marker); + +/** Read a HuffmanTable segment (DHT) and store the new data pointer in + * *data. Returns true on success and false on failure (failure isn't + * possible if JPEG_DEBUG is reset). + */ + +extern int JPEG_HuffmanTable_Read (JPEG_HuffmanTable *table, const unsigned char **data); + +/** Skip a HuffmanTable segment (DHT) and store the new data pointer in + * *data on success. Returns true on success and false on failure (failure + * isn't possible if JPEG_DEBUG is reset). + */ + +extern int JPEG_HuffmanTable_Skip (const unsigned char **data); + +/** Read a ScanHeader segment (SOS) and store the new data pointer in + * *data. Returns true on success and false on failure (failure isn't + * possible if JPEG_DEBUG is reset). + */ + +extern int JPEG_ScanHeader_Read (JPEG_ScanHeader *scan, const unsigned char **data); + +/** Read all headers up to the start of the image and store the new data + * pointer in *data. Returns true on success and false on failure (failure + * isn't possible if JPEG_DEBUG is reset). + */ + +extern int JPEG_Decoder_ReadHeaders (JPEG_Decoder *decoder, const unsigned char **data); + +/** Read the entire image from the *data value and then store the new data pointer. + * Returns true on success and false on failure (failure isn't possible if + * JPEG_DEBUG is reset). + */ + +extern int JPEG_Decoder_ReadImage (JPEG_Decoder *decoder, const unsigned char **data, volatile JPEG_OUTPUT_TYPE *out, int outWidth, int outHeight); + +/** Perform a 2D inverse DCT computation on the input. + * + * @param zz The coefficients to process, JPEG_DCTSIZE2 in length. The + * contents will be destroyed in the computations. + * @param chunk The chunk to store the results in, nominally from -64 to 63, + * although some error is expected. + * @param chunkStride The number of values in a row for the chunk array. + */ + +extern void JPEG_IDCT (JPEG_FIXED_TYPE *zz, signed char *chunk, int chunkStride); + +/** Create a decompressor, read the headers from the provided data, and then + * read the image into the buffer given. Returns true on success and false on + * failure (failure isn't possible if JPEG_DEBUG is reset). + */ + +extern int JPEG_DecompressImage (const unsigned char *data, volatile JPEG_OUTPUT_TYPE *out, int outWidth, int outHeight); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* GBA_IMAGE_JPEG_H */ diff --git a/source/arm7/PA.c b/source/arm7/PA.c index 4a03cb2..78735c2 100644 --- a/source/arm7/PA.c +++ b/source/arm7/PA.c @@ -1,48 +1,48 @@ -#include "PA_Internal.h" -#include - -extern bool sleepIsEnabled; // from libnds - -volatile PA_TransferRegion *volatile PA_Transfer = NULL; - -void PA_Init(void){ - - enableSound(); - - // Disable libnds autosleep - sleepIsEnabled = false; - - // Read user settings like the touch screen settings - readUserSettings(); - - // Initialize touch screen - touchInit(); - - // Initialize the basic part of the system - irqInit(); - fifoInit(); - - // Send input data as soon as possible - inputGetAndSend(); - - // Sleep mode, storage, firmware... - installSystemFIFO(); - - // Initialize the PAlib Fifo channel - PA_InitFifo(); - - // Stop LED blinking - ledBlink(0); - - // Wait until the IPC buffer has been sent from the ARM9 - while (PA_Transfer == NULL); - - // Read current date from the RTC and setup an interrupt to update the time - // regularly. The interrupt simply adds one second every time, it doesn't - // read the date. Reading the RTC is very slow, so it's a bad idea to do it - // frequently. - initClockIRQTimer(3); - - // Init microphone - micOn(); -} +#include "PA_Internal.h" +#include + +extern bool sleepIsEnabled; // from libnds + +volatile PA_TransferRegion *volatile PA_Transfer = NULL; + +void PA_Init(void){ + + enableSound(); + + // Disable libnds autosleep + sleepIsEnabled = false; + + // Read user settings like the touch screen settings + readUserSettings(); + + // Initialize touch screen + touchInit(); + + // Initialize the basic part of the system + irqInit(); + fifoInit(); + + // Send input data as soon as possible + inputGetAndSend(); + + // Sleep mode, storage, firmware... + installSystemFIFO(); + + // Initialize the PAlib Fifo channel + PA_InitFifo(); + + // Stop LED blinking + ledBlink(0); + + // Wait until the IPC buffer has been sent from the ARM9 + while (PA_Transfer == NULL); + + // Read current date from the RTC and setup an interrupt to update the time + // regularly. The interrupt simply adds one second every time, it doesn't + // read the date. Reading the RTC is very slow, so it's a bad idea to do it + // frequently. + initClockIRQTimer(3); + + // Init microphone + micOn(); +} diff --git a/source/arm7/PA_Fifo.c b/source/arm7/PA_Fifo.c index e50dc51..31f721f 100644 --- a/source/arm7/PA_Fifo.c +++ b/source/arm7/PA_Fifo.c @@ -1,38 +1,38 @@ -#include "PA_Internal.h" - -void PA_InitFifo(){ - fifoSetDatamsgHandler(FIFO_PALIB, PA_FifoMsgHandler, 0); - fifoSetValue32Handler(FIFO_PALIB, PA_FifoValHandler, 0); -} - -void PA_FifoMsgHandler(int bytes, void* dummy){ - PA_FifoMsg msg; - PA_GetFifoMsg(msg, bytes); - switch(msg.type){ - // Get shared memory buffer from the ARM9 - case PA_SHARED_MEM_SET: - PA_Transfer = msg.SharedMemSet.address; - break; - // Microphone record command - case PA_MSG_MIC: - PA_FifoMicMsg(&msg); - break; - // DS lite brightness change - case PA_MSG_DSLBRIGHT: - writePowerManagement(PM_DSLITE_REG, msg.DSLBrightMsg.brightness & 3); - break; - // PSG message - case PA_MSG_PSG: - PA_FifoPSGMsg(&msg); - break; - } -} - -void PA_FifoValHandler(u32 type, void* dummy){ - switch(type){ - // Microphone stop command - case PA_MSG_MICSTOP: - PA_MicStop(); - break; - } -} +#include "PA_Internal.h" + +void PA_InitFifo(){ + fifoSetDatamsgHandler(FIFO_PALIB, PA_FifoMsgHandler, 0); + fifoSetValue32Handler(FIFO_PALIB, PA_FifoValHandler, 0); +} + +void PA_FifoMsgHandler(int bytes, void* dummy){ + PA_FifoMsg msg; + PA_GetFifoMsg(msg, bytes); + switch(msg.type){ + // Get shared memory buffer from the ARM9 + case PA_SHARED_MEM_SET: + PA_Transfer = msg.SharedMemSet.address; + break; + // Microphone record command + case PA_MSG_MIC: + PA_FifoMicMsg(&msg); + break; + // DS lite brightness change + case PA_MSG_DSLBRIGHT: + writePowerManagement(PM_DSLITE_REG, msg.DSLBrightMsg.brightness & 3); + break; + // PSG message + case PA_MSG_PSG: + PA_FifoPSGMsg(&msg); + break; + } +} + +void PA_FifoValHandler(u32 type, void* dummy){ + switch(type){ + // Microphone stop command + case PA_MSG_MICSTOP: + PA_MicStop(); + break; + } +} diff --git a/source/arm7/PA_Input.c b/source/arm7/PA_Input.c index 3e43a5a..0fbc158 100644 --- a/source/arm7/PA_Input.c +++ b/source/arm7/PA_Input.c @@ -1,38 +1,38 @@ -#include "PA_Internal.h" - -// Some pseudocode for this function -// micvol(x) uses static variable oldsmp = 0 -// micvol(x) = (oldsmp + smpfix(x)) / 2, oldsmp = smpfix(x) -// smpfix(x) = abs(x) * 2 -u8 PA_ReadMicVol(){ - static u8 oldsmp = 0; - s8 smp_s = micReadData8() ^ 0x80; - u8 smp = ((smp_s < 0) ? (-smp_s) : smp_s) << 1; - return oldsmp = (oldsmp + smp) >> 1; -} - -void PA_InputGetAndSend(void){ - // The following is already managed by libnds: - // Keys, Stylus, RTC, Powerdown, Screen lights, Led blink - inputGetAndSend(); // a piece of cake isn't it? - - // Handle the remaining things (battery, temperature, microphone volume) - PA_FifoMsg msg; - msg.type = PA_MSG_INPUT; - - // Battery - msg.InputMsg.battery = 15; //touchRead(TSC_MEASURE_BATTERY); - // TODO (AntonioND) - - // Temperature - msg.InputMsg.temperature = 0; //tscReadTemperature(); - // TODO (AntonioND) - msg.InputMsg.tdiode1 = 0; - msg.InputMsg.tdiode2 = 0; - - // Microphone volume - msg.InputMsg.micvol = PA_ReadMicVol(); - - // Send the data - PA_SendFifoMsg(msg); -} +#include "PA_Internal.h" + +// Some pseudocode for this function +// micvol(x) uses static variable oldsmp = 0 +// micvol(x) = (oldsmp + smpfix(x)) / 2, oldsmp = smpfix(x) +// smpfix(x) = abs(x) * 2 +u8 PA_ReadMicVol(){ + static u8 oldsmp = 0; + s8 smp_s = micReadData8() ^ 0x80; + u8 smp = ((smp_s < 0) ? (-smp_s) : smp_s) << 1; + return oldsmp = (oldsmp + smp) >> 1; +} + +void PA_InputGetAndSend(void){ + // The following is already managed by libnds: + // Keys, Stylus, RTC, Powerdown, Screen lights, Led blink + inputGetAndSend(); // a piece of cake isn't it? + + // Handle the remaining things (battery, temperature, microphone volume) + PA_FifoMsg msg; + msg.type = PA_MSG_INPUT; + + // Battery + msg.InputMsg.battery = 15; //touchRead(TSC_MEASURE_BATTERY); + // TODO (AntonioND) + + // Temperature + msg.InputMsg.temperature = 0; //tscReadTemperature(); + // TODO (AntonioND) + msg.InputMsg.tdiode1 = 0; + msg.InputMsg.tdiode2 = 0; + + // Microphone volume + msg.InputMsg.micvol = PA_ReadMicVol(); + + // Send the data + PA_SendFifoMsg(msg); +} diff --git a/source/arm7/PA_Internal.h b/source/arm7/PA_Internal.h index 639ad52..a7825c3 100644 --- a/source/arm7/PA_Internal.h +++ b/source/arm7/PA_Internal.h @@ -1,31 +1,31 @@ -#pragma once - -#include - -// Sandbox START - should be organized /////////////////////////// - -// Um... This should be in libnds -#define PM_DSLITE_REG 4 - -// Improved version of timerStop() -static inline void timerStopEx(int channel){ - TIMER_CR(channel) = 0; - TIMER_DATA(channel) = 0; - irqDisable(IRQ_TIMER(channel)); - irqSet(IRQ_TIMER(channel), 0); -} - -// Sandbox END /////////////////////////////////////////////////// - -// Fifo functions -void PA_InitFifo(); -void PA_FifoMsgHandler(int bytes, void* dummy); -void PA_FifoValHandler(u32 type, void* dummy); - -// Microphone functions -void PA_MicTimer(); -void PA_FifoMicMsg(PA_FifoMsg* msg); -static inline void PA_MicStop(){ timerStopEx(2); } - -// PSG functions -void PA_FifoPSGMsg(PA_FifoMsg* msg); +#pragma once + +#include + +// Sandbox START - should be organized /////////////////////////// + +// Um... This should be in libnds +#define PM_DSLITE_REG 4 + +// Improved version of timerStop() +static inline void timerStopEx(int channel){ + TIMER_CR(channel) = 0; + TIMER_DATA(channel) = 0; + irqDisable(IRQ_TIMER(channel)); + irqSet(IRQ_TIMER(channel), 0); +} + +// Sandbox END /////////////////////////////////////////////////// + +// Fifo functions +void PA_InitFifo(); +void PA_FifoMsgHandler(int bytes, void* dummy); +void PA_FifoValHandler(u32 type, void* dummy); + +// Microphone functions +void PA_MicTimer(); +void PA_FifoMicMsg(PA_FifoMsg* msg); +static inline void PA_MicStop(){ timerStopEx(2); } + +// PSG functions +void PA_FifoPSGMsg(PA_FifoMsg* msg); diff --git a/source/arm7/PA_Legacy.c b/source/arm7/PA_Legacy.c index b01103b..acf778a 100644 --- a/source/arm7/PA_Legacy.c +++ b/source/arm7/PA_Legacy.c @@ -1,103 +1,103 @@ -#include "PA_Internal.h" - -void PA_LegacySoundUpdates(); -void runNdsLoaderCheck(); - -bool PA_LegacyInit = false; - -volatile PA_IPCType* PA_IPC; - -void PA_LegacyIPCManage(void){ - // For the NDS loader, not really a legacy function though - runNdsLoaderCheck(); - - if(PA_LegacyInit){ - // Legacy sound system - PA_LegacySoundUpdates(); - }else{ - if(PA_Transfer != NULL){ - if(PA_Transfer->mailData != 0){ - // Get the legacy IPC structure - PA_IPC = (PA_IPCType*)(PA_Transfer->mailData); - PA_Transfer->mailData = 0; - PA_LegacyInit = true; - } - } - } -} - -///////////////////////// -// Legacy sound system // -///////////////////////// - -void PA_SoundPlay(int channel); -void PA_SoundStop(int channel); - -void PA_LegacySoundUpdates(){ - int channel; - static PA_IPCSound Soundold[17]; - - // Update global sound volume - if(PA_IPC->Sound[16].Volume != Soundold[16].Volume){ - REG_SOUNDCNT = SOUND_ENABLE | SOUND_VOL(PA_IPC->Sound[16].Volume & 127); - Soundold[16].Volume = PA_IPC->Sound[16].Volume; - } - - for(channel = 0; channel < 16; channel++){ - if(PA_IPC->Sound[channel].Command){ // Play/stop sounds - if((PA_IPC->Sound[channel].Command >> PAIPC_STOP) & 1) PA_SoundStop(channel); - if((PA_IPC->Sound[channel].Command >> PAIPC_PLAY) & 1) PA_SoundPlay(channel); - PA_IPC->Sound[channel].Command = 0; - } - - // Update busy flags - PA_IPC->Sound[channel].Busy = SCHANNEL_CR(channel)>>31; - - // Update channel volume - if(PA_IPC->Sound[channel].Volume != Soundold[channel].Volume){ - SCHANNEL_CR(channel) &= ~SOUND_VOL(127); // reset sound volume - SCHANNEL_CR(channel) |= SOUND_VOL(PA_IPC->Sound[channel].Volume & 127); - Soundold[channel].Volume = PA_IPC->Sound[channel].Volume; - } - - // Update channel pan - if(PA_IPC->Sound[channel].Pan != Soundold[channel].Pan){ - SCHANNEL_PAN(channel) = SOUND_VOL(PA_IPC->Sound[channel].Pan & 127); - Soundold[channel].Pan = PA_IPC->Sound[channel].Pan; - } - } -} - -void PA_SoundPlay(int channel){ - SCHANNEL_TIMER(channel) = SOUND_FREQ(PA_IPC->Sound[channel].Rate); - SCHANNEL_SOURCE(channel) = (u32) PA_IPC->Sound[channel].Data; - SCHANNEL_LENGTH(channel) = PA_IPC->Sound[channel].Length >> 2; - - SCHANNEL_CR(channel) = SCHANNEL_ENABLE | - (SOUND_ONE_SHOT >> PA_IPC->Sound[channel].Repeat) | - SOUND_VOL(PA_IPC->Sound[channel].Volume) | - SOUND_PAN(PA_IPC->Sound[channel].Pan) | - (PA_IPC->Sound[channel].Format << 29) | - (PA_IPC->Sound[channel].Duty << 24); - - if(PA_IPC->Sound[channel].Repeat) - SCHANNEL_REPEAT_POINT(channel) = PA_IPC->Sound[channel].RepeatPoint; - else - SCHANNEL_REPEAT_POINT(channel) = 0; -} - -void PA_SoundStop(int channel){ - SCHANNEL_CR(channel) = 0; -} - -/////////////////////////////////////////////////////////// -// This is not a legacy function but useful nevertheless // -/////////////////////////////////////////////////////////// - -void runNdsLoaderCheck(){ - if(*((vu32*)0x02FFFE24) == (u32)0x02FFFE04){ - irqDisable(IRQ_ALL); - *((vu32*)0x02FFFE34) = (u32)0x06000000; - swiSoftReset(); - } -} +#include "PA_Internal.h" + +void PA_LegacySoundUpdates(); +void runNdsLoaderCheck(); + +bool PA_LegacyInit = false; + +volatile PA_IPCType* PA_IPC; + +void PA_LegacyIPCManage(void){ + // For the NDS loader, not really a legacy function though + runNdsLoaderCheck(); + + if(PA_LegacyInit){ + // Legacy sound system + PA_LegacySoundUpdates(); + }else{ + if(PA_Transfer != NULL){ + if(PA_Transfer->mailData != 0){ + // Get the legacy IPC structure + PA_IPC = (PA_IPCType*)(PA_Transfer->mailData); + PA_Transfer->mailData = 0; + PA_LegacyInit = true; + } + } + } +} + +///////////////////////// +// Legacy sound system // +///////////////////////// + +void PA_SoundPlay(int channel); +void PA_SoundStop(int channel); + +void PA_LegacySoundUpdates(){ + int channel; + static PA_IPCSound Soundold[17]; + + // Update global sound volume + if(PA_IPC->Sound[16].Volume != Soundold[16].Volume){ + REG_SOUNDCNT = SOUND_ENABLE | SOUND_VOL(PA_IPC->Sound[16].Volume & 127); + Soundold[16].Volume = PA_IPC->Sound[16].Volume; + } + + for(channel = 0; channel < 16; channel++){ + if(PA_IPC->Sound[channel].Command){ // Play/stop sounds + if((PA_IPC->Sound[channel].Command >> PAIPC_STOP) & 1) PA_SoundStop(channel); + if((PA_IPC->Sound[channel].Command >> PAIPC_PLAY) & 1) PA_SoundPlay(channel); + PA_IPC->Sound[channel].Command = 0; + } + + // Update busy flags + PA_IPC->Sound[channel].Busy = SCHANNEL_CR(channel)>>31; + + // Update channel volume + if(PA_IPC->Sound[channel].Volume != Soundold[channel].Volume){ + SCHANNEL_CR(channel) &= ~SOUND_VOL(127); // reset sound volume + SCHANNEL_CR(channel) |= SOUND_VOL(PA_IPC->Sound[channel].Volume & 127); + Soundold[channel].Volume = PA_IPC->Sound[channel].Volume; + } + + // Update channel pan + if(PA_IPC->Sound[channel].Pan != Soundold[channel].Pan){ + SCHANNEL_PAN(channel) = SOUND_VOL(PA_IPC->Sound[channel].Pan & 127); + Soundold[channel].Pan = PA_IPC->Sound[channel].Pan; + } + } +} + +void PA_SoundPlay(int channel){ + SCHANNEL_TIMER(channel) = SOUND_FREQ(PA_IPC->Sound[channel].Rate); + SCHANNEL_SOURCE(channel) = (u32) PA_IPC->Sound[channel].Data; + SCHANNEL_LENGTH(channel) = PA_IPC->Sound[channel].Length >> 2; + + SCHANNEL_CR(channel) = SCHANNEL_ENABLE | + (SOUND_ONE_SHOT >> PA_IPC->Sound[channel].Repeat) | + SOUND_VOL(PA_IPC->Sound[channel].Volume) | + SOUND_PAN(PA_IPC->Sound[channel].Pan) | + (PA_IPC->Sound[channel].Format << 29) | + (PA_IPC->Sound[channel].Duty << 24); + + if(PA_IPC->Sound[channel].Repeat) + SCHANNEL_REPEAT_POINT(channel) = PA_IPC->Sound[channel].RepeatPoint; + else + SCHANNEL_REPEAT_POINT(channel) = 0; +} + +void PA_SoundStop(int channel){ + SCHANNEL_CR(channel) = 0; +} + +/////////////////////////////////////////////////////////// +// This is not a legacy function but useful nevertheless // +/////////////////////////////////////////////////////////// + +void runNdsLoaderCheck(){ + if(*((vu32*)0x02FFFE24) == (u32)0x02FFFE04){ + irqDisable(IRQ_ALL); + *((vu32*)0x02FFFE34) = (u32)0x06000000; + swiSoftReset(); + } +} diff --git a/source/arm7/PA_Mic.c b/source/arm7/PA_Mic.c index 3ce0080..ab00f78 100644 --- a/source/arm7/PA_Mic.c +++ b/source/arm7/PA_Mic.c @@ -1,23 +1,23 @@ -#include "PA_Internal.h" - -vu8* PA_MicBuffer = 0; -vu32 PA_MicBufferLen = 0; - -void PA_FifoMicMsg(PA_FifoMsg* msg){ - PA_MicBuffer = msg->MicMsg.buffer; - PA_MicBufferLen = msg->MicMsg.length; - - // Start recording (16384 Hz) - // You gotta love the new libnds... - timerStart(2, ClockDivider_1, TIMER_FREQ(16384), PA_MicTimer); -} - -void PA_MicTimer(){ - if(PA_MicBuffer && (PA_MicBufferLen > 0)){ - // Read data from the microphone. Data from the Mic is unsigned, flipping - // the highest bit makes it signed. - *PA_MicBuffer++ = micReadData8() ^ 0x80; - PA_MicBufferLen--; - }else // as we have finished the recording - timerStopEx(2); // stop the recording timer -} +#include "PA_Internal.h" + +vu8* PA_MicBuffer = 0; +vu32 PA_MicBufferLen = 0; + +void PA_FifoMicMsg(PA_FifoMsg* msg){ + PA_MicBuffer = msg->MicMsg.buffer; + PA_MicBufferLen = msg->MicMsg.length; + + // Start recording (16384 Hz) + // You gotta love the new libnds... + timerStart(2, ClockDivider_1, TIMER_FREQ(16384), PA_MicTimer); +} + +void PA_MicTimer(){ + if(PA_MicBuffer && (PA_MicBufferLen > 0)){ + // Read data from the microphone. Data from the Mic is unsigned, flipping + // the highest bit makes it signed. + *PA_MicBuffer++ = micReadData8() ^ 0x80; + PA_MicBufferLen--; + }else // as we have finished the recording + timerStopEx(2); // stop the recording timer +} diff --git a/source/arm7/PA_PSG.c b/source/arm7/PA_PSG.c index 43b47c4..4e319fa 100644 --- a/source/arm7/PA_PSG.c +++ b/source/arm7/PA_PSG.c @@ -1,8 +1,8 @@ -#include "PA_Internal.h" - -void PA_FifoPSGMsg(PA_FifoMsg* msg){ - u32 ch = msg->PSGMsg.chan; // for faster access - SCHANNEL_TIMER(ch) = TIMER_FREQ((s32) msg->PSGMsg.freq); - SCHANNEL_CR(ch) = SCHANNEL_ENABLE | SOUND_VOL(msg->PSGMsg.vol) | SOUND_PAN(msg->PSGMsg.pan) - | SOUND_FORMAT_PSG | (msg->PSGMsg.duty << 24); -} +#include "PA_Internal.h" + +void PA_FifoPSGMsg(PA_FifoMsg* msg){ + u32 ch = msg->PSGMsg.chan; // for faster access + SCHANNEL_TIMER(ch) = TIMER_FREQ((s32) msg->PSGMsg.freq); + SCHANNEL_CR(ch) = SCHANNEL_ENABLE | SOUND_VOL(msg->PSGMsg.vol) | SOUND_PAN(msg->PSGMsg.pan) + | SOUND_FORMAT_PSG | (msg->PSGMsg.duty << 24); +} diff --git a/source/arm7/as_lib7.c b/source/arm7/as_lib7.c index f57dfcb..cad91f8 100644 --- a/source/arm7/as_lib7.c +++ b/source/arm7/as_lib7.c @@ -1,543 +1,543 @@ -/* - - Advanced Sound Library (ASlib) - ------------------------------ - - file : sound7.c - author : Lasorsa Yohan (Noda) - description : ARM7 sound functions - - history : - - 02/12/2007 - v1.0 - = Original release - - 21/12/2007 - v1.1 - = corrected arm7/amr9 initialization (fix M3S/R4 problems) - = fixed stereo detection problem (thanks to ThomasS) - - - credits : - - IPC sound system and streaming is based on cold_as_ice streaming example - - audio stream filling / mp3 decoding based on ThomasS mp3 decoding example - - ASM stereo desinterleave function was made by Thoduv - -*/ - -#include -#include - -#include - -#include "helix/mp3dec.h" -#include "helix/mp3common.h" -#include "helix/real/coder.h" -#include - -// internal functions -void AS_InitMP3(); -void AS_MP3Stop(); -static void AS_StartTimer(int freq); -static void AS_SetTimer(int freq); -static void AS_StopTimer(); -void AS_RegenStream(); -void AS_RegenStreamCallback(s16 *stream, u32 numsamples); -void AS_StereoDesinterleave(s16 *input, s16 *outputL, s16 *outputR, u32 samples); -void AS_MP3ClearBuffers(); - -// variables for the mp3 player -HMP3Decoder hMP3Decoder; -MP3FrameInfo mp3FrameInfo; -u8 *readPtr; -int bytesLeft; - -s16 audioBuf[AS_DECODEBUFFER_SIZE]; // buffer for the decoded mp3 audio -int nAudioBufStart; -int nAudioBuf; -u8 stereo; - - -// the sound engine, must be called each VBlank -void AS_SoundVBL() -{ - int i; - - // adjust master volume - if(IPC_Sound->chan[0].cmd & SNDCMD_SETMASTERVOLUME) { - REG_MASTER_VOLUME = SOUND_VOL(IPC_Sound->volume & 127); - IPC_Sound->chan[0].cmd &= ~SNDCMD_SETMASTERVOLUME; - } - - // manage sounds - for(i = 0; i < 16; i++) { - - if(IPC_Sound->chan[i].cmd & SNDCMD_DELAY) - { - if(IPC_Sound->chan[i].snd.delay == 0) { - IPC_Sound->chan[i].cmd &= ~SNDCMD_DELAY; - IPC_Sound->chan[i].cmd |= SNDCMD_PLAY; - } else { - IPC_Sound->chan[i].snd.delay -= 1; - } - } - - if(IPC_Sound->chan[i].cmd & SNDCMD_STOP) - { - SCHANNEL_CR(i) = 0; - IPC_Sound->chan[i].cmd &= ~SNDCMD_STOP; - } - - if(IPC_Sound->chan[i].cmd & SNDCMD_PLAY) - { - SCHANNEL_TIMER(i) = 0x10000 - (0x1000000 / IPC_Sound->chan[i].snd.rate); - SCHANNEL_SOURCE(i) = (u32)IPC_Sound->chan[i].snd.data; - SCHANNEL_REPEAT_POINT(i) = 0; - SCHANNEL_LENGTH(i) = IPC_Sound->chan[i].snd.size >> 2 ; - SCHANNEL_CR(i) = SCHANNEL_ENABLE | ((SOUND_ONE_SHOT) >> (IPC_Sound->chan[i].snd.loop)) | SOUND_VOL(IPC_Sound->chan[i].volume & 127) | SOUND_PAN(IPC_Sound->chan[i].pan & 127) | ((IPC_Sound->chan[i].snd.format) << 29); - IPC_Sound->chan[i].cmd &= ~SNDCMD_PLAY; - } - - if(IPC_Sound->chan[i].cmd & SNDCMD_SETVOLUME) - { - SCHANNEL_VOL(i) = IPC_Sound->chan[i].volume & 127; - IPC_Sound->chan[i].cmd &= ~SNDCMD_SETVOLUME; - } - - if(IPC_Sound->chan[i].cmd & SNDCMD_SETPAN) - { - SCHANNEL_PAN(i) = IPC_Sound->chan[i].pan & 127; - IPC_Sound->chan[i].cmd &= ~SNDCMD_SETPAN; - } - - if(IPC_Sound->chan[i].cmd & SNDCMD_SETRATE) - { - SCHANNEL_TIMER(i) = 0x10000 - (0x1000000 / IPC_Sound->chan[i].snd.rate); - IPC_Sound->chan[i].cmd &= ~SNDCMD_SETRATE; - } - - IPC_Sound->chan[i].busy = SCHANNEL_CR(i) >> 31; - } -} - -// the mp3 decoding engine, must be called on a regular basis (like after VBlank) -void AS_MP3Engine() -{ - s32 curtimer, numsamples; - - // All MP3 handling code needs to go here to avoid race conditions - - if (IPC_Sound->mp3.cmd & MP3CMD_INIT) - { - AS_InitMP3(); - IPC_Sound->mp3.cmd &= ~MP3CMD_INIT; - } - - if (IPC_Sound->mp3.cmd & MP3CMD_SETRATE) - { - IPC_Sound->mp3.cmd &= ~MP3CMD_SETRATE; - AS_SetTimer(IPC_Sound->mp3.rate); - SCHANNEL_TIMER(IPC_Sound->mp3.channelL) = 0x10000 - (0x1000000 / IPC_Sound->mp3.rate); - SCHANNEL_TIMER(IPC_Sound->mp3.channelR) = 0x10000 - (0x1000000 / IPC_Sound->mp3.rate); - } - - if (IPC_Sound->mp3.cmd & MP3CMD_PAUSE) - { - IPC_Sound->mp3.cmd &= ~MP3CMD_PAUSE; - - // disable mp3 channels - SCHANNEL_CR(IPC_Sound->mp3.channelL) = 0; - SCHANNEL_CR(IPC_Sound->mp3.channelR) = 0; - AS_StopTimer(); - - // then wait for the restart - IPC_Sound->mp3.cmd |= MP3CMD_WAITING; - IPC_Sound->mp3.state = MP3ST_PAUSED; - - } - - if (IPC_Sound->mp3.cmd & MP3CMD_STOP) - { - IPC_Sound->mp3.cmd &= ~MP3CMD_STOP; - AS_MP3Stop(); - return; - } - - if (IPC_Sound->mp3.cmd & MP3CMD_PLAY) - { - IPC_Sound->mp3.cmd &= ~MP3CMD_PLAY; - - if(IPC_Sound->mp3.state == MP3ST_PAUSED) { - - // restart on a fresh basis - IPC_Sound->mp3.prevtimer = 0; - AS_RegenStreamCallback((s16*)IPC_Sound->mp3.mixbuffer, IPC_Sound->mp3.buffersize >> 1); - IPC_Sound->mp3.soundcursor = IPC_Sound->mp3.buffersize >> 1; - AS_StartTimer(IPC_Sound->mp3.rate); - - IPC_Sound->mp3.cmd |= MP3CMD_MIX; - - } else { - - // set variables - IPC_Sound->mp3.prevtimer = 0; - IPC_Sound->mp3.numsamples = 0; - readPtr = IPC_Sound->mp3.mp3buffer; - bytesLeft = IPC_Sound->mp3.mp3filesize; - nAudioBuf = 0; - nAudioBufStart = 0; - - // find the first sync word - u32 offset = MP3FindSyncWord(readPtr, bytesLeft); - readPtr += offset; - bytesLeft -= offset; - - // gather information about the format - MP3GetNextFrameInfo(hMP3Decoder, &mp3FrameInfo, readPtr); - stereo = mp3FrameInfo.nChans >> 1; - - // fill the half of the buffer - AS_RegenStreamCallback((s16*)IPC_Sound->mp3.mixbuffer, IPC_Sound->mp3.buffersize >> 1); - IPC_Sound->mp3.soundcursor = IPC_Sound->mp3.buffersize >> 1; - - // set the mp3 to play at its original sampling rate - MP3GetLastFrameInfo(hMP3Decoder, &mp3FrameInfo); - IPC_Sound->mp3.rate = mp3FrameInfo.samprate; - AS_StartTimer(mp3FrameInfo.samprate); - - // start playing - IPC_Sound->mp3.cmd |= MP3CMD_MIX; - } - IPC_Sound->mp3.state = MP3ST_PLAYING; - - } - - // do the decoding - if (IPC_Sound->mp3.cmd & MP3CMD_MIXING) - { - curtimer = TIMER1_DATA; - - if (IPC_Sound->mp3.cmd & MP3CMD_WAITING) { - IPC_Sound->mp3.cmd &= ~MP3CMD_WAITING; - } else { - - numsamples = curtimer - IPC_Sound->mp3.prevtimer; - - if(numsamples < 0) - numsamples += 65536; - - IPC_Sound->mp3.numsamples = numsamples; - } - - IPC_Sound->mp3.prevtimer = curtimer; - AS_RegenStream(); - - IPC_Sound->mp3.soundcursor += IPC_Sound->mp3.numsamples; - if (IPC_Sound->mp3.soundcursor > IPC_Sound->mp3.buffersize) - IPC_Sound->mp3.soundcursor -= IPC_Sound->mp3.buffersize; - } - else if(IPC_Sound->mp3.cmd & MP3CMD_MIX) - { - // set up the left channel - IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.data = (u8*)IPC_Sound->mp3.mixbuffer; - IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.size = IPC_Sound->mp3.buffersize << 1; - IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.format = AS_PCM_16BIT; - IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.rate = IPC_Sound->mp3.rate; - IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.loop = true; - IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.delay = 0; - IPC_Sound->chan[IPC_Sound->mp3.channelL].cmd |= SNDCMD_PLAY; - - // set up the right channel - IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.data = (stereo ? (u8*)IPC_Sound->mp3.mixbuffer + (IPC_Sound->mp3.buffersize << 1) : (u8*)IPC_Sound->mp3.mixbuffer); - IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.size = IPC_Sound->mp3.buffersize << 1; - IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.format = AS_PCM_16BIT; - IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.rate = IPC_Sound->mp3.rate; - IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.loop = true; - IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.delay = IPC_Sound->mp3.delay; - IPC_Sound->chan[IPC_Sound->mp3.channelR].cmd |= SNDCMD_DELAY; - - IPC_Sound->mp3.cmd &= ~MP3CMD_MIX; - IPC_Sound->mp3.cmd |= MP3CMD_MIXING; - } -} - -void AS_StartTimer(int freq) -{ - if(freq == 0) - return; - - TIMER1_CR = 0; - TIMER0_CR = 0; - - TIMER0_DATA = 0x10000 - (0x1000000 / freq) * 2; - TIMER1_DATA = 0; - - TIMER1_CR = TIMER_ENABLE | TIMER_CASCADE | TIMER_DIV_1; - TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1; -} - -// set timer to the given period -void AS_SetTimer(int freq) -{ - if(freq == 0) - return; - - // Timer 0 is the one that controls the frequency, timer 1 is used as a - // reference to know how many samples need to be generated. It is - // important to not reset it to 0 or the decoder loop won't know how - // much to decode next time. - TIMER0_DATA = 0x10000 - (0x1000000 / freq) * 2; - //TIMER1_DATA = 0; -} - -void AS_StopTimer() -{ - TIMER1_CR = 0; - TIMER0_CR = 0; -} - -// clear some buffers to avoid clicking on new mp3 start -inline void AS_MP3ClearBuffers(){ - MP3DecInfo *mp3DecInfo = (MP3DecInfo*)hMP3Decoder; - memset(mp3DecInfo->FrameHeaderPS, 0, sizeof(FrameHeader)); - memset(mp3DecInfo->SideInfoPS, 0, sizeof(SideInfo)); - memset(mp3DecInfo->ScaleFactorInfoPS, 0, sizeof(ScaleFactorInfo)); - memset(mp3DecInfo->HuffmanInfoPS, 0, sizeof(HuffmanInfo)); - memset(mp3DecInfo->DequantInfoPS, 0, sizeof(DequantInfo)); - memset(mp3DecInfo->IMDCTInfoPS, 0, sizeof(IMDCTInfo)); - memset(mp3DecInfo->SubbandInfoPS, 0, sizeof(SubbandInfo)); - memset(mp3DecInfo->IMDCTInfoPS, 0, sizeof(IMDCTInfo)); - memset(mp3DecInfo->SubbandInfoPS, 0, sizeof(SubbandInfo)); -} - -// fill the given stream buffer with numsamples samples. (based on ThomasS code) -void AS_RegenStreamCallback(s16 *stream, u32 numsamples) -{ - int outSample, restSample, minSamples, offset, err; - outSample = 0; - - // fill buffered data into stream - minSamples = MIN(nAudioBuf, (int)numsamples); - if (minSamples > 0) { - - // copy data from audioBuf to stream - numsamples -= minSamples; - - if(stereo) - AS_StereoDesinterleave(audioBuf + nAudioBufStart, stream + outSample, stream + outSample + IPC_Sound->mp3.buffersize, minSamples); - else - memcpy(stream + outSample, audioBuf + nAudioBufStart, minSamples * sizeof(s16)); - - outSample += minSamples; - - nAudioBufStart += (stereo ? minSamples << 1 : minSamples); - nAudioBuf -= minSamples; - - if (nAudioBuf <= 0) { - nAudioBufStart = 0; - nAudioBuf = 0; - } - } - - // if more data is still needed then decode some mp3 frames - if (numsamples > 0) { - - // if mp3 is set to loop indefinitely, don't bother with how many data is left - if((bytesLeft < 2*MAINBUF_SIZE) && IPC_Sound->mp3.loop && IPC_Sound->mp3.stream) - bytesLeft += IPC_Sound->mp3.mp3filesize; - - // decode a mp3 frame to outBuf - do { - - // find the start of the next MP3 frame (assume EOF if no sync found) - offset = MP3FindSyncWord(readPtr, bytesLeft); - if (offset < 0) { - - // if mp3 is set to loop & no frame is found, retry from the start - if(IPC_Sound->mp3.loop && !IPC_Sound->mp3.stream) { - bytesLeft = IPC_Sound->mp3.mp3filesize; - readPtr = IPC_Sound->mp3.mp3buffer; - offset = MP3FindSyncWord(readPtr, bytesLeft); - } else { - AS_MP3Stop(); - IPC_Sound->mp3.state = MP3ST_OUT_OF_DATA; - } - return; - } - readPtr += offset; - bytesLeft -= offset; - - // decode one MP3 frame to the audio buffer - err = MP3Decode(hMP3Decoder, &readPtr, &bytesLeft, audioBuf, 0); - if (err) { - AS_MP3Stop(); - IPC_Sound->mp3.state = MP3ST_DECODE_ERROR; - return; - } - - // copy the decoded data to the stream - MP3GetLastFrameInfo(hMP3Decoder, &mp3FrameInfo); - if(stereo) - mp3FrameInfo.outputSamps = mp3FrameInfo.outputSamps >> 1; - - minSamples = MIN(mp3FrameInfo.outputSamps, (int)numsamples); - restSample = mp3FrameInfo.outputSamps - numsamples; - numsamples -= minSamples; - - if(stereo) - AS_StereoDesinterleave(audioBuf, stream + outSample, stream + outSample + IPC_Sound->mp3.buffersize, minSamples); - else - memcpy(stream + outSample, audioBuf, minSamples * sizeof(s16)); - - outSample += minSamples; - - // if still more data is needed, then decode the next frame - } while (numsamples > 0); - - // set the rest of the decoded data to be used for the next frame - nAudioBufStart = (stereo ? minSamples << 1 : minSamples); - nAudioBuf = restSample; - } - - // check if we moved onto the 2nd file data buffer, if so move it to the 1st one and request a refill - if(IPC_Sound->mp3.stream && (readPtr >= IPC_Sound->mp3.mp3buffer + IPC_Sound->mp3.mp3buffersize )) { - memcpy(IPC_Sound->mp3.mp3buffer, IPC_Sound->mp3.mp3buffer + IPC_Sound->mp3.mp3buffersize, IPC_Sound->mp3.mp3buffersize); - readPtr = readPtr - IPC_Sound->mp3.mp3buffersize; - IPC_Sound->mp3.needdata = true; - } - -} - -// regenerate the sound stream into the ring buffer. -void AS_RegenStream() -{ - int remain; - - // decode data to the ring buffer - if((IPC_Sound->mp3.soundcursor + IPC_Sound->mp3.numsamples) >= IPC_Sound->mp3.buffersize) { - - AS_RegenStreamCallback((s16*)&IPC_Sound->mp3.mixbuffer[IPC_Sound->mp3.soundcursor << 1], IPC_Sound->mp3.buffersize - IPC_Sound->mp3.soundcursor); - remain = IPC_Sound->mp3.numsamples - (IPC_Sound->mp3.buffersize - IPC_Sound->mp3.soundcursor); - AS_RegenStreamCallback((s16*)IPC_Sound->mp3.mixbuffer, remain); - - } else { - - AS_RegenStreamCallback((s16*)&IPC_Sound->mp3.mixbuffer[IPC_Sound->mp3.soundcursor << 1], IPC_Sound->mp3.numsamples); - } -} - -// stop playing the mp3 -void AS_MP3Stop() -{ - SCHANNEL_CR(IPC_Sound->mp3.channelL) = 0; - SCHANNEL_CR(IPC_Sound->mp3.channelR) = 0; - AS_StopTimer(); - IPC_Sound->mp3.rate = 0; - IPC_Sound->mp3.cmd = MP3CMD_NONE; - IPC_Sound->mp3.state = MP3ST_STOPPED; - AS_MP3ClearBuffers(); -} - -// initialize the mp3 system -void AS_InitMP3() -{ - // init the timers - AS_StopTimer(); - - // wait for the arm 9 to allocate data on main ram - while( !(IPC_Sound->mp3.cmd & MP3CMD_ARM9ALLOCDONE) ) - swiWaitForVBlank(); - - // init the helix mp3 decoder - hMP3Decoder = MP3InitDecoder(IPC_Sound->mp3.alloc_ram); -} - -// initialize the main system -void AS_Init() -{ - // clear the sound structure - memset(IPC_Sound, 0, sizeof(IPC_SoundSystem)); - - // get the needed allocation size for the mp3 decoder - IPC_Sound->mp3.alloc_ram = (void*)getAllocationSize(); - - // tell the arm9 that we are ready - IPC_Sound->chan[0].cmd = SNDCMD_ARM7READY; -} - -// desinterleave a stereo source (thanks to Thoduv for the code) -asm ( -"@--------------------------------------------------------------------------------------\n" -" .text \n" -" .arm \n" -" \n" -"@ desinterleave an mp3 stereo source \n" -"@ r0 = interleaved data, r1 = left, r2 = right, r3 = len \n" -" \n" -" .global AS_StereoDesinterleave \n" -" \n" -"AS_StereoDesinterleave: \n" -" stmfd sp!, {r4-r11} \n" -" \n" -"_loop: \n" -" \n" -" ldmia r0!, {r4-r12} \n" -" \n" -" strh r4, [r1], #2 \n" -" mov r4, r4, lsr #16 \n" -" strh r4, [r2], #2 \n" -" subs r3, #1 \n" -" beq _done \n" -" \n" -" strh r5, [r1], #2 \n" -" mov r5, r5, lsr #16 \n" -" strh r5, [r2], #2 \n" -" subs r3, #1 \n" -" beq _done \n" -" \n" -" strh r6, [r1], #2 \n" -" mov r6, r6, lsr #16 \n" -" strh r6, [r2], #2 \n" -" subs r3, #1 \n" -" beq _done \n" -" \n" -" strh r7, [r1], #2 \n" -" mov r7, r7, lsr #16 \n" -" strh r7, [r2], #2 \n" -" subs r3, #1 \n" -" beq _done \n" -" \n" -" strh r8, [r1], #2 \n" -" mov r8, r8, lsr #16 \n" -" strh r8, [r2], #2 \n" -" subs r3, #1 \n" -" beq _done \n" -" \n" -" strh r9, [r1], #2 \n" -" mov r9, r9, lsr #16 \n" -" strh r9, [r2], #2 \n" -" subs r3, #1 \n" -" beq _done \n" -" \n" -" strh r10, [r1], #2 \n" -" mov r10, r10, lsr #16 \n" -" strh r10, [r2], #2 \n" -" subs r3, #1 \n" -" beq _done \n" -" \n" -" strh r11, [r1], #2 \n" -" mov r11, r11, lsr #16 \n" -" strh r11, [r2], #2 \n" -" subs r3, #1 \n" -" beq _done \n" -" \n" -" strh r12, [r1], #2 \n" -" mov r12, r12, lsr #16 \n" -" strh r12, [r2], #2 \n" -" subs r3, #1 \n" -" bne _loop \n" -"_done: \n" -" \n" -" ldmia sp!, {r4-r11} \n" -" bx lr \n" -"@--------------------------------------------------------------------------------------\n" -); +/* + + Advanced Sound Library (ASlib) + ------------------------------ + + file : sound7.c + author : Lasorsa Yohan (Noda) + description : ARM7 sound functions + + history : + + 02/12/2007 - v1.0 + = Original release + + 21/12/2007 - v1.1 + = corrected arm7/amr9 initialization (fix M3S/R4 problems) + = fixed stereo detection problem (thanks to ThomasS) + + + credits : + - IPC sound system and streaming is based on cold_as_ice streaming example + - audio stream filling / mp3 decoding based on ThomasS mp3 decoding example + - ASM stereo desinterleave function was made by Thoduv + +*/ + +#include +#include + +#include + +#include "helix/mp3dec.h" +#include "helix/mp3common.h" +#include "helix/real/coder.h" +#include + +// internal functions +void AS_InitMP3(); +void AS_MP3Stop(); +static void AS_StartTimer(int freq); +static void AS_SetTimer(int freq); +static void AS_StopTimer(); +void AS_RegenStream(); +void AS_RegenStreamCallback(s16 *stream, u32 numsamples); +void AS_StereoDesinterleave(s16 *input, s16 *outputL, s16 *outputR, u32 samples); +void AS_MP3ClearBuffers(); + +// variables for the mp3 player +HMP3Decoder hMP3Decoder; +MP3FrameInfo mp3FrameInfo; +u8 *readPtr; +int bytesLeft; + +s16 audioBuf[AS_DECODEBUFFER_SIZE]; // buffer for the decoded mp3 audio +int nAudioBufStart; +int nAudioBuf; +u8 stereo; + + +// the sound engine, must be called each VBlank +void AS_SoundVBL() +{ + int i; + + // adjust master volume + if(IPC_Sound->chan[0].cmd & SNDCMD_SETMASTERVOLUME) { + REG_MASTER_VOLUME = SOUND_VOL(IPC_Sound->volume & 127); + IPC_Sound->chan[0].cmd &= ~SNDCMD_SETMASTERVOLUME; + } + + // manage sounds + for(i = 0; i < 16; i++) { + + if(IPC_Sound->chan[i].cmd & SNDCMD_DELAY) + { + if(IPC_Sound->chan[i].snd.delay == 0) { + IPC_Sound->chan[i].cmd &= ~SNDCMD_DELAY; + IPC_Sound->chan[i].cmd |= SNDCMD_PLAY; + } else { + IPC_Sound->chan[i].snd.delay -= 1; + } + } + + if(IPC_Sound->chan[i].cmd & SNDCMD_STOP) + { + SCHANNEL_CR(i) = 0; + IPC_Sound->chan[i].cmd &= ~SNDCMD_STOP; + } + + if(IPC_Sound->chan[i].cmd & SNDCMD_PLAY) + { + SCHANNEL_TIMER(i) = 0x10000 - (0x1000000 / IPC_Sound->chan[i].snd.rate); + SCHANNEL_SOURCE(i) = (u32)IPC_Sound->chan[i].snd.data; + SCHANNEL_REPEAT_POINT(i) = 0; + SCHANNEL_LENGTH(i) = IPC_Sound->chan[i].snd.size >> 2 ; + SCHANNEL_CR(i) = SCHANNEL_ENABLE | ((SOUND_ONE_SHOT) >> (IPC_Sound->chan[i].snd.loop)) | SOUND_VOL(IPC_Sound->chan[i].volume & 127) | SOUND_PAN(IPC_Sound->chan[i].pan & 127) | ((IPC_Sound->chan[i].snd.format) << 29); + IPC_Sound->chan[i].cmd &= ~SNDCMD_PLAY; + } + + if(IPC_Sound->chan[i].cmd & SNDCMD_SETVOLUME) + { + SCHANNEL_VOL(i) = IPC_Sound->chan[i].volume & 127; + IPC_Sound->chan[i].cmd &= ~SNDCMD_SETVOLUME; + } + + if(IPC_Sound->chan[i].cmd & SNDCMD_SETPAN) + { + SCHANNEL_PAN(i) = IPC_Sound->chan[i].pan & 127; + IPC_Sound->chan[i].cmd &= ~SNDCMD_SETPAN; + } + + if(IPC_Sound->chan[i].cmd & SNDCMD_SETRATE) + { + SCHANNEL_TIMER(i) = 0x10000 - (0x1000000 / IPC_Sound->chan[i].snd.rate); + IPC_Sound->chan[i].cmd &= ~SNDCMD_SETRATE; + } + + IPC_Sound->chan[i].busy = SCHANNEL_CR(i) >> 31; + } +} + +// the mp3 decoding engine, must be called on a regular basis (like after VBlank) +void AS_MP3Engine() +{ + s32 curtimer, numsamples; + + // All MP3 handling code needs to go here to avoid race conditions + + if (IPC_Sound->mp3.cmd & MP3CMD_INIT) + { + AS_InitMP3(); + IPC_Sound->mp3.cmd &= ~MP3CMD_INIT; + } + + if (IPC_Sound->mp3.cmd & MP3CMD_SETRATE) + { + IPC_Sound->mp3.cmd &= ~MP3CMD_SETRATE; + AS_SetTimer(IPC_Sound->mp3.rate); + SCHANNEL_TIMER(IPC_Sound->mp3.channelL) = 0x10000 - (0x1000000 / IPC_Sound->mp3.rate); + SCHANNEL_TIMER(IPC_Sound->mp3.channelR) = 0x10000 - (0x1000000 / IPC_Sound->mp3.rate); + } + + if (IPC_Sound->mp3.cmd & MP3CMD_PAUSE) + { + IPC_Sound->mp3.cmd &= ~MP3CMD_PAUSE; + + // disable mp3 channels + SCHANNEL_CR(IPC_Sound->mp3.channelL) = 0; + SCHANNEL_CR(IPC_Sound->mp3.channelR) = 0; + AS_StopTimer(); + + // then wait for the restart + IPC_Sound->mp3.cmd |= MP3CMD_WAITING; + IPC_Sound->mp3.state = MP3ST_PAUSED; + + } + + if (IPC_Sound->mp3.cmd & MP3CMD_STOP) + { + IPC_Sound->mp3.cmd &= ~MP3CMD_STOP; + AS_MP3Stop(); + return; + } + + if (IPC_Sound->mp3.cmd & MP3CMD_PLAY) + { + IPC_Sound->mp3.cmd &= ~MP3CMD_PLAY; + + if(IPC_Sound->mp3.state == MP3ST_PAUSED) { + + // restart on a fresh basis + IPC_Sound->mp3.prevtimer = 0; + AS_RegenStreamCallback((s16*)IPC_Sound->mp3.mixbuffer, IPC_Sound->mp3.buffersize >> 1); + IPC_Sound->mp3.soundcursor = IPC_Sound->mp3.buffersize >> 1; + AS_StartTimer(IPC_Sound->mp3.rate); + + IPC_Sound->mp3.cmd |= MP3CMD_MIX; + + } else { + + // set variables + IPC_Sound->mp3.prevtimer = 0; + IPC_Sound->mp3.numsamples = 0; + readPtr = IPC_Sound->mp3.mp3buffer; + bytesLeft = IPC_Sound->mp3.mp3filesize; + nAudioBuf = 0; + nAudioBufStart = 0; + + // find the first sync word + u32 offset = MP3FindSyncWord(readPtr, bytesLeft); + readPtr += offset; + bytesLeft -= offset; + + // gather information about the format + MP3GetNextFrameInfo(hMP3Decoder, &mp3FrameInfo, readPtr); + stereo = mp3FrameInfo.nChans >> 1; + + // fill the half of the buffer + AS_RegenStreamCallback((s16*)IPC_Sound->mp3.mixbuffer, IPC_Sound->mp3.buffersize >> 1); + IPC_Sound->mp3.soundcursor = IPC_Sound->mp3.buffersize >> 1; + + // set the mp3 to play at its original sampling rate + MP3GetLastFrameInfo(hMP3Decoder, &mp3FrameInfo); + IPC_Sound->mp3.rate = mp3FrameInfo.samprate; + AS_StartTimer(mp3FrameInfo.samprate); + + // start playing + IPC_Sound->mp3.cmd |= MP3CMD_MIX; + } + IPC_Sound->mp3.state = MP3ST_PLAYING; + + } + + // do the decoding + if (IPC_Sound->mp3.cmd & MP3CMD_MIXING) + { + curtimer = TIMER1_DATA; + + if (IPC_Sound->mp3.cmd & MP3CMD_WAITING) { + IPC_Sound->mp3.cmd &= ~MP3CMD_WAITING; + } else { + + numsamples = curtimer - IPC_Sound->mp3.prevtimer; + + if(numsamples < 0) + numsamples += 65536; + + IPC_Sound->mp3.numsamples = numsamples; + } + + IPC_Sound->mp3.prevtimer = curtimer; + AS_RegenStream(); + + IPC_Sound->mp3.soundcursor += IPC_Sound->mp3.numsamples; + if (IPC_Sound->mp3.soundcursor > IPC_Sound->mp3.buffersize) + IPC_Sound->mp3.soundcursor -= IPC_Sound->mp3.buffersize; + } + else if(IPC_Sound->mp3.cmd & MP3CMD_MIX) + { + // set up the left channel + IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.data = (u8*)IPC_Sound->mp3.mixbuffer; + IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.size = IPC_Sound->mp3.buffersize << 1; + IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.format = AS_PCM_16BIT; + IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.rate = IPC_Sound->mp3.rate; + IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.loop = true; + IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.delay = 0; + IPC_Sound->chan[IPC_Sound->mp3.channelL].cmd |= SNDCMD_PLAY; + + // set up the right channel + IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.data = (stereo ? (u8*)IPC_Sound->mp3.mixbuffer + (IPC_Sound->mp3.buffersize << 1) : (u8*)IPC_Sound->mp3.mixbuffer); + IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.size = IPC_Sound->mp3.buffersize << 1; + IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.format = AS_PCM_16BIT; + IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.rate = IPC_Sound->mp3.rate; + IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.loop = true; + IPC_Sound->chan[IPC_Sound->mp3.channelR].snd.delay = IPC_Sound->mp3.delay; + IPC_Sound->chan[IPC_Sound->mp3.channelR].cmd |= SNDCMD_DELAY; + + IPC_Sound->mp3.cmd &= ~MP3CMD_MIX; + IPC_Sound->mp3.cmd |= MP3CMD_MIXING; + } +} + +void AS_StartTimer(int freq) +{ + if(freq == 0) + return; + + TIMER1_CR = 0; + TIMER0_CR = 0; + + TIMER0_DATA = 0x10000 - (0x1000000 / freq) * 2; + TIMER1_DATA = 0; + + TIMER1_CR = TIMER_ENABLE | TIMER_CASCADE | TIMER_DIV_1; + TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1; +} + +// set timer to the given period +void AS_SetTimer(int freq) +{ + if(freq == 0) + return; + + // Timer 0 is the one that controls the frequency, timer 1 is used as a + // reference to know how many samples need to be generated. It is + // important to not reset it to 0 or the decoder loop won't know how + // much to decode next time. + TIMER0_DATA = 0x10000 - (0x1000000 / freq) * 2; + //TIMER1_DATA = 0; +} + +void AS_StopTimer() +{ + TIMER1_CR = 0; + TIMER0_CR = 0; +} + +// clear some buffers to avoid clicking on new mp3 start +inline void AS_MP3ClearBuffers(){ + MP3DecInfo *mp3DecInfo = (MP3DecInfo*)hMP3Decoder; + memset(mp3DecInfo->FrameHeaderPS, 0, sizeof(FrameHeader)); + memset(mp3DecInfo->SideInfoPS, 0, sizeof(SideInfo)); + memset(mp3DecInfo->ScaleFactorInfoPS, 0, sizeof(ScaleFactorInfo)); + memset(mp3DecInfo->HuffmanInfoPS, 0, sizeof(HuffmanInfo)); + memset(mp3DecInfo->DequantInfoPS, 0, sizeof(DequantInfo)); + memset(mp3DecInfo->IMDCTInfoPS, 0, sizeof(IMDCTInfo)); + memset(mp3DecInfo->SubbandInfoPS, 0, sizeof(SubbandInfo)); + memset(mp3DecInfo->IMDCTInfoPS, 0, sizeof(IMDCTInfo)); + memset(mp3DecInfo->SubbandInfoPS, 0, sizeof(SubbandInfo)); +} + +// fill the given stream buffer with numsamples samples. (based on ThomasS code) +void AS_RegenStreamCallback(s16 *stream, u32 numsamples) +{ + int outSample, restSample, minSamples, offset, err; + outSample = 0; + + // fill buffered data into stream + minSamples = MIN(nAudioBuf, (int)numsamples); + if (minSamples > 0) { + + // copy data from audioBuf to stream + numsamples -= minSamples; + + if(stereo) + AS_StereoDesinterleave(audioBuf + nAudioBufStart, stream + outSample, stream + outSample + IPC_Sound->mp3.buffersize, minSamples); + else + memcpy(stream + outSample, audioBuf + nAudioBufStart, minSamples * sizeof(s16)); + + outSample += minSamples; + + nAudioBufStart += (stereo ? minSamples << 1 : minSamples); + nAudioBuf -= minSamples; + + if (nAudioBuf <= 0) { + nAudioBufStart = 0; + nAudioBuf = 0; + } + } + + // if more data is still needed then decode some mp3 frames + if (numsamples > 0) { + + // if mp3 is set to loop indefinitely, don't bother with how many data is left + if((bytesLeft < 2*MAINBUF_SIZE) && IPC_Sound->mp3.loop && IPC_Sound->mp3.stream) + bytesLeft += IPC_Sound->mp3.mp3filesize; + + // decode a mp3 frame to outBuf + do { + + // find the start of the next MP3 frame (assume EOF if no sync found) + offset = MP3FindSyncWord(readPtr, bytesLeft); + if (offset < 0) { + + // if mp3 is set to loop & no frame is found, retry from the start + if(IPC_Sound->mp3.loop && !IPC_Sound->mp3.stream) { + bytesLeft = IPC_Sound->mp3.mp3filesize; + readPtr = IPC_Sound->mp3.mp3buffer; + offset = MP3FindSyncWord(readPtr, bytesLeft); + } else { + AS_MP3Stop(); + IPC_Sound->mp3.state = MP3ST_OUT_OF_DATA; + } + return; + } + readPtr += offset; + bytesLeft -= offset; + + // decode one MP3 frame to the audio buffer + err = MP3Decode(hMP3Decoder, &readPtr, &bytesLeft, audioBuf, 0); + if (err) { + AS_MP3Stop(); + IPC_Sound->mp3.state = MP3ST_DECODE_ERROR; + return; + } + + // copy the decoded data to the stream + MP3GetLastFrameInfo(hMP3Decoder, &mp3FrameInfo); + if(stereo) + mp3FrameInfo.outputSamps = mp3FrameInfo.outputSamps >> 1; + + minSamples = MIN(mp3FrameInfo.outputSamps, (int)numsamples); + restSample = mp3FrameInfo.outputSamps - numsamples; + numsamples -= minSamples; + + if(stereo) + AS_StereoDesinterleave(audioBuf, stream + outSample, stream + outSample + IPC_Sound->mp3.buffersize, minSamples); + else + memcpy(stream + outSample, audioBuf, minSamples * sizeof(s16)); + + outSample += minSamples; + + // if still more data is needed, then decode the next frame + } while (numsamples > 0); + + // set the rest of the decoded data to be used for the next frame + nAudioBufStart = (stereo ? minSamples << 1 : minSamples); + nAudioBuf = restSample; + } + + // check if we moved onto the 2nd file data buffer, if so move it to the 1st one and request a refill + if(IPC_Sound->mp3.stream && (readPtr >= IPC_Sound->mp3.mp3buffer + IPC_Sound->mp3.mp3buffersize )) { + memcpy(IPC_Sound->mp3.mp3buffer, IPC_Sound->mp3.mp3buffer + IPC_Sound->mp3.mp3buffersize, IPC_Sound->mp3.mp3buffersize); + readPtr = readPtr - IPC_Sound->mp3.mp3buffersize; + IPC_Sound->mp3.needdata = true; + } + +} + +// regenerate the sound stream into the ring buffer. +void AS_RegenStream() +{ + int remain; + + // decode data to the ring buffer + if((IPC_Sound->mp3.soundcursor + IPC_Sound->mp3.numsamples) >= IPC_Sound->mp3.buffersize) { + + AS_RegenStreamCallback((s16*)&IPC_Sound->mp3.mixbuffer[IPC_Sound->mp3.soundcursor << 1], IPC_Sound->mp3.buffersize - IPC_Sound->mp3.soundcursor); + remain = IPC_Sound->mp3.numsamples - (IPC_Sound->mp3.buffersize - IPC_Sound->mp3.soundcursor); + AS_RegenStreamCallback((s16*)IPC_Sound->mp3.mixbuffer, remain); + + } else { + + AS_RegenStreamCallback((s16*)&IPC_Sound->mp3.mixbuffer[IPC_Sound->mp3.soundcursor << 1], IPC_Sound->mp3.numsamples); + } +} + +// stop playing the mp3 +void AS_MP3Stop() +{ + SCHANNEL_CR(IPC_Sound->mp3.channelL) = 0; + SCHANNEL_CR(IPC_Sound->mp3.channelR) = 0; + AS_StopTimer(); + IPC_Sound->mp3.rate = 0; + IPC_Sound->mp3.cmd = MP3CMD_NONE; + IPC_Sound->mp3.state = MP3ST_STOPPED; + AS_MP3ClearBuffers(); +} + +// initialize the mp3 system +void AS_InitMP3() +{ + // init the timers + AS_StopTimer(); + + // wait for the arm 9 to allocate data on main ram + while( !(IPC_Sound->mp3.cmd & MP3CMD_ARM9ALLOCDONE) ) + swiWaitForVBlank(); + + // init the helix mp3 decoder + hMP3Decoder = MP3InitDecoder(IPC_Sound->mp3.alloc_ram); +} + +// initialize the main system +void AS_Init() +{ + // clear the sound structure + memset(IPC_Sound, 0, sizeof(IPC_SoundSystem)); + + // get the needed allocation size for the mp3 decoder + IPC_Sound->mp3.alloc_ram = (void*)getAllocationSize(); + + // tell the arm9 that we are ready + IPC_Sound->chan[0].cmd = SNDCMD_ARM7READY; +} + +// desinterleave a stereo source (thanks to Thoduv for the code) +asm ( +"@--------------------------------------------------------------------------------------\n" +" .text \n" +" .arm \n" +" \n" +"@ desinterleave an mp3 stereo source \n" +"@ r0 = interleaved data, r1 = left, r2 = right, r3 = len \n" +" \n" +" .global AS_StereoDesinterleave \n" +" \n" +"AS_StereoDesinterleave: \n" +" stmfd sp!, {r4-r11} \n" +" \n" +"_loop: \n" +" \n" +" ldmia r0!, {r4-r12} \n" +" \n" +" strh r4, [r1], #2 \n" +" mov r4, r4, lsr #16 \n" +" strh r4, [r2], #2 \n" +" subs r3, #1 \n" +" beq _done \n" +" \n" +" strh r5, [r1], #2 \n" +" mov r5, r5, lsr #16 \n" +" strh r5, [r2], #2 \n" +" subs r3, #1 \n" +" beq _done \n" +" \n" +" strh r6, [r1], #2 \n" +" mov r6, r6, lsr #16 \n" +" strh r6, [r2], #2 \n" +" subs r3, #1 \n" +" beq _done \n" +" \n" +" strh r7, [r1], #2 \n" +" mov r7, r7, lsr #16 \n" +" strh r7, [r2], #2 \n" +" subs r3, #1 \n" +" beq _done \n" +" \n" +" strh r8, [r1], #2 \n" +" mov r8, r8, lsr #16 \n" +" strh r8, [r2], #2 \n" +" subs r3, #1 \n" +" beq _done \n" +" \n" +" strh r9, [r1], #2 \n" +" mov r9, r9, lsr #16 \n" +" strh r9, [r2], #2 \n" +" subs r3, #1 \n" +" beq _done \n" +" \n" +" strh r10, [r1], #2 \n" +" mov r10, r10, lsr #16 \n" +" strh r10, [r2], #2 \n" +" subs r3, #1 \n" +" beq _done \n" +" \n" +" strh r11, [r1], #2 \n" +" mov r11, r11, lsr #16 \n" +" strh r11, [r2], #2 \n" +" subs r3, #1 \n" +" beq _done \n" +" \n" +" strh r12, [r1], #2 \n" +" mov r12, r12, lsr #16 \n" +" strh r12, [r2], #2 \n" +" subs r3, #1 \n" +" bne _loop \n" +"_done: \n" +" \n" +" ldmia sp!, {r4-r11} \n" +" bx lr \n" +"@--------------------------------------------------------------------------------------\n" +); diff --git a/source/arm7/helix/license.txt b/source/arm7/helix/license.txt index 2f06404..12e5372 100644 --- a/source/arm7/helix/license.txt +++ b/source/arm7/helix/license.txt @@ -1,30 +1,30 @@ - Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. - - The contents of this directory, and (except where otherwise - indicated) the directories included within this directory, are - subject to the current version of the RealNetworks Public Source - License (the "RPSL") available at RPSL.txt in this directory, unless - you have licensed the directory under the current version of the - RealNetworks Community Source License (the "RCSL") available at - RCSL.txt in this directory, in which case the RCSL will apply. You - may also obtain the license terms directly from RealNetworks. You - may not use the files in this directory except in compliance with the - RPSL or, if you have a valid RCSL with RealNetworks applicable to - this directory, the RCSL. Please see the applicable RPSL or RCSL for - the rights, obligations and limitations governing use of the contents - of the directory. - - This directory is part of the Helix DNA Technology. RealNetworks is - the developer of the Original Code and owns the copyrights in the - portions it created. - - This directory, and the directories included with this directory, are - distributed and made available on an 'AS IS' basis, WITHOUT WARRANTY - OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY - DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY - WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - QUIET ENJOYMENT OR NON-INFRINGEMENT. - - Technology Compatibility Kit Test Suite(s) Location: - http://www.helixcommunity.org/content/tck - + Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. + + The contents of this directory, and (except where otherwise + indicated) the directories included within this directory, are + subject to the current version of the RealNetworks Public Source + License (the "RPSL") available at RPSL.txt in this directory, unless + you have licensed the directory under the current version of the + RealNetworks Community Source License (the "RCSL") available at + RCSL.txt in this directory, in which case the RCSL will apply. You + may also obtain the license terms directly from RealNetworks. You + may not use the files in this directory except in compliance with the + RPSL or, if you have a valid RCSL with RealNetworks applicable to + this directory, the RCSL. Please see the applicable RPSL or RCSL for + the rights, obligations and limitations governing use of the contents + of the directory. + + This directory is part of the Helix DNA Technology. RealNetworks is + the developer of the Original Code and owns the copyrights in the + portions it created. + + This directory, and the directories included with this directory, are + distributed and made available on an 'AS IS' basis, WITHOUT WARRANTY + OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY + DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + QUIET ENJOYMENT OR NON-INFRINGEMENT. + + Technology Compatibility Kit Test Suite(s) Location: + http://www.helixcommunity.org/content/tck + diff --git a/source/arm7/helix/rcsl.txt b/source/arm7/helix/rcsl.txt index a545be4..a809759 100644 --- a/source/arm7/helix/rcsl.txt +++ b/source/arm7/helix/rcsl.txt @@ -1,948 +1,948 @@ -The RCSL is made up of a base agreement and a few Attachments. - -For Research and Development use, you agree to the terms of the -RCSL R&D License (base RCSL and Attachments A, B, and C) - -For Commercial Use (either distribution or internal commercial -deployment) of the Helix DNA with or without support for RealNetworks' -RealAudio and RealVideo Add-on Technology, you agree to the -terms of the same RCSL R&D license -and execute one or more additional Commercial Use License attachments -. - ------------------------------------------------------------------------- - - - REALNETWORKS COMMUNITY SOURCE LICENSE - -Version 1.2 (Rev. Date: January 22, 2003). - - - RECITALS - -Original Contributor has developed Specifications, Source Code -implementations and Executables of certain Technology; and - -Original Contributor desires to license the Technology to a large -community to facilitate research, innovation and product development -while maintaining compatibility of such products with the Technology as -delivered by Original Contributor; and - -Original Contributor desires to license certain Trademarks for the -purpose of branding products that are compatible with the relevant -Technology delivered by Original Contributor; and - -You desire to license the Technology and possibly certain Trademarks -from Original Contributor on the terms and conditions specified in this -License. - -In consideration for the mutual covenants contained herein, You and -Original Contributor agree as follows: - - - AGREEMENT - -*1. Introduction.* - -The RealNetworks Community Source License ("RCSL") and effective -attachments ("License") may include five distinct licenses: - -i) Research Use license -- License plus Attachments A, B and C only. - -ii) Commercial Use and Trademark License, which may be for Internal -Deployment Use or external distribution, or both -- License plus -Attachments A, B, C, and D. - -iii) Technology Compatibility Kit (TCK) license -- Attachment C. - -iv) Add-On Technology License (Executable) Commercial Use License --Attachment F. - -v) Add-On Technology Source Code Porting and Optimization -License-Attachment G. - -The Research Use license is effective when You click and accept this -License. The TCK is effective when You click and accept this License, -unless otherwise specified in the TCK attachments. The Commercial Use -and Trademark, Add-On Technology License, and the Add-On Technology -Source Code Porting and Optimization licenses must each be signed by You -and Original Contributor to become effective. Once effective, these -licenses and the associated requirements and responsibilities are -cumulative. Capitalized terms used in this License are defined in the -Glossary. - -*2. License Grants.* - -2.1 Original Contributor Grant. - -Subject to Your compliance with Sections 3, 8.10 and Attachment A of -this License, Original Contributor grants to You a worldwide, -royalty-free, non-exclusive license, to the extent of Original -Contributor's Intellectual Property Rights covering the Original Code, -Upgraded Code and Specifications, to do the following: - -(a) Research Use License: - -(i) use, reproduce and modify the Original Code, Upgraded Code and -Specifications to create Modifications and Reformatted Specifications -for Research Use by You; - -(ii) publish and display Original Code, Upgraded Code and Specifications -with, or as part of Modifications, as permitted under Section 3.1(b) below; - -(iii) reproduce and distribute copies of Original Code and Upgraded Code -to Licensees and students for Research Use by You; - -(iv) compile, reproduce and distribute Original Code and Upgraded Code -in Executable form, and Reformatted Specifications to anyone for -Research Use by You. - -(b) Other than the licenses expressly granted in this License, Original -Contributor retains all right, title, and interest in Original Code and -Upgraded Code and Specifications. - -2.2 Your Grants. - -(a) To Other Licensees. You hereby grant to each Licensee a license to -Your Error Corrections and Shared Modifications, of the same scope and -extent as Original Contributor's licenses under Section 2.1 a) above -relative to Research Use and Attachment D relative to Commercial Use. - -(b) To Original Contributor. You hereby grant to Original Contributor a -worldwide, royalty-free, non-exclusive, perpetual and irrevocable -license, to the extent of Your Intellectual Property Rights covering -Your Error Corrections, Shared Modifications and Reformatted -Specifications, to use, reproduce, modify, display and distribute Your -Error Corrections, Shared Modifications and Reformatted Specifications, -in any form, including the right to sublicense such rights through -multiple tiers of distribution. - -(c) Other than the licenses expressly granted in Sections 2.2(a) and (b) -above, and the restrictions set forth in Section 3.1(d)(iv) below, You -retain all right, title, and interest in Your Error Corrections, Shared -Modifications and Reformatted Specifications. - -2.3 Contributor Modifications. - -You may use, reproduce, modify, display and distribute Contributor Error -Corrections, Shared Modifications and Reformatted Specifications, -obtained by You under this License, to the same scope and extent as with -Original Code, Upgraded Code and Specifications. - -2.4 Subcontracting. - -You may deliver the Source Code of Covered Code to other Licensees -having at least a Research Use license, for the sole purpose of -furnishing development services to You in connection with Your rights -granted in this License. All such Licensees must execute appropriate -documents with respect to such work consistent with the terms of this -License, and acknowledging their work-made-for-hire status or assigning -exclusive right to the work product and associated Intellectual Property -Rights to You. - -*3. Requirements and Responsibilities*. - -3.1 Research Use License. - -As a condition of exercising the rights granted under Section 2.1(a) -above, You agree to comply with the following: - -(a) Your Contribution to the Community. All Error Corrections and Shared -Modifications which You create or contribute to are automatically -subject to the licenses granted under Section 2.2 above. You are -encouraged to license all of Your other Modifications under Section 2.2 -as Shared Modifications, but are not required to do so. You agree to -notify Original Contributor of any errors in the Specification. - -(b) Source Code Availability. You agree to provide all Your Error -Corrections to Original Contributor as soon as reasonably practicable -and, in any event, prior to Internal Deployment Use or Commercial Use, -if applicable. Original Contributor may, at its discretion, post Source -Code for Your Error Corrections and Shared Modifications on the -Community Webserver. You may also post Error Corrections and Shared -Modifications on a web-server of Your choice; provided, that You must -take reasonable precautions to ensure that only Licensees have access to -such Error Corrections and Shared Modifications. Such precautions shall -include, without limitation, a password protection scheme limited to -Licensees and a click-on, download certification of Licensee status -required of those attempting to download from the server. An example of -an acceptable certification is attached as Attachment A-2. - -(c) Notices. All Error Corrections and Shared Modifications You create -or contribute to must include a file documenting the additions and -changes You made and the date of such additions and changes. You must -also include the notice set forth in Attachment A-1 in the file header. -If it is not possible to put the notice in a particular Source Code file -due to its structure, then You must include the notice in a location -(such as a relevant directory file), where a recipient would be most -likely to look for such a notice. - -(d) Redistribution. - -(i) Source. Covered Code may be distributed in Source Code form only to -another Licensee (except for students as provided below). You may not -offer or impose any terms on any Covered Code that alter the rights, -requirements, or responsibilities of such Licensee. You may distribute -Covered Code to students for use in connection with their course work -and research projects undertaken at accredited educational institutions. -Such students need not be Licensees, but must be given a copy of the -notice set forth in Attachment A-3 and such notice must also be included -in a file header or prominent location in the Source Code made available -to such students. - -(ii) Executable. You may distribute Executable version(s) of Covered -Code to Licensees and other third parties only for the purpose of -evaluation and comment in connection with Research Use by You and under -a license of Your choice, but which limits use of such Executable -version(s) of Covered Code only to that purpose. - -(iii) Modified Class, Interface and Package Naming. In connection with -Research Use by You only, You may use Original Contributor's class, -Interface and package names only to accurately reference or invoke the -Source Code files You modify. Original Contributor grants to You a -limited license to the extent necessary for such purposes. - -(iv) You expressly agree that any distribution, in whole or in part, of -Modifications developed by You shall only be done pursuant to the terms -and conditions of this License. - -(e) Extensions. - -(i) Covered Code. You may not include any Source Code of Community Code -in any Extensions. You may include the compiled Header Files of -Community Code in an Extension provided that Your use of the Covered -Code, including Heading Files, complies with the Commercial Use License, -the TCK and all other terms of this License. - -(ii) Publication. No later than the date on which You first distribute -such Extension for Commercial Use, You must publish to the industry, on -a non-confidential basis and free of all copyright restrictions with -respect to reproduction and use, an accurate and current specification -for any Extension. In addition, You must make available an appropriate -test suite, pursuant to the same rights as the specification, -sufficiently detailed to allow any third party reasonably skilled in the -technology to produce implementations of the Extension compatible with -the specification. Such test suites must be made available as soon as -reasonably practicable but, in no event, later than ninety (90) days -after Your first Commercial Use of the Extension. You must use -reasonable efforts to promptly clarify and correct the specification and -the test suite upon written request by Original Contributor. - -(iii) Open. You agree to refrain from enforcing any Intellectual -Property Rights You may have covering any interface(s) of Your -Extension, which would prevent the implementation of such interface(s) -by Original Contributor or any Licensee. This obligation does not -prevent You from enforcing any Intellectual Property Right You have that -would otherwise be infringed by an implementation of Your Extension. - -(iv) Interface Modifications and Naming. You may not modify or add to -the GUID space * * "xxxxxxxx-0901-11d1-8B06-00A024406D59" or any other -GUID space designated by Original Contributor. You may not modify any -Interface prefix provided with the Covered Code or any other prefix -designated by Original Contributor.* * - -* * - -(f) You agree that any Specifications provided to You by Original -Contributor are confidential and proprietary information of Original -Contributor. You must maintain the confidentiality of the Specifications -and may not disclose them to any third party without Original -Contributor's prior written consent. You may only use the Specifications -under the terms of this License and only for the purpose of implementing -the terms of this License with respect to Covered Code. You agree not -use, copy or distribute any such Specifications except as provided in -writing by Original Contributor. - -3.2 Commercial Use License. - -You may not make Commercial Use of any Covered Code unless You and -Original Contributor have executed a copy of the Commercial Use and -Trademark License attached as Attachment D. - -*4. Versions of the License.* - -4.1 License Versions. - -Original Contributor may publish revised versions of the License from -time to time. Each version will be given a distinguishing version number. - -4.2 Effect. - -Once a particular version of Covered Code has been provided under a -version of the License, You may always continue to use such Covered Code -under the terms of that version of the License. You may also choose to -use such Covered Code under the terms of any subsequent version of the -License. No one other than Original Contributor has the right to -promulgate License versions. - -4.3 Multiple-Licensed Code. - -Original Contributor may designate portions of the Covered Code as -"Multiple-Licensed." "Multiple-Licensed" means that the Original -Contributor permits You to utilize those designated portions of the -Covered Code under Your choice of this License or the alternative -license(s), if any, specified by the Original Contributor in an -Attachment to this License. - -*5. Disclaimer of Warranty.* - -5.1 COVERED CODE PROVIDED AS IS. - -COVERED CODE IS PROVIDED UNDER THIS LICENSE "AS IS," WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, -WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT -FOR A PARTICULAR PURPOSE OR NON-INFRINGING. YOU AGREE TO BEAR THE ENTIRE -RISK IN CONNECTION WITH YOUR USE AND DISTRIBUTION OF COVERED CODE UNDER -THIS LICENSE. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART -OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER -EXCEPT SUBJECT TO THIS DISCLAIMER. - -5.2 Not Designed for High Risk Activities. - -You acknowledge that Original Code, Upgraded Code and Specifications are -not designed or intended for use in high risk activities including, but -not limited to: (i) on-line control of aircraft, air traffic, aircraft -navigation or aircraft communications; or (ii) in the design, -construction, operation or maintenance of any nuclear facility. Original -Contributor disclaims any express or implied warranty of fitness for -such uses. - -*6. Termination.* - -6.1 By You. - -You may terminate this Research Use license at anytime by providing -written notice to Original Contributor. - -6.2 By Original Contributor. - -This License and the rights granted hereunder will terminate: - -(i) automatically if You fail to comply with the terms of this License -and fail to cure such breach within 30 days of receipt of written notice -of the breach; - -(ii) immediately in the event of circumstances specified in Sections 7.1 -and 8.4; or - -(iii) at Original Contributor's discretion upon any action initiated by -You (including by cross-claim or counter claim) alleging that use or -distribution by Original Contributor or any Licensee, of Original Code, -Upgraded Code, Error Corrections, Shared Modifications or Specifications -infringe a patent owned or controlled by You. - -6.3 Effective of Termination. - -Upon termination, You agree to discontinue use of and destroy all copies -of Covered Code in Your possession. All sublicenses to the Covered Code -which You have properly granted shall survive any termination of this -License. Provisions that, by their nature, should remain in effect -beyond the termination of this License shall survive including, without -limitation, Sections 2.2, 3, 5, 7 and 8. - -6.4 No Compensation. - -Each party waives and releases the other from any claim to compensation -or indemnity for permitted or lawful termination of the business -relationship established by this License. - -*7. Liability.* - -7.1 Infringement. Should any of the Original Code, Upgraded Code, TCK or -Specifications ("Materials") become the subject of a claim of -infringement, Original Contributor may, at its sole option, (i) attempt -to procure the rights necessary for You to continue using the Materials, -(ii) modify the Materials so that they are no longer infringing, or -(iii) terminate Your right to use the Materials, immediately upon -written notice, and refund to You the amount, if any, having then -actually been paid by You to Original Contributor for the Original Code, -Upgraded Code and TCK, depreciated on a straight line, five year basis. - -7.2 LIMITATION OF LIABILITY. TO THE FULL EXTENT ALLOWED BY APPLICABLE -LAW, ORIGINAL CONTRIBUTOR'S LIABILITY TO YOU FOR CLAIMS RELATING TO THIS -LICENSE, WHETHER FOR BREACH OR IN TORT, SHALL BE LIMITED TO ONE HUNDRED -PERCENT (100%) OF THE AMOUNT HAVING THEN ACTUALLY BEEN PAID BY YOU TO -ORIGINAL CONTRIBUTOR FOR ALL COPIES LICENSED HEREUNDER OF THE PARTICULAR -ITEMS GIVING RISE TO SUCH CLAIM, IF ANY, DURING THE TWELVE MONTHS -PRECEDING THE CLAIMED BREACH. IN NO EVENT WILL YOU (RELATIVE TO YOUR -SHARED MODIFICATIONS OR ERROR CORRECTIONS) OR ORIGINAL CONTRIBUTOR BE -LIABLE FOR ANY INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES IN CONNECTION WITH OR RISING OUT OF THIS LICENSE (INCLUDING, -WITHOUT LIMITATION, LOSS OF PROFITS, USE, DATA, OR OTHER ECONOMIC -ADVANTAGE), HOWEVER IT ARISES AND ON ANY THEORY OF LIABILITY, WHETHER IN -AN ACTION FOR CONTRACT, STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE) -OR OTHERWISE, WHETHER OR NOT YOU OR ORIGINAL CONTRIBUTOR HAS BEEN -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE AND NOTWITHSTANDING THE -FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. - -*8. Miscellaneous.* - -8.1 Trademark. - -You shall not use any Trademark unless You and Original Contributor -execute a copy of the Commercial Use and Trademark License Agreement -attached hereto as Attachment D. Except as expressly provided in the -License, You are granted no right, title or license to, or interest in, -any Trademarks. Whether or not You and Original Contributor enter into -the Trademark License, You agree not to (i) challenge Original -Contributor's ownership or use of Trademarks; (ii) attempt to register -any Trademarks, or any mark or logo substantially similar thereto; or -(iii) incorporate any Trademarks into Your own trademarks, product -names, service marks, company names, or domain names. - -8.2 Integration. - -This License represents the complete agreement concerning the subject -matter hereof. - -8.3 Assignment. - -Original Contributor may assign this License, and its rights and -obligations hereunder, in its sole discretion. You may assign the -Research Use portions of this License and the TCK license to a third -party upon prior written notice to Original Contributor (which may be -provided electronically via the Community Web-Server). You may not -assign the Commercial Use and Trademark license, the Add-On Technology -License, or the Add-On Technology Source Code Porting License, including -by way of merger (regardless of whether You are the surviving entity) or -acquisition, without Original Contributor's prior written consent. - -8.4 Severability. - -If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. Notwithstanding the foregoing, if You are prohibited by law -from fully and specifically complying with Sections 2.2 or 3, this -License will immediately terminate and You must immediately discontinue -any use of Covered Code. - -8.5 Governing Law. - -This License shall be governed by the laws of the United States and the -State of Washington, as applied to contracts entered into and to be -performed in Washington between Washington residents. The application of -the United Nations Convention on Contracts for the International Sale of -Goods is expressly excluded. You agree that the state and federal courts -located in Seattle, Washington have exclusive jurisdiction over any -claim relating to the License, including contract and tort claims. - -8.6 Dispute Resolution. - -a) Arbitration. Any dispute arising out of or relating to this License -shall be finally settled by arbitration as set out herein, except that -either party may bring any action, in a court of competent jurisdiction -(which jurisdiction shall be exclusive), with respect to any dispute -relating to such party's Intellectual Property Rights or with respect to -Your compliance with the TCK license. Arbitration shall be administered: -(i) by the American Arbitration Association (AAA), (ii) in accordance -with the rules of the United Nations Commission on International Trade -Law (UNCITRAL) (the "Rules") in effect at the time of arbitration as -modified herein; and (iii) the arbitrator will apply the substantive -laws of Washington and the United States. Judgment upon the award -rendered by the arbitrator may be entered in any court having -jurisdiction to enforce such award. - -b) Arbitration language, venue and damages. All arbitration proceedings -shall be conducted in English by a single arbitrator selected in -accordance with the Rules, who must be fluent in English and be either a -retired judge or practicing attorney having at least ten (10) years -litigation experience and be reasonably familiar with the technology -matters relative to the dispute. Unless otherwise agreed, arbitration -venue shall be in Seattle, Washington. The arbitrator may award monetary -damages only and nothing shall preclude either party from seeking -provisional or emergency relief from a court of competent jurisdiction. -The arbitrator shall have no authority to award damages in excess of -those permitted in this License and any such award in excess is void. -All awards will be payable in U.S. dollars and may include, for the -prevailing party (i) pre-judgment award interest, (ii) reasonable -attorneys' fees incurred in connection with the arbitration, and (iii) -reasonable costs and expenses incurred in enforcing the award. The -arbitrator will order each party to produce identified documents and -respond to no more than twenty-five single question interrogatories. - -8.7 Construction. - -Any law or regulation, which provides that the language of a contract -shall be construed against the drafter, shall not apply to this License. - -8.8 U.S. Government End Users. - -The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" -and "commercial computer software documentation," as such terms are used -in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and -48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government -End Users acquire Covered Code with only those rights set forth herein. -You agree to pass this notice to our licensees. - -8.9 Marketing Activities. - -Licensee hereby grants Original Contributor a non-exclusive, -non-transferable, limited license to use the Licensee's company name and -logo ("Licensee Marks") in any presentations, press releases, or -marketing materials solely for the purpose of identifying Licensee as a -member of the Helix Community. Licensee shall provide samples of -Licensee Marks to Original Contributor upon request by Original -Contributor. Original Contributor acknowledges that the Licensee Marks -are the trademarks of Licensee. Original Contributor shall not use the -Licensee Marks in a way that may imply that Original Contributor is an -agency or branch of Licensee. Original Contributor understands and -agrees that the use of any Licensee Marks in connection with this -Agreement shall not create any right, title or interest, in, or to the -Licensee Marks or any Licensee trademarks and that all such use and -goodwill associated with any such trademarks will inure to the benefit -of Licensee. Further the Original Contributor will stop usage of the -Licensee Marks upon Licensee's request. - -8.10 Press Announcements. - -You may make press announcements or other public statements regarding -this License without the prior written consent of the Original -Contributor, if Your statement is limited to announcing the licensing of -the Covered Code or the availability of Your Product and its -compatibility with the Covered Code. All other public announcements -regarding this license require the prior written consent of the Original -Contributor. Consent requests are welcome at press@helixcommunity.org. - -8.11 International Use. - -a) Export/Import laws. Covered Code is subject to U.S. export control -laws and may be subject to export or import regulations in other -countries. Each party agrees to comply strictly with all such laws and -regulations and acknowledges their responsibility to obtain such -licenses to export, re-export, or import as may be required. You agree -to pass these obligations to Your licensees. - -b) Intellectual Property Protection. Due to limited intellectual -property protection and enforcement in certain countries, You agree not -to redistribute the Original Code, Upgraded Code, TCK and Specifications -to any country on the list of restricted countries on the Community Web -Server. - -8.12 Language. - -This License is in the English language only, which language shall be -controlling in all respects, and all versions of this License in any -other language shall be for accommodation only and shall not be binding -on the parties to this License. All communications and notices made or -given pursuant to this License, and all documentation and support to be -provided, unless otherwise noted, shall be in the English language. - -PLEASE READ THE TERMS OF THIS LICENSE CAREFULLY. BY CLICKING ON THE -"ACCEPT" BUTTON BELOW YOU ARE ACCEPTING AND AGREEING TO THE TERMS AND -CONDITIONS OF THIS LICENSE WITH REALNETWORKS, INC. IF YOU ARE AGREEING -TO THIS LICENSE ON BEHALF OF A COMPANY, YOU REPRESENT THAT YOU ARE -AUTHORIZED TO BIND THE COMPANY TO SUCH A LICENSE. WHETHER YOU ARE ACTING -ON YOUR OWN BEHALF, OR REPRESENTING A COMPANY, YOU MUST BE OF MAJORITY -AGE AND BE OTHERWISE COMPETENT TO ENTER INTO CONTRACTS. IF YOU DO NOT -MEET THIS CRITERIA OR YOU DO NOT AGREE TO ANY OF THE TERMS AND -CONDITIONS OF THIS LICENSE, CLICK ON THE REJECT BUTTON TO EXIT. - - - GLOSSARY - -1. *"Added Value"* means code which: - -(i) has a principal purpose which is substantially different from that -of the stand-alone Technology; - -(ii) represents a significant functional and value enhancement to the -Technology; - -(iii) operates in conjunction with the Technology; and - -(iv) is not marketed as a technology which replaces or substitutes for -the Technology - -2. "*Applicable Patent Rights*" mean: (a) in the case where Original -Contributor is the grantor of rights, claims of patents that (i) are now -or hereafter acquired, owned by or assigned to Original Contributor and -(ii) are necessarily infringed by using or making the Original Code or -Upgraded Code, including Modifications provided by Original Contributor, -alone and not in combination with other software or hardware; and (b) in -the case where Licensee is the grantor of rights, claims of patents that -(i) are now or hereafter acquired, owned by or assigned to Licensee and -(ii) are infringed (directly or indirectly) by using or making -Licensee's Modifications or Error Corrections, taken alone or in -combination with Covered Code. - -3. "*Application Programming Interfaces (APIs)"* means the interfaces, -associated header files, service provider interfaces, and protocols that -enable a device, application, Operating System, or other program to -obtain services from or make requests of (or provide services in -response to requests from) other programs, and to use, benefit from, or -rely on the resources, facilities, and capabilities of the relevant -programs using the APIs. APIs includes the technical documentation -describing the APIs, the Source Code constituting the API, and any -Header Files used with the APIs. - -4. "*Commercial Use*" means any use (internal or external), copying, -sublicensing or distribution (internal or external), directly or -indirectly of Covered Code by You other than Your Research Use of -Covered Code within Your business or organization or in conjunction with -other Licensees with equivalent Research Use rights. Commercial Use -includes any use of the Covered Code for direct or indirect commercial -or strategic gain, advantage or other business purpose. Any Commercial -Use requires execution of Attachment D by You and Original Contributor. - -5. "*Community Code*" means the Original Code, Upgraded Code, Error -Corrections, Shared Modifications, or any combination thereof. - -6. "*Community Webserver(s)"* means the webservers designated by -Original Contributor for access to the Original Code, Upgraded Code, TCK -and Specifications and for posting Error Corrections and Shared -Modifications. - -7. "*Compliant Covered Code*" means Covered Code that complies with the -requirements of the TCK. - -8. "*Contributor*" means each Licensee that creates or contributes to -the creation of any Error Correction or Shared Modification. - -9. "*Covered Code*" means the Original Code, Upgraded Code, -Modifications, or any combination thereof. - -10. "*Error Correction*" means any change made to Community Code which -conforms to the Specification and corrects the adverse effect of a -failure of Community Code to perform any function set forth in or -required by the Specifications. - -11. "*Executable*" means Covered Code that has been converted from -Source Code to the preferred form for execution by a computer or digital -processor (e.g. binary form). - -12. "*Extension(s)"* means any additional Interfaces developed by or for -You which: (i) are designed for use with the Technology; (ii) constitute -an API for a library of computing functions or services; and (iii) are -disclosed or otherwise made available to third party software developers -for the purpose of developing software which invokes such additional -Interfaces. The foregoing shall not apply to software developed by Your -subcontractors to be exclusively used by You. - -13. "*Header File(s)"* means that portion of the Source Code that -provides the names and types of member functions, data members, class -definitions, and interface definitions necessary to implement the APIs -for the Covered Code. Header Files include, files specifically -designated by Original Contributor as Header Files. Header Files do not -include the code necessary to implement the functionality underlying the -Interface. - -14. *"Helix DNA Server Technology"* means the program(s) that implement -the Helix Universal Server streaming engine for the Technology as -defined in the Specification. - -15. *"Helix DNA Client Technology"* means the Covered Code that -implements the RealOne Player engine as defined in the Specification. - -16. *"Helix DNA Producer Technology"* means the Covered Code that -implements the Helix Producer engine as defined in the Specification. - -17. *"Helix DNA Technology"* means the Helix DNA Server Technology, the -Helix DNA Client Technology, the Helix DNA Producer Technology and other -Helix technologies designated by Original Contributor. - -18. "*Intellectual Property Rights*" means worldwide statutory and -common law rights associated solely with (i) Applicable Patent Rights; -(ii) works of authorship including copyrights, copyright applications, -copyright registrations and "moral rights"; (iii) the protection of -trade and industrial secrets and confidential information; and (iv) -divisions, continuations, renewals, and re-issuances of the foregoing -now existing or acquired in the future. - -19. *"Interface*" means interfaces, functions, properties, class -definitions, APIs, Header Files, GUIDs, V-Tables, and/or protocols -allowing one piece of software, firmware or hardware to communicate or -interoperate with another piece of software, firmware or hardware. - -20. "*Internal Deployment Use*" means use of Compliant Covered Code -(excluding Research Use) within Your business or organization only by -Your employees and/or agents on behalf of Your business or organization, -but not to provide services, including content distribution, to third -parties, subject to execution of Attachment D by You and Original -Contributor, if required. - -21. "*Licensee*" means any party that has entered into and has in effect -a version of this License with Original Contributor. - -22. "*MIME type*" means a description of what type of media or other -content is in a file, including by way of example but not limited to -'audio/x-pn-realaudio-plugin.' - -23. "*Modification(s)"* means (i) any addition to, deletion from and/or -change to the substance and/or structure of the Covered Code, including -Interfaces; (ii) the combination of any Covered Code and any previous -Modifications; (iii) any new file or other representation of computer -program statements that contains any portion of Covered Code; and/or -(iv) any new Source Code implementing any portion of the Specifications. - -24. "*MP3 Patents*" means any patents necessary to make, use or sell -technology implementing any portion of the specification developed by -the Moving Picture Experts Group known as MPEG-1 Audio Layer-3 or MP3, -including but not limited to all past and future versions, profiles, -extensions, parts and amendments relating to the MP3 specification. - -25. "*MPEG-4 Patents*" means any patents necessary to make, use or sell -technology implementing any portion of the specification developed by -the Moving Pictures Experts Group known as MPEG-4, including but not -limited to all past and future versions, profiles, extensions, parts and -amendments relating to the MPEG-4 specification. - -26. "*Original Code*" means the initial Source Code for the Technology -as described on the Community Web Server. - -27. "*Original Contributor*" means RealNetworks, Inc., its affiliates -and its successors and assigns. - -28. "*Original Contributor MIME Type*" means the MIME registry, browser -preferences, or local file/protocol associations invoking any Helix DNA -Client-based application, including the RealOne Player, for playback of -RealAudio, RealVideo, other RealMedia MIME types or datatypes (e.g., -.ram, .rnx, .rpm, .ra, .rm, .rp, .rt, .rf, .prx, .mpe, .rmp, .rmj, .rav, -.rjs, .rmx, .rjt, .rms), and any other Original Contributor-specific or -proprietary MIME types that Original Contributor may introduce in the -future. - -29. "*Personal Use*" means use of Covered Code by an individual solely -for his or her personal, private and non-commercial purposes. An -individual's use of Covered Code in his or her capacity as an officer, -employee, member, independent contractor or agent of a corporation, -business or organization (commercial or non-commercial) does not qualify -as Personal Use. - -30. "*RealMedia File Format*" means the file format designed and -developed by RealNetworks for storing multimedia data and used to store -RealAudio and RealVideo encoded streams. Valid RealMedia File Format -extensions include: .rm, .rmj, .rmc, .rmvb, .rms. - -31. "*RCSL Webpage*" means the RealNetworks Community Source License -webpage located at https://www.helixcommunity.org/content/rcsl or such -other URL that Original Contributor may designate from time to time. - -32. "*Reformatted Specifications*" means any revision to the -Specifications which translates or reformats the Specifications (as for -example in connection with Your documentation) but which does not alter, -subset or superset * *the functional or operational aspects of the -Specifications. - -33. "*Research Use*" means use and distribution of Covered Code only for -Your Personal Use, research or development use and expressly excludes -Internal Deployment Use and Commercial Use. Research Use also includes -use of Covered Code to teach individuals how to use Covered Code. - -34. "*Shared Modifications*" means Modifications that You distribute or -use for a Commercial Use, in addition to any Modifications provided by -You, at Your option, pursuant to Section 2.2, or received by You from a -Contributor pursuant to Section 2.3. - -35. "*Source Code*" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control -compilation and installation of an Executable, or source code -differential comparisons against either the Original Code or another -well known, available Covered Code of the Contributor's choice. The -Source Code can be in a compressed or archival form, provided the -appropriate decompression or de-archiving software is widely available -for no charge. - -36. "*Specifications*" means the specifications for the Technology and -other documentation, as designated on the Community Web Server, as may -be revised by Original Contributor from time to time. - -37. "*Trademarks*" means Original Contributor's trademarks and logos, -including, but not limited to, RealNetworks, RealAudio, RealVideo, -RealOne, RealSystem, SureStream, Helix, Helix DNA and other trademarks -whether now used or adopted in the future. - -38. "*Technology*" means the technology described in Attachment B, and -Upgrades. - -39. "*Technology Compatibility Kit"* or *"TCK*" means the test programs, -procedures, acceptance criteria and/or other requirements, designated by -Original Contributor for use in verifying compliance of Covered Code -with the Specifications, in conjunction with the Original Code and -Upgraded Code. Original Contributor may, in its sole discretion and from -time to time, revise a TCK to correct errors and/or omissions and in -connection with Upgrades. - -40. "*Upgrade(s)"* means new versions of Technology designated -exclusively by Original Contributor as an "Upgrade" and released by -Original Contributor from time to time under the terms of the License. - -41. "*Upgraded Code*" means the Source Code and/or Executables for -Upgrades, possibly including Modifications made by Contributors. - -42. *"User's Guide"* means the users guide for the TCK which Original -Contributor makes available to You to provide direction in how to run -the TCK and properly interpret the results, as may be revised by -Original Contributor from time to time. - -43. "*You(r)*" means an individual, or a legal entity acting by and -through an individual or individuals, exercising rights either under -this License or under a future version of this License issued pursuant -to Section 4.1. For legal entities, "You(r)" includes any entity that by -majority voting interest controls, is controlled by, or is under common -control with You. - -44. "*Your Products*" means any (i) hardware products You distribute -integrating the Covered Code; (ii) any software products You distribute -with the Covered Code that utilize the APIs of the Covered Code; or -(iii) any services You provide using the Covered Code. - - - ATTACHMENT A - -REQUIRED NOTICES - - - ATTACHMENT A-1 - -REQUIRED IN ALL CASES - -Notice to be included in header file of all Error Corrections and Shared -Modifications: - -Portions Copyright 1994-2003 © RealNetworks, Inc. All rights reserved. - -The contents of this file, and the files included with this file, are -subject to the current version of RealNetworks Community Source License -Version 1.1 (the "License"). You may not use this file except in -compliance with the License executed by both You and RealNetworks. You -may obtain a copy of the License at * -https://www.helixcommunity.org/content/rcsl.* You may also obtain a copy -of the License by contacting RealNetworks directly. Please see the -License for the rights, obligations and limitations governing use of the -contents of the file. - -This file is part of the Helix DNA technology. RealNetworks, Inc., is -the developer of the Original code and owns the copyrights in the -portions it created. - -This file, and the files included with this file, are distributed on an -'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, -AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT -LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - -Contributor(s): - -_______________________________________________ - -Technology Compatibility Kit Test Suite(s) Location: - -________________________________ - - - ATTACHMENT A-2 - -SAMPLE LICENSEE CERTIFICATION - -"By clicking the `Agree' button below, You certify that You are a -Licensee in good standing under the RealNetworks Community Source -License, ("License") and that Your access, use and distribution of code -and information You may obtain at this site is subject to the License. -If You are not a Licensee under the RealNetworks Community Source -License You agree not to download, copy or use the Helix DNA technology. - - - ATTACHMENT A-3 - -REQUIRED STUDENT NOTIFICATION - -"This software and related documentation has been obtained by Your -educational institution subject to the RealNetworks Community Source -License. You have been provided access to the software and related -documentation for use only in connection with your course work and -research activities as a matriculated student of Your educational -institution. Any other use is expressly prohibited. - -THIS SOFTWARE AND RELATED DOCUMENTATION CONTAINS PROPRIETARY MATERIAL OF -REALNETWORKS, INC, WHICH ARE PROTECTED BY VARIOUS INTELLECTUAL PROPERTY -RIGHTS. - -You may not use this file except in compliance with the License. You may -obtain a copy of the License on the web at -https://www.helixcommunity.org/content/rcsl. - -* -* - - - ATTACHMENT B - -Description of Technology - -Helix DNA, which consists of Helix DNA Client, Helix DNA Server and -Helix DNA Producer. - -Description of "Technology" - -Helix DNA Technology v1.0 as described on the Community Web Server. - - - ATTACHMENT C - -TECHNOLOGY COMPATIBILITY KIT LICENSE - -The following license is effective for the *Helix DNA* Technology -Compatibility Kit - as described on the Community Web Server. The -Technology Compatibility Kit(s) for the Technology specified in -Attachment B may be accessed at the Community Web Server. - -1. TCK License. - -1.1 Grants to use TCK - -Subject to the terms and restrictions set forth below and the -RealNetworks Community Source License, and the Research Use license, -Original Contributor grants to You a worldwide, non-exclusive, -non-transferable license, to the extent of Original Contributor's -Intellectual Property Rights in the TCK (without the right to -sublicense), to use the TCK to develop and test Covered Code. - -1.2 TCK Use Restrictions. - -You are not authorized to create derivative works of the TCK or use the -TCK to test any implementation of the Specification that is not Covered -Code. You may not publish Your test results or make claims of -comparative compatibility with respect to other implementations of the -Specification. In consideration for the license grant in Section 1.1 -above You agree not to develop Your own tests that are intended to -validate conformation with the Specification. - -2. Test Results. - -You agree to provide to Original Contributor or the third party test -facility if applicable, Your test results that demonstrate that Covered -Code is Compliant Covered Code and that Original Contributor may publish -or otherwise distribute such test results. - -PLEASE READ THE TERMS OF THIS LICENSE CAREFULLY. BY CLICKING ON THE -"ACCEPT" BUTTON BELOW YOU ARE ACCEPTING AND AGREEING TO THE TERMS AND -CONDITIONS OF THIS LICENSE WITH THE ORIGINAL CONTRIBUTOR, REALNETWORKS, -INC. IF YOU ARE AGREEING TO THIS LICENSE ON BEHALF OF A COMPANY, YOU -REPRESENT THAT YOU ARE AUTHORIZED TO BIND THE COMPANY TO SUCH A LICENSE. -WHETHER YOU ARE ACTING ON YOUR OWN BEHALF, OR REPRESENTING A COMPANY, -YOU MUST BE OF MAJORITY AGE AND BE OTHERWISE COMPETENT TO ENTER INTO -CONTRACTS. IF YOU DO NOT MEET THIS CRITERIA OR YOU DO NOT AGREE TO ANY -OF THE TERMS AND CONDITIONS OF THIS LICENSE, CLICK ON THE REJECT BUTTON -TO EXIT. - -*ACCEPT / REJECT -* - -* -* - -*To agree to the R&D/academic terms of this license, please register - on the site -- -you will then be given a chance to agree to the clickwrap RCSL - -R&D License - -and gain access to the RCSL-licensed source code. To build or deploy -commercial applications based on the RCSL, you will need to agree to the -Commercial Use license attachments -* - - - +The RCSL is made up of a base agreement and a few Attachments. + +For Research and Development use, you agree to the terms of the +RCSL R&D License (base RCSL and Attachments A, B, and C) + +For Commercial Use (either distribution or internal commercial +deployment) of the Helix DNA with or without support for RealNetworks' +RealAudio and RealVideo Add-on Technology, you agree to the +terms of the same RCSL R&D license +and execute one or more additional Commercial Use License attachments +. + +------------------------------------------------------------------------ + + + REALNETWORKS COMMUNITY SOURCE LICENSE + +Version 1.2 (Rev. Date: January 22, 2003). + + + RECITALS + +Original Contributor has developed Specifications, Source Code +implementations and Executables of certain Technology; and + +Original Contributor desires to license the Technology to a large +community to facilitate research, innovation and product development +while maintaining compatibility of such products with the Technology as +delivered by Original Contributor; and + +Original Contributor desires to license certain Trademarks for the +purpose of branding products that are compatible with the relevant +Technology delivered by Original Contributor; and + +You desire to license the Technology and possibly certain Trademarks +from Original Contributor on the terms and conditions specified in this +License. + +In consideration for the mutual covenants contained herein, You and +Original Contributor agree as follows: + + + AGREEMENT + +*1. Introduction.* + +The RealNetworks Community Source License ("RCSL") and effective +attachments ("License") may include five distinct licenses: + +i) Research Use license -- License plus Attachments A, B and C only. + +ii) Commercial Use and Trademark License, which may be for Internal +Deployment Use or external distribution, or both -- License plus +Attachments A, B, C, and D. + +iii) Technology Compatibility Kit (TCK) license -- Attachment C. + +iv) Add-On Technology License (Executable) Commercial Use License +-Attachment F. + +v) Add-On Technology Source Code Porting and Optimization +License-Attachment G. + +The Research Use license is effective when You click and accept this +License. The TCK is effective when You click and accept this License, +unless otherwise specified in the TCK attachments. The Commercial Use +and Trademark, Add-On Technology License, and the Add-On Technology +Source Code Porting and Optimization licenses must each be signed by You +and Original Contributor to become effective. Once effective, these +licenses and the associated requirements and responsibilities are +cumulative. Capitalized terms used in this License are defined in the +Glossary. + +*2. License Grants.* + +2.1 Original Contributor Grant. + +Subject to Your compliance with Sections 3, 8.10 and Attachment A of +this License, Original Contributor grants to You a worldwide, +royalty-free, non-exclusive license, to the extent of Original +Contributor's Intellectual Property Rights covering the Original Code, +Upgraded Code and Specifications, to do the following: + +(a) Research Use License: + +(i) use, reproduce and modify the Original Code, Upgraded Code and +Specifications to create Modifications and Reformatted Specifications +for Research Use by You; + +(ii) publish and display Original Code, Upgraded Code and Specifications +with, or as part of Modifications, as permitted under Section 3.1(b) below; + +(iii) reproduce and distribute copies of Original Code and Upgraded Code +to Licensees and students for Research Use by You; + +(iv) compile, reproduce and distribute Original Code and Upgraded Code +in Executable form, and Reformatted Specifications to anyone for +Research Use by You. + +(b) Other than the licenses expressly granted in this License, Original +Contributor retains all right, title, and interest in Original Code and +Upgraded Code and Specifications. + +2.2 Your Grants. + +(a) To Other Licensees. You hereby grant to each Licensee a license to +Your Error Corrections and Shared Modifications, of the same scope and +extent as Original Contributor's licenses under Section 2.1 a) above +relative to Research Use and Attachment D relative to Commercial Use. + +(b) To Original Contributor. You hereby grant to Original Contributor a +worldwide, royalty-free, non-exclusive, perpetual and irrevocable +license, to the extent of Your Intellectual Property Rights covering +Your Error Corrections, Shared Modifications and Reformatted +Specifications, to use, reproduce, modify, display and distribute Your +Error Corrections, Shared Modifications and Reformatted Specifications, +in any form, including the right to sublicense such rights through +multiple tiers of distribution. + +(c) Other than the licenses expressly granted in Sections 2.2(a) and (b) +above, and the restrictions set forth in Section 3.1(d)(iv) below, You +retain all right, title, and interest in Your Error Corrections, Shared +Modifications and Reformatted Specifications. + +2.3 Contributor Modifications. + +You may use, reproduce, modify, display and distribute Contributor Error +Corrections, Shared Modifications and Reformatted Specifications, +obtained by You under this License, to the same scope and extent as with +Original Code, Upgraded Code and Specifications. + +2.4 Subcontracting. + +You may deliver the Source Code of Covered Code to other Licensees +having at least a Research Use license, for the sole purpose of +furnishing development services to You in connection with Your rights +granted in this License. All such Licensees must execute appropriate +documents with respect to such work consistent with the terms of this +License, and acknowledging their work-made-for-hire status or assigning +exclusive right to the work product and associated Intellectual Property +Rights to You. + +*3. Requirements and Responsibilities*. + +3.1 Research Use License. + +As a condition of exercising the rights granted under Section 2.1(a) +above, You agree to comply with the following: + +(a) Your Contribution to the Community. All Error Corrections and Shared +Modifications which You create or contribute to are automatically +subject to the licenses granted under Section 2.2 above. You are +encouraged to license all of Your other Modifications under Section 2.2 +as Shared Modifications, but are not required to do so. You agree to +notify Original Contributor of any errors in the Specification. + +(b) Source Code Availability. You agree to provide all Your Error +Corrections to Original Contributor as soon as reasonably practicable +and, in any event, prior to Internal Deployment Use or Commercial Use, +if applicable. Original Contributor may, at its discretion, post Source +Code for Your Error Corrections and Shared Modifications on the +Community Webserver. You may also post Error Corrections and Shared +Modifications on a web-server of Your choice; provided, that You must +take reasonable precautions to ensure that only Licensees have access to +such Error Corrections and Shared Modifications. Such precautions shall +include, without limitation, a password protection scheme limited to +Licensees and a click-on, download certification of Licensee status +required of those attempting to download from the server. An example of +an acceptable certification is attached as Attachment A-2. + +(c) Notices. All Error Corrections and Shared Modifications You create +or contribute to must include a file documenting the additions and +changes You made and the date of such additions and changes. You must +also include the notice set forth in Attachment A-1 in the file header. +If it is not possible to put the notice in a particular Source Code file +due to its structure, then You must include the notice in a location +(such as a relevant directory file), where a recipient would be most +likely to look for such a notice. + +(d) Redistribution. + +(i) Source. Covered Code may be distributed in Source Code form only to +another Licensee (except for students as provided below). You may not +offer or impose any terms on any Covered Code that alter the rights, +requirements, or responsibilities of such Licensee. You may distribute +Covered Code to students for use in connection with their course work +and research projects undertaken at accredited educational institutions. +Such students need not be Licensees, but must be given a copy of the +notice set forth in Attachment A-3 and such notice must also be included +in a file header or prominent location in the Source Code made available +to such students. + +(ii) Executable. You may distribute Executable version(s) of Covered +Code to Licensees and other third parties only for the purpose of +evaluation and comment in connection with Research Use by You and under +a license of Your choice, but which limits use of such Executable +version(s) of Covered Code only to that purpose. + +(iii) Modified Class, Interface and Package Naming. In connection with +Research Use by You only, You may use Original Contributor's class, +Interface and package names only to accurately reference or invoke the +Source Code files You modify. Original Contributor grants to You a +limited license to the extent necessary for such purposes. + +(iv) You expressly agree that any distribution, in whole or in part, of +Modifications developed by You shall only be done pursuant to the terms +and conditions of this License. + +(e) Extensions. + +(i) Covered Code. You may not include any Source Code of Community Code +in any Extensions. You may include the compiled Header Files of +Community Code in an Extension provided that Your use of the Covered +Code, including Heading Files, complies with the Commercial Use License, +the TCK and all other terms of this License. + +(ii) Publication. No later than the date on which You first distribute +such Extension for Commercial Use, You must publish to the industry, on +a non-confidential basis and free of all copyright restrictions with +respect to reproduction and use, an accurate and current specification +for any Extension. In addition, You must make available an appropriate +test suite, pursuant to the same rights as the specification, +sufficiently detailed to allow any third party reasonably skilled in the +technology to produce implementations of the Extension compatible with +the specification. Such test suites must be made available as soon as +reasonably practicable but, in no event, later than ninety (90) days +after Your first Commercial Use of the Extension. You must use +reasonable efforts to promptly clarify and correct the specification and +the test suite upon written request by Original Contributor. + +(iii) Open. You agree to refrain from enforcing any Intellectual +Property Rights You may have covering any interface(s) of Your +Extension, which would prevent the implementation of such interface(s) +by Original Contributor or any Licensee. This obligation does not +prevent You from enforcing any Intellectual Property Right You have that +would otherwise be infringed by an implementation of Your Extension. + +(iv) Interface Modifications and Naming. You may not modify or add to +the GUID space * * "xxxxxxxx-0901-11d1-8B06-00A024406D59" or any other +GUID space designated by Original Contributor. You may not modify any +Interface prefix provided with the Covered Code or any other prefix +designated by Original Contributor.* * + +* * + +(f) You agree that any Specifications provided to You by Original +Contributor are confidential and proprietary information of Original +Contributor. You must maintain the confidentiality of the Specifications +and may not disclose them to any third party without Original +Contributor's prior written consent. You may only use the Specifications +under the terms of this License and only for the purpose of implementing +the terms of this License with respect to Covered Code. You agree not +use, copy or distribute any such Specifications except as provided in +writing by Original Contributor. + +3.2 Commercial Use License. + +You may not make Commercial Use of any Covered Code unless You and +Original Contributor have executed a copy of the Commercial Use and +Trademark License attached as Attachment D. + +*4. Versions of the License.* + +4.1 License Versions. + +Original Contributor may publish revised versions of the License from +time to time. Each version will be given a distinguishing version number. + +4.2 Effect. + +Once a particular version of Covered Code has been provided under a +version of the License, You may always continue to use such Covered Code +under the terms of that version of the License. You may also choose to +use such Covered Code under the terms of any subsequent version of the +License. No one other than Original Contributor has the right to +promulgate License versions. + +4.3 Multiple-Licensed Code. + +Original Contributor may designate portions of the Covered Code as +"Multiple-Licensed." "Multiple-Licensed" means that the Original +Contributor permits You to utilize those designated portions of the +Covered Code under Your choice of this License or the alternative +license(s), if any, specified by the Original Contributor in an +Attachment to this License. + +*5. Disclaimer of Warranty.* + +5.1 COVERED CODE PROVIDED AS IS. + +COVERED CODE IS PROVIDED UNDER THIS LICENSE "AS IS," WITHOUT WARRANTY OF +ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, +WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT +FOR A PARTICULAR PURPOSE OR NON-INFRINGING. YOU AGREE TO BEAR THE ENTIRE +RISK IN CONNECTION WITH YOUR USE AND DISTRIBUTION OF COVERED CODE UNDER +THIS LICENSE. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART +OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER +EXCEPT SUBJECT TO THIS DISCLAIMER. + +5.2 Not Designed for High Risk Activities. + +You acknowledge that Original Code, Upgraded Code and Specifications are +not designed or intended for use in high risk activities including, but +not limited to: (i) on-line control of aircraft, air traffic, aircraft +navigation or aircraft communications; or (ii) in the design, +construction, operation or maintenance of any nuclear facility. Original +Contributor disclaims any express or implied warranty of fitness for +such uses. + +*6. Termination.* + +6.1 By You. + +You may terminate this Research Use license at anytime by providing +written notice to Original Contributor. + +6.2 By Original Contributor. + +This License and the rights granted hereunder will terminate: + +(i) automatically if You fail to comply with the terms of this License +and fail to cure such breach within 30 days of receipt of written notice +of the breach; + +(ii) immediately in the event of circumstances specified in Sections 7.1 +and 8.4; or + +(iii) at Original Contributor's discretion upon any action initiated by +You (including by cross-claim or counter claim) alleging that use or +distribution by Original Contributor or any Licensee, of Original Code, +Upgraded Code, Error Corrections, Shared Modifications or Specifications +infringe a patent owned or controlled by You. + +6.3 Effective of Termination. + +Upon termination, You agree to discontinue use of and destroy all copies +of Covered Code in Your possession. All sublicenses to the Covered Code +which You have properly granted shall survive any termination of this +License. Provisions that, by their nature, should remain in effect +beyond the termination of this License shall survive including, without +limitation, Sections 2.2, 3, 5, 7 and 8. + +6.4 No Compensation. + +Each party waives and releases the other from any claim to compensation +or indemnity for permitted or lawful termination of the business +relationship established by this License. + +*7. Liability.* + +7.1 Infringement. Should any of the Original Code, Upgraded Code, TCK or +Specifications ("Materials") become the subject of a claim of +infringement, Original Contributor may, at its sole option, (i) attempt +to procure the rights necessary for You to continue using the Materials, +(ii) modify the Materials so that they are no longer infringing, or +(iii) terminate Your right to use the Materials, immediately upon +written notice, and refund to You the amount, if any, having then +actually been paid by You to Original Contributor for the Original Code, +Upgraded Code and TCK, depreciated on a straight line, five year basis. + +7.2 LIMITATION OF LIABILITY. TO THE FULL EXTENT ALLOWED BY APPLICABLE +LAW, ORIGINAL CONTRIBUTOR'S LIABILITY TO YOU FOR CLAIMS RELATING TO THIS +LICENSE, WHETHER FOR BREACH OR IN TORT, SHALL BE LIMITED TO ONE HUNDRED +PERCENT (100%) OF THE AMOUNT HAVING THEN ACTUALLY BEEN PAID BY YOU TO +ORIGINAL CONTRIBUTOR FOR ALL COPIES LICENSED HEREUNDER OF THE PARTICULAR +ITEMS GIVING RISE TO SUCH CLAIM, IF ANY, DURING THE TWELVE MONTHS +PRECEDING THE CLAIMED BREACH. IN NO EVENT WILL YOU (RELATIVE TO YOUR +SHARED MODIFICATIONS OR ERROR CORRECTIONS) OR ORIGINAL CONTRIBUTOR BE +LIABLE FOR ANY INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR CONSEQUENTIAL +DAMAGES IN CONNECTION WITH OR RISING OUT OF THIS LICENSE (INCLUDING, +WITHOUT LIMITATION, LOSS OF PROFITS, USE, DATA, OR OTHER ECONOMIC +ADVANTAGE), HOWEVER IT ARISES AND ON ANY THEORY OF LIABILITY, WHETHER IN +AN ACTION FOR CONTRACT, STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE) +OR OTHERWISE, WHETHER OR NOT YOU OR ORIGINAL CONTRIBUTOR HAS BEEN +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE AND NOTWITHSTANDING THE +FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. + +*8. Miscellaneous.* + +8.1 Trademark. + +You shall not use any Trademark unless You and Original Contributor +execute a copy of the Commercial Use and Trademark License Agreement +attached hereto as Attachment D. Except as expressly provided in the +License, You are granted no right, title or license to, or interest in, +any Trademarks. Whether or not You and Original Contributor enter into +the Trademark License, You agree not to (i) challenge Original +Contributor's ownership or use of Trademarks; (ii) attempt to register +any Trademarks, or any mark or logo substantially similar thereto; or +(iii) incorporate any Trademarks into Your own trademarks, product +names, service marks, company names, or domain names. + +8.2 Integration. + +This License represents the complete agreement concerning the subject +matter hereof. + +8.3 Assignment. + +Original Contributor may assign this License, and its rights and +obligations hereunder, in its sole discretion. You may assign the +Research Use portions of this License and the TCK license to a third +party upon prior written notice to Original Contributor (which may be +provided electronically via the Community Web-Server). You may not +assign the Commercial Use and Trademark license, the Add-On Technology +License, or the Add-On Technology Source Code Porting License, including +by way of merger (regardless of whether You are the surviving entity) or +acquisition, without Original Contributor's prior written consent. + +8.4 Severability. + +If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. Notwithstanding the foregoing, if You are prohibited by law +from fully and specifically complying with Sections 2.2 or 3, this +License will immediately terminate and You must immediately discontinue +any use of Covered Code. + +8.5 Governing Law. + +This License shall be governed by the laws of the United States and the +State of Washington, as applied to contracts entered into and to be +performed in Washington between Washington residents. The application of +the United Nations Convention on Contracts for the International Sale of +Goods is expressly excluded. You agree that the state and federal courts +located in Seattle, Washington have exclusive jurisdiction over any +claim relating to the License, including contract and tort claims. + +8.6 Dispute Resolution. + +a) Arbitration. Any dispute arising out of or relating to this License +shall be finally settled by arbitration as set out herein, except that +either party may bring any action, in a court of competent jurisdiction +(which jurisdiction shall be exclusive), with respect to any dispute +relating to such party's Intellectual Property Rights or with respect to +Your compliance with the TCK license. Arbitration shall be administered: +(i) by the American Arbitration Association (AAA), (ii) in accordance +with the rules of the United Nations Commission on International Trade +Law (UNCITRAL) (the "Rules") in effect at the time of arbitration as +modified herein; and (iii) the arbitrator will apply the substantive +laws of Washington and the United States. Judgment upon the award +rendered by the arbitrator may be entered in any court having +jurisdiction to enforce such award. + +b) Arbitration language, venue and damages. All arbitration proceedings +shall be conducted in English by a single arbitrator selected in +accordance with the Rules, who must be fluent in English and be either a +retired judge or practicing attorney having at least ten (10) years +litigation experience and be reasonably familiar with the technology +matters relative to the dispute. Unless otherwise agreed, arbitration +venue shall be in Seattle, Washington. The arbitrator may award monetary +damages only and nothing shall preclude either party from seeking +provisional or emergency relief from a court of competent jurisdiction. +The arbitrator shall have no authority to award damages in excess of +those permitted in this License and any such award in excess is void. +All awards will be payable in U.S. dollars and may include, for the +prevailing party (i) pre-judgment award interest, (ii) reasonable +attorneys' fees incurred in connection with the arbitration, and (iii) +reasonable costs and expenses incurred in enforcing the award. The +arbitrator will order each party to produce identified documents and +respond to no more than twenty-five single question interrogatories. + +8.7 Construction. + +Any law or regulation, which provides that the language of a contract +shall be construed against the drafter, shall not apply to this License. + +8.8 U.S. Government End Users. + +The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" +and "commercial computer software documentation," as such terms are used +in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and +48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government +End Users acquire Covered Code with only those rights set forth herein. +You agree to pass this notice to our licensees. + +8.9 Marketing Activities. + +Licensee hereby grants Original Contributor a non-exclusive, +non-transferable, limited license to use the Licensee's company name and +logo ("Licensee Marks") in any presentations, press releases, or +marketing materials solely for the purpose of identifying Licensee as a +member of the Helix Community. Licensee shall provide samples of +Licensee Marks to Original Contributor upon request by Original +Contributor. Original Contributor acknowledges that the Licensee Marks +are the trademarks of Licensee. Original Contributor shall not use the +Licensee Marks in a way that may imply that Original Contributor is an +agency or branch of Licensee. Original Contributor understands and +agrees that the use of any Licensee Marks in connection with this +Agreement shall not create any right, title or interest, in, or to the +Licensee Marks or any Licensee trademarks and that all such use and +goodwill associated with any such trademarks will inure to the benefit +of Licensee. Further the Original Contributor will stop usage of the +Licensee Marks upon Licensee's request. + +8.10 Press Announcements. + +You may make press announcements or other public statements regarding +this License without the prior written consent of the Original +Contributor, if Your statement is limited to announcing the licensing of +the Covered Code or the availability of Your Product and its +compatibility with the Covered Code. All other public announcements +regarding this license require the prior written consent of the Original +Contributor. Consent requests are welcome at press@helixcommunity.org. + +8.11 International Use. + +a) Export/Import laws. Covered Code is subject to U.S. export control +laws and may be subject to export or import regulations in other +countries. Each party agrees to comply strictly with all such laws and +regulations and acknowledges their responsibility to obtain such +licenses to export, re-export, or import as may be required. You agree +to pass these obligations to Your licensees. + +b) Intellectual Property Protection. Due to limited intellectual +property protection and enforcement in certain countries, You agree not +to redistribute the Original Code, Upgraded Code, TCK and Specifications +to any country on the list of restricted countries on the Community Web +Server. + +8.12 Language. + +This License is in the English language only, which language shall be +controlling in all respects, and all versions of this License in any +other language shall be for accommodation only and shall not be binding +on the parties to this License. All communications and notices made or +given pursuant to this License, and all documentation and support to be +provided, unless otherwise noted, shall be in the English language. + +PLEASE READ THE TERMS OF THIS LICENSE CAREFULLY. BY CLICKING ON THE +"ACCEPT" BUTTON BELOW YOU ARE ACCEPTING AND AGREEING TO THE TERMS AND +CONDITIONS OF THIS LICENSE WITH REALNETWORKS, INC. IF YOU ARE AGREEING +TO THIS LICENSE ON BEHALF OF A COMPANY, YOU REPRESENT THAT YOU ARE +AUTHORIZED TO BIND THE COMPANY TO SUCH A LICENSE. WHETHER YOU ARE ACTING +ON YOUR OWN BEHALF, OR REPRESENTING A COMPANY, YOU MUST BE OF MAJORITY +AGE AND BE OTHERWISE COMPETENT TO ENTER INTO CONTRACTS. IF YOU DO NOT +MEET THIS CRITERIA OR YOU DO NOT AGREE TO ANY OF THE TERMS AND +CONDITIONS OF THIS LICENSE, CLICK ON THE REJECT BUTTON TO EXIT. + + + GLOSSARY + +1. *"Added Value"* means code which: + +(i) has a principal purpose which is substantially different from that +of the stand-alone Technology; + +(ii) represents a significant functional and value enhancement to the +Technology; + +(iii) operates in conjunction with the Technology; and + +(iv) is not marketed as a technology which replaces or substitutes for +the Technology + +2. "*Applicable Patent Rights*" mean: (a) in the case where Original +Contributor is the grantor of rights, claims of patents that (i) are now +or hereafter acquired, owned by or assigned to Original Contributor and +(ii) are necessarily infringed by using or making the Original Code or +Upgraded Code, including Modifications provided by Original Contributor, +alone and not in combination with other software or hardware; and (b) in +the case where Licensee is the grantor of rights, claims of patents that +(i) are now or hereafter acquired, owned by or assigned to Licensee and +(ii) are infringed (directly or indirectly) by using or making +Licensee's Modifications or Error Corrections, taken alone or in +combination with Covered Code. + +3. "*Application Programming Interfaces (APIs)"* means the interfaces, +associated header files, service provider interfaces, and protocols that +enable a device, application, Operating System, or other program to +obtain services from or make requests of (or provide services in +response to requests from) other programs, and to use, benefit from, or +rely on the resources, facilities, and capabilities of the relevant +programs using the APIs. APIs includes the technical documentation +describing the APIs, the Source Code constituting the API, and any +Header Files used with the APIs. + +4. "*Commercial Use*" means any use (internal or external), copying, +sublicensing or distribution (internal or external), directly or +indirectly of Covered Code by You other than Your Research Use of +Covered Code within Your business or organization or in conjunction with +other Licensees with equivalent Research Use rights. Commercial Use +includes any use of the Covered Code for direct or indirect commercial +or strategic gain, advantage or other business purpose. Any Commercial +Use requires execution of Attachment D by You and Original Contributor. + +5. "*Community Code*" means the Original Code, Upgraded Code, Error +Corrections, Shared Modifications, or any combination thereof. + +6. "*Community Webserver(s)"* means the webservers designated by +Original Contributor for access to the Original Code, Upgraded Code, TCK +and Specifications and for posting Error Corrections and Shared +Modifications. + +7. "*Compliant Covered Code*" means Covered Code that complies with the +requirements of the TCK. + +8. "*Contributor*" means each Licensee that creates or contributes to +the creation of any Error Correction or Shared Modification. + +9. "*Covered Code*" means the Original Code, Upgraded Code, +Modifications, or any combination thereof. + +10. "*Error Correction*" means any change made to Community Code which +conforms to the Specification and corrects the adverse effect of a +failure of Community Code to perform any function set forth in or +required by the Specifications. + +11. "*Executable*" means Covered Code that has been converted from +Source Code to the preferred form for execution by a computer or digital +processor (e.g. binary form). + +12. "*Extension(s)"* means any additional Interfaces developed by or for +You which: (i) are designed for use with the Technology; (ii) constitute +an API for a library of computing functions or services; and (iii) are +disclosed or otherwise made available to third party software developers +for the purpose of developing software which invokes such additional +Interfaces. The foregoing shall not apply to software developed by Your +subcontractors to be exclusively used by You. + +13. "*Header File(s)"* means that portion of the Source Code that +provides the names and types of member functions, data members, class +definitions, and interface definitions necessary to implement the APIs +for the Covered Code. Header Files include, files specifically +designated by Original Contributor as Header Files. Header Files do not +include the code necessary to implement the functionality underlying the +Interface. + +14. *"Helix DNA Server Technology"* means the program(s) that implement +the Helix Universal Server streaming engine for the Technology as +defined in the Specification. + +15. *"Helix DNA Client Technology"* means the Covered Code that +implements the RealOne Player engine as defined in the Specification. + +16. *"Helix DNA Producer Technology"* means the Covered Code that +implements the Helix Producer engine as defined in the Specification. + +17. *"Helix DNA Technology"* means the Helix DNA Server Technology, the +Helix DNA Client Technology, the Helix DNA Producer Technology and other +Helix technologies designated by Original Contributor. + +18. "*Intellectual Property Rights*" means worldwide statutory and +common law rights associated solely with (i) Applicable Patent Rights; +(ii) works of authorship including copyrights, copyright applications, +copyright registrations and "moral rights"; (iii) the protection of +trade and industrial secrets and confidential information; and (iv) +divisions, continuations, renewals, and re-issuances of the foregoing +now existing or acquired in the future. + +19. *"Interface*" means interfaces, functions, properties, class +definitions, APIs, Header Files, GUIDs, V-Tables, and/or protocols +allowing one piece of software, firmware or hardware to communicate or +interoperate with another piece of software, firmware or hardware. + +20. "*Internal Deployment Use*" means use of Compliant Covered Code +(excluding Research Use) within Your business or organization only by +Your employees and/or agents on behalf of Your business or organization, +but not to provide services, including content distribution, to third +parties, subject to execution of Attachment D by You and Original +Contributor, if required. + +21. "*Licensee*" means any party that has entered into and has in effect +a version of this License with Original Contributor. + +22. "*MIME type*" means a description of what type of media or other +content is in a file, including by way of example but not limited to +'audio/x-pn-realaudio-plugin.' + +23. "*Modification(s)"* means (i) any addition to, deletion from and/or +change to the substance and/or structure of the Covered Code, including +Interfaces; (ii) the combination of any Covered Code and any previous +Modifications; (iii) any new file or other representation of computer +program statements that contains any portion of Covered Code; and/or +(iv) any new Source Code implementing any portion of the Specifications. + +24. "*MP3 Patents*" means any patents necessary to make, use or sell +technology implementing any portion of the specification developed by +the Moving Picture Experts Group known as MPEG-1 Audio Layer-3 or MP3, +including but not limited to all past and future versions, profiles, +extensions, parts and amendments relating to the MP3 specification. + +25. "*MPEG-4 Patents*" means any patents necessary to make, use or sell +technology implementing any portion of the specification developed by +the Moving Pictures Experts Group known as MPEG-4, including but not +limited to all past and future versions, profiles, extensions, parts and +amendments relating to the MPEG-4 specification. + +26. "*Original Code*" means the initial Source Code for the Technology +as described on the Community Web Server. + +27. "*Original Contributor*" means RealNetworks, Inc., its affiliates +and its successors and assigns. + +28. "*Original Contributor MIME Type*" means the MIME registry, browser +preferences, or local file/protocol associations invoking any Helix DNA +Client-based application, including the RealOne Player, for playback of +RealAudio, RealVideo, other RealMedia MIME types or datatypes (e.g., +.ram, .rnx, .rpm, .ra, .rm, .rp, .rt, .rf, .prx, .mpe, .rmp, .rmj, .rav, +.rjs, .rmx, .rjt, .rms), and any other Original Contributor-specific or +proprietary MIME types that Original Contributor may introduce in the +future. + +29. "*Personal Use*" means use of Covered Code by an individual solely +for his or her personal, private and non-commercial purposes. An +individual's use of Covered Code in his or her capacity as an officer, +employee, member, independent contractor or agent of a corporation, +business or organization (commercial or non-commercial) does not qualify +as Personal Use. + +30. "*RealMedia File Format*" means the file format designed and +developed by RealNetworks for storing multimedia data and used to store +RealAudio and RealVideo encoded streams. Valid RealMedia File Format +extensions include: .rm, .rmj, .rmc, .rmvb, .rms. + +31. "*RCSL Webpage*" means the RealNetworks Community Source License +webpage located at https://www.helixcommunity.org/content/rcsl or such +other URL that Original Contributor may designate from time to time. + +32. "*Reformatted Specifications*" means any revision to the +Specifications which translates or reformats the Specifications (as for +example in connection with Your documentation) but which does not alter, +subset or superset * *the functional or operational aspects of the +Specifications. + +33. "*Research Use*" means use and distribution of Covered Code only for +Your Personal Use, research or development use and expressly excludes +Internal Deployment Use and Commercial Use. Research Use also includes +use of Covered Code to teach individuals how to use Covered Code. + +34. "*Shared Modifications*" means Modifications that You distribute or +use for a Commercial Use, in addition to any Modifications provided by +You, at Your option, pursuant to Section 2.2, or received by You from a +Contributor pursuant to Section 2.3. + +35. "*Source Code*" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control +compilation and installation of an Executable, or source code +differential comparisons against either the Original Code or another +well known, available Covered Code of the Contributor's choice. The +Source Code can be in a compressed or archival form, provided the +appropriate decompression or de-archiving software is widely available +for no charge. + +36. "*Specifications*" means the specifications for the Technology and +other documentation, as designated on the Community Web Server, as may +be revised by Original Contributor from time to time. + +37. "*Trademarks*" means Original Contributor's trademarks and logos, +including, but not limited to, RealNetworks, RealAudio, RealVideo, +RealOne, RealSystem, SureStream, Helix, Helix DNA and other trademarks +whether now used or adopted in the future. + +38. "*Technology*" means the technology described in Attachment B, and +Upgrades. + +39. "*Technology Compatibility Kit"* or *"TCK*" means the test programs, +procedures, acceptance criteria and/or other requirements, designated by +Original Contributor for use in verifying compliance of Covered Code +with the Specifications, in conjunction with the Original Code and +Upgraded Code. Original Contributor may, in its sole discretion and from +time to time, revise a TCK to correct errors and/or omissions and in +connection with Upgrades. + +40. "*Upgrade(s)"* means new versions of Technology designated +exclusively by Original Contributor as an "Upgrade" and released by +Original Contributor from time to time under the terms of the License. + +41. "*Upgraded Code*" means the Source Code and/or Executables for +Upgrades, possibly including Modifications made by Contributors. + +42. *"User's Guide"* means the users guide for the TCK which Original +Contributor makes available to You to provide direction in how to run +the TCK and properly interpret the results, as may be revised by +Original Contributor from time to time. + +43. "*You(r)*" means an individual, or a legal entity acting by and +through an individual or individuals, exercising rights either under +this License or under a future version of this License issued pursuant +to Section 4.1. For legal entities, "You(r)" includes any entity that by +majority voting interest controls, is controlled by, or is under common +control with You. + +44. "*Your Products*" means any (i) hardware products You distribute +integrating the Covered Code; (ii) any software products You distribute +with the Covered Code that utilize the APIs of the Covered Code; or +(iii) any services You provide using the Covered Code. + + + ATTACHMENT A + +REQUIRED NOTICES + + + ATTACHMENT A-1 + +REQUIRED IN ALL CASES + +Notice to be included in header file of all Error Corrections and Shared +Modifications: + +Portions Copyright 1994-2003 © RealNetworks, Inc. All rights reserved. + +The contents of this file, and the files included with this file, are +subject to the current version of RealNetworks Community Source License +Version 1.1 (the "License"). You may not use this file except in +compliance with the License executed by both You and RealNetworks. You +may obtain a copy of the License at * +https://www.helixcommunity.org/content/rcsl.* You may also obtain a copy +of the License by contacting RealNetworks directly. Please see the +License for the rights, obligations and limitations governing use of the +contents of the file. + +This file is part of the Helix DNA technology. RealNetworks, Inc., is +the developer of the Original code and owns the copyrights in the +portions it created. + +This file, and the files included with this file, are distributed on an +'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, +AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT +LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + +Contributor(s): + +_______________________________________________ + +Technology Compatibility Kit Test Suite(s) Location: + +________________________________ + + + ATTACHMENT A-2 + +SAMPLE LICENSEE CERTIFICATION + +"By clicking the `Agree' button below, You certify that You are a +Licensee in good standing under the RealNetworks Community Source +License, ("License") and that Your access, use and distribution of code +and information You may obtain at this site is subject to the License. +If You are not a Licensee under the RealNetworks Community Source +License You agree not to download, copy or use the Helix DNA technology. + + + ATTACHMENT A-3 + +REQUIRED STUDENT NOTIFICATION + +"This software and related documentation has been obtained by Your +educational institution subject to the RealNetworks Community Source +License. You have been provided access to the software and related +documentation for use only in connection with your course work and +research activities as a matriculated student of Your educational +institution. Any other use is expressly prohibited. + +THIS SOFTWARE AND RELATED DOCUMENTATION CONTAINS PROPRIETARY MATERIAL OF +REALNETWORKS, INC, WHICH ARE PROTECTED BY VARIOUS INTELLECTUAL PROPERTY +RIGHTS. + +You may not use this file except in compliance with the License. You may +obtain a copy of the License on the web at +https://www.helixcommunity.org/content/rcsl. + +* +* + + + ATTACHMENT B + +Description of Technology + +Helix DNA, which consists of Helix DNA Client, Helix DNA Server and +Helix DNA Producer. + +Description of "Technology" + +Helix DNA Technology v1.0 as described on the Community Web Server. + + + ATTACHMENT C + +TECHNOLOGY COMPATIBILITY KIT LICENSE + +The following license is effective for the *Helix DNA* Technology +Compatibility Kit - as described on the Community Web Server. The +Technology Compatibility Kit(s) for the Technology specified in +Attachment B may be accessed at the Community Web Server. + +1. TCK License. + +1.1 Grants to use TCK + +Subject to the terms and restrictions set forth below and the +RealNetworks Community Source License, and the Research Use license, +Original Contributor grants to You a worldwide, non-exclusive, +non-transferable license, to the extent of Original Contributor's +Intellectual Property Rights in the TCK (without the right to +sublicense), to use the TCK to develop and test Covered Code. + +1.2 TCK Use Restrictions. + +You are not authorized to create derivative works of the TCK or use the +TCK to test any implementation of the Specification that is not Covered +Code. You may not publish Your test results or make claims of +comparative compatibility with respect to other implementations of the +Specification. In consideration for the license grant in Section 1.1 +above You agree not to develop Your own tests that are intended to +validate conformation with the Specification. + +2. Test Results. + +You agree to provide to Original Contributor or the third party test +facility if applicable, Your test results that demonstrate that Covered +Code is Compliant Covered Code and that Original Contributor may publish +or otherwise distribute such test results. + +PLEASE READ THE TERMS OF THIS LICENSE CAREFULLY. BY CLICKING ON THE +"ACCEPT" BUTTON BELOW YOU ARE ACCEPTING AND AGREEING TO THE TERMS AND +CONDITIONS OF THIS LICENSE WITH THE ORIGINAL CONTRIBUTOR, REALNETWORKS, +INC. IF YOU ARE AGREEING TO THIS LICENSE ON BEHALF OF A COMPANY, YOU +REPRESENT THAT YOU ARE AUTHORIZED TO BIND THE COMPANY TO SUCH A LICENSE. +WHETHER YOU ARE ACTING ON YOUR OWN BEHALF, OR REPRESENTING A COMPANY, +YOU MUST BE OF MAJORITY AGE AND BE OTHERWISE COMPETENT TO ENTER INTO +CONTRACTS. IF YOU DO NOT MEET THIS CRITERIA OR YOU DO NOT AGREE TO ANY +OF THE TERMS AND CONDITIONS OF THIS LICENSE, CLICK ON THE REJECT BUTTON +TO EXIT. + +*ACCEPT / REJECT +* + +* +* + +*To agree to the R&D/academic terms of this license, please register + on the site -- +you will then be given a chance to agree to the clickwrap RCSL + +R&D License + +and gain access to the RCSL-licensed source code. To build or deploy +commercial applications based on the RCSL, you will need to agree to the +Commercial Use license attachments +* + + + diff --git a/source/arm7/helix/real/hufftabs.c b/source/arm7/helix/real/hufftabs.c index c1b066c..a2367ad 100644 --- a/source/arm7/helix/real/hufftabs.c +++ b/source/arm7/helix/real/hufftabs.c @@ -1,755 +1,755 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: RCSL 1.0/RPSL 1.0 - * - * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. - * - * The contents of this file, and the files included with this file, are - * subject to the current version of the RealNetworks Public Source License - * Version 1.0 (the "RPSL") available at - * http://www.helixcommunity.org/content/rpsl unless you have licensed - * the file under the RealNetworks Community Source License Version 1.0 - * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, - * in which case the RCSL will apply. You may also obtain the license terms - * directly from RealNetworks. You may not use this file except in - * compliance with the RPSL or, if you have a valid RCSL with RealNetworks - * applicable to this file, the RCSL. Please see the applicable RPSL or - * RCSL for the rights, obligations and limitations governing use of the - * contents of the file. - * - * This file is part of the Helix DNA Technology. RealNetworks is the - * developer of the Original Code and owns the copyrights in the portions - * it created. - * - * This file, and the files included with this file, is distributed and made - * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * - * Technology Compatibility Kit Test Suite(s) Location: - * http://www.helixcommunity.org/content/tck - * - * Contributor(s): - * - * ***** END LICENSE BLOCK ***** */ - -/************************************************************************************** - * Fixed-point MP3 decoder - * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com) - * June 2003 - * - * hufftabs.c - compressed Huffman code tables - **************************************************************************************/ - -#include "coder.h" - -/* NOTE - regenerated tables to use shorts instead of ints - * (all needed data can fit in 16 bits - see below) - * - * format 0xABCD - * A = length of codeword - * B = y value - * C = x value - * D = number of sign bits (0, 1, or 2) - * - * to read a CW, the code reads maxbits from the stream (dep. on - * table index), but doesn't remove them from the bitstream reader - * then it gets the correct CW by direct lookup into the table - * of length (2^maxbits) (more complicated for non-oneShot...) - * for CW's with hlen < maxbits, there are multiple entries in the - * table (extra bits are don't cares) - * the bitstream reader then "purges" (or removes) only the correct - * number of bits for the chosen CW - * - * entries starting with F are special: D (signbits) is maxbits, - * so the decoder always checks huffTableXX[0] first, gets the - * signbits, and reads that many bits from the bitstream - * (sometimes it takes > 1 read to get the value, so maxbits is - * can get updated by jumping to another value starting with 0xF) - * entries starting with 0 are also special: A = hlen = 0, rest of - * value is an offset to jump higher in the table (for tables of - * type loopNoLinbits or loopLinbits) - */ - -/* store Huffman codes as one big table plus table of offsets, since some platforms - * don't properly support table-of-tables (table of pointers to other const tables) - */ -const unsigned short huffTable[] = { - /* huffTable01[9] */ - 0xf003, 0x3112, 0x3101, 0x2011, 0x2011, 0x1000, 0x1000, 0x1000, - 0x1000, - - /* huffTable02[65] */ - 0xf006, 0x6222, 0x6201, 0x5212, 0x5212, 0x5122, 0x5122, 0x5021, - 0x5021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, - - /* huffTable03[65] */ - 0xf006, 0x6222, 0x6201, 0x5212, 0x5212, 0x5122, 0x5122, 0x5021, - 0x5021, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, - 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, - 0x2101, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, - - /* huffTable05[257] */ - 0xf008, 0x8332, 0x8322, 0x7232, 0x7232, 0x6132, 0x6132, 0x6132, - 0x6132, 0x7312, 0x7312, 0x7301, 0x7301, 0x7031, 0x7031, 0x7222, - 0x7222, 0x6212, 0x6212, 0x6212, 0x6212, 0x6122, 0x6122, 0x6122, - 0x6122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021, - 0x6021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, - - /* huffTable06[129] */ - 0xf007, 0x7332, 0x7301, 0x6322, 0x6322, 0x6232, 0x6232, 0x6031, - 0x6031, 0x5312, 0x5312, 0x5312, 0x5312, 0x5132, 0x5132, 0x5132, - 0x5132, 0x5222, 0x5222, 0x5222, 0x5222, 0x5201, 0x5201, 0x5201, - 0x5201, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, - 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, - 0x4122, 0x4021, 0x4021, 0x4021, 0x4021, 0x4021, 0x4021, 0x4021, - 0x4021, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, - 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, - 0x3000, - - /* huffTable07[110] */ - 0xf006, 0x0041, 0x0052, 0x005b, 0x0060, 0x0063, 0x0068, 0x006b, - 0x6212, 0x5122, 0x5122, 0x6201, 0x6021, 0x4112, 0x4112, 0x4112, - 0x4112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0xf004, 0x4552, 0x4542, 0x4452, 0x4352, 0x3532, 0x3532, - 0x3442, 0x3442, 0x3522, 0x3522, 0x3252, 0x3252, 0x2512, 0x2512, - 0x2512, 0x2512, 0xf003, 0x2152, 0x2152, 0x3501, 0x3432, 0x2051, - 0x2051, 0x3342, 0x3332, 0xf002, 0x2422, 0x2242, 0x1412, 0x1412, - 0xf001, 0x1142, 0x1041, 0xf002, 0x2401, 0x2322, 0x2232, 0x2301, - 0xf001, 0x1312, 0x1132, 0xf001, 0x1031, 0x1222, - - /* huffTable08[280] */ - 0xf008, 0x0101, 0x010a, 0x010f, 0x8512, 0x8152, 0x0112, 0x0115, - 0x8422, 0x8242, 0x8412, 0x7142, 0x7142, 0x8401, 0x8041, 0x8322, - 0x8232, 0x8312, 0x8132, 0x8301, 0x8031, 0x6222, 0x6222, 0x6222, - 0x6222, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021, - 0x6021, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, - 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, - 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, - 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, - 0x4122, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, - 0x2112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0xf003, 0x3552, 0x3452, 0x2542, 0x2542, 0x1352, 0x1352, - 0x1352, 0x1352, 0xf002, 0x2532, 0x2442, 0x1522, 0x1522, 0xf001, - 0x1252, 0x1501, 0xf001, 0x1432, 0x1342, 0xf001, 0x1051, 0x1332, - - /* huffTable09[93] */ - 0xf006, 0x0041, 0x004a, 0x004f, 0x0052, 0x0057, 0x005a, 0x6412, - 0x6142, 0x6322, 0x6232, 0x5312, 0x5312, 0x5132, 0x5132, 0x6301, - 0x6031, 0x5222, 0x5222, 0x5201, 0x5201, 0x4212, 0x4212, 0x4212, - 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4021, 0x4021, 0x4021, - 0x4021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, - 0x3000, 0xf003, 0x3552, 0x3542, 0x2532, 0x2532, 0x2352, 0x2352, - 0x3452, 0x3501, 0xf002, 0x2442, 0x2522, 0x2252, 0x2512, 0xf001, - 0x1152, 0x1432, 0xf002, 0x1342, 0x1342, 0x2051, 0x2401, 0xf001, - 0x1422, 0x1242, 0xf001, 0x1332, 0x1041, - - /* huffTable10[320] */ - 0xf008, 0x0101, 0x010a, 0x010f, 0x0118, 0x011b, 0x0120, 0x0125, - 0x8712, 0x8172, 0x012a, 0x012d, 0x0132, 0x8612, 0x8162, 0x8061, - 0x0137, 0x013a, 0x013d, 0x8412, 0x8142, 0x8041, 0x8322, 0x8232, - 0x8301, 0x7312, 0x7312, 0x7132, 0x7132, 0x7031, 0x7031, 0x7222, - 0x7222, 0x6212, 0x6212, 0x6212, 0x6212, 0x6122, 0x6122, 0x6122, - 0x6122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021, - 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, - 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, - 0x4112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0xf003, 0x3772, 0x3762, 0x3672, 0x3752, 0x3572, 0x3662, - 0x2742, 0x2742, 0xf002, 0x2472, 0x2652, 0x2562, 0x2732, 0xf003, - 0x2372, 0x2372, 0x2642, 0x2642, 0x3552, 0x3452, 0x2362, 0x2362, - 0xf001, 0x1722, 0x1272, 0xf002, 0x2462, 0x2701, 0x1071, 0x1071, - 0xf002, 0x1262, 0x1262, 0x2542, 0x2532, 0xf002, 0x1601, 0x1601, - 0x2352, 0x2442, 0xf001, 0x1632, 0x1622, 0xf002, 0x2522, 0x2252, - 0x1512, 0x1512, 0xf002, 0x1152, 0x1152, 0x2432, 0x2342, 0xf001, - 0x1501, 0x1051, 0xf001, 0x1422, 0x1242, 0xf001, 0x1332, 0x1401, - - /* huffTable11[296] */ - 0xf008, 0x0101, 0x0106, 0x010f, 0x0114, 0x0117, 0x8722, 0x8272, - 0x011c, 0x7172, 0x7172, 0x8712, 0x8071, 0x8632, 0x8362, 0x8061, - 0x011f, 0x0122, 0x8512, 0x7262, 0x7262, 0x8622, 0x8601, 0x7612, - 0x7612, 0x7162, 0x7162, 0x8152, 0x8432, 0x8051, 0x0125, 0x8422, - 0x8242, 0x8412, 0x8142, 0x8401, 0x8041, 0x7322, 0x7322, 0x7232, - 0x7232, 0x6312, 0x6312, 0x6312, 0x6312, 0x6132, 0x6132, 0x6132, - 0x6132, 0x7301, 0x7301, 0x7031, 0x7031, 0x6222, 0x6222, 0x6222, - 0x6222, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, - 0x5122, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, - 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, - 0x4212, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, - 0x5201, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, - 0x5021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, - 0x2000, 0xf002, 0x2772, 0x2762, 0x2672, 0x2572, 0xf003, 0x2662, - 0x2662, 0x2742, 0x2742, 0x2472, 0x2472, 0x3752, 0x3552, 0xf002, - 0x2652, 0x2562, 0x1732, 0x1732, 0xf001, 0x1372, 0x1642, 0xf002, - 0x2542, 0x2452, 0x2532, 0x2352, 0xf001, 0x1462, 0x1701, 0xf001, - 0x1442, 0x1522, 0xf001, 0x1252, 0x1501, 0xf001, 0x1342, 0x1332, - - /* huffTable12[185] */ - 0xf007, 0x0081, 0x008a, 0x008f, 0x0092, 0x0097, 0x009a, 0x009d, - 0x00a2, 0x00a5, 0x00a8, 0x7622, 0x7262, 0x7162, 0x00ad, 0x00b0, - 0x00b3, 0x7512, 0x7152, 0x7432, 0x7342, 0x00b6, 0x7422, 0x7242, - 0x7412, 0x6332, 0x6332, 0x6142, 0x6142, 0x6322, 0x6322, 0x6232, - 0x6232, 0x7041, 0x7301, 0x6031, 0x6031, 0x5312, 0x5312, 0x5312, - 0x5312, 0x5132, 0x5132, 0x5132, 0x5132, 0x5222, 0x5222, 0x5222, - 0x5222, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, - 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, - 0x4122, 0x5201, 0x5201, 0x5201, 0x5201, 0x5021, 0x5021, 0x5021, - 0x5021, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, - 0x4000, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, - 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0xf003, 0x3772, 0x3762, 0x2672, 0x2672, 0x2752, 0x2752, - 0x2572, 0x2572, 0xf002, 0x2662, 0x2742, 0x2472, 0x2562, 0xf001, - 0x1652, 0x1732, 0xf002, 0x2372, 0x2552, 0x1722, 0x1722, 0xf001, - 0x1272, 0x1642, 0xf001, 0x1462, 0x1712, 0xf002, 0x1172, 0x1172, - 0x2701, 0x2071, 0xf001, 0x1632, 0x1362, 0xf001, 0x1542, 0x1452, - 0xf002, 0x1442, 0x1442, 0x2601, 0x2501, 0xf001, 0x1612, 0x1061, - 0xf001, 0x1532, 0x1352, 0xf001, 0x1522, 0x1252, 0xf001, 0x1051, - 0x1401, - - /* huffTable13[497] */ - 0xf006, 0x0041, 0x0082, 0x00c3, 0x00e4, 0x0105, 0x0116, 0x011f, - 0x0130, 0x0139, 0x013e, 0x0143, 0x0146, 0x6212, 0x6122, 0x6201, - 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4101, 0x4101, 0x4101, - 0x4101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0xf006, 0x0108, 0x0111, 0x011a, 0x0123, 0x012c, 0x0131, - 0x0136, 0x013f, 0x0144, 0x0147, 0x014c, 0x0151, 0x0156, 0x015b, - 0x6f12, 0x61f2, 0x60f1, 0x0160, 0x0163, 0x0166, 0x62e2, 0x0169, - 0x6e12, 0x61e2, 0x016c, 0x016f, 0x0172, 0x0175, 0x0178, 0x017b, - 0x66c2, 0x6d32, 0x017e, 0x6d22, 0x62d2, 0x6d12, 0x67b2, 0x0181, - 0x0184, 0x63c2, 0x0187, 0x6b42, 0x51d2, 0x51d2, 0x6d01, 0x60d1, - 0x6a82, 0x68a2, 0x6c42, 0x64c2, 0x6b62, 0x66b2, 0x5c32, 0x5c32, - 0x5c22, 0x5c22, 0x52c2, 0x52c2, 0x5b52, 0x5b52, 0x65b2, 0x6982, - 0x5c12, 0x5c12, 0xf006, 0x51c2, 0x51c2, 0x6892, 0x6c01, 0x50c1, - 0x50c1, 0x64b2, 0x6a62, 0x66a2, 0x6972, 0x5b32, 0x5b32, 0x53b2, - 0x53b2, 0x6882, 0x6a52, 0x5b22, 0x5b22, 0x65a2, 0x6962, 0x54a2, - 0x54a2, 0x6872, 0x6782, 0x5492, 0x5492, 0x6772, 0x6672, 0x42b2, - 0x42b2, 0x42b2, 0x42b2, 0x4b12, 0x4b12, 0x4b12, 0x4b12, 0x41b2, - 0x41b2, 0x41b2, 0x41b2, 0x5b01, 0x5b01, 0x50b1, 0x50b1, 0x5692, - 0x5692, 0x5a42, 0x5a42, 0x5a32, 0x5a32, 0x53a2, 0x53a2, 0x5952, - 0x5952, 0x5592, 0x5592, 0x4a22, 0x4a22, 0x4a22, 0x4a22, 0x42a2, - 0x42a2, 0x42a2, 0x42a2, 0xf005, 0x4a12, 0x4a12, 0x41a2, 0x41a2, - 0x5a01, 0x5862, 0x40a1, 0x40a1, 0x5682, 0x5942, 0x4392, 0x4392, - 0x5932, 0x5852, 0x5582, 0x5762, 0x4922, 0x4922, 0x4292, 0x4292, - 0x5752, 0x5572, 0x4832, 0x4832, 0x4382, 0x4382, 0x5662, 0x5742, - 0x5472, 0x5652, 0x5562, 0x5372, 0xf005, 0x3912, 0x3912, 0x3912, - 0x3912, 0x3192, 0x3192, 0x3192, 0x3192, 0x4901, 0x4901, 0x4091, - 0x4091, 0x4842, 0x4842, 0x4482, 0x4482, 0x4272, 0x4272, 0x5642, - 0x5462, 0x3822, 0x3822, 0x3822, 0x3822, 0x3282, 0x3282, 0x3282, - 0x3282, 0x3812, 0x3812, 0x3812, 0x3812, 0xf004, 0x4732, 0x4722, - 0x3712, 0x3712, 0x3172, 0x3172, 0x4552, 0x4701, 0x4071, 0x4632, - 0x4362, 0x4542, 0x4452, 0x4622, 0x4262, 0x4532, 0xf003, 0x2182, - 0x2182, 0x3801, 0x3081, 0x3612, 0x3162, 0x3601, 0x3061, 0xf004, - 0x4352, 0x4442, 0x3522, 0x3522, 0x3252, 0x3252, 0x3501, 0x3501, - 0x2512, 0x2512, 0x2512, 0x2512, 0x2152, 0x2152, 0x2152, 0x2152, - 0xf003, 0x3432, 0x3342, 0x3051, 0x3422, 0x3242, 0x3332, 0x2412, - 0x2412, 0xf002, 0x1142, 0x1142, 0x2401, 0x2041, 0xf002, 0x2322, - 0x2232, 0x1312, 0x1312, 0xf001, 0x1132, 0x1301, 0xf001, 0x1031, - 0x1222, 0xf003, 0x0082, 0x008b, 0x008e, 0x0091, 0x0094, 0x0097, - 0x3ce2, 0x3dd2, 0xf003, 0x0093, 0x3eb2, 0x3be2, 0x3f92, 0x39f2, - 0x3ae2, 0x3db2, 0x3bd2, 0xf003, 0x3f82, 0x38f2, 0x3cc2, 0x008d, - 0x3e82, 0x0090, 0x27f2, 0x27f2, 0xf003, 0x2ad2, 0x2ad2, 0x3da2, - 0x3cb2, 0x3bc2, 0x36f2, 0x2f62, 0x2f62, 0xf002, 0x28e2, 0x2f52, - 0x2d92, 0x29d2, 0xf002, 0x25f2, 0x27e2, 0x2ca2, 0x2bb2, 0xf003, - 0x2f42, 0x2f42, 0x24f2, 0x24f2, 0x3ac2, 0x36e2, 0x23f2, 0x23f2, - 0xf002, 0x1f32, 0x1f32, 0x2d82, 0x28d2, 0xf001, 0x1f22, 0x12f2, - 0xf002, 0x2e62, 0x2c92, 0x1f01, 0x1f01, 0xf002, 0x29c2, 0x2e52, - 0x1ba2, 0x1ba2, 0xf002, 0x2d72, 0x27d2, 0x1e42, 0x1e42, 0xf002, - 0x28c2, 0x26d2, 0x1e32, 0x1e32, 0xf002, 0x19b2, 0x19b2, 0x2b92, - 0x2aa2, 0xf001, 0x1ab2, 0x15e2, 0xf001, 0x14e2, 0x1c82, 0xf001, - 0x1d62, 0x13e2, 0xf001, 0x1e22, 0x1e01, 0xf001, 0x10e1, 0x1d52, - 0xf001, 0x15d2, 0x1c72, 0xf001, 0x17c2, 0x1d42, 0xf001, 0x1b82, - 0x18b2, 0xf001, 0x14d2, 0x1a92, 0xf001, 0x19a2, 0x1c62, 0xf001, - 0x13d2, 0x1b72, 0xf001, 0x1c52, 0x15c2, 0xf001, 0x1992, 0x1a72, - 0xf001, 0x17a2, 0x1792, 0xf003, 0x0023, 0x3df2, 0x2de2, 0x2de2, - 0x1ff2, 0x1ff2, 0x1ff2, 0x1ff2, 0xf001, 0x1fe2, 0x1fd2, 0xf001, - 0x1ee2, 0x1fc2, 0xf001, 0x1ed2, 0x1fb2, 0xf001, 0x1bf2, 0x1ec2, - 0xf002, 0x1cd2, 0x1cd2, 0x2fa2, 0x29e2, 0xf001, 0x1af2, 0x1dc2, - 0xf001, 0x1ea2, 0x1e92, 0xf001, 0x1f72, 0x1e72, 0xf001, 0x1ef2, - 0x1cf2, - - /* huffTable15[580] */ - 0xf008, 0x0101, 0x0122, 0x0143, 0x0154, 0x0165, 0x0176, 0x017f, - 0x0188, 0x0199, 0x01a2, 0x01ab, 0x01b4, 0x01bd, 0x01c2, 0x01cb, - 0x01d4, 0x01d9, 0x01de, 0x01e3, 0x01e8, 0x01ed, 0x01f2, 0x01f7, - 0x01fc, 0x0201, 0x0204, 0x0207, 0x020a, 0x020f, 0x0212, 0x0215, - 0x021a, 0x021d, 0x0220, 0x8192, 0x0223, 0x0226, 0x0229, 0x022c, - 0x022f, 0x8822, 0x8282, 0x8812, 0x8182, 0x0232, 0x0235, 0x0238, - 0x023b, 0x8722, 0x8272, 0x8462, 0x8712, 0x8552, 0x8172, 0x023e, - 0x8632, 0x8362, 0x8542, 0x8452, 0x8622, 0x8262, 0x8612, 0x0241, - 0x8532, 0x7162, 0x7162, 0x8352, 0x8442, 0x7522, 0x7522, 0x7252, - 0x7252, 0x7512, 0x7512, 0x7152, 0x7152, 0x8501, 0x8051, 0x7432, - 0x7432, 0x7342, 0x7342, 0x7422, 0x7422, 0x7242, 0x7242, 0x7332, - 0x7332, 0x6142, 0x6142, 0x6142, 0x6142, 0x7412, 0x7412, 0x7401, - 0x7401, 0x6322, 0x6322, 0x6322, 0x6322, 0x6232, 0x6232, 0x6232, - 0x6232, 0x7041, 0x7041, 0x7301, 0x7301, 0x6312, 0x6312, 0x6312, - 0x6312, 0x6132, 0x6132, 0x6132, 0x6132, 0x6031, 0x6031, 0x6031, - 0x6031, 0x5222, 0x5222, 0x5222, 0x5222, 0x5222, 0x5222, 0x5222, - 0x5222, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, - 0x5212, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, - 0x5122, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, - 0x5201, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, - 0x5021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, - 0x3112, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, - 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, - 0x4101, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, - 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, - 0x4011, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, - 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, - 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, - 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, - 0x3000, 0xf005, 0x5ff2, 0x5fe2, 0x5ef2, 0x5fd2, 0x4ee2, 0x4ee2, - 0x5df2, 0x5fc2, 0x5cf2, 0x5ed2, 0x5de2, 0x5fb2, 0x4bf2, 0x4bf2, - 0x5ec2, 0x5ce2, 0x4dd2, 0x4dd2, 0x4fa2, 0x4fa2, 0x4af2, 0x4af2, - 0x4eb2, 0x4eb2, 0x4be2, 0x4be2, 0x4dc2, 0x4dc2, 0x4cd2, 0x4cd2, - 0x4f92, 0x4f92, 0xf005, 0x49f2, 0x49f2, 0x4ae2, 0x4ae2, 0x4db2, - 0x4db2, 0x4bd2, 0x4bd2, 0x4f82, 0x4f82, 0x48f2, 0x48f2, 0x4cc2, - 0x4cc2, 0x4e92, 0x4e92, 0x49e2, 0x49e2, 0x4f72, 0x4f72, 0x47f2, - 0x47f2, 0x4da2, 0x4da2, 0x4ad2, 0x4ad2, 0x4cb2, 0x4cb2, 0x4f62, - 0x4f62, 0x5ea2, 0x5f01, 0xf004, 0x3bc2, 0x3bc2, 0x36f2, 0x36f2, - 0x4e82, 0x48e2, 0x4f52, 0x4d92, 0x35f2, 0x35f2, 0x3e72, 0x3e72, - 0x37e2, 0x37e2, 0x3ca2, 0x3ca2, 0xf004, 0x3ac2, 0x3ac2, 0x3bb2, - 0x3bb2, 0x49d2, 0x4d82, 0x3f42, 0x3f42, 0x34f2, 0x34f2, 0x3f32, - 0x3f32, 0x33f2, 0x33f2, 0x38d2, 0x38d2, 0xf004, 0x36e2, 0x36e2, - 0x3f22, 0x3f22, 0x32f2, 0x32f2, 0x4e62, 0x40f1, 0x3f12, 0x3f12, - 0x31f2, 0x31f2, 0x3c92, 0x3c92, 0x39c2, 0x39c2, 0xf003, 0x3e52, - 0x3ba2, 0x3ab2, 0x35e2, 0x3d72, 0x37d2, 0x3e42, 0x34e2, 0xf003, - 0x3c82, 0x38c2, 0x3e32, 0x3d62, 0x36d2, 0x33e2, 0x3b92, 0x39b2, - 0xf004, 0x3e22, 0x3e22, 0x3aa2, 0x3aa2, 0x32e2, 0x32e2, 0x3e12, - 0x3e12, 0x31e2, 0x31e2, 0x4e01, 0x40e1, 0x3d52, 0x3d52, 0x35d2, - 0x35d2, 0xf003, 0x3c72, 0x37c2, 0x3d42, 0x3b82, 0x24d2, 0x24d2, - 0x38b2, 0x3a92, 0xf003, 0x39a2, 0x3c62, 0x36c2, 0x3d32, 0x23d2, - 0x23d2, 0x22d2, 0x22d2, 0xf003, 0x3d22, 0x3d01, 0x2d12, 0x2d12, - 0x2b72, 0x2b72, 0x27b2, 0x27b2, 0xf003, 0x21d2, 0x21d2, 0x3c52, - 0x30d1, 0x25c2, 0x25c2, 0x2a82, 0x2a82, 0xf002, 0x28a2, 0x2c42, - 0x24c2, 0x2b62, 0xf003, 0x26b2, 0x26b2, 0x3992, 0x3c01, 0x2c32, - 0x2c32, 0x23c2, 0x23c2, 0xf003, 0x2a72, 0x2a72, 0x27a2, 0x27a2, - 0x26a2, 0x26a2, 0x30c1, 0x3b01, 0xf002, 0x12c2, 0x12c2, 0x2c22, - 0x2b52, 0xf002, 0x25b2, 0x2c12, 0x2982, 0x2892, 0xf002, 0x21c2, - 0x2b42, 0x24b2, 0x2a62, 0xf002, 0x2b32, 0x2972, 0x13b2, 0x13b2, - 0xf002, 0x2792, 0x2882, 0x2b22, 0x2a52, 0xf002, 0x12b2, 0x12b2, - 0x25a2, 0x2b12, 0xf002, 0x11b2, 0x11b2, 0x20b1, 0x2962, 0xf002, - 0x2692, 0x2a42, 0x24a2, 0x2872, 0xf002, 0x2782, 0x2a32, 0x13a2, - 0x13a2, 0xf001, 0x1952, 0x1592, 0xf001, 0x1a22, 0x12a2, 0xf001, - 0x1a12, 0x11a2, 0xf002, 0x2a01, 0x20a1, 0x1862, 0x1862, 0xf001, - 0x1682, 0x1942, 0xf001, 0x1492, 0x1932, 0xf002, 0x1392, 0x1392, - 0x2772, 0x2901, 0xf001, 0x1852, 0x1582, 0xf001, 0x1922, 0x1762, - 0xf001, 0x1672, 0x1292, 0xf001, 0x1912, 0x1091, 0xf001, 0x1842, - 0x1482, 0xf001, 0x1752, 0x1572, 0xf001, 0x1832, 0x1382, 0xf001, - 0x1662, 0x1742, 0xf001, 0x1472, 0x1801, 0xf001, 0x1081, 0x1652, - 0xf001, 0x1562, 0x1732, 0xf001, 0x1372, 0x1642, 0xf001, 0x1701, - 0x1071, 0xf001, 0x1601, 0x1061, - - /* huffTable16[651] */ - 0xf008, 0x0101, 0x010a, 0x0113, 0x8ff2, 0x0118, 0x011d, 0x0120, - 0x82f2, 0x0131, 0x8f12, 0x81f2, 0x0134, 0x0145, 0x0156, 0x0167, - 0x0178, 0x0189, 0x019a, 0x01a3, 0x01ac, 0x01b5, 0x01be, 0x01c7, - 0x01d0, 0x01d9, 0x01de, 0x01e3, 0x01e6, 0x01eb, 0x01f0, 0x8152, - 0x01f3, 0x01f6, 0x01f9, 0x01fc, 0x8412, 0x8142, 0x01ff, 0x8322, - 0x8232, 0x7312, 0x7312, 0x7132, 0x7132, 0x8301, 0x8031, 0x7222, - 0x7222, 0x6212, 0x6212, 0x6212, 0x6212, 0x6122, 0x6122, 0x6122, - 0x6122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021, - 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, - 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, - 0x4112, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, - 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, - 0x4101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, - 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0xf003, 0x3fe2, 0x3ef2, 0x3fd2, 0x3df2, 0x3fc2, 0x3cf2, - 0x3fb2, 0x3bf2, 0xf003, 0x2fa2, 0x2fa2, 0x3af2, 0x3f92, 0x39f2, - 0x38f2, 0x2f82, 0x2f82, 0xf002, 0x2f72, 0x27f2, 0x2f62, 0x26f2, - 0xf002, 0x2f52, 0x25f2, 0x1f42, 0x1f42, 0xf001, 0x14f2, 0x13f2, - 0xf004, 0x10f1, 0x10f1, 0x10f1, 0x10f1, 0x10f1, 0x10f1, 0x10f1, - 0x10f1, 0x2f32, 0x2f32, 0x2f32, 0x2f32, 0x00e2, 0x00f3, 0x00fc, - 0x0105, 0xf001, 0x1f22, 0x1f01, 0xf004, 0x00fa, 0x00ff, 0x0104, - 0x0109, 0x010c, 0x0111, 0x0116, 0x0119, 0x011e, 0x0123, 0x0128, - 0x43e2, 0x012d, 0x0130, 0x0133, 0x0136, 0xf004, 0x0128, 0x012b, - 0x012e, 0x4d01, 0x0131, 0x0134, 0x0137, 0x4c32, 0x013a, 0x4c12, - 0x40c1, 0x013d, 0x32e2, 0x32e2, 0x4e22, 0x4e12, 0xf004, 0x43d2, - 0x4d22, 0x42d2, 0x41d2, 0x4b32, 0x012f, 0x3d12, 0x3d12, 0x44c2, - 0x4b62, 0x43c2, 0x47a2, 0x3c22, 0x3c22, 0x42c2, 0x45b2, 0xf004, - 0x41c2, 0x4c01, 0x4b42, 0x44b2, 0x4a62, 0x46a2, 0x33b2, 0x33b2, - 0x4a52, 0x45a2, 0x3b22, 0x3b22, 0x32b2, 0x32b2, 0x3b12, 0x3b12, - 0xf004, 0x31b2, 0x31b2, 0x4b01, 0x40b1, 0x4962, 0x4692, 0x4a42, - 0x44a2, 0x4872, 0x4782, 0x33a2, 0x33a2, 0x4a32, 0x4952, 0x3a22, - 0x3a22, 0xf004, 0x4592, 0x4862, 0x31a2, 0x31a2, 0x4682, 0x4772, - 0x3492, 0x3492, 0x4942, 0x4752, 0x3762, 0x3762, 0x22a2, 0x22a2, - 0x22a2, 0x22a2, 0xf003, 0x2a12, 0x2a12, 0x3a01, 0x30a1, 0x3932, - 0x3392, 0x3852, 0x3582, 0xf003, 0x2922, 0x2922, 0x2292, 0x2292, - 0x3672, 0x3901, 0x2912, 0x2912, 0xf003, 0x2192, 0x2192, 0x3091, - 0x3842, 0x3482, 0x3572, 0x3832, 0x3382, 0xf003, 0x3662, 0x3822, - 0x2282, 0x2282, 0x3742, 0x3472, 0x2812, 0x2812, 0xf003, 0x2182, - 0x2182, 0x2081, 0x2081, 0x3801, 0x3652, 0x2732, 0x2732, 0xf003, - 0x2372, 0x2372, 0x3562, 0x3642, 0x2722, 0x2722, 0x2272, 0x2272, - 0xf003, 0x3462, 0x3552, 0x2701, 0x2701, 0x1712, 0x1712, 0x1712, - 0x1712, 0xf002, 0x1172, 0x1172, 0x2071, 0x2632, 0xf002, 0x2362, - 0x2542, 0x2452, 0x2622, 0xf001, 0x1262, 0x1612, 0xf002, 0x1162, - 0x1162, 0x2601, 0x2061, 0xf002, 0x1352, 0x1352, 0x2532, 0x2442, - 0xf001, 0x1522, 0x1252, 0xf001, 0x1512, 0x1501, 0xf001, 0x1432, - 0x1342, 0xf001, 0x1051, 0x1422, 0xf001, 0x1242, 0x1332, 0xf001, - 0x1401, 0x1041, 0xf004, 0x4ec2, 0x0086, 0x3ed2, 0x3ed2, 0x39e2, - 0x39e2, 0x4ae2, 0x49d2, 0x2ee2, 0x2ee2, 0x2ee2, 0x2ee2, 0x3de2, - 0x3de2, 0x3be2, 0x3be2, 0xf003, 0x2eb2, 0x2eb2, 0x2dc2, 0x2dc2, - 0x3cd2, 0x3bd2, 0x2ea2, 0x2ea2, 0xf003, 0x2cc2, 0x2cc2, 0x3da2, - 0x3ad2, 0x3e72, 0x3ca2, 0x2ac2, 0x2ac2, 0xf003, 0x39c2, 0x3d72, - 0x2e52, 0x2e52, 0x1db2, 0x1db2, 0x1db2, 0x1db2, 0xf002, 0x1e92, - 0x1e92, 0x2cb2, 0x2bc2, 0xf002, 0x2e82, 0x28e2, 0x2d92, 0x27e2, - 0xf002, 0x2bb2, 0x2d82, 0x28d2, 0x2e62, 0xf001, 0x16e2, 0x1c92, - 0xf002, 0x2ba2, 0x2ab2, 0x25e2, 0x27d2, 0xf002, 0x1e42, 0x1e42, - 0x24e2, 0x2c82, 0xf001, 0x18c2, 0x1e32, 0xf002, 0x1d62, 0x1d62, - 0x26d2, 0x2b92, 0xf002, 0x29b2, 0x2aa2, 0x11e2, 0x11e2, 0xf002, - 0x14d2, 0x14d2, 0x28b2, 0x29a2, 0xf002, 0x1b72, 0x1b72, 0x27b2, - 0x20d1, 0xf001, 0x1e01, 0x10e1, 0xf001, 0x1d52, 0x15d2, 0xf001, - 0x1c72, 0x17c2, 0xf001, 0x1d42, 0x1b82, 0xf001, 0x1a92, 0x1c62, - 0xf001, 0x16c2, 0x1d32, 0xf001, 0x1c52, 0x15c2, 0xf001, 0x1a82, - 0x18a2, 0xf001, 0x1992, 0x1c42, 0xf001, 0x16b2, 0x1a72, 0xf001, - 0x1b52, 0x1982, 0xf001, 0x1892, 0x1972, 0xf001, 0x1792, 0x1882, - 0xf001, 0x1ce2, 0x1dd2, - - /* huffTable24[705] */ - 0xf009, 0x8fe2, 0x8fe2, 0x8ef2, 0x8ef2, 0x8fd2, 0x8fd2, 0x8df2, - 0x8df2, 0x8fc2, 0x8fc2, 0x8cf2, 0x8cf2, 0x8fb2, 0x8fb2, 0x8bf2, - 0x8bf2, 0x7af2, 0x7af2, 0x7af2, 0x7af2, 0x8fa2, 0x8fa2, 0x8f92, - 0x8f92, 0x79f2, 0x79f2, 0x79f2, 0x79f2, 0x78f2, 0x78f2, 0x78f2, - 0x78f2, 0x8f82, 0x8f82, 0x8f72, 0x8f72, 0x77f2, 0x77f2, 0x77f2, - 0x77f2, 0x7f62, 0x7f62, 0x7f62, 0x7f62, 0x76f2, 0x76f2, 0x76f2, - 0x76f2, 0x7f52, 0x7f52, 0x7f52, 0x7f52, 0x75f2, 0x75f2, 0x75f2, - 0x75f2, 0x7f42, 0x7f42, 0x7f42, 0x7f42, 0x74f2, 0x74f2, 0x74f2, - 0x74f2, 0x7f32, 0x7f32, 0x7f32, 0x7f32, 0x73f2, 0x73f2, 0x73f2, - 0x73f2, 0x7f22, 0x7f22, 0x7f22, 0x7f22, 0x72f2, 0x72f2, 0x72f2, - 0x72f2, 0x71f2, 0x71f2, 0x71f2, 0x71f2, 0x8f12, 0x8f12, 0x80f1, - 0x80f1, 0x9f01, 0x0201, 0x0206, 0x020b, 0x0210, 0x0215, 0x021a, - 0x021f, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, - 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, - 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, - 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, - 0x4ff2, 0x0224, 0x0229, 0x0232, 0x0237, 0x023a, 0x023f, 0x0242, - 0x0245, 0x024a, 0x024d, 0x0250, 0x0253, 0x0256, 0x0259, 0x025c, - 0x025f, 0x0262, 0x0265, 0x0268, 0x026b, 0x026e, 0x0271, 0x0274, - 0x0277, 0x027a, 0x027d, 0x0280, 0x0283, 0x0288, 0x028b, 0x028e, - 0x0291, 0x0294, 0x0297, 0x029a, 0x029f, 0x94b2, 0x02a4, 0x02a7, - 0x02aa, 0x93b2, 0x9882, 0x02af, 0x92b2, 0x02b2, 0x02b5, 0x9692, - 0x94a2, 0x02b8, 0x9782, 0x9a32, 0x93a2, 0x9952, 0x9592, 0x9a22, - 0x92a2, 0x91a2, 0x9862, 0x9682, 0x9772, 0x9942, 0x9492, 0x9932, - 0x9392, 0x9852, 0x9582, 0x9922, 0x9762, 0x9672, 0x9292, 0x9912, - 0x9192, 0x9842, 0x9482, 0x9752, 0x9572, 0x9832, 0x9382, 0x9662, - 0x9822, 0x9282, 0x9812, 0x9742, 0x9472, 0x9182, 0x02bb, 0x9652, - 0x9562, 0x9712, 0x02be, 0x8372, 0x8372, 0x9732, 0x9722, 0x8272, - 0x8272, 0x8642, 0x8642, 0x8462, 0x8462, 0x8552, 0x8552, 0x8172, - 0x8172, 0x8632, 0x8632, 0x8362, 0x8362, 0x8542, 0x8542, 0x8452, - 0x8452, 0x8622, 0x8622, 0x8262, 0x8262, 0x8612, 0x8612, 0x8162, - 0x8162, 0x9601, 0x9061, 0x8532, 0x8532, 0x8352, 0x8352, 0x8442, - 0x8442, 0x8522, 0x8522, 0x8252, 0x8252, 0x8512, 0x8512, 0x9501, - 0x9051, 0x7152, 0x7152, 0x7152, 0x7152, 0x8432, 0x8432, 0x8342, - 0x8342, 0x7422, 0x7422, 0x7422, 0x7422, 0x7242, 0x7242, 0x7242, - 0x7242, 0x7332, 0x7332, 0x7332, 0x7332, 0x7412, 0x7412, 0x7412, - 0x7412, 0x7142, 0x7142, 0x7142, 0x7142, 0x8401, 0x8401, 0x8041, - 0x8041, 0x7322, 0x7322, 0x7322, 0x7322, 0x7232, 0x7232, 0x7232, - 0x7232, 0x6312, 0x6312, 0x6312, 0x6312, 0x6312, 0x6312, 0x6312, - 0x6312, 0x6132, 0x6132, 0x6132, 0x6132, 0x6132, 0x6132, 0x6132, - 0x6132, 0x7301, 0x7301, 0x7301, 0x7301, 0x7031, 0x7031, 0x7031, - 0x7031, 0x6222, 0x6222, 0x6222, 0x6222, 0x6222, 0x6222, 0x6222, - 0x6222, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, - 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, - 0x5212, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, - 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, - 0x5122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6201, 0x6201, 0x6201, - 0x6201, 0x6021, 0x6021, 0x6021, 0x6021, 0x6021, 0x6021, 0x6021, - 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, - 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, - 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, - 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, - 0x4112, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, - 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, - 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, - 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, - 0x4101, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, - 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, - 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, - 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, - 0x4011, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, - 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, - 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, - 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, - 0x4000, 0xf002, 0x2ee2, 0x2ed2, 0x2de2, 0x2ec2, 0xf002, 0x2ce2, - 0x2dd2, 0x2eb2, 0x2be2, 0xf002, 0x2dc2, 0x2cd2, 0x2ea2, 0x2ae2, - 0xf002, 0x2db2, 0x2bd2, 0x2cc2, 0x2e92, 0xf002, 0x29e2, 0x2da2, - 0x2ad2, 0x2cb2, 0xf002, 0x2bc2, 0x2e82, 0x28e2, 0x2d92, 0xf002, - 0x29d2, 0x2e72, 0x27e2, 0x2ca2, 0xf002, 0x2ac2, 0x2bb2, 0x2d82, - 0x28d2, 0xf003, 0x3e01, 0x30e1, 0x2d01, 0x2d01, 0x16e2, 0x16e2, - 0x16e2, 0x16e2, 0xf002, 0x2e62, 0x2c92, 0x19c2, 0x19c2, 0xf001, - 0x1e52, 0x1ab2, 0xf002, 0x15e2, 0x15e2, 0x2ba2, 0x2d72, 0xf001, - 0x17d2, 0x14e2, 0xf001, 0x1c82, 0x18c2, 0xf002, 0x2e42, 0x2e22, - 0x1e32, 0x1e32, 0xf001, 0x1d62, 0x16d2, 0xf001, 0x13e2, 0x1b92, - 0xf001, 0x19b2, 0x1aa2, 0xf001, 0x12e2, 0x1e12, 0xf001, 0x11e2, - 0x1d52, 0xf001, 0x15d2, 0x1c72, 0xf001, 0x17c2, 0x1d42, 0xf001, - 0x1b82, 0x18b2, 0xf001, 0x14d2, 0x1a92, 0xf001, 0x19a2, 0x1c62, - 0xf001, 0x16c2, 0x1d32, 0xf001, 0x13d2, 0x1d22, 0xf001, 0x12d2, - 0x1d12, 0xf001, 0x1b72, 0x17b2, 0xf001, 0x11d2, 0x1c52, 0xf001, - 0x15c2, 0x1a82, 0xf001, 0x18a2, 0x1992, 0xf001, 0x1c42, 0x14c2, - 0xf001, 0x1b62, 0x16b2, 0xf002, 0x20d1, 0x2c01, 0x1c32, 0x1c32, - 0xf001, 0x13c2, 0x1a72, 0xf001, 0x17a2, 0x1c22, 0xf001, 0x12c2, - 0x1b52, 0xf001, 0x15b2, 0x1c12, 0xf001, 0x1982, 0x1892, 0xf001, - 0x11c2, 0x1b42, 0xf002, 0x20c1, 0x2b01, 0x1b32, 0x1b32, 0xf002, - 0x20b1, 0x2a01, 0x1a12, 0x1a12, 0xf001, 0x1a62, 0x16a2, 0xf001, - 0x1972, 0x1792, 0xf002, 0x20a1, 0x2901, 0x1091, 0x1091, 0xf001, - 0x1b22, 0x1a52, 0xf001, 0x15a2, 0x1b12, 0xf001, 0x11b2, 0x1962, - 0xf001, 0x1a42, 0x1872, 0xf001, 0x1801, 0x1081, 0xf001, 0x1701, - 0x1071, -}; - -#define HUFF_OFFSET_01 0 -#define HUFF_OFFSET_02 ( 9 + HUFF_OFFSET_01) -#define HUFF_OFFSET_03 ( 65 + HUFF_OFFSET_02) -#define HUFF_OFFSET_05 ( 65 + HUFF_OFFSET_03) -#define HUFF_OFFSET_06 (257 + HUFF_OFFSET_05) -#define HUFF_OFFSET_07 (129 + HUFF_OFFSET_06) -#define HUFF_OFFSET_08 (110 + HUFF_OFFSET_07) -#define HUFF_OFFSET_09 (280 + HUFF_OFFSET_08) -#define HUFF_OFFSET_10 ( 93 + HUFF_OFFSET_09) -#define HUFF_OFFSET_11 (320 + HUFF_OFFSET_10) -#define HUFF_OFFSET_12 (296 + HUFF_OFFSET_11) -#define HUFF_OFFSET_13 (185 + HUFF_OFFSET_12) -#define HUFF_OFFSET_15 (497 + HUFF_OFFSET_13) -#define HUFF_OFFSET_16 (580 + HUFF_OFFSET_15) -#define HUFF_OFFSET_24 (651 + HUFF_OFFSET_16) - -const int huffTabOffset[HUFF_PAIRTABS] = { - 0, - HUFF_OFFSET_01, - HUFF_OFFSET_02, - HUFF_OFFSET_03, - 0, - HUFF_OFFSET_05, - HUFF_OFFSET_06, - HUFF_OFFSET_07, - HUFF_OFFSET_08, - HUFF_OFFSET_09, - HUFF_OFFSET_10, - HUFF_OFFSET_11, - HUFF_OFFSET_12, - HUFF_OFFSET_13, - 0, - HUFF_OFFSET_15, - HUFF_OFFSET_16, - HUFF_OFFSET_16, - HUFF_OFFSET_16, - HUFF_OFFSET_16, - HUFF_OFFSET_16, - HUFF_OFFSET_16, - HUFF_OFFSET_16, - HUFF_OFFSET_16, - HUFF_OFFSET_24, - HUFF_OFFSET_24, - HUFF_OFFSET_24, - HUFF_OFFSET_24, - HUFF_OFFSET_24, - HUFF_OFFSET_24, - HUFF_OFFSET_24, - HUFF_OFFSET_24, -}; - -const HuffTabLookup huffTabLookup[HUFF_PAIRTABS] = { - { 0, noBits }, - { 0, oneShot }, - { 0, oneShot }, - { 0, oneShot }, - { 0, invalidTab }, - { 0, oneShot }, - { 0, oneShot }, - { 0, loopNoLinbits }, - { 0, loopNoLinbits }, - { 0, loopNoLinbits }, - { 0, loopNoLinbits }, - { 0, loopNoLinbits }, - { 0, loopNoLinbits }, - { 0, loopNoLinbits }, - { 0, invalidTab }, - { 0, loopNoLinbits }, - { 1, loopLinbits }, - { 2, loopLinbits }, - { 3, loopLinbits }, - { 4, loopLinbits }, - { 6, loopLinbits }, - { 8, loopLinbits }, - { 10, loopLinbits }, - { 13, loopLinbits }, - { 4, loopLinbits }, - { 5, loopLinbits }, - { 6, loopLinbits }, - { 7, loopLinbits }, - { 8, loopLinbits }, - { 9, loopLinbits }, - { 11, loopLinbits }, - { 13, loopLinbits }, -}; - -/* tables for quadruples - * format 0xAB - * A = length of codeword - * B = codeword - */ -const unsigned char quadTable[64+16] = { - /* table A */ - 0x6b, 0x6f, 0x6d, 0x6e, 0x67, 0x65, 0x59, 0x59, - 0x56, 0x56, 0x53, 0x53, 0x5a, 0x5a, 0x5c, 0x5c, - 0x42, 0x42, 0x42, 0x42, 0x41, 0x41, 0x41, 0x41, - 0x44, 0x44, 0x44, 0x44, 0x48, 0x48, 0x48, 0x48, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - /* table B */ - 0x4f, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x48, - 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, 0x40, -}; - -const int quadTabOffset[2] = {0, 64}; -const int quadTabMaxBits[2] = {6, 4}; +/* ***** BEGIN LICENSE BLOCK ***** + * Version: RCSL 1.0/RPSL 1.0 + * + * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. + * + * The contents of this file, and the files included with this file, are + * subject to the current version of the RealNetworks Public Source License + * Version 1.0 (the "RPSL") available at + * http://www.helixcommunity.org/content/rpsl unless you have licensed + * the file under the RealNetworks Community Source License Version 1.0 + * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, + * in which case the RCSL will apply. You may also obtain the license terms + * directly from RealNetworks. You may not use this file except in + * compliance with the RPSL or, if you have a valid RCSL with RealNetworks + * applicable to this file, the RCSL. Please see the applicable RPSL or + * RCSL for the rights, obligations and limitations governing use of the + * contents of the file. + * + * This file is part of the Helix DNA Technology. RealNetworks is the + * developer of the Original Code and owns the copyrights in the portions + * it created. + * + * This file, and the files included with this file, is distributed and made + * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * + * Technology Compatibility Kit Test Suite(s) Location: + * http://www.helixcommunity.org/content/tck + * + * Contributor(s): + * + * ***** END LICENSE BLOCK ***** */ + +/************************************************************************************** + * Fixed-point MP3 decoder + * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com) + * June 2003 + * + * hufftabs.c - compressed Huffman code tables + **************************************************************************************/ + +#include "coder.h" + +/* NOTE - regenerated tables to use shorts instead of ints + * (all needed data can fit in 16 bits - see below) + * + * format 0xABCD + * A = length of codeword + * B = y value + * C = x value + * D = number of sign bits (0, 1, or 2) + * + * to read a CW, the code reads maxbits from the stream (dep. on + * table index), but doesn't remove them from the bitstream reader + * then it gets the correct CW by direct lookup into the table + * of length (2^maxbits) (more complicated for non-oneShot...) + * for CW's with hlen < maxbits, there are multiple entries in the + * table (extra bits are don't cares) + * the bitstream reader then "purges" (or removes) only the correct + * number of bits for the chosen CW + * + * entries starting with F are special: D (signbits) is maxbits, + * so the decoder always checks huffTableXX[0] first, gets the + * signbits, and reads that many bits from the bitstream + * (sometimes it takes > 1 read to get the value, so maxbits is + * can get updated by jumping to another value starting with 0xF) + * entries starting with 0 are also special: A = hlen = 0, rest of + * value is an offset to jump higher in the table (for tables of + * type loopNoLinbits or loopLinbits) + */ + +/* store Huffman codes as one big table plus table of offsets, since some platforms + * don't properly support table-of-tables (table of pointers to other const tables) + */ +const unsigned short huffTable[] = { + /* huffTable01[9] */ + 0xf003, 0x3112, 0x3101, 0x2011, 0x2011, 0x1000, 0x1000, 0x1000, + 0x1000, + + /* huffTable02[65] */ + 0xf006, 0x6222, 0x6201, 0x5212, 0x5212, 0x5122, 0x5122, 0x5021, + 0x5021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, + + /* huffTable03[65] */ + 0xf006, 0x6222, 0x6201, 0x5212, 0x5212, 0x5122, 0x5122, 0x5021, + 0x5021, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, + 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, 0x2101, + 0x2101, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, + + /* huffTable05[257] */ + 0xf008, 0x8332, 0x8322, 0x7232, 0x7232, 0x6132, 0x6132, 0x6132, + 0x6132, 0x7312, 0x7312, 0x7301, 0x7301, 0x7031, 0x7031, 0x7222, + 0x7222, 0x6212, 0x6212, 0x6212, 0x6212, 0x6122, 0x6122, 0x6122, + 0x6122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021, + 0x6021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, + + /* huffTable06[129] */ + 0xf007, 0x7332, 0x7301, 0x6322, 0x6322, 0x6232, 0x6232, 0x6031, + 0x6031, 0x5312, 0x5312, 0x5312, 0x5312, 0x5132, 0x5132, 0x5132, + 0x5132, 0x5222, 0x5222, 0x5222, 0x5222, 0x5201, 0x5201, 0x5201, + 0x5201, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, + 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, + 0x4122, 0x4021, 0x4021, 0x4021, 0x4021, 0x4021, 0x4021, 0x4021, + 0x4021, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, + 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, + 0x3000, + + /* huffTable07[110] */ + 0xf006, 0x0041, 0x0052, 0x005b, 0x0060, 0x0063, 0x0068, 0x006b, + 0x6212, 0x5122, 0x5122, 0x6201, 0x6021, 0x4112, 0x4112, 0x4112, + 0x4112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0xf004, 0x4552, 0x4542, 0x4452, 0x4352, 0x3532, 0x3532, + 0x3442, 0x3442, 0x3522, 0x3522, 0x3252, 0x3252, 0x2512, 0x2512, + 0x2512, 0x2512, 0xf003, 0x2152, 0x2152, 0x3501, 0x3432, 0x2051, + 0x2051, 0x3342, 0x3332, 0xf002, 0x2422, 0x2242, 0x1412, 0x1412, + 0xf001, 0x1142, 0x1041, 0xf002, 0x2401, 0x2322, 0x2232, 0x2301, + 0xf001, 0x1312, 0x1132, 0xf001, 0x1031, 0x1222, + + /* huffTable08[280] */ + 0xf008, 0x0101, 0x010a, 0x010f, 0x8512, 0x8152, 0x0112, 0x0115, + 0x8422, 0x8242, 0x8412, 0x7142, 0x7142, 0x8401, 0x8041, 0x8322, + 0x8232, 0x8312, 0x8132, 0x8301, 0x8031, 0x6222, 0x6222, 0x6222, + 0x6222, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021, + 0x6021, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, + 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, + 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, + 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, + 0x4122, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, 0x2112, + 0x2112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0xf003, 0x3552, 0x3452, 0x2542, 0x2542, 0x1352, 0x1352, + 0x1352, 0x1352, 0xf002, 0x2532, 0x2442, 0x1522, 0x1522, 0xf001, + 0x1252, 0x1501, 0xf001, 0x1432, 0x1342, 0xf001, 0x1051, 0x1332, + + /* huffTable09[93] */ + 0xf006, 0x0041, 0x004a, 0x004f, 0x0052, 0x0057, 0x005a, 0x6412, + 0x6142, 0x6322, 0x6232, 0x5312, 0x5312, 0x5132, 0x5132, 0x6301, + 0x6031, 0x5222, 0x5222, 0x5201, 0x5201, 0x4212, 0x4212, 0x4212, + 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4021, 0x4021, 0x4021, + 0x4021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, + 0x3000, 0xf003, 0x3552, 0x3542, 0x2532, 0x2532, 0x2352, 0x2352, + 0x3452, 0x3501, 0xf002, 0x2442, 0x2522, 0x2252, 0x2512, 0xf001, + 0x1152, 0x1432, 0xf002, 0x1342, 0x1342, 0x2051, 0x2401, 0xf001, + 0x1422, 0x1242, 0xf001, 0x1332, 0x1041, + + /* huffTable10[320] */ + 0xf008, 0x0101, 0x010a, 0x010f, 0x0118, 0x011b, 0x0120, 0x0125, + 0x8712, 0x8172, 0x012a, 0x012d, 0x0132, 0x8612, 0x8162, 0x8061, + 0x0137, 0x013a, 0x013d, 0x8412, 0x8142, 0x8041, 0x8322, 0x8232, + 0x8301, 0x7312, 0x7312, 0x7132, 0x7132, 0x7031, 0x7031, 0x7222, + 0x7222, 0x6212, 0x6212, 0x6212, 0x6212, 0x6122, 0x6122, 0x6122, + 0x6122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021, + 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, + 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, + 0x4112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0xf003, 0x3772, 0x3762, 0x3672, 0x3752, 0x3572, 0x3662, + 0x2742, 0x2742, 0xf002, 0x2472, 0x2652, 0x2562, 0x2732, 0xf003, + 0x2372, 0x2372, 0x2642, 0x2642, 0x3552, 0x3452, 0x2362, 0x2362, + 0xf001, 0x1722, 0x1272, 0xf002, 0x2462, 0x2701, 0x1071, 0x1071, + 0xf002, 0x1262, 0x1262, 0x2542, 0x2532, 0xf002, 0x1601, 0x1601, + 0x2352, 0x2442, 0xf001, 0x1632, 0x1622, 0xf002, 0x2522, 0x2252, + 0x1512, 0x1512, 0xf002, 0x1152, 0x1152, 0x2432, 0x2342, 0xf001, + 0x1501, 0x1051, 0xf001, 0x1422, 0x1242, 0xf001, 0x1332, 0x1401, + + /* huffTable11[296] */ + 0xf008, 0x0101, 0x0106, 0x010f, 0x0114, 0x0117, 0x8722, 0x8272, + 0x011c, 0x7172, 0x7172, 0x8712, 0x8071, 0x8632, 0x8362, 0x8061, + 0x011f, 0x0122, 0x8512, 0x7262, 0x7262, 0x8622, 0x8601, 0x7612, + 0x7612, 0x7162, 0x7162, 0x8152, 0x8432, 0x8051, 0x0125, 0x8422, + 0x8242, 0x8412, 0x8142, 0x8401, 0x8041, 0x7322, 0x7322, 0x7232, + 0x7232, 0x6312, 0x6312, 0x6312, 0x6312, 0x6132, 0x6132, 0x6132, + 0x6132, 0x7301, 0x7301, 0x7031, 0x7031, 0x6222, 0x6222, 0x6222, + 0x6222, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, + 0x5122, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, + 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, + 0x4212, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, + 0x5201, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, + 0x5021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, 0x2000, + 0x2000, 0xf002, 0x2772, 0x2762, 0x2672, 0x2572, 0xf003, 0x2662, + 0x2662, 0x2742, 0x2742, 0x2472, 0x2472, 0x3752, 0x3552, 0xf002, + 0x2652, 0x2562, 0x1732, 0x1732, 0xf001, 0x1372, 0x1642, 0xf002, + 0x2542, 0x2452, 0x2532, 0x2352, 0xf001, 0x1462, 0x1701, 0xf001, + 0x1442, 0x1522, 0xf001, 0x1252, 0x1501, 0xf001, 0x1342, 0x1332, + + /* huffTable12[185] */ + 0xf007, 0x0081, 0x008a, 0x008f, 0x0092, 0x0097, 0x009a, 0x009d, + 0x00a2, 0x00a5, 0x00a8, 0x7622, 0x7262, 0x7162, 0x00ad, 0x00b0, + 0x00b3, 0x7512, 0x7152, 0x7432, 0x7342, 0x00b6, 0x7422, 0x7242, + 0x7412, 0x6332, 0x6332, 0x6142, 0x6142, 0x6322, 0x6322, 0x6232, + 0x6232, 0x7041, 0x7301, 0x6031, 0x6031, 0x5312, 0x5312, 0x5312, + 0x5312, 0x5132, 0x5132, 0x5132, 0x5132, 0x5222, 0x5222, 0x5222, + 0x5222, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, 0x4212, + 0x4212, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, 0x4122, + 0x4122, 0x5201, 0x5201, 0x5201, 0x5201, 0x5021, 0x5021, 0x5021, + 0x5021, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, + 0x4000, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, 0x3101, + 0x3101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0xf003, 0x3772, 0x3762, 0x2672, 0x2672, 0x2752, 0x2752, + 0x2572, 0x2572, 0xf002, 0x2662, 0x2742, 0x2472, 0x2562, 0xf001, + 0x1652, 0x1732, 0xf002, 0x2372, 0x2552, 0x1722, 0x1722, 0xf001, + 0x1272, 0x1642, 0xf001, 0x1462, 0x1712, 0xf002, 0x1172, 0x1172, + 0x2701, 0x2071, 0xf001, 0x1632, 0x1362, 0xf001, 0x1542, 0x1452, + 0xf002, 0x1442, 0x1442, 0x2601, 0x2501, 0xf001, 0x1612, 0x1061, + 0xf001, 0x1532, 0x1352, 0xf001, 0x1522, 0x1252, 0xf001, 0x1051, + 0x1401, + + /* huffTable13[497] */ + 0xf006, 0x0041, 0x0082, 0x00c3, 0x00e4, 0x0105, 0x0116, 0x011f, + 0x0130, 0x0139, 0x013e, 0x0143, 0x0146, 0x6212, 0x6122, 0x6201, + 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4101, 0x4101, 0x4101, + 0x4101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0xf006, 0x0108, 0x0111, 0x011a, 0x0123, 0x012c, 0x0131, + 0x0136, 0x013f, 0x0144, 0x0147, 0x014c, 0x0151, 0x0156, 0x015b, + 0x6f12, 0x61f2, 0x60f1, 0x0160, 0x0163, 0x0166, 0x62e2, 0x0169, + 0x6e12, 0x61e2, 0x016c, 0x016f, 0x0172, 0x0175, 0x0178, 0x017b, + 0x66c2, 0x6d32, 0x017e, 0x6d22, 0x62d2, 0x6d12, 0x67b2, 0x0181, + 0x0184, 0x63c2, 0x0187, 0x6b42, 0x51d2, 0x51d2, 0x6d01, 0x60d1, + 0x6a82, 0x68a2, 0x6c42, 0x64c2, 0x6b62, 0x66b2, 0x5c32, 0x5c32, + 0x5c22, 0x5c22, 0x52c2, 0x52c2, 0x5b52, 0x5b52, 0x65b2, 0x6982, + 0x5c12, 0x5c12, 0xf006, 0x51c2, 0x51c2, 0x6892, 0x6c01, 0x50c1, + 0x50c1, 0x64b2, 0x6a62, 0x66a2, 0x6972, 0x5b32, 0x5b32, 0x53b2, + 0x53b2, 0x6882, 0x6a52, 0x5b22, 0x5b22, 0x65a2, 0x6962, 0x54a2, + 0x54a2, 0x6872, 0x6782, 0x5492, 0x5492, 0x6772, 0x6672, 0x42b2, + 0x42b2, 0x42b2, 0x42b2, 0x4b12, 0x4b12, 0x4b12, 0x4b12, 0x41b2, + 0x41b2, 0x41b2, 0x41b2, 0x5b01, 0x5b01, 0x50b1, 0x50b1, 0x5692, + 0x5692, 0x5a42, 0x5a42, 0x5a32, 0x5a32, 0x53a2, 0x53a2, 0x5952, + 0x5952, 0x5592, 0x5592, 0x4a22, 0x4a22, 0x4a22, 0x4a22, 0x42a2, + 0x42a2, 0x42a2, 0x42a2, 0xf005, 0x4a12, 0x4a12, 0x41a2, 0x41a2, + 0x5a01, 0x5862, 0x40a1, 0x40a1, 0x5682, 0x5942, 0x4392, 0x4392, + 0x5932, 0x5852, 0x5582, 0x5762, 0x4922, 0x4922, 0x4292, 0x4292, + 0x5752, 0x5572, 0x4832, 0x4832, 0x4382, 0x4382, 0x5662, 0x5742, + 0x5472, 0x5652, 0x5562, 0x5372, 0xf005, 0x3912, 0x3912, 0x3912, + 0x3912, 0x3192, 0x3192, 0x3192, 0x3192, 0x4901, 0x4901, 0x4091, + 0x4091, 0x4842, 0x4842, 0x4482, 0x4482, 0x4272, 0x4272, 0x5642, + 0x5462, 0x3822, 0x3822, 0x3822, 0x3822, 0x3282, 0x3282, 0x3282, + 0x3282, 0x3812, 0x3812, 0x3812, 0x3812, 0xf004, 0x4732, 0x4722, + 0x3712, 0x3712, 0x3172, 0x3172, 0x4552, 0x4701, 0x4071, 0x4632, + 0x4362, 0x4542, 0x4452, 0x4622, 0x4262, 0x4532, 0xf003, 0x2182, + 0x2182, 0x3801, 0x3081, 0x3612, 0x3162, 0x3601, 0x3061, 0xf004, + 0x4352, 0x4442, 0x3522, 0x3522, 0x3252, 0x3252, 0x3501, 0x3501, + 0x2512, 0x2512, 0x2512, 0x2512, 0x2152, 0x2152, 0x2152, 0x2152, + 0xf003, 0x3432, 0x3342, 0x3051, 0x3422, 0x3242, 0x3332, 0x2412, + 0x2412, 0xf002, 0x1142, 0x1142, 0x2401, 0x2041, 0xf002, 0x2322, + 0x2232, 0x1312, 0x1312, 0xf001, 0x1132, 0x1301, 0xf001, 0x1031, + 0x1222, 0xf003, 0x0082, 0x008b, 0x008e, 0x0091, 0x0094, 0x0097, + 0x3ce2, 0x3dd2, 0xf003, 0x0093, 0x3eb2, 0x3be2, 0x3f92, 0x39f2, + 0x3ae2, 0x3db2, 0x3bd2, 0xf003, 0x3f82, 0x38f2, 0x3cc2, 0x008d, + 0x3e82, 0x0090, 0x27f2, 0x27f2, 0xf003, 0x2ad2, 0x2ad2, 0x3da2, + 0x3cb2, 0x3bc2, 0x36f2, 0x2f62, 0x2f62, 0xf002, 0x28e2, 0x2f52, + 0x2d92, 0x29d2, 0xf002, 0x25f2, 0x27e2, 0x2ca2, 0x2bb2, 0xf003, + 0x2f42, 0x2f42, 0x24f2, 0x24f2, 0x3ac2, 0x36e2, 0x23f2, 0x23f2, + 0xf002, 0x1f32, 0x1f32, 0x2d82, 0x28d2, 0xf001, 0x1f22, 0x12f2, + 0xf002, 0x2e62, 0x2c92, 0x1f01, 0x1f01, 0xf002, 0x29c2, 0x2e52, + 0x1ba2, 0x1ba2, 0xf002, 0x2d72, 0x27d2, 0x1e42, 0x1e42, 0xf002, + 0x28c2, 0x26d2, 0x1e32, 0x1e32, 0xf002, 0x19b2, 0x19b2, 0x2b92, + 0x2aa2, 0xf001, 0x1ab2, 0x15e2, 0xf001, 0x14e2, 0x1c82, 0xf001, + 0x1d62, 0x13e2, 0xf001, 0x1e22, 0x1e01, 0xf001, 0x10e1, 0x1d52, + 0xf001, 0x15d2, 0x1c72, 0xf001, 0x17c2, 0x1d42, 0xf001, 0x1b82, + 0x18b2, 0xf001, 0x14d2, 0x1a92, 0xf001, 0x19a2, 0x1c62, 0xf001, + 0x13d2, 0x1b72, 0xf001, 0x1c52, 0x15c2, 0xf001, 0x1992, 0x1a72, + 0xf001, 0x17a2, 0x1792, 0xf003, 0x0023, 0x3df2, 0x2de2, 0x2de2, + 0x1ff2, 0x1ff2, 0x1ff2, 0x1ff2, 0xf001, 0x1fe2, 0x1fd2, 0xf001, + 0x1ee2, 0x1fc2, 0xf001, 0x1ed2, 0x1fb2, 0xf001, 0x1bf2, 0x1ec2, + 0xf002, 0x1cd2, 0x1cd2, 0x2fa2, 0x29e2, 0xf001, 0x1af2, 0x1dc2, + 0xf001, 0x1ea2, 0x1e92, 0xf001, 0x1f72, 0x1e72, 0xf001, 0x1ef2, + 0x1cf2, + + /* huffTable15[580] */ + 0xf008, 0x0101, 0x0122, 0x0143, 0x0154, 0x0165, 0x0176, 0x017f, + 0x0188, 0x0199, 0x01a2, 0x01ab, 0x01b4, 0x01bd, 0x01c2, 0x01cb, + 0x01d4, 0x01d9, 0x01de, 0x01e3, 0x01e8, 0x01ed, 0x01f2, 0x01f7, + 0x01fc, 0x0201, 0x0204, 0x0207, 0x020a, 0x020f, 0x0212, 0x0215, + 0x021a, 0x021d, 0x0220, 0x8192, 0x0223, 0x0226, 0x0229, 0x022c, + 0x022f, 0x8822, 0x8282, 0x8812, 0x8182, 0x0232, 0x0235, 0x0238, + 0x023b, 0x8722, 0x8272, 0x8462, 0x8712, 0x8552, 0x8172, 0x023e, + 0x8632, 0x8362, 0x8542, 0x8452, 0x8622, 0x8262, 0x8612, 0x0241, + 0x8532, 0x7162, 0x7162, 0x8352, 0x8442, 0x7522, 0x7522, 0x7252, + 0x7252, 0x7512, 0x7512, 0x7152, 0x7152, 0x8501, 0x8051, 0x7432, + 0x7432, 0x7342, 0x7342, 0x7422, 0x7422, 0x7242, 0x7242, 0x7332, + 0x7332, 0x6142, 0x6142, 0x6142, 0x6142, 0x7412, 0x7412, 0x7401, + 0x7401, 0x6322, 0x6322, 0x6322, 0x6322, 0x6232, 0x6232, 0x6232, + 0x6232, 0x7041, 0x7041, 0x7301, 0x7301, 0x6312, 0x6312, 0x6312, + 0x6312, 0x6132, 0x6132, 0x6132, 0x6132, 0x6031, 0x6031, 0x6031, + 0x6031, 0x5222, 0x5222, 0x5222, 0x5222, 0x5222, 0x5222, 0x5222, + 0x5222, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, + 0x5212, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, + 0x5122, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, 0x5201, + 0x5201, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, 0x5021, + 0x5021, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, 0x3112, + 0x3112, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, + 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, + 0x4101, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, + 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, + 0x4011, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, + 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, + 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, + 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, + 0x3000, 0xf005, 0x5ff2, 0x5fe2, 0x5ef2, 0x5fd2, 0x4ee2, 0x4ee2, + 0x5df2, 0x5fc2, 0x5cf2, 0x5ed2, 0x5de2, 0x5fb2, 0x4bf2, 0x4bf2, + 0x5ec2, 0x5ce2, 0x4dd2, 0x4dd2, 0x4fa2, 0x4fa2, 0x4af2, 0x4af2, + 0x4eb2, 0x4eb2, 0x4be2, 0x4be2, 0x4dc2, 0x4dc2, 0x4cd2, 0x4cd2, + 0x4f92, 0x4f92, 0xf005, 0x49f2, 0x49f2, 0x4ae2, 0x4ae2, 0x4db2, + 0x4db2, 0x4bd2, 0x4bd2, 0x4f82, 0x4f82, 0x48f2, 0x48f2, 0x4cc2, + 0x4cc2, 0x4e92, 0x4e92, 0x49e2, 0x49e2, 0x4f72, 0x4f72, 0x47f2, + 0x47f2, 0x4da2, 0x4da2, 0x4ad2, 0x4ad2, 0x4cb2, 0x4cb2, 0x4f62, + 0x4f62, 0x5ea2, 0x5f01, 0xf004, 0x3bc2, 0x3bc2, 0x36f2, 0x36f2, + 0x4e82, 0x48e2, 0x4f52, 0x4d92, 0x35f2, 0x35f2, 0x3e72, 0x3e72, + 0x37e2, 0x37e2, 0x3ca2, 0x3ca2, 0xf004, 0x3ac2, 0x3ac2, 0x3bb2, + 0x3bb2, 0x49d2, 0x4d82, 0x3f42, 0x3f42, 0x34f2, 0x34f2, 0x3f32, + 0x3f32, 0x33f2, 0x33f2, 0x38d2, 0x38d2, 0xf004, 0x36e2, 0x36e2, + 0x3f22, 0x3f22, 0x32f2, 0x32f2, 0x4e62, 0x40f1, 0x3f12, 0x3f12, + 0x31f2, 0x31f2, 0x3c92, 0x3c92, 0x39c2, 0x39c2, 0xf003, 0x3e52, + 0x3ba2, 0x3ab2, 0x35e2, 0x3d72, 0x37d2, 0x3e42, 0x34e2, 0xf003, + 0x3c82, 0x38c2, 0x3e32, 0x3d62, 0x36d2, 0x33e2, 0x3b92, 0x39b2, + 0xf004, 0x3e22, 0x3e22, 0x3aa2, 0x3aa2, 0x32e2, 0x32e2, 0x3e12, + 0x3e12, 0x31e2, 0x31e2, 0x4e01, 0x40e1, 0x3d52, 0x3d52, 0x35d2, + 0x35d2, 0xf003, 0x3c72, 0x37c2, 0x3d42, 0x3b82, 0x24d2, 0x24d2, + 0x38b2, 0x3a92, 0xf003, 0x39a2, 0x3c62, 0x36c2, 0x3d32, 0x23d2, + 0x23d2, 0x22d2, 0x22d2, 0xf003, 0x3d22, 0x3d01, 0x2d12, 0x2d12, + 0x2b72, 0x2b72, 0x27b2, 0x27b2, 0xf003, 0x21d2, 0x21d2, 0x3c52, + 0x30d1, 0x25c2, 0x25c2, 0x2a82, 0x2a82, 0xf002, 0x28a2, 0x2c42, + 0x24c2, 0x2b62, 0xf003, 0x26b2, 0x26b2, 0x3992, 0x3c01, 0x2c32, + 0x2c32, 0x23c2, 0x23c2, 0xf003, 0x2a72, 0x2a72, 0x27a2, 0x27a2, + 0x26a2, 0x26a2, 0x30c1, 0x3b01, 0xf002, 0x12c2, 0x12c2, 0x2c22, + 0x2b52, 0xf002, 0x25b2, 0x2c12, 0x2982, 0x2892, 0xf002, 0x21c2, + 0x2b42, 0x24b2, 0x2a62, 0xf002, 0x2b32, 0x2972, 0x13b2, 0x13b2, + 0xf002, 0x2792, 0x2882, 0x2b22, 0x2a52, 0xf002, 0x12b2, 0x12b2, + 0x25a2, 0x2b12, 0xf002, 0x11b2, 0x11b2, 0x20b1, 0x2962, 0xf002, + 0x2692, 0x2a42, 0x24a2, 0x2872, 0xf002, 0x2782, 0x2a32, 0x13a2, + 0x13a2, 0xf001, 0x1952, 0x1592, 0xf001, 0x1a22, 0x12a2, 0xf001, + 0x1a12, 0x11a2, 0xf002, 0x2a01, 0x20a1, 0x1862, 0x1862, 0xf001, + 0x1682, 0x1942, 0xf001, 0x1492, 0x1932, 0xf002, 0x1392, 0x1392, + 0x2772, 0x2901, 0xf001, 0x1852, 0x1582, 0xf001, 0x1922, 0x1762, + 0xf001, 0x1672, 0x1292, 0xf001, 0x1912, 0x1091, 0xf001, 0x1842, + 0x1482, 0xf001, 0x1752, 0x1572, 0xf001, 0x1832, 0x1382, 0xf001, + 0x1662, 0x1742, 0xf001, 0x1472, 0x1801, 0xf001, 0x1081, 0x1652, + 0xf001, 0x1562, 0x1732, 0xf001, 0x1372, 0x1642, 0xf001, 0x1701, + 0x1071, 0xf001, 0x1601, 0x1061, + + /* huffTable16[651] */ + 0xf008, 0x0101, 0x010a, 0x0113, 0x8ff2, 0x0118, 0x011d, 0x0120, + 0x82f2, 0x0131, 0x8f12, 0x81f2, 0x0134, 0x0145, 0x0156, 0x0167, + 0x0178, 0x0189, 0x019a, 0x01a3, 0x01ac, 0x01b5, 0x01be, 0x01c7, + 0x01d0, 0x01d9, 0x01de, 0x01e3, 0x01e6, 0x01eb, 0x01f0, 0x8152, + 0x01f3, 0x01f6, 0x01f9, 0x01fc, 0x8412, 0x8142, 0x01ff, 0x8322, + 0x8232, 0x7312, 0x7312, 0x7132, 0x7132, 0x8301, 0x8031, 0x7222, + 0x7222, 0x6212, 0x6212, 0x6212, 0x6212, 0x6122, 0x6122, 0x6122, + 0x6122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6021, 0x6021, 0x6021, + 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, + 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, + 0x4112, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, + 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, + 0x4101, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, 0x3011, + 0x3011, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, + 0x1000, 0xf003, 0x3fe2, 0x3ef2, 0x3fd2, 0x3df2, 0x3fc2, 0x3cf2, + 0x3fb2, 0x3bf2, 0xf003, 0x2fa2, 0x2fa2, 0x3af2, 0x3f92, 0x39f2, + 0x38f2, 0x2f82, 0x2f82, 0xf002, 0x2f72, 0x27f2, 0x2f62, 0x26f2, + 0xf002, 0x2f52, 0x25f2, 0x1f42, 0x1f42, 0xf001, 0x14f2, 0x13f2, + 0xf004, 0x10f1, 0x10f1, 0x10f1, 0x10f1, 0x10f1, 0x10f1, 0x10f1, + 0x10f1, 0x2f32, 0x2f32, 0x2f32, 0x2f32, 0x00e2, 0x00f3, 0x00fc, + 0x0105, 0xf001, 0x1f22, 0x1f01, 0xf004, 0x00fa, 0x00ff, 0x0104, + 0x0109, 0x010c, 0x0111, 0x0116, 0x0119, 0x011e, 0x0123, 0x0128, + 0x43e2, 0x012d, 0x0130, 0x0133, 0x0136, 0xf004, 0x0128, 0x012b, + 0x012e, 0x4d01, 0x0131, 0x0134, 0x0137, 0x4c32, 0x013a, 0x4c12, + 0x40c1, 0x013d, 0x32e2, 0x32e2, 0x4e22, 0x4e12, 0xf004, 0x43d2, + 0x4d22, 0x42d2, 0x41d2, 0x4b32, 0x012f, 0x3d12, 0x3d12, 0x44c2, + 0x4b62, 0x43c2, 0x47a2, 0x3c22, 0x3c22, 0x42c2, 0x45b2, 0xf004, + 0x41c2, 0x4c01, 0x4b42, 0x44b2, 0x4a62, 0x46a2, 0x33b2, 0x33b2, + 0x4a52, 0x45a2, 0x3b22, 0x3b22, 0x32b2, 0x32b2, 0x3b12, 0x3b12, + 0xf004, 0x31b2, 0x31b2, 0x4b01, 0x40b1, 0x4962, 0x4692, 0x4a42, + 0x44a2, 0x4872, 0x4782, 0x33a2, 0x33a2, 0x4a32, 0x4952, 0x3a22, + 0x3a22, 0xf004, 0x4592, 0x4862, 0x31a2, 0x31a2, 0x4682, 0x4772, + 0x3492, 0x3492, 0x4942, 0x4752, 0x3762, 0x3762, 0x22a2, 0x22a2, + 0x22a2, 0x22a2, 0xf003, 0x2a12, 0x2a12, 0x3a01, 0x30a1, 0x3932, + 0x3392, 0x3852, 0x3582, 0xf003, 0x2922, 0x2922, 0x2292, 0x2292, + 0x3672, 0x3901, 0x2912, 0x2912, 0xf003, 0x2192, 0x2192, 0x3091, + 0x3842, 0x3482, 0x3572, 0x3832, 0x3382, 0xf003, 0x3662, 0x3822, + 0x2282, 0x2282, 0x3742, 0x3472, 0x2812, 0x2812, 0xf003, 0x2182, + 0x2182, 0x2081, 0x2081, 0x3801, 0x3652, 0x2732, 0x2732, 0xf003, + 0x2372, 0x2372, 0x3562, 0x3642, 0x2722, 0x2722, 0x2272, 0x2272, + 0xf003, 0x3462, 0x3552, 0x2701, 0x2701, 0x1712, 0x1712, 0x1712, + 0x1712, 0xf002, 0x1172, 0x1172, 0x2071, 0x2632, 0xf002, 0x2362, + 0x2542, 0x2452, 0x2622, 0xf001, 0x1262, 0x1612, 0xf002, 0x1162, + 0x1162, 0x2601, 0x2061, 0xf002, 0x1352, 0x1352, 0x2532, 0x2442, + 0xf001, 0x1522, 0x1252, 0xf001, 0x1512, 0x1501, 0xf001, 0x1432, + 0x1342, 0xf001, 0x1051, 0x1422, 0xf001, 0x1242, 0x1332, 0xf001, + 0x1401, 0x1041, 0xf004, 0x4ec2, 0x0086, 0x3ed2, 0x3ed2, 0x39e2, + 0x39e2, 0x4ae2, 0x49d2, 0x2ee2, 0x2ee2, 0x2ee2, 0x2ee2, 0x3de2, + 0x3de2, 0x3be2, 0x3be2, 0xf003, 0x2eb2, 0x2eb2, 0x2dc2, 0x2dc2, + 0x3cd2, 0x3bd2, 0x2ea2, 0x2ea2, 0xf003, 0x2cc2, 0x2cc2, 0x3da2, + 0x3ad2, 0x3e72, 0x3ca2, 0x2ac2, 0x2ac2, 0xf003, 0x39c2, 0x3d72, + 0x2e52, 0x2e52, 0x1db2, 0x1db2, 0x1db2, 0x1db2, 0xf002, 0x1e92, + 0x1e92, 0x2cb2, 0x2bc2, 0xf002, 0x2e82, 0x28e2, 0x2d92, 0x27e2, + 0xf002, 0x2bb2, 0x2d82, 0x28d2, 0x2e62, 0xf001, 0x16e2, 0x1c92, + 0xf002, 0x2ba2, 0x2ab2, 0x25e2, 0x27d2, 0xf002, 0x1e42, 0x1e42, + 0x24e2, 0x2c82, 0xf001, 0x18c2, 0x1e32, 0xf002, 0x1d62, 0x1d62, + 0x26d2, 0x2b92, 0xf002, 0x29b2, 0x2aa2, 0x11e2, 0x11e2, 0xf002, + 0x14d2, 0x14d2, 0x28b2, 0x29a2, 0xf002, 0x1b72, 0x1b72, 0x27b2, + 0x20d1, 0xf001, 0x1e01, 0x10e1, 0xf001, 0x1d52, 0x15d2, 0xf001, + 0x1c72, 0x17c2, 0xf001, 0x1d42, 0x1b82, 0xf001, 0x1a92, 0x1c62, + 0xf001, 0x16c2, 0x1d32, 0xf001, 0x1c52, 0x15c2, 0xf001, 0x1a82, + 0x18a2, 0xf001, 0x1992, 0x1c42, 0xf001, 0x16b2, 0x1a72, 0xf001, + 0x1b52, 0x1982, 0xf001, 0x1892, 0x1972, 0xf001, 0x1792, 0x1882, + 0xf001, 0x1ce2, 0x1dd2, + + /* huffTable24[705] */ + 0xf009, 0x8fe2, 0x8fe2, 0x8ef2, 0x8ef2, 0x8fd2, 0x8fd2, 0x8df2, + 0x8df2, 0x8fc2, 0x8fc2, 0x8cf2, 0x8cf2, 0x8fb2, 0x8fb2, 0x8bf2, + 0x8bf2, 0x7af2, 0x7af2, 0x7af2, 0x7af2, 0x8fa2, 0x8fa2, 0x8f92, + 0x8f92, 0x79f2, 0x79f2, 0x79f2, 0x79f2, 0x78f2, 0x78f2, 0x78f2, + 0x78f2, 0x8f82, 0x8f82, 0x8f72, 0x8f72, 0x77f2, 0x77f2, 0x77f2, + 0x77f2, 0x7f62, 0x7f62, 0x7f62, 0x7f62, 0x76f2, 0x76f2, 0x76f2, + 0x76f2, 0x7f52, 0x7f52, 0x7f52, 0x7f52, 0x75f2, 0x75f2, 0x75f2, + 0x75f2, 0x7f42, 0x7f42, 0x7f42, 0x7f42, 0x74f2, 0x74f2, 0x74f2, + 0x74f2, 0x7f32, 0x7f32, 0x7f32, 0x7f32, 0x73f2, 0x73f2, 0x73f2, + 0x73f2, 0x7f22, 0x7f22, 0x7f22, 0x7f22, 0x72f2, 0x72f2, 0x72f2, + 0x72f2, 0x71f2, 0x71f2, 0x71f2, 0x71f2, 0x8f12, 0x8f12, 0x80f1, + 0x80f1, 0x9f01, 0x0201, 0x0206, 0x020b, 0x0210, 0x0215, 0x021a, + 0x021f, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, + 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, + 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, + 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, 0x4ff2, + 0x4ff2, 0x0224, 0x0229, 0x0232, 0x0237, 0x023a, 0x023f, 0x0242, + 0x0245, 0x024a, 0x024d, 0x0250, 0x0253, 0x0256, 0x0259, 0x025c, + 0x025f, 0x0262, 0x0265, 0x0268, 0x026b, 0x026e, 0x0271, 0x0274, + 0x0277, 0x027a, 0x027d, 0x0280, 0x0283, 0x0288, 0x028b, 0x028e, + 0x0291, 0x0294, 0x0297, 0x029a, 0x029f, 0x94b2, 0x02a4, 0x02a7, + 0x02aa, 0x93b2, 0x9882, 0x02af, 0x92b2, 0x02b2, 0x02b5, 0x9692, + 0x94a2, 0x02b8, 0x9782, 0x9a32, 0x93a2, 0x9952, 0x9592, 0x9a22, + 0x92a2, 0x91a2, 0x9862, 0x9682, 0x9772, 0x9942, 0x9492, 0x9932, + 0x9392, 0x9852, 0x9582, 0x9922, 0x9762, 0x9672, 0x9292, 0x9912, + 0x9192, 0x9842, 0x9482, 0x9752, 0x9572, 0x9832, 0x9382, 0x9662, + 0x9822, 0x9282, 0x9812, 0x9742, 0x9472, 0x9182, 0x02bb, 0x9652, + 0x9562, 0x9712, 0x02be, 0x8372, 0x8372, 0x9732, 0x9722, 0x8272, + 0x8272, 0x8642, 0x8642, 0x8462, 0x8462, 0x8552, 0x8552, 0x8172, + 0x8172, 0x8632, 0x8632, 0x8362, 0x8362, 0x8542, 0x8542, 0x8452, + 0x8452, 0x8622, 0x8622, 0x8262, 0x8262, 0x8612, 0x8612, 0x8162, + 0x8162, 0x9601, 0x9061, 0x8532, 0x8532, 0x8352, 0x8352, 0x8442, + 0x8442, 0x8522, 0x8522, 0x8252, 0x8252, 0x8512, 0x8512, 0x9501, + 0x9051, 0x7152, 0x7152, 0x7152, 0x7152, 0x8432, 0x8432, 0x8342, + 0x8342, 0x7422, 0x7422, 0x7422, 0x7422, 0x7242, 0x7242, 0x7242, + 0x7242, 0x7332, 0x7332, 0x7332, 0x7332, 0x7412, 0x7412, 0x7412, + 0x7412, 0x7142, 0x7142, 0x7142, 0x7142, 0x8401, 0x8401, 0x8041, + 0x8041, 0x7322, 0x7322, 0x7322, 0x7322, 0x7232, 0x7232, 0x7232, + 0x7232, 0x6312, 0x6312, 0x6312, 0x6312, 0x6312, 0x6312, 0x6312, + 0x6312, 0x6132, 0x6132, 0x6132, 0x6132, 0x6132, 0x6132, 0x6132, + 0x6132, 0x7301, 0x7301, 0x7301, 0x7301, 0x7031, 0x7031, 0x7031, + 0x7031, 0x6222, 0x6222, 0x6222, 0x6222, 0x6222, 0x6222, 0x6222, + 0x6222, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, + 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, 0x5212, + 0x5212, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, + 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, 0x5122, + 0x5122, 0x6201, 0x6201, 0x6201, 0x6201, 0x6201, 0x6201, 0x6201, + 0x6201, 0x6021, 0x6021, 0x6021, 0x6021, 0x6021, 0x6021, 0x6021, + 0x6021, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, + 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, + 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, + 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, 0x4112, + 0x4112, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, + 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, + 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, + 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, 0x4101, + 0x4101, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, + 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, + 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, + 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, 0x4011, + 0x4011, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, + 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, + 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, + 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, + 0x4000, 0xf002, 0x2ee2, 0x2ed2, 0x2de2, 0x2ec2, 0xf002, 0x2ce2, + 0x2dd2, 0x2eb2, 0x2be2, 0xf002, 0x2dc2, 0x2cd2, 0x2ea2, 0x2ae2, + 0xf002, 0x2db2, 0x2bd2, 0x2cc2, 0x2e92, 0xf002, 0x29e2, 0x2da2, + 0x2ad2, 0x2cb2, 0xf002, 0x2bc2, 0x2e82, 0x28e2, 0x2d92, 0xf002, + 0x29d2, 0x2e72, 0x27e2, 0x2ca2, 0xf002, 0x2ac2, 0x2bb2, 0x2d82, + 0x28d2, 0xf003, 0x3e01, 0x30e1, 0x2d01, 0x2d01, 0x16e2, 0x16e2, + 0x16e2, 0x16e2, 0xf002, 0x2e62, 0x2c92, 0x19c2, 0x19c2, 0xf001, + 0x1e52, 0x1ab2, 0xf002, 0x15e2, 0x15e2, 0x2ba2, 0x2d72, 0xf001, + 0x17d2, 0x14e2, 0xf001, 0x1c82, 0x18c2, 0xf002, 0x2e42, 0x2e22, + 0x1e32, 0x1e32, 0xf001, 0x1d62, 0x16d2, 0xf001, 0x13e2, 0x1b92, + 0xf001, 0x19b2, 0x1aa2, 0xf001, 0x12e2, 0x1e12, 0xf001, 0x11e2, + 0x1d52, 0xf001, 0x15d2, 0x1c72, 0xf001, 0x17c2, 0x1d42, 0xf001, + 0x1b82, 0x18b2, 0xf001, 0x14d2, 0x1a92, 0xf001, 0x19a2, 0x1c62, + 0xf001, 0x16c2, 0x1d32, 0xf001, 0x13d2, 0x1d22, 0xf001, 0x12d2, + 0x1d12, 0xf001, 0x1b72, 0x17b2, 0xf001, 0x11d2, 0x1c52, 0xf001, + 0x15c2, 0x1a82, 0xf001, 0x18a2, 0x1992, 0xf001, 0x1c42, 0x14c2, + 0xf001, 0x1b62, 0x16b2, 0xf002, 0x20d1, 0x2c01, 0x1c32, 0x1c32, + 0xf001, 0x13c2, 0x1a72, 0xf001, 0x17a2, 0x1c22, 0xf001, 0x12c2, + 0x1b52, 0xf001, 0x15b2, 0x1c12, 0xf001, 0x1982, 0x1892, 0xf001, + 0x11c2, 0x1b42, 0xf002, 0x20c1, 0x2b01, 0x1b32, 0x1b32, 0xf002, + 0x20b1, 0x2a01, 0x1a12, 0x1a12, 0xf001, 0x1a62, 0x16a2, 0xf001, + 0x1972, 0x1792, 0xf002, 0x20a1, 0x2901, 0x1091, 0x1091, 0xf001, + 0x1b22, 0x1a52, 0xf001, 0x15a2, 0x1b12, 0xf001, 0x11b2, 0x1962, + 0xf001, 0x1a42, 0x1872, 0xf001, 0x1801, 0x1081, 0xf001, 0x1701, + 0x1071, +}; + +#define HUFF_OFFSET_01 0 +#define HUFF_OFFSET_02 ( 9 + HUFF_OFFSET_01) +#define HUFF_OFFSET_03 ( 65 + HUFF_OFFSET_02) +#define HUFF_OFFSET_05 ( 65 + HUFF_OFFSET_03) +#define HUFF_OFFSET_06 (257 + HUFF_OFFSET_05) +#define HUFF_OFFSET_07 (129 + HUFF_OFFSET_06) +#define HUFF_OFFSET_08 (110 + HUFF_OFFSET_07) +#define HUFF_OFFSET_09 (280 + HUFF_OFFSET_08) +#define HUFF_OFFSET_10 ( 93 + HUFF_OFFSET_09) +#define HUFF_OFFSET_11 (320 + HUFF_OFFSET_10) +#define HUFF_OFFSET_12 (296 + HUFF_OFFSET_11) +#define HUFF_OFFSET_13 (185 + HUFF_OFFSET_12) +#define HUFF_OFFSET_15 (497 + HUFF_OFFSET_13) +#define HUFF_OFFSET_16 (580 + HUFF_OFFSET_15) +#define HUFF_OFFSET_24 (651 + HUFF_OFFSET_16) + +const int huffTabOffset[HUFF_PAIRTABS] = { + 0, + HUFF_OFFSET_01, + HUFF_OFFSET_02, + HUFF_OFFSET_03, + 0, + HUFF_OFFSET_05, + HUFF_OFFSET_06, + HUFF_OFFSET_07, + HUFF_OFFSET_08, + HUFF_OFFSET_09, + HUFF_OFFSET_10, + HUFF_OFFSET_11, + HUFF_OFFSET_12, + HUFF_OFFSET_13, + 0, + HUFF_OFFSET_15, + HUFF_OFFSET_16, + HUFF_OFFSET_16, + HUFF_OFFSET_16, + HUFF_OFFSET_16, + HUFF_OFFSET_16, + HUFF_OFFSET_16, + HUFF_OFFSET_16, + HUFF_OFFSET_16, + HUFF_OFFSET_24, + HUFF_OFFSET_24, + HUFF_OFFSET_24, + HUFF_OFFSET_24, + HUFF_OFFSET_24, + HUFF_OFFSET_24, + HUFF_OFFSET_24, + HUFF_OFFSET_24, +}; + +const HuffTabLookup huffTabLookup[HUFF_PAIRTABS] = { + { 0, noBits }, + { 0, oneShot }, + { 0, oneShot }, + { 0, oneShot }, + { 0, invalidTab }, + { 0, oneShot }, + { 0, oneShot }, + { 0, loopNoLinbits }, + { 0, loopNoLinbits }, + { 0, loopNoLinbits }, + { 0, loopNoLinbits }, + { 0, loopNoLinbits }, + { 0, loopNoLinbits }, + { 0, loopNoLinbits }, + { 0, invalidTab }, + { 0, loopNoLinbits }, + { 1, loopLinbits }, + { 2, loopLinbits }, + { 3, loopLinbits }, + { 4, loopLinbits }, + { 6, loopLinbits }, + { 8, loopLinbits }, + { 10, loopLinbits }, + { 13, loopLinbits }, + { 4, loopLinbits }, + { 5, loopLinbits }, + { 6, loopLinbits }, + { 7, loopLinbits }, + { 8, loopLinbits }, + { 9, loopLinbits }, + { 11, loopLinbits }, + { 13, loopLinbits }, +}; + +/* tables for quadruples + * format 0xAB + * A = length of codeword + * B = codeword + */ +const unsigned char quadTable[64+16] = { + /* table A */ + 0x6b, 0x6f, 0x6d, 0x6e, 0x67, 0x65, 0x59, 0x59, + 0x56, 0x56, 0x53, 0x53, 0x5a, 0x5a, 0x5c, 0x5c, + 0x42, 0x42, 0x42, 0x42, 0x41, 0x41, 0x41, 0x41, + 0x44, 0x44, 0x44, 0x44, 0x48, 0x48, 0x48, 0x48, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + /* table B */ + 0x4f, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x48, + 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, 0x40, +}; + +const int quadTabOffset[2] = {0, 64}; +const int quadTabMaxBits[2] = {6, 4}; diff --git a/source/arm7/helix/real/license.txt b/source/arm7/helix/real/license.txt index 2f06404..12e5372 100644 --- a/source/arm7/helix/real/license.txt +++ b/source/arm7/helix/real/license.txt @@ -1,30 +1,30 @@ - Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. - - The contents of this directory, and (except where otherwise - indicated) the directories included within this directory, are - subject to the current version of the RealNetworks Public Source - License (the "RPSL") available at RPSL.txt in this directory, unless - you have licensed the directory under the current version of the - RealNetworks Community Source License (the "RCSL") available at - RCSL.txt in this directory, in which case the RCSL will apply. You - may also obtain the license terms directly from RealNetworks. You - may not use the files in this directory except in compliance with the - RPSL or, if you have a valid RCSL with RealNetworks applicable to - this directory, the RCSL. Please see the applicable RPSL or RCSL for - the rights, obligations and limitations governing use of the contents - of the directory. - - This directory is part of the Helix DNA Technology. RealNetworks is - the developer of the Original Code and owns the copyrights in the - portions it created. - - This directory, and the directories included with this directory, are - distributed and made available on an 'AS IS' basis, WITHOUT WARRANTY - OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY - DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY - WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - QUIET ENJOYMENT OR NON-INFRINGEMENT. - - Technology Compatibility Kit Test Suite(s) Location: - http://www.helixcommunity.org/content/tck - + Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. + + The contents of this directory, and (except where otherwise + indicated) the directories included within this directory, are + subject to the current version of the RealNetworks Public Source + License (the "RPSL") available at RPSL.txt in this directory, unless + you have licensed the directory under the current version of the + RealNetworks Community Source License (the "RCSL") available at + RCSL.txt in this directory, in which case the RCSL will apply. You + may also obtain the license terms directly from RealNetworks. You + may not use the files in this directory except in compliance with the + RPSL or, if you have a valid RCSL with RealNetworks applicable to + this directory, the RCSL. Please see the applicable RPSL or RCSL for + the rights, obligations and limitations governing use of the contents + of the directory. + + This directory is part of the Helix DNA Technology. RealNetworks is + the developer of the Original Code and owns the copyrights in the + portions it created. + + This directory, and the directories included with this directory, are + distributed and made available on an 'AS IS' basis, WITHOUT WARRANTY + OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY + DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + QUIET ENJOYMENT OR NON-INFRINGEMENT. + + Technology Compatibility Kit Test Suite(s) Location: + http://www.helixcommunity.org/content/tck + diff --git a/source/arm7/helix/real/rcsl.txt b/source/arm7/helix/real/rcsl.txt index a545be4..a809759 100644 --- a/source/arm7/helix/real/rcsl.txt +++ b/source/arm7/helix/real/rcsl.txt @@ -1,948 +1,948 @@ -The RCSL is made up of a base agreement and a few Attachments. - -For Research and Development use, you agree to the terms of the -RCSL R&D License (base RCSL and Attachments A, B, and C) - -For Commercial Use (either distribution or internal commercial -deployment) of the Helix DNA with or without support for RealNetworks' -RealAudio and RealVideo Add-on Technology, you agree to the -terms of the same RCSL R&D license -and execute one or more additional Commercial Use License attachments -. - ------------------------------------------------------------------------- - - - REALNETWORKS COMMUNITY SOURCE LICENSE - -Version 1.2 (Rev. Date: January 22, 2003). - - - RECITALS - -Original Contributor has developed Specifications, Source Code -implementations and Executables of certain Technology; and - -Original Contributor desires to license the Technology to a large -community to facilitate research, innovation and product development -while maintaining compatibility of such products with the Technology as -delivered by Original Contributor; and - -Original Contributor desires to license certain Trademarks for the -purpose of branding products that are compatible with the relevant -Technology delivered by Original Contributor; and - -You desire to license the Technology and possibly certain Trademarks -from Original Contributor on the terms and conditions specified in this -License. - -In consideration for the mutual covenants contained herein, You and -Original Contributor agree as follows: - - - AGREEMENT - -*1. Introduction.* - -The RealNetworks Community Source License ("RCSL") and effective -attachments ("License") may include five distinct licenses: - -i) Research Use license -- License plus Attachments A, B and C only. - -ii) Commercial Use and Trademark License, which may be for Internal -Deployment Use or external distribution, or both -- License plus -Attachments A, B, C, and D. - -iii) Technology Compatibility Kit (TCK) license -- Attachment C. - -iv) Add-On Technology License (Executable) Commercial Use License --Attachment F. - -v) Add-On Technology Source Code Porting and Optimization -License-Attachment G. - -The Research Use license is effective when You click and accept this -License. The TCK is effective when You click and accept this License, -unless otherwise specified in the TCK attachments. The Commercial Use -and Trademark, Add-On Technology License, and the Add-On Technology -Source Code Porting and Optimization licenses must each be signed by You -and Original Contributor to become effective. Once effective, these -licenses and the associated requirements and responsibilities are -cumulative. Capitalized terms used in this License are defined in the -Glossary. - -*2. License Grants.* - -2.1 Original Contributor Grant. - -Subject to Your compliance with Sections 3, 8.10 and Attachment A of -this License, Original Contributor grants to You a worldwide, -royalty-free, non-exclusive license, to the extent of Original -Contributor's Intellectual Property Rights covering the Original Code, -Upgraded Code and Specifications, to do the following: - -(a) Research Use License: - -(i) use, reproduce and modify the Original Code, Upgraded Code and -Specifications to create Modifications and Reformatted Specifications -for Research Use by You; - -(ii) publish and display Original Code, Upgraded Code and Specifications -with, or as part of Modifications, as permitted under Section 3.1(b) below; - -(iii) reproduce and distribute copies of Original Code and Upgraded Code -to Licensees and students for Research Use by You; - -(iv) compile, reproduce and distribute Original Code and Upgraded Code -in Executable form, and Reformatted Specifications to anyone for -Research Use by You. - -(b) Other than the licenses expressly granted in this License, Original -Contributor retains all right, title, and interest in Original Code and -Upgraded Code and Specifications. - -2.2 Your Grants. - -(a) To Other Licensees. You hereby grant to each Licensee a license to -Your Error Corrections and Shared Modifications, of the same scope and -extent as Original Contributor's licenses under Section 2.1 a) above -relative to Research Use and Attachment D relative to Commercial Use. - -(b) To Original Contributor. You hereby grant to Original Contributor a -worldwide, royalty-free, non-exclusive, perpetual and irrevocable -license, to the extent of Your Intellectual Property Rights covering -Your Error Corrections, Shared Modifications and Reformatted -Specifications, to use, reproduce, modify, display and distribute Your -Error Corrections, Shared Modifications and Reformatted Specifications, -in any form, including the right to sublicense such rights through -multiple tiers of distribution. - -(c) Other than the licenses expressly granted in Sections 2.2(a) and (b) -above, and the restrictions set forth in Section 3.1(d)(iv) below, You -retain all right, title, and interest in Your Error Corrections, Shared -Modifications and Reformatted Specifications. - -2.3 Contributor Modifications. - -You may use, reproduce, modify, display and distribute Contributor Error -Corrections, Shared Modifications and Reformatted Specifications, -obtained by You under this License, to the same scope and extent as with -Original Code, Upgraded Code and Specifications. - -2.4 Subcontracting. - -You may deliver the Source Code of Covered Code to other Licensees -having at least a Research Use license, for the sole purpose of -furnishing development services to You in connection with Your rights -granted in this License. All such Licensees must execute appropriate -documents with respect to such work consistent with the terms of this -License, and acknowledging their work-made-for-hire status or assigning -exclusive right to the work product and associated Intellectual Property -Rights to You. - -*3. Requirements and Responsibilities*. - -3.1 Research Use License. - -As a condition of exercising the rights granted under Section 2.1(a) -above, You agree to comply with the following: - -(a) Your Contribution to the Community. All Error Corrections and Shared -Modifications which You create or contribute to are automatically -subject to the licenses granted under Section 2.2 above. You are -encouraged to license all of Your other Modifications under Section 2.2 -as Shared Modifications, but are not required to do so. You agree to -notify Original Contributor of any errors in the Specification. - -(b) Source Code Availability. You agree to provide all Your Error -Corrections to Original Contributor as soon as reasonably practicable -and, in any event, prior to Internal Deployment Use or Commercial Use, -if applicable. Original Contributor may, at its discretion, post Source -Code for Your Error Corrections and Shared Modifications on the -Community Webserver. You may also post Error Corrections and Shared -Modifications on a web-server of Your choice; provided, that You must -take reasonable precautions to ensure that only Licensees have access to -such Error Corrections and Shared Modifications. Such precautions shall -include, without limitation, a password protection scheme limited to -Licensees and a click-on, download certification of Licensee status -required of those attempting to download from the server. An example of -an acceptable certification is attached as Attachment A-2. - -(c) Notices. All Error Corrections and Shared Modifications You create -or contribute to must include a file documenting the additions and -changes You made and the date of such additions and changes. You must -also include the notice set forth in Attachment A-1 in the file header. -If it is not possible to put the notice in a particular Source Code file -due to its structure, then You must include the notice in a location -(such as a relevant directory file), where a recipient would be most -likely to look for such a notice. - -(d) Redistribution. - -(i) Source. Covered Code may be distributed in Source Code form only to -another Licensee (except for students as provided below). You may not -offer or impose any terms on any Covered Code that alter the rights, -requirements, or responsibilities of such Licensee. You may distribute -Covered Code to students for use in connection with their course work -and research projects undertaken at accredited educational institutions. -Such students need not be Licensees, but must be given a copy of the -notice set forth in Attachment A-3 and such notice must also be included -in a file header or prominent location in the Source Code made available -to such students. - -(ii) Executable. You may distribute Executable version(s) of Covered -Code to Licensees and other third parties only for the purpose of -evaluation and comment in connection with Research Use by You and under -a license of Your choice, but which limits use of such Executable -version(s) of Covered Code only to that purpose. - -(iii) Modified Class, Interface and Package Naming. In connection with -Research Use by You only, You may use Original Contributor's class, -Interface and package names only to accurately reference or invoke the -Source Code files You modify. Original Contributor grants to You a -limited license to the extent necessary for such purposes. - -(iv) You expressly agree that any distribution, in whole or in part, of -Modifications developed by You shall only be done pursuant to the terms -and conditions of this License. - -(e) Extensions. - -(i) Covered Code. You may not include any Source Code of Community Code -in any Extensions. You may include the compiled Header Files of -Community Code in an Extension provided that Your use of the Covered -Code, including Heading Files, complies with the Commercial Use License, -the TCK and all other terms of this License. - -(ii) Publication. No later than the date on which You first distribute -such Extension for Commercial Use, You must publish to the industry, on -a non-confidential basis and free of all copyright restrictions with -respect to reproduction and use, an accurate and current specification -for any Extension. In addition, You must make available an appropriate -test suite, pursuant to the same rights as the specification, -sufficiently detailed to allow any third party reasonably skilled in the -technology to produce implementations of the Extension compatible with -the specification. Such test suites must be made available as soon as -reasonably practicable but, in no event, later than ninety (90) days -after Your first Commercial Use of the Extension. You must use -reasonable efforts to promptly clarify and correct the specification and -the test suite upon written request by Original Contributor. - -(iii) Open. You agree to refrain from enforcing any Intellectual -Property Rights You may have covering any interface(s) of Your -Extension, which would prevent the implementation of such interface(s) -by Original Contributor or any Licensee. This obligation does not -prevent You from enforcing any Intellectual Property Right You have that -would otherwise be infringed by an implementation of Your Extension. - -(iv) Interface Modifications and Naming. You may not modify or add to -the GUID space * * "xxxxxxxx-0901-11d1-8B06-00A024406D59" or any other -GUID space designated by Original Contributor. You may not modify any -Interface prefix provided with the Covered Code or any other prefix -designated by Original Contributor.* * - -* * - -(f) You agree that any Specifications provided to You by Original -Contributor are confidential and proprietary information of Original -Contributor. You must maintain the confidentiality of the Specifications -and may not disclose them to any third party without Original -Contributor's prior written consent. You may only use the Specifications -under the terms of this License and only for the purpose of implementing -the terms of this License with respect to Covered Code. You agree not -use, copy or distribute any such Specifications except as provided in -writing by Original Contributor. - -3.2 Commercial Use License. - -You may not make Commercial Use of any Covered Code unless You and -Original Contributor have executed a copy of the Commercial Use and -Trademark License attached as Attachment D. - -*4. Versions of the License.* - -4.1 License Versions. - -Original Contributor may publish revised versions of the License from -time to time. Each version will be given a distinguishing version number. - -4.2 Effect. - -Once a particular version of Covered Code has been provided under a -version of the License, You may always continue to use such Covered Code -under the terms of that version of the License. You may also choose to -use such Covered Code under the terms of any subsequent version of the -License. No one other than Original Contributor has the right to -promulgate License versions. - -4.3 Multiple-Licensed Code. - -Original Contributor may designate portions of the Covered Code as -"Multiple-Licensed." "Multiple-Licensed" means that the Original -Contributor permits You to utilize those designated portions of the -Covered Code under Your choice of this License or the alternative -license(s), if any, specified by the Original Contributor in an -Attachment to this License. - -*5. Disclaimer of Warranty.* - -5.1 COVERED CODE PROVIDED AS IS. - -COVERED CODE IS PROVIDED UNDER THIS LICENSE "AS IS," WITHOUT WARRANTY OF -ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, -WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT -FOR A PARTICULAR PURPOSE OR NON-INFRINGING. YOU AGREE TO BEAR THE ENTIRE -RISK IN CONNECTION WITH YOUR USE AND DISTRIBUTION OF COVERED CODE UNDER -THIS LICENSE. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART -OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER -EXCEPT SUBJECT TO THIS DISCLAIMER. - -5.2 Not Designed for High Risk Activities. - -You acknowledge that Original Code, Upgraded Code and Specifications are -not designed or intended for use in high risk activities including, but -not limited to: (i) on-line control of aircraft, air traffic, aircraft -navigation or aircraft communications; or (ii) in the design, -construction, operation or maintenance of any nuclear facility. Original -Contributor disclaims any express or implied warranty of fitness for -such uses. - -*6. Termination.* - -6.1 By You. - -You may terminate this Research Use license at anytime by providing -written notice to Original Contributor. - -6.2 By Original Contributor. - -This License and the rights granted hereunder will terminate: - -(i) automatically if You fail to comply with the terms of this License -and fail to cure such breach within 30 days of receipt of written notice -of the breach; - -(ii) immediately in the event of circumstances specified in Sections 7.1 -and 8.4; or - -(iii) at Original Contributor's discretion upon any action initiated by -You (including by cross-claim or counter claim) alleging that use or -distribution by Original Contributor or any Licensee, of Original Code, -Upgraded Code, Error Corrections, Shared Modifications or Specifications -infringe a patent owned or controlled by You. - -6.3 Effective of Termination. - -Upon termination, You agree to discontinue use of and destroy all copies -of Covered Code in Your possession. All sublicenses to the Covered Code -which You have properly granted shall survive any termination of this -License. Provisions that, by their nature, should remain in effect -beyond the termination of this License shall survive including, without -limitation, Sections 2.2, 3, 5, 7 and 8. - -6.4 No Compensation. - -Each party waives and releases the other from any claim to compensation -or indemnity for permitted or lawful termination of the business -relationship established by this License. - -*7. Liability.* - -7.1 Infringement. Should any of the Original Code, Upgraded Code, TCK or -Specifications ("Materials") become the subject of a claim of -infringement, Original Contributor may, at its sole option, (i) attempt -to procure the rights necessary for You to continue using the Materials, -(ii) modify the Materials so that they are no longer infringing, or -(iii) terminate Your right to use the Materials, immediately upon -written notice, and refund to You the amount, if any, having then -actually been paid by You to Original Contributor for the Original Code, -Upgraded Code and TCK, depreciated on a straight line, five year basis. - -7.2 LIMITATION OF LIABILITY. TO THE FULL EXTENT ALLOWED BY APPLICABLE -LAW, ORIGINAL CONTRIBUTOR'S LIABILITY TO YOU FOR CLAIMS RELATING TO THIS -LICENSE, WHETHER FOR BREACH OR IN TORT, SHALL BE LIMITED TO ONE HUNDRED -PERCENT (100%) OF THE AMOUNT HAVING THEN ACTUALLY BEEN PAID BY YOU TO -ORIGINAL CONTRIBUTOR FOR ALL COPIES LICENSED HEREUNDER OF THE PARTICULAR -ITEMS GIVING RISE TO SUCH CLAIM, IF ANY, DURING THE TWELVE MONTHS -PRECEDING THE CLAIMED BREACH. IN NO EVENT WILL YOU (RELATIVE TO YOUR -SHARED MODIFICATIONS OR ERROR CORRECTIONS) OR ORIGINAL CONTRIBUTOR BE -LIABLE FOR ANY INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES IN CONNECTION WITH OR RISING OUT OF THIS LICENSE (INCLUDING, -WITHOUT LIMITATION, LOSS OF PROFITS, USE, DATA, OR OTHER ECONOMIC -ADVANTAGE), HOWEVER IT ARISES AND ON ANY THEORY OF LIABILITY, WHETHER IN -AN ACTION FOR CONTRACT, STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE) -OR OTHERWISE, WHETHER OR NOT YOU OR ORIGINAL CONTRIBUTOR HAS BEEN -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE AND NOTWITHSTANDING THE -FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. - -*8. Miscellaneous.* - -8.1 Trademark. - -You shall not use any Trademark unless You and Original Contributor -execute a copy of the Commercial Use and Trademark License Agreement -attached hereto as Attachment D. Except as expressly provided in the -License, You are granted no right, title or license to, or interest in, -any Trademarks. Whether or not You and Original Contributor enter into -the Trademark License, You agree not to (i) challenge Original -Contributor's ownership or use of Trademarks; (ii) attempt to register -any Trademarks, or any mark or logo substantially similar thereto; or -(iii) incorporate any Trademarks into Your own trademarks, product -names, service marks, company names, or domain names. - -8.2 Integration. - -This License represents the complete agreement concerning the subject -matter hereof. - -8.3 Assignment. - -Original Contributor may assign this License, and its rights and -obligations hereunder, in its sole discretion. You may assign the -Research Use portions of this License and the TCK license to a third -party upon prior written notice to Original Contributor (which may be -provided electronically via the Community Web-Server). You may not -assign the Commercial Use and Trademark license, the Add-On Technology -License, or the Add-On Technology Source Code Porting License, including -by way of merger (regardless of whether You are the surviving entity) or -acquisition, without Original Contributor's prior written consent. - -8.4 Severability. - -If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. Notwithstanding the foregoing, if You are prohibited by law -from fully and specifically complying with Sections 2.2 or 3, this -License will immediately terminate and You must immediately discontinue -any use of Covered Code. - -8.5 Governing Law. - -This License shall be governed by the laws of the United States and the -State of Washington, as applied to contracts entered into and to be -performed in Washington between Washington residents. The application of -the United Nations Convention on Contracts for the International Sale of -Goods is expressly excluded. You agree that the state and federal courts -located in Seattle, Washington have exclusive jurisdiction over any -claim relating to the License, including contract and tort claims. - -8.6 Dispute Resolution. - -a) Arbitration. Any dispute arising out of or relating to this License -shall be finally settled by arbitration as set out herein, except that -either party may bring any action, in a court of competent jurisdiction -(which jurisdiction shall be exclusive), with respect to any dispute -relating to such party's Intellectual Property Rights or with respect to -Your compliance with the TCK license. Arbitration shall be administered: -(i) by the American Arbitration Association (AAA), (ii) in accordance -with the rules of the United Nations Commission on International Trade -Law (UNCITRAL) (the "Rules") in effect at the time of arbitration as -modified herein; and (iii) the arbitrator will apply the substantive -laws of Washington and the United States. Judgment upon the award -rendered by the arbitrator may be entered in any court having -jurisdiction to enforce such award. - -b) Arbitration language, venue and damages. All arbitration proceedings -shall be conducted in English by a single arbitrator selected in -accordance with the Rules, who must be fluent in English and be either a -retired judge or practicing attorney having at least ten (10) years -litigation experience and be reasonably familiar with the technology -matters relative to the dispute. Unless otherwise agreed, arbitration -venue shall be in Seattle, Washington. The arbitrator may award monetary -damages only and nothing shall preclude either party from seeking -provisional or emergency relief from a court of competent jurisdiction. -The arbitrator shall have no authority to award damages in excess of -those permitted in this License and any such award in excess is void. -All awards will be payable in U.S. dollars and may include, for the -prevailing party (i) pre-judgment award interest, (ii) reasonable -attorneys' fees incurred in connection with the arbitration, and (iii) -reasonable costs and expenses incurred in enforcing the award. The -arbitrator will order each party to produce identified documents and -respond to no more than twenty-five single question interrogatories. - -8.7 Construction. - -Any law or regulation, which provides that the language of a contract -shall be construed against the drafter, shall not apply to this License. - -8.8 U.S. Government End Users. - -The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" -and "commercial computer software documentation," as such terms are used -in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and -48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government -End Users acquire Covered Code with only those rights set forth herein. -You agree to pass this notice to our licensees. - -8.9 Marketing Activities. - -Licensee hereby grants Original Contributor a non-exclusive, -non-transferable, limited license to use the Licensee's company name and -logo ("Licensee Marks") in any presentations, press releases, or -marketing materials solely for the purpose of identifying Licensee as a -member of the Helix Community. Licensee shall provide samples of -Licensee Marks to Original Contributor upon request by Original -Contributor. Original Contributor acknowledges that the Licensee Marks -are the trademarks of Licensee. Original Contributor shall not use the -Licensee Marks in a way that may imply that Original Contributor is an -agency or branch of Licensee. Original Contributor understands and -agrees that the use of any Licensee Marks in connection with this -Agreement shall not create any right, title or interest, in, or to the -Licensee Marks or any Licensee trademarks and that all such use and -goodwill associated with any such trademarks will inure to the benefit -of Licensee. Further the Original Contributor will stop usage of the -Licensee Marks upon Licensee's request. - -8.10 Press Announcements. - -You may make press announcements or other public statements regarding -this License without the prior written consent of the Original -Contributor, if Your statement is limited to announcing the licensing of -the Covered Code or the availability of Your Product and its -compatibility with the Covered Code. All other public announcements -regarding this license require the prior written consent of the Original -Contributor. Consent requests are welcome at press@helixcommunity.org. - -8.11 International Use. - -a) Export/Import laws. Covered Code is subject to U.S. export control -laws and may be subject to export or import regulations in other -countries. Each party agrees to comply strictly with all such laws and -regulations and acknowledges their responsibility to obtain such -licenses to export, re-export, or import as may be required. You agree -to pass these obligations to Your licensees. - -b) Intellectual Property Protection. Due to limited intellectual -property protection and enforcement in certain countries, You agree not -to redistribute the Original Code, Upgraded Code, TCK and Specifications -to any country on the list of restricted countries on the Community Web -Server. - -8.12 Language. - -This License is in the English language only, which language shall be -controlling in all respects, and all versions of this License in any -other language shall be for accommodation only and shall not be binding -on the parties to this License. All communications and notices made or -given pursuant to this License, and all documentation and support to be -provided, unless otherwise noted, shall be in the English language. - -PLEASE READ THE TERMS OF THIS LICENSE CAREFULLY. BY CLICKING ON THE -"ACCEPT" BUTTON BELOW YOU ARE ACCEPTING AND AGREEING TO THE TERMS AND -CONDITIONS OF THIS LICENSE WITH REALNETWORKS, INC. IF YOU ARE AGREEING -TO THIS LICENSE ON BEHALF OF A COMPANY, YOU REPRESENT THAT YOU ARE -AUTHORIZED TO BIND THE COMPANY TO SUCH A LICENSE. WHETHER YOU ARE ACTING -ON YOUR OWN BEHALF, OR REPRESENTING A COMPANY, YOU MUST BE OF MAJORITY -AGE AND BE OTHERWISE COMPETENT TO ENTER INTO CONTRACTS. IF YOU DO NOT -MEET THIS CRITERIA OR YOU DO NOT AGREE TO ANY OF THE TERMS AND -CONDITIONS OF THIS LICENSE, CLICK ON THE REJECT BUTTON TO EXIT. - - - GLOSSARY - -1. *"Added Value"* means code which: - -(i) has a principal purpose which is substantially different from that -of the stand-alone Technology; - -(ii) represents a significant functional and value enhancement to the -Technology; - -(iii) operates in conjunction with the Technology; and - -(iv) is not marketed as a technology which replaces or substitutes for -the Technology - -2. "*Applicable Patent Rights*" mean: (a) in the case where Original -Contributor is the grantor of rights, claims of patents that (i) are now -or hereafter acquired, owned by or assigned to Original Contributor and -(ii) are necessarily infringed by using or making the Original Code or -Upgraded Code, including Modifications provided by Original Contributor, -alone and not in combination with other software or hardware; and (b) in -the case where Licensee is the grantor of rights, claims of patents that -(i) are now or hereafter acquired, owned by or assigned to Licensee and -(ii) are infringed (directly or indirectly) by using or making -Licensee's Modifications or Error Corrections, taken alone or in -combination with Covered Code. - -3. "*Application Programming Interfaces (APIs)"* means the interfaces, -associated header files, service provider interfaces, and protocols that -enable a device, application, Operating System, or other program to -obtain services from or make requests of (or provide services in -response to requests from) other programs, and to use, benefit from, or -rely on the resources, facilities, and capabilities of the relevant -programs using the APIs. APIs includes the technical documentation -describing the APIs, the Source Code constituting the API, and any -Header Files used with the APIs. - -4. "*Commercial Use*" means any use (internal or external), copying, -sublicensing or distribution (internal or external), directly or -indirectly of Covered Code by You other than Your Research Use of -Covered Code within Your business or organization or in conjunction with -other Licensees with equivalent Research Use rights. Commercial Use -includes any use of the Covered Code for direct or indirect commercial -or strategic gain, advantage or other business purpose. Any Commercial -Use requires execution of Attachment D by You and Original Contributor. - -5. "*Community Code*" means the Original Code, Upgraded Code, Error -Corrections, Shared Modifications, or any combination thereof. - -6. "*Community Webserver(s)"* means the webservers designated by -Original Contributor for access to the Original Code, Upgraded Code, TCK -and Specifications and for posting Error Corrections and Shared -Modifications. - -7. "*Compliant Covered Code*" means Covered Code that complies with the -requirements of the TCK. - -8. "*Contributor*" means each Licensee that creates or contributes to -the creation of any Error Correction or Shared Modification. - -9. "*Covered Code*" means the Original Code, Upgraded Code, -Modifications, or any combination thereof. - -10. "*Error Correction*" means any change made to Community Code which -conforms to the Specification and corrects the adverse effect of a -failure of Community Code to perform any function set forth in or -required by the Specifications. - -11. "*Executable*" means Covered Code that has been converted from -Source Code to the preferred form for execution by a computer or digital -processor (e.g. binary form). - -12. "*Extension(s)"* means any additional Interfaces developed by or for -You which: (i) are designed for use with the Technology; (ii) constitute -an API for a library of computing functions or services; and (iii) are -disclosed or otherwise made available to third party software developers -for the purpose of developing software which invokes such additional -Interfaces. The foregoing shall not apply to software developed by Your -subcontractors to be exclusively used by You. - -13. "*Header File(s)"* means that portion of the Source Code that -provides the names and types of member functions, data members, class -definitions, and interface definitions necessary to implement the APIs -for the Covered Code. Header Files include, files specifically -designated by Original Contributor as Header Files. Header Files do not -include the code necessary to implement the functionality underlying the -Interface. - -14. *"Helix DNA Server Technology"* means the program(s) that implement -the Helix Universal Server streaming engine for the Technology as -defined in the Specification. - -15. *"Helix DNA Client Technology"* means the Covered Code that -implements the RealOne Player engine as defined in the Specification. - -16. *"Helix DNA Producer Technology"* means the Covered Code that -implements the Helix Producer engine as defined in the Specification. - -17. *"Helix DNA Technology"* means the Helix DNA Server Technology, the -Helix DNA Client Technology, the Helix DNA Producer Technology and other -Helix technologies designated by Original Contributor. - -18. "*Intellectual Property Rights*" means worldwide statutory and -common law rights associated solely with (i) Applicable Patent Rights; -(ii) works of authorship including copyrights, copyright applications, -copyright registrations and "moral rights"; (iii) the protection of -trade and industrial secrets and confidential information; and (iv) -divisions, continuations, renewals, and re-issuances of the foregoing -now existing or acquired in the future. - -19. *"Interface*" means interfaces, functions, properties, class -definitions, APIs, Header Files, GUIDs, V-Tables, and/or protocols -allowing one piece of software, firmware or hardware to communicate or -interoperate with another piece of software, firmware or hardware. - -20. "*Internal Deployment Use*" means use of Compliant Covered Code -(excluding Research Use) within Your business or organization only by -Your employees and/or agents on behalf of Your business or organization, -but not to provide services, including content distribution, to third -parties, subject to execution of Attachment D by You and Original -Contributor, if required. - -21. "*Licensee*" means any party that has entered into and has in effect -a version of this License with Original Contributor. - -22. "*MIME type*" means a description of what type of media or other -content is in a file, including by way of example but not limited to -'audio/x-pn-realaudio-plugin.' - -23. "*Modification(s)"* means (i) any addition to, deletion from and/or -change to the substance and/or structure of the Covered Code, including -Interfaces; (ii) the combination of any Covered Code and any previous -Modifications; (iii) any new file or other representation of computer -program statements that contains any portion of Covered Code; and/or -(iv) any new Source Code implementing any portion of the Specifications. - -24. "*MP3 Patents*" means any patents necessary to make, use or sell -technology implementing any portion of the specification developed by -the Moving Picture Experts Group known as MPEG-1 Audio Layer-3 or MP3, -including but not limited to all past and future versions, profiles, -extensions, parts and amendments relating to the MP3 specification. - -25. "*MPEG-4 Patents*" means any patents necessary to make, use or sell -technology implementing any portion of the specification developed by -the Moving Pictures Experts Group known as MPEG-4, including but not -limited to all past and future versions, profiles, extensions, parts and -amendments relating to the MPEG-4 specification. - -26. "*Original Code*" means the initial Source Code for the Technology -as described on the Community Web Server. - -27. "*Original Contributor*" means RealNetworks, Inc., its affiliates -and its successors and assigns. - -28. "*Original Contributor MIME Type*" means the MIME registry, browser -preferences, or local file/protocol associations invoking any Helix DNA -Client-based application, including the RealOne Player, for playback of -RealAudio, RealVideo, other RealMedia MIME types or datatypes (e.g., -.ram, .rnx, .rpm, .ra, .rm, .rp, .rt, .rf, .prx, .mpe, .rmp, .rmj, .rav, -.rjs, .rmx, .rjt, .rms), and any other Original Contributor-specific or -proprietary MIME types that Original Contributor may introduce in the -future. - -29. "*Personal Use*" means use of Covered Code by an individual solely -for his or her personal, private and non-commercial purposes. An -individual's use of Covered Code in his or her capacity as an officer, -employee, member, independent contractor or agent of a corporation, -business or organization (commercial or non-commercial) does not qualify -as Personal Use. - -30. "*RealMedia File Format*" means the file format designed and -developed by RealNetworks for storing multimedia data and used to store -RealAudio and RealVideo encoded streams. Valid RealMedia File Format -extensions include: .rm, .rmj, .rmc, .rmvb, .rms. - -31. "*RCSL Webpage*" means the RealNetworks Community Source License -webpage located at https://www.helixcommunity.org/content/rcsl or such -other URL that Original Contributor may designate from time to time. - -32. "*Reformatted Specifications*" means any revision to the -Specifications which translates or reformats the Specifications (as for -example in connection with Your documentation) but which does not alter, -subset or superset * *the functional or operational aspects of the -Specifications. - -33. "*Research Use*" means use and distribution of Covered Code only for -Your Personal Use, research or development use and expressly excludes -Internal Deployment Use and Commercial Use. Research Use also includes -use of Covered Code to teach individuals how to use Covered Code. - -34. "*Shared Modifications*" means Modifications that You distribute or -use for a Commercial Use, in addition to any Modifications provided by -You, at Your option, pursuant to Section 2.2, or received by You from a -Contributor pursuant to Section 2.3. - -35. "*Source Code*" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control -compilation and installation of an Executable, or source code -differential comparisons against either the Original Code or another -well known, available Covered Code of the Contributor's choice. The -Source Code can be in a compressed or archival form, provided the -appropriate decompression or de-archiving software is widely available -for no charge. - -36. "*Specifications*" means the specifications for the Technology and -other documentation, as designated on the Community Web Server, as may -be revised by Original Contributor from time to time. - -37. "*Trademarks*" means Original Contributor's trademarks and logos, -including, but not limited to, RealNetworks, RealAudio, RealVideo, -RealOne, RealSystem, SureStream, Helix, Helix DNA and other trademarks -whether now used or adopted in the future. - -38. "*Technology*" means the technology described in Attachment B, and -Upgrades. - -39. "*Technology Compatibility Kit"* or *"TCK*" means the test programs, -procedures, acceptance criteria and/or other requirements, designated by -Original Contributor for use in verifying compliance of Covered Code -with the Specifications, in conjunction with the Original Code and -Upgraded Code. Original Contributor may, in its sole discretion and from -time to time, revise a TCK to correct errors and/or omissions and in -connection with Upgrades. - -40. "*Upgrade(s)"* means new versions of Technology designated -exclusively by Original Contributor as an "Upgrade" and released by -Original Contributor from time to time under the terms of the License. - -41. "*Upgraded Code*" means the Source Code and/or Executables for -Upgrades, possibly including Modifications made by Contributors. - -42. *"User's Guide"* means the users guide for the TCK which Original -Contributor makes available to You to provide direction in how to run -the TCK and properly interpret the results, as may be revised by -Original Contributor from time to time. - -43. "*You(r)*" means an individual, or a legal entity acting by and -through an individual or individuals, exercising rights either under -this License or under a future version of this License issued pursuant -to Section 4.1. For legal entities, "You(r)" includes any entity that by -majority voting interest controls, is controlled by, or is under common -control with You. - -44. "*Your Products*" means any (i) hardware products You distribute -integrating the Covered Code; (ii) any software products You distribute -with the Covered Code that utilize the APIs of the Covered Code; or -(iii) any services You provide using the Covered Code. - - - ATTACHMENT A - -REQUIRED NOTICES - - - ATTACHMENT A-1 - -REQUIRED IN ALL CASES - -Notice to be included in header file of all Error Corrections and Shared -Modifications: - -Portions Copyright 1994-2003 © RealNetworks, Inc. All rights reserved. - -The contents of this file, and the files included with this file, are -subject to the current version of RealNetworks Community Source License -Version 1.1 (the "License"). You may not use this file except in -compliance with the License executed by both You and RealNetworks. You -may obtain a copy of the License at * -https://www.helixcommunity.org/content/rcsl.* You may also obtain a copy -of the License by contacting RealNetworks directly. Please see the -License for the rights, obligations and limitations governing use of the -contents of the file. - -This file is part of the Helix DNA technology. RealNetworks, Inc., is -the developer of the Original code and owns the copyrights in the -portions it created. - -This file, and the files included with this file, are distributed on an -'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, -AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT -LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - -Contributor(s): - -_______________________________________________ - -Technology Compatibility Kit Test Suite(s) Location: - -________________________________ - - - ATTACHMENT A-2 - -SAMPLE LICENSEE CERTIFICATION - -"By clicking the `Agree' button below, You certify that You are a -Licensee in good standing under the RealNetworks Community Source -License, ("License") and that Your access, use and distribution of code -and information You may obtain at this site is subject to the License. -If You are not a Licensee under the RealNetworks Community Source -License You agree not to download, copy or use the Helix DNA technology. - - - ATTACHMENT A-3 - -REQUIRED STUDENT NOTIFICATION - -"This software and related documentation has been obtained by Your -educational institution subject to the RealNetworks Community Source -License. You have been provided access to the software and related -documentation for use only in connection with your course work and -research activities as a matriculated student of Your educational -institution. Any other use is expressly prohibited. - -THIS SOFTWARE AND RELATED DOCUMENTATION CONTAINS PROPRIETARY MATERIAL OF -REALNETWORKS, INC, WHICH ARE PROTECTED BY VARIOUS INTELLECTUAL PROPERTY -RIGHTS. - -You may not use this file except in compliance with the License. You may -obtain a copy of the License on the web at -https://www.helixcommunity.org/content/rcsl. - -* -* - - - ATTACHMENT B - -Description of Technology - -Helix DNA, which consists of Helix DNA Client, Helix DNA Server and -Helix DNA Producer. - -Description of "Technology" - -Helix DNA Technology v1.0 as described on the Community Web Server. - - - ATTACHMENT C - -TECHNOLOGY COMPATIBILITY KIT LICENSE - -The following license is effective for the *Helix DNA* Technology -Compatibility Kit - as described on the Community Web Server. The -Technology Compatibility Kit(s) for the Technology specified in -Attachment B may be accessed at the Community Web Server. - -1. TCK License. - -1.1 Grants to use TCK - -Subject to the terms and restrictions set forth below and the -RealNetworks Community Source License, and the Research Use license, -Original Contributor grants to You a worldwide, non-exclusive, -non-transferable license, to the extent of Original Contributor's -Intellectual Property Rights in the TCK (without the right to -sublicense), to use the TCK to develop and test Covered Code. - -1.2 TCK Use Restrictions. - -You are not authorized to create derivative works of the TCK or use the -TCK to test any implementation of the Specification that is not Covered -Code. You may not publish Your test results or make claims of -comparative compatibility with respect to other implementations of the -Specification. In consideration for the license grant in Section 1.1 -above You agree not to develop Your own tests that are intended to -validate conformation with the Specification. - -2. Test Results. - -You agree to provide to Original Contributor or the third party test -facility if applicable, Your test results that demonstrate that Covered -Code is Compliant Covered Code and that Original Contributor may publish -or otherwise distribute such test results. - -PLEASE READ THE TERMS OF THIS LICENSE CAREFULLY. BY CLICKING ON THE -"ACCEPT" BUTTON BELOW YOU ARE ACCEPTING AND AGREEING TO THE TERMS AND -CONDITIONS OF THIS LICENSE WITH THE ORIGINAL CONTRIBUTOR, REALNETWORKS, -INC. IF YOU ARE AGREEING TO THIS LICENSE ON BEHALF OF A COMPANY, YOU -REPRESENT THAT YOU ARE AUTHORIZED TO BIND THE COMPANY TO SUCH A LICENSE. -WHETHER YOU ARE ACTING ON YOUR OWN BEHALF, OR REPRESENTING A COMPANY, -YOU MUST BE OF MAJORITY AGE AND BE OTHERWISE COMPETENT TO ENTER INTO -CONTRACTS. IF YOU DO NOT MEET THIS CRITERIA OR YOU DO NOT AGREE TO ANY -OF THE TERMS AND CONDITIONS OF THIS LICENSE, CLICK ON THE REJECT BUTTON -TO EXIT. - -*ACCEPT / REJECT -* - -* -* - -*To agree to the R&D/academic terms of this license, please register - on the site -- -you will then be given a chance to agree to the clickwrap RCSL - -R&D License - -and gain access to the RCSL-licensed source code. To build or deploy -commercial applications based on the RCSL, you will need to agree to the -Commercial Use license attachments -* - - - +The RCSL is made up of a base agreement and a few Attachments. + +For Research and Development use, you agree to the terms of the +RCSL R&D License (base RCSL and Attachments A, B, and C) + +For Commercial Use (either distribution or internal commercial +deployment) of the Helix DNA with or without support for RealNetworks' +RealAudio and RealVideo Add-on Technology, you agree to the +terms of the same RCSL R&D license +and execute one or more additional Commercial Use License attachments +. + +------------------------------------------------------------------------ + + + REALNETWORKS COMMUNITY SOURCE LICENSE + +Version 1.2 (Rev. Date: January 22, 2003). + + + RECITALS + +Original Contributor has developed Specifications, Source Code +implementations and Executables of certain Technology; and + +Original Contributor desires to license the Technology to a large +community to facilitate research, innovation and product development +while maintaining compatibility of such products with the Technology as +delivered by Original Contributor; and + +Original Contributor desires to license certain Trademarks for the +purpose of branding products that are compatible with the relevant +Technology delivered by Original Contributor; and + +You desire to license the Technology and possibly certain Trademarks +from Original Contributor on the terms and conditions specified in this +License. + +In consideration for the mutual covenants contained herein, You and +Original Contributor agree as follows: + + + AGREEMENT + +*1. Introduction.* + +The RealNetworks Community Source License ("RCSL") and effective +attachments ("License") may include five distinct licenses: + +i) Research Use license -- License plus Attachments A, B and C only. + +ii) Commercial Use and Trademark License, which may be for Internal +Deployment Use or external distribution, or both -- License plus +Attachments A, B, C, and D. + +iii) Technology Compatibility Kit (TCK) license -- Attachment C. + +iv) Add-On Technology License (Executable) Commercial Use License +-Attachment F. + +v) Add-On Technology Source Code Porting and Optimization +License-Attachment G. + +The Research Use license is effective when You click and accept this +License. The TCK is effective when You click and accept this License, +unless otherwise specified in the TCK attachments. The Commercial Use +and Trademark, Add-On Technology License, and the Add-On Technology +Source Code Porting and Optimization licenses must each be signed by You +and Original Contributor to become effective. Once effective, these +licenses and the associated requirements and responsibilities are +cumulative. Capitalized terms used in this License are defined in the +Glossary. + +*2. License Grants.* + +2.1 Original Contributor Grant. + +Subject to Your compliance with Sections 3, 8.10 and Attachment A of +this License, Original Contributor grants to You a worldwide, +royalty-free, non-exclusive license, to the extent of Original +Contributor's Intellectual Property Rights covering the Original Code, +Upgraded Code and Specifications, to do the following: + +(a) Research Use License: + +(i) use, reproduce and modify the Original Code, Upgraded Code and +Specifications to create Modifications and Reformatted Specifications +for Research Use by You; + +(ii) publish and display Original Code, Upgraded Code and Specifications +with, or as part of Modifications, as permitted under Section 3.1(b) below; + +(iii) reproduce and distribute copies of Original Code and Upgraded Code +to Licensees and students for Research Use by You; + +(iv) compile, reproduce and distribute Original Code and Upgraded Code +in Executable form, and Reformatted Specifications to anyone for +Research Use by You. + +(b) Other than the licenses expressly granted in this License, Original +Contributor retains all right, title, and interest in Original Code and +Upgraded Code and Specifications. + +2.2 Your Grants. + +(a) To Other Licensees. You hereby grant to each Licensee a license to +Your Error Corrections and Shared Modifications, of the same scope and +extent as Original Contributor's licenses under Section 2.1 a) above +relative to Research Use and Attachment D relative to Commercial Use. + +(b) To Original Contributor. You hereby grant to Original Contributor a +worldwide, royalty-free, non-exclusive, perpetual and irrevocable +license, to the extent of Your Intellectual Property Rights covering +Your Error Corrections, Shared Modifications and Reformatted +Specifications, to use, reproduce, modify, display and distribute Your +Error Corrections, Shared Modifications and Reformatted Specifications, +in any form, including the right to sublicense such rights through +multiple tiers of distribution. + +(c) Other than the licenses expressly granted in Sections 2.2(a) and (b) +above, and the restrictions set forth in Section 3.1(d)(iv) below, You +retain all right, title, and interest in Your Error Corrections, Shared +Modifications and Reformatted Specifications. + +2.3 Contributor Modifications. + +You may use, reproduce, modify, display and distribute Contributor Error +Corrections, Shared Modifications and Reformatted Specifications, +obtained by You under this License, to the same scope and extent as with +Original Code, Upgraded Code and Specifications. + +2.4 Subcontracting. + +You may deliver the Source Code of Covered Code to other Licensees +having at least a Research Use license, for the sole purpose of +furnishing development services to You in connection with Your rights +granted in this License. All such Licensees must execute appropriate +documents with respect to such work consistent with the terms of this +License, and acknowledging their work-made-for-hire status or assigning +exclusive right to the work product and associated Intellectual Property +Rights to You. + +*3. Requirements and Responsibilities*. + +3.1 Research Use License. + +As a condition of exercising the rights granted under Section 2.1(a) +above, You agree to comply with the following: + +(a) Your Contribution to the Community. All Error Corrections and Shared +Modifications which You create or contribute to are automatically +subject to the licenses granted under Section 2.2 above. You are +encouraged to license all of Your other Modifications under Section 2.2 +as Shared Modifications, but are not required to do so. You agree to +notify Original Contributor of any errors in the Specification. + +(b) Source Code Availability. You agree to provide all Your Error +Corrections to Original Contributor as soon as reasonably practicable +and, in any event, prior to Internal Deployment Use or Commercial Use, +if applicable. Original Contributor may, at its discretion, post Source +Code for Your Error Corrections and Shared Modifications on the +Community Webserver. You may also post Error Corrections and Shared +Modifications on a web-server of Your choice; provided, that You must +take reasonable precautions to ensure that only Licensees have access to +such Error Corrections and Shared Modifications. Such precautions shall +include, without limitation, a password protection scheme limited to +Licensees and a click-on, download certification of Licensee status +required of those attempting to download from the server. An example of +an acceptable certification is attached as Attachment A-2. + +(c) Notices. All Error Corrections and Shared Modifications You create +or contribute to must include a file documenting the additions and +changes You made and the date of such additions and changes. You must +also include the notice set forth in Attachment A-1 in the file header. +If it is not possible to put the notice in a particular Source Code file +due to its structure, then You must include the notice in a location +(such as a relevant directory file), where a recipient would be most +likely to look for such a notice. + +(d) Redistribution. + +(i) Source. Covered Code may be distributed in Source Code form only to +another Licensee (except for students as provided below). You may not +offer or impose any terms on any Covered Code that alter the rights, +requirements, or responsibilities of such Licensee. You may distribute +Covered Code to students for use in connection with their course work +and research projects undertaken at accredited educational institutions. +Such students need not be Licensees, but must be given a copy of the +notice set forth in Attachment A-3 and such notice must also be included +in a file header or prominent location in the Source Code made available +to such students. + +(ii) Executable. You may distribute Executable version(s) of Covered +Code to Licensees and other third parties only for the purpose of +evaluation and comment in connection with Research Use by You and under +a license of Your choice, but which limits use of such Executable +version(s) of Covered Code only to that purpose. + +(iii) Modified Class, Interface and Package Naming. In connection with +Research Use by You only, You may use Original Contributor's class, +Interface and package names only to accurately reference or invoke the +Source Code files You modify. Original Contributor grants to You a +limited license to the extent necessary for such purposes. + +(iv) You expressly agree that any distribution, in whole or in part, of +Modifications developed by You shall only be done pursuant to the terms +and conditions of this License. + +(e) Extensions. + +(i) Covered Code. You may not include any Source Code of Community Code +in any Extensions. You may include the compiled Header Files of +Community Code in an Extension provided that Your use of the Covered +Code, including Heading Files, complies with the Commercial Use License, +the TCK and all other terms of this License. + +(ii) Publication. No later than the date on which You first distribute +such Extension for Commercial Use, You must publish to the industry, on +a non-confidential basis and free of all copyright restrictions with +respect to reproduction and use, an accurate and current specification +for any Extension. In addition, You must make available an appropriate +test suite, pursuant to the same rights as the specification, +sufficiently detailed to allow any third party reasonably skilled in the +technology to produce implementations of the Extension compatible with +the specification. Such test suites must be made available as soon as +reasonably practicable but, in no event, later than ninety (90) days +after Your first Commercial Use of the Extension. You must use +reasonable efforts to promptly clarify and correct the specification and +the test suite upon written request by Original Contributor. + +(iii) Open. You agree to refrain from enforcing any Intellectual +Property Rights You may have covering any interface(s) of Your +Extension, which would prevent the implementation of such interface(s) +by Original Contributor or any Licensee. This obligation does not +prevent You from enforcing any Intellectual Property Right You have that +would otherwise be infringed by an implementation of Your Extension. + +(iv) Interface Modifications and Naming. You may not modify or add to +the GUID space * * "xxxxxxxx-0901-11d1-8B06-00A024406D59" or any other +GUID space designated by Original Contributor. You may not modify any +Interface prefix provided with the Covered Code or any other prefix +designated by Original Contributor.* * + +* * + +(f) You agree that any Specifications provided to You by Original +Contributor are confidential and proprietary information of Original +Contributor. You must maintain the confidentiality of the Specifications +and may not disclose them to any third party without Original +Contributor's prior written consent. You may only use the Specifications +under the terms of this License and only for the purpose of implementing +the terms of this License with respect to Covered Code. You agree not +use, copy or distribute any such Specifications except as provided in +writing by Original Contributor. + +3.2 Commercial Use License. + +You may not make Commercial Use of any Covered Code unless You and +Original Contributor have executed a copy of the Commercial Use and +Trademark License attached as Attachment D. + +*4. Versions of the License.* + +4.1 License Versions. + +Original Contributor may publish revised versions of the License from +time to time. Each version will be given a distinguishing version number. + +4.2 Effect. + +Once a particular version of Covered Code has been provided under a +version of the License, You may always continue to use such Covered Code +under the terms of that version of the License. You may also choose to +use such Covered Code under the terms of any subsequent version of the +License. No one other than Original Contributor has the right to +promulgate License versions. + +4.3 Multiple-Licensed Code. + +Original Contributor may designate portions of the Covered Code as +"Multiple-Licensed." "Multiple-Licensed" means that the Original +Contributor permits You to utilize those designated portions of the +Covered Code under Your choice of this License or the alternative +license(s), if any, specified by the Original Contributor in an +Attachment to this License. + +*5. Disclaimer of Warranty.* + +5.1 COVERED CODE PROVIDED AS IS. + +COVERED CODE IS PROVIDED UNDER THIS LICENSE "AS IS," WITHOUT WARRANTY OF +ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, +WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT +FOR A PARTICULAR PURPOSE OR NON-INFRINGING. YOU AGREE TO BEAR THE ENTIRE +RISK IN CONNECTION WITH YOUR USE AND DISTRIBUTION OF COVERED CODE UNDER +THIS LICENSE. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART +OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER +EXCEPT SUBJECT TO THIS DISCLAIMER. + +5.2 Not Designed for High Risk Activities. + +You acknowledge that Original Code, Upgraded Code and Specifications are +not designed or intended for use in high risk activities including, but +not limited to: (i) on-line control of aircraft, air traffic, aircraft +navigation or aircraft communications; or (ii) in the design, +construction, operation or maintenance of any nuclear facility. Original +Contributor disclaims any express or implied warranty of fitness for +such uses. + +*6. Termination.* + +6.1 By You. + +You may terminate this Research Use license at anytime by providing +written notice to Original Contributor. + +6.2 By Original Contributor. + +This License and the rights granted hereunder will terminate: + +(i) automatically if You fail to comply with the terms of this License +and fail to cure such breach within 30 days of receipt of written notice +of the breach; + +(ii) immediately in the event of circumstances specified in Sections 7.1 +and 8.4; or + +(iii) at Original Contributor's discretion upon any action initiated by +You (including by cross-claim or counter claim) alleging that use or +distribution by Original Contributor or any Licensee, of Original Code, +Upgraded Code, Error Corrections, Shared Modifications or Specifications +infringe a patent owned or controlled by You. + +6.3 Effective of Termination. + +Upon termination, You agree to discontinue use of and destroy all copies +of Covered Code in Your possession. All sublicenses to the Covered Code +which You have properly granted shall survive any termination of this +License. Provisions that, by their nature, should remain in effect +beyond the termination of this License shall survive including, without +limitation, Sections 2.2, 3, 5, 7 and 8. + +6.4 No Compensation. + +Each party waives and releases the other from any claim to compensation +or indemnity for permitted or lawful termination of the business +relationship established by this License. + +*7. Liability.* + +7.1 Infringement. Should any of the Original Code, Upgraded Code, TCK or +Specifications ("Materials") become the subject of a claim of +infringement, Original Contributor may, at its sole option, (i) attempt +to procure the rights necessary for You to continue using the Materials, +(ii) modify the Materials so that they are no longer infringing, or +(iii) terminate Your right to use the Materials, immediately upon +written notice, and refund to You the amount, if any, having then +actually been paid by You to Original Contributor for the Original Code, +Upgraded Code and TCK, depreciated on a straight line, five year basis. + +7.2 LIMITATION OF LIABILITY. TO THE FULL EXTENT ALLOWED BY APPLICABLE +LAW, ORIGINAL CONTRIBUTOR'S LIABILITY TO YOU FOR CLAIMS RELATING TO THIS +LICENSE, WHETHER FOR BREACH OR IN TORT, SHALL BE LIMITED TO ONE HUNDRED +PERCENT (100%) OF THE AMOUNT HAVING THEN ACTUALLY BEEN PAID BY YOU TO +ORIGINAL CONTRIBUTOR FOR ALL COPIES LICENSED HEREUNDER OF THE PARTICULAR +ITEMS GIVING RISE TO SUCH CLAIM, IF ANY, DURING THE TWELVE MONTHS +PRECEDING THE CLAIMED BREACH. IN NO EVENT WILL YOU (RELATIVE TO YOUR +SHARED MODIFICATIONS OR ERROR CORRECTIONS) OR ORIGINAL CONTRIBUTOR BE +LIABLE FOR ANY INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR CONSEQUENTIAL +DAMAGES IN CONNECTION WITH OR RISING OUT OF THIS LICENSE (INCLUDING, +WITHOUT LIMITATION, LOSS OF PROFITS, USE, DATA, OR OTHER ECONOMIC +ADVANTAGE), HOWEVER IT ARISES AND ON ANY THEORY OF LIABILITY, WHETHER IN +AN ACTION FOR CONTRACT, STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE) +OR OTHERWISE, WHETHER OR NOT YOU OR ORIGINAL CONTRIBUTOR HAS BEEN +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE AND NOTWITHSTANDING THE +FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. + +*8. Miscellaneous.* + +8.1 Trademark. + +You shall not use any Trademark unless You and Original Contributor +execute a copy of the Commercial Use and Trademark License Agreement +attached hereto as Attachment D. Except as expressly provided in the +License, You are granted no right, title or license to, or interest in, +any Trademarks. Whether or not You and Original Contributor enter into +the Trademark License, You agree not to (i) challenge Original +Contributor's ownership or use of Trademarks; (ii) attempt to register +any Trademarks, or any mark or logo substantially similar thereto; or +(iii) incorporate any Trademarks into Your own trademarks, product +names, service marks, company names, or domain names. + +8.2 Integration. + +This License represents the complete agreement concerning the subject +matter hereof. + +8.3 Assignment. + +Original Contributor may assign this License, and its rights and +obligations hereunder, in its sole discretion. You may assign the +Research Use portions of this License and the TCK license to a third +party upon prior written notice to Original Contributor (which may be +provided electronically via the Community Web-Server). You may not +assign the Commercial Use and Trademark license, the Add-On Technology +License, or the Add-On Technology Source Code Porting License, including +by way of merger (regardless of whether You are the surviving entity) or +acquisition, without Original Contributor's prior written consent. + +8.4 Severability. + +If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. Notwithstanding the foregoing, if You are prohibited by law +from fully and specifically complying with Sections 2.2 or 3, this +License will immediately terminate and You must immediately discontinue +any use of Covered Code. + +8.5 Governing Law. + +This License shall be governed by the laws of the United States and the +State of Washington, as applied to contracts entered into and to be +performed in Washington between Washington residents. The application of +the United Nations Convention on Contracts for the International Sale of +Goods is expressly excluded. You agree that the state and federal courts +located in Seattle, Washington have exclusive jurisdiction over any +claim relating to the License, including contract and tort claims. + +8.6 Dispute Resolution. + +a) Arbitration. Any dispute arising out of or relating to this License +shall be finally settled by arbitration as set out herein, except that +either party may bring any action, in a court of competent jurisdiction +(which jurisdiction shall be exclusive), with respect to any dispute +relating to such party's Intellectual Property Rights or with respect to +Your compliance with the TCK license. Arbitration shall be administered: +(i) by the American Arbitration Association (AAA), (ii) in accordance +with the rules of the United Nations Commission on International Trade +Law (UNCITRAL) (the "Rules") in effect at the time of arbitration as +modified herein; and (iii) the arbitrator will apply the substantive +laws of Washington and the United States. Judgment upon the award +rendered by the arbitrator may be entered in any court having +jurisdiction to enforce such award. + +b) Arbitration language, venue and damages. All arbitration proceedings +shall be conducted in English by a single arbitrator selected in +accordance with the Rules, who must be fluent in English and be either a +retired judge or practicing attorney having at least ten (10) years +litigation experience and be reasonably familiar with the technology +matters relative to the dispute. Unless otherwise agreed, arbitration +venue shall be in Seattle, Washington. The arbitrator may award monetary +damages only and nothing shall preclude either party from seeking +provisional or emergency relief from a court of competent jurisdiction. +The arbitrator shall have no authority to award damages in excess of +those permitted in this License and any such award in excess is void. +All awards will be payable in U.S. dollars and may include, for the +prevailing party (i) pre-judgment award interest, (ii) reasonable +attorneys' fees incurred in connection with the arbitration, and (iii) +reasonable costs and expenses incurred in enforcing the award. The +arbitrator will order each party to produce identified documents and +respond to no more than twenty-five single question interrogatories. + +8.7 Construction. + +Any law or regulation, which provides that the language of a contract +shall be construed against the drafter, shall not apply to this License. + +8.8 U.S. Government End Users. + +The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" +and "commercial computer software documentation," as such terms are used +in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and +48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government +End Users acquire Covered Code with only those rights set forth herein. +You agree to pass this notice to our licensees. + +8.9 Marketing Activities. + +Licensee hereby grants Original Contributor a non-exclusive, +non-transferable, limited license to use the Licensee's company name and +logo ("Licensee Marks") in any presentations, press releases, or +marketing materials solely for the purpose of identifying Licensee as a +member of the Helix Community. Licensee shall provide samples of +Licensee Marks to Original Contributor upon request by Original +Contributor. Original Contributor acknowledges that the Licensee Marks +are the trademarks of Licensee. Original Contributor shall not use the +Licensee Marks in a way that may imply that Original Contributor is an +agency or branch of Licensee. Original Contributor understands and +agrees that the use of any Licensee Marks in connection with this +Agreement shall not create any right, title or interest, in, or to the +Licensee Marks or any Licensee trademarks and that all such use and +goodwill associated with any such trademarks will inure to the benefit +of Licensee. Further the Original Contributor will stop usage of the +Licensee Marks upon Licensee's request. + +8.10 Press Announcements. + +You may make press announcements or other public statements regarding +this License without the prior written consent of the Original +Contributor, if Your statement is limited to announcing the licensing of +the Covered Code or the availability of Your Product and its +compatibility with the Covered Code. All other public announcements +regarding this license require the prior written consent of the Original +Contributor. Consent requests are welcome at press@helixcommunity.org. + +8.11 International Use. + +a) Export/Import laws. Covered Code is subject to U.S. export control +laws and may be subject to export or import regulations in other +countries. Each party agrees to comply strictly with all such laws and +regulations and acknowledges their responsibility to obtain such +licenses to export, re-export, or import as may be required. You agree +to pass these obligations to Your licensees. + +b) Intellectual Property Protection. Due to limited intellectual +property protection and enforcement in certain countries, You agree not +to redistribute the Original Code, Upgraded Code, TCK and Specifications +to any country on the list of restricted countries on the Community Web +Server. + +8.12 Language. + +This License is in the English language only, which language shall be +controlling in all respects, and all versions of this License in any +other language shall be for accommodation only and shall not be binding +on the parties to this License. All communications and notices made or +given pursuant to this License, and all documentation and support to be +provided, unless otherwise noted, shall be in the English language. + +PLEASE READ THE TERMS OF THIS LICENSE CAREFULLY. BY CLICKING ON THE +"ACCEPT" BUTTON BELOW YOU ARE ACCEPTING AND AGREEING TO THE TERMS AND +CONDITIONS OF THIS LICENSE WITH REALNETWORKS, INC. IF YOU ARE AGREEING +TO THIS LICENSE ON BEHALF OF A COMPANY, YOU REPRESENT THAT YOU ARE +AUTHORIZED TO BIND THE COMPANY TO SUCH A LICENSE. WHETHER YOU ARE ACTING +ON YOUR OWN BEHALF, OR REPRESENTING A COMPANY, YOU MUST BE OF MAJORITY +AGE AND BE OTHERWISE COMPETENT TO ENTER INTO CONTRACTS. IF YOU DO NOT +MEET THIS CRITERIA OR YOU DO NOT AGREE TO ANY OF THE TERMS AND +CONDITIONS OF THIS LICENSE, CLICK ON THE REJECT BUTTON TO EXIT. + + + GLOSSARY + +1. *"Added Value"* means code which: + +(i) has a principal purpose which is substantially different from that +of the stand-alone Technology; + +(ii) represents a significant functional and value enhancement to the +Technology; + +(iii) operates in conjunction with the Technology; and + +(iv) is not marketed as a technology which replaces or substitutes for +the Technology + +2. "*Applicable Patent Rights*" mean: (a) in the case where Original +Contributor is the grantor of rights, claims of patents that (i) are now +or hereafter acquired, owned by or assigned to Original Contributor and +(ii) are necessarily infringed by using or making the Original Code or +Upgraded Code, including Modifications provided by Original Contributor, +alone and not in combination with other software or hardware; and (b) in +the case where Licensee is the grantor of rights, claims of patents that +(i) are now or hereafter acquired, owned by or assigned to Licensee and +(ii) are infringed (directly or indirectly) by using or making +Licensee's Modifications or Error Corrections, taken alone or in +combination with Covered Code. + +3. "*Application Programming Interfaces (APIs)"* means the interfaces, +associated header files, service provider interfaces, and protocols that +enable a device, application, Operating System, or other program to +obtain services from or make requests of (or provide services in +response to requests from) other programs, and to use, benefit from, or +rely on the resources, facilities, and capabilities of the relevant +programs using the APIs. APIs includes the technical documentation +describing the APIs, the Source Code constituting the API, and any +Header Files used with the APIs. + +4. "*Commercial Use*" means any use (internal or external), copying, +sublicensing or distribution (internal or external), directly or +indirectly of Covered Code by You other than Your Research Use of +Covered Code within Your business or organization or in conjunction with +other Licensees with equivalent Research Use rights. Commercial Use +includes any use of the Covered Code for direct or indirect commercial +or strategic gain, advantage or other business purpose. Any Commercial +Use requires execution of Attachment D by You and Original Contributor. + +5. "*Community Code*" means the Original Code, Upgraded Code, Error +Corrections, Shared Modifications, or any combination thereof. + +6. "*Community Webserver(s)"* means the webservers designated by +Original Contributor for access to the Original Code, Upgraded Code, TCK +and Specifications and for posting Error Corrections and Shared +Modifications. + +7. "*Compliant Covered Code*" means Covered Code that complies with the +requirements of the TCK. + +8. "*Contributor*" means each Licensee that creates or contributes to +the creation of any Error Correction or Shared Modification. + +9. "*Covered Code*" means the Original Code, Upgraded Code, +Modifications, or any combination thereof. + +10. "*Error Correction*" means any change made to Community Code which +conforms to the Specification and corrects the adverse effect of a +failure of Community Code to perform any function set forth in or +required by the Specifications. + +11. "*Executable*" means Covered Code that has been converted from +Source Code to the preferred form for execution by a computer or digital +processor (e.g. binary form). + +12. "*Extension(s)"* means any additional Interfaces developed by or for +You which: (i) are designed for use with the Technology; (ii) constitute +an API for a library of computing functions or services; and (iii) are +disclosed or otherwise made available to third party software developers +for the purpose of developing software which invokes such additional +Interfaces. The foregoing shall not apply to software developed by Your +subcontractors to be exclusively used by You. + +13. "*Header File(s)"* means that portion of the Source Code that +provides the names and types of member functions, data members, class +definitions, and interface definitions necessary to implement the APIs +for the Covered Code. Header Files include, files specifically +designated by Original Contributor as Header Files. Header Files do not +include the code necessary to implement the functionality underlying the +Interface. + +14. *"Helix DNA Server Technology"* means the program(s) that implement +the Helix Universal Server streaming engine for the Technology as +defined in the Specification. + +15. *"Helix DNA Client Technology"* means the Covered Code that +implements the RealOne Player engine as defined in the Specification. + +16. *"Helix DNA Producer Technology"* means the Covered Code that +implements the Helix Producer engine as defined in the Specification. + +17. *"Helix DNA Technology"* means the Helix DNA Server Technology, the +Helix DNA Client Technology, the Helix DNA Producer Technology and other +Helix technologies designated by Original Contributor. + +18. "*Intellectual Property Rights*" means worldwide statutory and +common law rights associated solely with (i) Applicable Patent Rights; +(ii) works of authorship including copyrights, copyright applications, +copyright registrations and "moral rights"; (iii) the protection of +trade and industrial secrets and confidential information; and (iv) +divisions, continuations, renewals, and re-issuances of the foregoing +now existing or acquired in the future. + +19. *"Interface*" means interfaces, functions, properties, class +definitions, APIs, Header Files, GUIDs, V-Tables, and/or protocols +allowing one piece of software, firmware or hardware to communicate or +interoperate with another piece of software, firmware or hardware. + +20. "*Internal Deployment Use*" means use of Compliant Covered Code +(excluding Research Use) within Your business or organization only by +Your employees and/or agents on behalf of Your business or organization, +but not to provide services, including content distribution, to third +parties, subject to execution of Attachment D by You and Original +Contributor, if required. + +21. "*Licensee*" means any party that has entered into and has in effect +a version of this License with Original Contributor. + +22. "*MIME type*" means a description of what type of media or other +content is in a file, including by way of example but not limited to +'audio/x-pn-realaudio-plugin.' + +23. "*Modification(s)"* means (i) any addition to, deletion from and/or +change to the substance and/or structure of the Covered Code, including +Interfaces; (ii) the combination of any Covered Code and any previous +Modifications; (iii) any new file or other representation of computer +program statements that contains any portion of Covered Code; and/or +(iv) any new Source Code implementing any portion of the Specifications. + +24. "*MP3 Patents*" means any patents necessary to make, use or sell +technology implementing any portion of the specification developed by +the Moving Picture Experts Group known as MPEG-1 Audio Layer-3 or MP3, +including but not limited to all past and future versions, profiles, +extensions, parts and amendments relating to the MP3 specification. + +25. "*MPEG-4 Patents*" means any patents necessary to make, use or sell +technology implementing any portion of the specification developed by +the Moving Pictures Experts Group known as MPEG-4, including but not +limited to all past and future versions, profiles, extensions, parts and +amendments relating to the MPEG-4 specification. + +26. "*Original Code*" means the initial Source Code for the Technology +as described on the Community Web Server. + +27. "*Original Contributor*" means RealNetworks, Inc., its affiliates +and its successors and assigns. + +28. "*Original Contributor MIME Type*" means the MIME registry, browser +preferences, or local file/protocol associations invoking any Helix DNA +Client-based application, including the RealOne Player, for playback of +RealAudio, RealVideo, other RealMedia MIME types or datatypes (e.g., +.ram, .rnx, .rpm, .ra, .rm, .rp, .rt, .rf, .prx, .mpe, .rmp, .rmj, .rav, +.rjs, .rmx, .rjt, .rms), and any other Original Contributor-specific or +proprietary MIME types that Original Contributor may introduce in the +future. + +29. "*Personal Use*" means use of Covered Code by an individual solely +for his or her personal, private and non-commercial purposes. An +individual's use of Covered Code in his or her capacity as an officer, +employee, member, independent contractor or agent of a corporation, +business or organization (commercial or non-commercial) does not qualify +as Personal Use. + +30. "*RealMedia File Format*" means the file format designed and +developed by RealNetworks for storing multimedia data and used to store +RealAudio and RealVideo encoded streams. Valid RealMedia File Format +extensions include: .rm, .rmj, .rmc, .rmvb, .rms. + +31. "*RCSL Webpage*" means the RealNetworks Community Source License +webpage located at https://www.helixcommunity.org/content/rcsl or such +other URL that Original Contributor may designate from time to time. + +32. "*Reformatted Specifications*" means any revision to the +Specifications which translates or reformats the Specifications (as for +example in connection with Your documentation) but which does not alter, +subset or superset * *the functional or operational aspects of the +Specifications. + +33. "*Research Use*" means use and distribution of Covered Code only for +Your Personal Use, research or development use and expressly excludes +Internal Deployment Use and Commercial Use. Research Use also includes +use of Covered Code to teach individuals how to use Covered Code. + +34. "*Shared Modifications*" means Modifications that You distribute or +use for a Commercial Use, in addition to any Modifications provided by +You, at Your option, pursuant to Section 2.2, or received by You from a +Contributor pursuant to Section 2.3. + +35. "*Source Code*" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control +compilation and installation of an Executable, or source code +differential comparisons against either the Original Code or another +well known, available Covered Code of the Contributor's choice. The +Source Code can be in a compressed or archival form, provided the +appropriate decompression or de-archiving software is widely available +for no charge. + +36. "*Specifications*" means the specifications for the Technology and +other documentation, as designated on the Community Web Server, as may +be revised by Original Contributor from time to time. + +37. "*Trademarks*" means Original Contributor's trademarks and logos, +including, but not limited to, RealNetworks, RealAudio, RealVideo, +RealOne, RealSystem, SureStream, Helix, Helix DNA and other trademarks +whether now used or adopted in the future. + +38. "*Technology*" means the technology described in Attachment B, and +Upgrades. + +39. "*Technology Compatibility Kit"* or *"TCK*" means the test programs, +procedures, acceptance criteria and/or other requirements, designated by +Original Contributor for use in verifying compliance of Covered Code +with the Specifications, in conjunction with the Original Code and +Upgraded Code. Original Contributor may, in its sole discretion and from +time to time, revise a TCK to correct errors and/or omissions and in +connection with Upgrades. + +40. "*Upgrade(s)"* means new versions of Technology designated +exclusively by Original Contributor as an "Upgrade" and released by +Original Contributor from time to time under the terms of the License. + +41. "*Upgraded Code*" means the Source Code and/or Executables for +Upgrades, possibly including Modifications made by Contributors. + +42. *"User's Guide"* means the users guide for the TCK which Original +Contributor makes available to You to provide direction in how to run +the TCK and properly interpret the results, as may be revised by +Original Contributor from time to time. + +43. "*You(r)*" means an individual, or a legal entity acting by and +through an individual or individuals, exercising rights either under +this License or under a future version of this License issued pursuant +to Section 4.1. For legal entities, "You(r)" includes any entity that by +majority voting interest controls, is controlled by, or is under common +control with You. + +44. "*Your Products*" means any (i) hardware products You distribute +integrating the Covered Code; (ii) any software products You distribute +with the Covered Code that utilize the APIs of the Covered Code; or +(iii) any services You provide using the Covered Code. + + + ATTACHMENT A + +REQUIRED NOTICES + + + ATTACHMENT A-1 + +REQUIRED IN ALL CASES + +Notice to be included in header file of all Error Corrections and Shared +Modifications: + +Portions Copyright 1994-2003 © RealNetworks, Inc. All rights reserved. + +The contents of this file, and the files included with this file, are +subject to the current version of RealNetworks Community Source License +Version 1.1 (the "License"). You may not use this file except in +compliance with the License executed by both You and RealNetworks. You +may obtain a copy of the License at * +https://www.helixcommunity.org/content/rcsl.* You may also obtain a copy +of the License by contacting RealNetworks directly. Please see the +License for the rights, obligations and limitations governing use of the +contents of the file. + +This file is part of the Helix DNA technology. RealNetworks, Inc., is +the developer of the Original code and owns the copyrights in the +portions it created. + +This file, and the files included with this file, are distributed on an +'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, +AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT +LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + +Contributor(s): + +_______________________________________________ + +Technology Compatibility Kit Test Suite(s) Location: + +________________________________ + + + ATTACHMENT A-2 + +SAMPLE LICENSEE CERTIFICATION + +"By clicking the `Agree' button below, You certify that You are a +Licensee in good standing under the RealNetworks Community Source +License, ("License") and that Your access, use and distribution of code +and information You may obtain at this site is subject to the License. +If You are not a Licensee under the RealNetworks Community Source +License You agree not to download, copy or use the Helix DNA technology. + + + ATTACHMENT A-3 + +REQUIRED STUDENT NOTIFICATION + +"This software and related documentation has been obtained by Your +educational institution subject to the RealNetworks Community Source +License. You have been provided access to the software and related +documentation for use only in connection with your course work and +research activities as a matriculated student of Your educational +institution. Any other use is expressly prohibited. + +THIS SOFTWARE AND RELATED DOCUMENTATION CONTAINS PROPRIETARY MATERIAL OF +REALNETWORKS, INC, WHICH ARE PROTECTED BY VARIOUS INTELLECTUAL PROPERTY +RIGHTS. + +You may not use this file except in compliance with the License. You may +obtain a copy of the License on the web at +https://www.helixcommunity.org/content/rcsl. + +* +* + + + ATTACHMENT B + +Description of Technology + +Helix DNA, which consists of Helix DNA Client, Helix DNA Server and +Helix DNA Producer. + +Description of "Technology" + +Helix DNA Technology v1.0 as described on the Community Web Server. + + + ATTACHMENT C + +TECHNOLOGY COMPATIBILITY KIT LICENSE + +The following license is effective for the *Helix DNA* Technology +Compatibility Kit - as described on the Community Web Server. The +Technology Compatibility Kit(s) for the Technology specified in +Attachment B may be accessed at the Community Web Server. + +1. TCK License. + +1.1 Grants to use TCK + +Subject to the terms and restrictions set forth below and the +RealNetworks Community Source License, and the Research Use license, +Original Contributor grants to You a worldwide, non-exclusive, +non-transferable license, to the extent of Original Contributor's +Intellectual Property Rights in the TCK (without the right to +sublicense), to use the TCK to develop and test Covered Code. + +1.2 TCK Use Restrictions. + +You are not authorized to create derivative works of the TCK or use the +TCK to test any implementation of the Specification that is not Covered +Code. You may not publish Your test results or make claims of +comparative compatibility with respect to other implementations of the +Specification. In consideration for the license grant in Section 1.1 +above You agree not to develop Your own tests that are intended to +validate conformation with the Specification. + +2. Test Results. + +You agree to provide to Original Contributor or the third party test +facility if applicable, Your test results that demonstrate that Covered +Code is Compliant Covered Code and that Original Contributor may publish +or otherwise distribute such test results. + +PLEASE READ THE TERMS OF THIS LICENSE CAREFULLY. BY CLICKING ON THE +"ACCEPT" BUTTON BELOW YOU ARE ACCEPTING AND AGREEING TO THE TERMS AND +CONDITIONS OF THIS LICENSE WITH THE ORIGINAL CONTRIBUTOR, REALNETWORKS, +INC. IF YOU ARE AGREEING TO THIS LICENSE ON BEHALF OF A COMPANY, YOU +REPRESENT THAT YOU ARE AUTHORIZED TO BIND THE COMPANY TO SUCH A LICENSE. +WHETHER YOU ARE ACTING ON YOUR OWN BEHALF, OR REPRESENTING A COMPANY, +YOU MUST BE OF MAJORITY AGE AND BE OTHERWISE COMPETENT TO ENTER INTO +CONTRACTS. IF YOU DO NOT MEET THIS CRITERIA OR YOU DO NOT AGREE TO ANY +OF THE TERMS AND CONDITIONS OF THIS LICENSE, CLICK ON THE REJECT BUTTON +TO EXIT. + +*ACCEPT / REJECT +* + +* +* + +*To agree to the R&D/academic terms of this license, please register + on the site -- +you will then be given a chance to agree to the clickwrap RCSL + +R&D License + +and gain access to the RCSL-licensed source code. To build or deploy +commercial applications based on the RCSL, you will need to agree to the +Commercial Use license attachments +* + + + diff --git a/source/arm7/helix/real/rpsl.txt b/source/arm7/helix/real/rpsl.txt index b7a122b..d040a45 100644 --- a/source/arm7/helix/real/rpsl.txt +++ b/source/arm7/helix/real/rpsl.txt @@ -1,518 +1,518 @@ -RealNetworks Public Source License Version 1.0 -(Rev. Date October 28, 2002) - -1. General Definitions. This License applies to any program or other work which -RealNetworks, Inc., or any other entity that elects to use this license, -("Licensor") makes publicly available and which contains a notice placed by -Licensor identifying such program or work as "Original Code" and stating that it -is subject to the terms of this RealNetworks Public Source License version 1.0 -(or subsequent version thereof) ("License"). You are not required to accept this -License. However, nothing else grants You permission to use, copy, modify or -distribute the software or its derivative works. These actions are prohibited by -law if You do not accept this License. Therefore, by modifying, copying or -distributing the software (or any work based on the software), You indicate your -acceptance of this License to do so, and all its terms and conditions. In -addition, you agree to the terms of this License by clicking the Accept button -or downloading the software. As used in this License: - -1.1 "Applicable Patent Rights" mean: (a) in the case where Licensor is the -grantor of rights, claims of patents that (i) are now or hereafter acquired, -owned by or assigned to Licensor and (ii) are necessarily infringed by using or -making the Original Code alone and not in combination with other software or -hardware; and (b) in the case where You are the grantor of rights, claims of -patents that (i) are now or hereafter acquired, owned by or assigned to You and -(ii) are infringed (directly or indirectly) by using or making Your -Modifications, taken alone or in combination with Original Code. - -1.2 "Compatible Source License" means any one of the licenses listed on Exhibit -B or at https://www.helixcommunity.org/content/complicense or other licenses -specifically identified by Licensor in writing. Notwithstanding any term to the -contrary in any Compatible Source License, any code covered by any Compatible -Source License that is used with Covered Code must be made readily available in -Source Code format for royalty-free use under the terms of the Compatible Source -License or this License. - -1.3 "Contributor" means any person or entity that creates or contributes to the -creation of Modifications. - -1.4 "Covered Code" means the Original Code, Modifications, the combination of -Original Code and any Modifications, and/or any respective portions thereof. - -1.5 "Deploy" means to use, sublicense or distribute Covered Code other than for -Your internal research and development (R&D) and/or Personal Use, and includes -without limitation, any and all internal use or distribution of Covered Code -within Your business or organization except for R&D use and/or Personal Use, as -well as direct or indirect sublicensing or distribution of Covered Code by You -to any third party in any form or manner. - -1.6 "Derivative Work" means either the Covered Code or any derivative work under -United States copyright law, and including any work containing or including any -portion of the Covered Code or Modifications, either verbatim or with -modifications and/or translated into another language. Derivative Work also -includes any work which combines any portion of Covered Code or Modifications -with code not otherwise governed by the terms of this License. - -1.7 "Externally Deploy" means to Deploy the Covered Code in any way that may be -accessed or used by anyone other than You, used to provide any services to -anyone other than You, or used in any way to deliver any content to anyone other -than You, whether the Covered Code is distributed to those parties, made -available as an application intended for use over a computer network, or used to -provide services or otherwise deliver content to anyone other than You. - -1.8. "Interface" means interfaces, functions, properties, class definitions, -APIs, header files, GUIDs, V-Tables, and/or protocols allowing one piece of -software, firmware or hardware to communicate or interoperate with another piece -of software, firmware or hardware. - -1.9 "Modifications" mean any addition to, deletion from, and/or change to, the -substance and/or structure of the Original Code, any previous Modifications, the -combination of Original Code and any previous Modifications, and/or any -respective portions thereof. When code is released as a series of files, a -Modification is: (a) any addition to or deletion from the contents of a file -containing Covered Code; and/or (b) any new file or other representation of -computer program statements that contains any part of Covered Code. - -1.10 "Original Code" means (a) the Source Code of a program or other work as -originally made available by Licensor under this License, including the Source -Code of any updates or upgrades to such programs or works made available by -Licensor under this License, and that has been expressly identified by Licensor -as such in the header file(s) of such work; and (b) the object code compiled -from such Source Code and originally made available by Licensor under this -License. - -1.11 "Personal Use" means use of Covered Code by an individual solely for his or -her personal, private and non-commercial purposes. An individual's use of -Covered Code in his or her capacity as an officer, employee, member, independent -contractor or agent of a corporation, business or organization (commercial or -non-commercial) does not qualify as Personal Use. - -1.12 "Source Code" means the human readable form of a program or other work that -is suitable for making modifications to it, including all modules it contains, -plus any associated interface definition files, scripts used to control -compilation and installation of an executable (object code). - -1.13 "You" or "Your" means an individual or a legal entity exercising rights -under this License. For legal entities, "You" or "Your" includes any entity -which controls, is controlled by, or is under common control with, You, where -"control" means (a) the power, direct or indirect, to cause the direction or -management of such entity, whether by contract or otherwise, or (b) ownership of -fifty percent (50%) or more of the outstanding shares or beneficial ownership of -such entity. - -2. Permitted Uses; Conditions & Restrictions. Subject to the terms and -conditions of this License, Licensor hereby grants You, effective on the date -You accept this License (via downloading or using Covered Code or otherwise -indicating your acceptance of this License), a worldwide, royalty-free, -non-exclusive copyright license, to the extent of Licensor's copyrights cover -the Original Code, to do the following: - -2.1 You may reproduce, display, perform, modify and Deploy Covered Code, -provided that in each instance: - -(a) You must retain and reproduce in all copies of Original Code the copyright -and other proprietary notices and disclaimers of Licensor as they appear in the -Original Code, and keep intact all notices in the Original Code that refer to -this License; - -(b) You must include a copy of this License with every copy of Source Code of -Covered Code and documentation You distribute, and You may not offer or impose -any terms on such Source Code that alter or restrict this License or the -recipients' rights hereunder, except as permitted under Section 6; - -(c) You must duplicate, to the extent it does not already exist, the notice in -Exhibit A in each file of the Source Code of all Your Modifications, and cause -the modified files to carry prominent notices stating that You changed the files -and the date of any change; - -(d) You must make Source Code of all Your Externally Deployed Modifications -publicly available under the terms of this License, including the license grants -set forth in Section 3 below, for as long as you Deploy the Covered Code or -twelve (12) months from the date of initial Deployment, whichever is longer. You -should preferably distribute the Source Code of Your Deployed Modifications -electronically (e.g. download from a web site); and - -(e) if You Deploy Covered Code in object code, executable form only, You must -include a prominent notice, in the code itself as well as in related -documentation, stating that Source Code of the Covered Code is available under -the terms of this License with information on how and where to obtain such -Source Code. You must also include the Object Code Notice set forth in Exhibit A -in the "about" box or other appropriate place where other copyright notices are -placed, including any packaging materials. - -2.2 You expressly acknowledge and agree that although Licensor and each -Contributor grants the licenses to their respective portions of the Covered Code -set forth herein, no assurances are provided by Licensor or any Contributor that -the Covered Code does not infringe the patent or other intellectual property -rights of any other entity. Licensor and each Contributor disclaim any liability -to You for claims brought by any other entity based on infringement of -intellectual property rights or otherwise. As a condition to exercising the -rights and licenses granted hereunder, You hereby assume sole responsibility to -secure any other intellectual property rights needed, if any. For example, if a -third party patent license is required to allow You to make, use, sell, import -or offer for sale the Covered Code, it is Your responsibility to acquire such -license(s). - -2.3 Subject to the terms and conditions of this License, Licensor hereby grants -You, effective on the date You accept this License (via downloading or using -Covered Code or otherwise indicating your acceptance of this License), a -worldwide, royalty-free, perpetual, non-exclusive patent license under -Licensor's Applicable Patent Rights to make, use, sell, offer for sale and -import the Covered Code, provided that in each instance you comply with the -terms of this License. - -3. Your Grants. In consideration of, and as a condition to, the licenses granted -to You under this License: - -(a) You grant to Licensor and all third parties a non-exclusive, perpetual, -irrevocable, royalty free license under Your Applicable Patent Rights and other -intellectual property rights owned or controlled by You, to make, sell, offer -for sale, use, import, reproduce, display, perform, modify, distribute and -Deploy Your Modifications of the same scope and extent as Licensor's licenses -under Sections 2.1 and 2.2; and - -(b) You grant to Licensor and its subsidiaries a non-exclusive, worldwide, -royalty-free, perpetual and irrevocable license, under Your Applicable Patent -Rights and other intellectual property rights owned or controlled by You, to -make, use, sell, offer for sale, import, reproduce, display, perform, -distribute, modify or have modified (for Licensor and/or its subsidiaries), -sublicense and distribute Your Modifications, in any form and for any purpose, -through multiple tiers of distribution. - -(c) You agree not use any information derived from Your use and review of the -Covered Code, including but not limited to any algorithms or inventions that may -be contained in the Covered Code, for the purpose of asserting any of Your -patent rights, or assisting a third party to assert any of its patent rights, -against Licensor or any Contributor. - -4. Derivative Works. You may create a Derivative Work by combining Covered Code -with other code not otherwise governed by the terms of this License and -distribute the Derivative Work as an integrated product. In each such instance, -You must make sure the requirements of this License are fulfilled for the -Covered Code or any portion thereof, including all Modifications. - -4.1 You must cause any Derivative Work that you distribute, publish or -Externally Deploy, that in whole or in part contains or is derived from the -Covered Code or any part thereof, to be licensed as a whole at no charge to all -third parties under the terms of this License and no other license except as -provided in Section 4.2. You also must make Source Code available for the -Derivative Work under the same terms as Modifications, described in Sections 2 -and 3, above. - -4.2 Compatible Source Licenses. Software modules that have been independently -developed without any use of Covered Code and which contain no portion of the -Covered Code, Modifications or other Derivative Works, but are used or combined -in any way wtih the Covered Code or any Derivative Work to form a larger -Derivative Work, are exempt from the conditions described in Section 4.1 but -only to the extent that: the software module, including any software that is -linked to, integrated with, or part of the same applications as, the software -module by any method must be wholly subject to one of the Compatible Source -Licenses. Notwithstanding the foregoing, all Covered Code must be subject to the -terms of this License. Thus, the entire Derivative Work must be licensed under a -combination of the RPSL (for Covered Code) and a Compatible Source License for -any independently developed software modules within the Derivative Work. The -foregoing requirement applies even if the Compatible Source License would -ordinarily allow the software module to link with, or form larger works with, -other software that is not subject to the Compatible Source License. For -example, although the Mozilla Public License v1.1 allows Mozilla code to be -combined with proprietary software that is not subject to the MPL, if -MPL-licensed code is used with Covered Code the MPL-licensed code could not be -combined or linked with any code not governed by the MPL. The general intent of -this section 4.2 is to enable use of Covered Code with applications that are -wholly subject to an acceptable open source license. You are responsible for -determining whether your use of software with Covered Code is allowed under Your -license to such software. - -4.3 Mere aggregation of another work not based on the Covered Code with the -Covered Code (or with a work based on the Covered Code) on a volume of a storage -or distribution medium does not bring the other work under the scope of this -License. If You deliver the Covered Code for combination and/or integration with -an application previously provided by You (for example, via automatic updating -technology), such combination and/or integration constitutes a Derivative Work -subject to the terms of this License. - -5. Exclusions From License Grant. Nothing in this License shall be deemed to -grant any rights to trademarks, copyrights, patents, trade secrets or any other -intellectual property of Licensor or any Contributor except as expressly stated -herein. No right is granted to the trademarks of Licensor or any Contributor -even if such marks are included in the Covered Code. Nothing in this License -shall be interpreted to prohibit Licensor from licensing under different terms -from this License any code that Licensor otherwise would have a right to -license. Modifications, Derivative Works and/or any use or combination of -Covered Code with other technology provided by Licensor or third parties may -require additional patent licenses from Licensor which Licensor may grant in its -sole discretion. No patent license is granted separate from the Original Code or -combinations of the Original Code with other software or hardware. - -5.1. Trademarks. This License does not grant any rights to use the trademarks or -trade names owned by Licensor ("Licensor Marks" defined in Exhibit C) or to any -trademark or trade name belonging to any Contributor. No Licensor Marks may be -used to endorse or promote products derived from the Original Code other than as -permitted by the Licensor Trademark Policy defined in Exhibit C. - -6. Additional Terms. You may choose to offer, and to charge a fee for, warranty, -support, indemnity or liability obligations and/or other rights consistent with -the scope of the license granted herein ("Additional Terms") to one or more -recipients of Covered Code. However, You may do so only on Your own behalf and -as Your sole responsibility, and not on behalf of Licensor or any Contributor. -You must obtain the recipient's agreement that any such Additional Terms are -offered by You alone, and You hereby agree to indemnify, defend and hold -Licensor and every Contributor harmless for any liability incurred by or claims -asserted against Licensor or such Contributor by reason of any such Additional -Terms. - -7. Versions of the License. Licensor may publish revised and/or new versions of -this License from time to time. Each version will be given a distinguishing -version number. Once Original Code has been published under a particular version -of this License, You may continue to use it under the terms of that version. You -may also choose to use such Original Code under the terms of any subsequent -version of this License published by Licensor. No one other than Licensor has -the right to modify the terms applicable to Covered Code created under this -License. - -8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in part -pre-release, untested, or not fully tested works. The Covered Code may contain -errors that could cause failures or loss of data, and may be incomplete or -contain inaccuracies. You expressly acknowledge and agree that use of the -Covered Code, or any portion thereof, is at Your sole and entire risk. THE -COVERED CODE IS PROVIDED "AS IS" AND WITHOUT WARRANTY, UPGRADES OR SUPPORT OF -ANY KIND AND LICENSOR AND LICENSOR'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS -"LICENSOR" FOR THE PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY -DISCLAIM ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT -NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, OF -SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY, OF QUIET -ENJOYMENT, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. LICENSOR AND EACH -CONTRIBUTOR DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE -COVERED CODE, THAT THE FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR -REQUIREMENTS, THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR -ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO ORAL OR -WRITTEN DOCUMENTATION, INFORMATION OR ADVICE GIVEN BY LICENSOR, A LICENSOR -AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY. You -acknowledge that the Covered Code is not intended for use in high risk -activities, including, but not limited to, the design, construction, operation -or maintenance of nuclear facilities, aircraft navigation, aircraft -communication systems, or air traffic control machines in which case the failure -of the Covered Code could lead to death, personal injury, or severe physical or -environmental damage. Licensor disclaims any express or implied warranty of -fitness for such uses. - -9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT -SHALL LICENSOR OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL, -INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO THIS LICENSE OR -YOUR USE OR INABILITY TO USE THE COVERED CODE, OR ANY PORTION THEREOF, WHETHER -UNDER A THEORY OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE OR STRICT -LIABILITY), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF LICENSOR OR SUCH -CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND -NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. SOME -JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF INCIDENTAL OR -CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event -shall Licensor's total liability to You for all damages (other than as may be -required by applicable law) under this License exceed the amount of ten dollars -($10.00). - -10. Ownership. Subject to the licenses granted under this License, each -Contributor retains all rights, title and interest in and to any Modifications -made by such Contributor. Licensor retains all rights, title and interest in and -to the Original Code and any Modifications made by or on behalf of Licensor -("Licensor Modifications"), and such Licensor Modifications will not be -automatically subject to this License. Licensor may, at its sole discretion, -choose to license such Licensor Modifications under this License, or on -different terms from those contained in this License or may choose not to -license them at all. - -11. Termination. - -11.1 Term and Termination. The term of this License is perpetual unless -terminated as provided below. This License and the rights granted hereunder will -terminate: - -(a) automatically without notice from Licensor if You fail to comply with any -term(s) of this License and fail to cure such breach within 30 days of becoming -aware of such breach; - -(b) immediately in the event of the circumstances described in Section 12.5(b); -or - -(c) automatically without notice from Licensor if You, at any time during the -term of this License, commence an action for patent infringement against -Licensor (including by cross-claim or counter claim in a lawsuit); - -(d) upon written notice from Licensor if You, at any time during the term of -this License, commence an action for patent infringement against any third party -alleging that the Covered Code itself (excluding combinations with other -software or hardware) infringes any patent (including by cross-claim or counter -claim in a lawsuit). - -11.2 Effect of Termination. Upon termination, You agree to immediately stop any -further use, reproduction, modification, sublicensing and distribution of the -Covered Code and to destroy all copies of the Covered Code that are in your -possession or control. All sublicenses to the Covered Code which have been -properly granted prior to termination shall survive any termination of this -License. Provisions which, by their nature, should remain in effect beyond the -termination of this License shall survive, including but not limited to Sections -3, 5, 8, 9, 10, 11, 12.2 and 13. No party will be liable to any other for -compensation, indemnity or damages of any sort solely as a result of terminating -this License in accordance with its terms, and termination of this License will -be without prejudice to any other right or remedy of any party. - -12. Miscellaneous. - -12.1 Government End Users. The Covered Code is a "commercial item" as defined in -FAR 2.101. Government software and technical data rights in the Covered Code -include only those rights customarily provided to the public as defined in this -License. This customary commercial license in technical data and software is -provided in accordance with FAR 12.211 (Technical Data) and 12.212 (Computer -Software) and, for Department of Defense purchases, DFAR 252.227-7015 (Technical -Data -- Commercial Items) and 227.7202-3 (Rights in Commercial Computer Software -or Computer Software Documentation). Accordingly, all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -12.2 Relationship of Parties. This License will not be construed as creating an -agency, partnership, joint venture or any other form of legal association -between or among You, Licensor or any Contributor, and You will not represent to -the contrary, whether expressly, by implication, appearance or otherwise. - -12.3 Independent Development. Nothing in this License will impair Licensor's -right to acquire, license, develop, have others develop for it, market and/or -distribute technology or products that perform the same or similar functions as, -or otherwise compete with, Modifications, Derivative Works, technology or -products that You may develop, produce, market or distribute. - -12.4 Waiver; Construction. Failure by Licensor or any Contributor to enforce any -provision of this License will not be deemed a waiver of future enforcement of -that or any other provision. Any law or regulation which provides that the -language of a contract shall be construed against the drafter will not apply to -this License. - -12.5 Severability. (a) If for any reason a court of competent jurisdiction finds -any provision of this License, or portion thereof, to be unenforceable, that -provision of the License will be enforced to the maximum extent permissible so -as to effect the economic benefits and intent of the parties, and the remainder -of this License will continue in full force and effect. (b) Notwithstanding the -foregoing, if applicable law prohibits or restricts You from fully and/or -specifically complying with Sections 2 and/or 3 or prevents the enforceability -of either of those Sections, this License will immediately terminate and You -must immediately discontinue any use of the Covered Code and destroy all copies -of it that are in your possession or control. - -12.6 Dispute Resolution. Any litigation or other dispute resolution between You -and Licensor relating to this License shall take place in the Seattle, -Washington, and You and Licensor hereby consent to the personal jurisdiction of, -and venue in, the state and federal courts within that District with respect to -this License. The application of the United Nations Convention on Contracts for -the International Sale of Goods is expressly excluded. - -12.7 Export/Import Laws. This software is subject to all export and import laws -and restrictions and regulations of the country in which you receive the Covered -Code and You are solely responsible for ensuring that You do not export, -re-export or import the Covered Code or any direct product thereof in violation -of any such restrictions, laws or regulations, or without all necessary -authorizations. - -12.8 Entire Agreement; Governing Law. This License constitutes the entire -agreement between the parties with respect to the subject matter hereof. This -License shall be governed by the laws of the United States and the State of -Washington. - -Where You are located in the province of Quebec, Canada, the following clause -applies: The parties hereby confirm that they have requested that this License -and all related documents be drafted in English. Les parties ont exigé -que le présent contrat et tous les documents connexes soient -rédigés en anglais. - - EXHIBIT A. - -"Copyright © 1995-2002 -RealNetworks, Inc. and/or its licensors. All Rights Reserved. - -The contents of this file, and the files included with this file, are subject to -the current version of the RealNetworks Public Source License Version 1.0 (the -"RPSL") available at https://www.helixcommunity.org/content/rpsl unless you have -licensed the file under the RealNetworks Community Source License Version 1.0 -(the "RCSL") available at https://www.helixcommunity.org/content/rcsl, in which -case the RCSL will apply. You may also obtain the license terms directly from -RealNetworks. You may not use this file except in compliance with the RPSL or, -if you have a valid RCSL with RealNetworks applicable to this file, the RCSL. -Please see the applicable RPSL or RCSL for the rights, obligations and -limitations governing use of the contents of the file. - -This file is part of the Helix DNA Technology. RealNetworks is the developer of -the Original code and owns the copyrights in the portions it created. - -This file, and the files included with this file, is distributed and made -available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR -IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING -WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - -Contributor(s): ____________________________________ - -Technology Compatibility Kit Test -Suite(s) Location (if licensed under the RCSL): ______________________________ - -Object Code Notice: Helix DNA Client technology included. Copyright (c) -RealNetworks, Inc., 1995-2002. All rights reserved. - - - EXHIBIT B - -Compatible Source Licenses for the RealNetworks Public Source License. The -following list applies to the most recent version of the license as of October -25, 2002, unless otherwise indicated. - -* Academic Free License -* Apache Software License -* Apple Public Source License -* Artistic license -* Attribution Assurance Licenses -* BSD license -* Common Public License (1) -* Eiffel Forum License -* GNU General Public License (GPL) (1) -* GNU Library or "Lesser" General Public License (LGPL) (1) -* IBM Public License -* Intel Open Source License -* Jabber Open Source License -* MIT license -* MITRE Collaborative Virtual Workspace License (CVW License) -* Motosoto License -* Mozilla Public License 1.0 (MPL) -* Mozilla Public License 1.1 (MPL) -* Nokia Open Source License -* Open Group Test Suite License -* Python Software Foundation License -* Ricoh Source Code Public License -* Sun Industry Standards Source License (SISSL) -* Sun Public License -* University of Illinois/NCSA Open Source License -* Vovida Software License v. 1.0 -* W3C License -* X.Net License -* Zope Public License -* zlib/libpng license - -(1) Note: because this license contains certain reciprocal licensing terms that -purport to extend to independently developed code, You may be prohibited under -the terms of this otherwise compatible license from using code licensed under -its terms with Covered Code because Covered Code may only be licensed under the -RealNetworks Public Source License. Any attempt to apply non RPSL license terms, -including without limitation the GPL, to Covered Code is expressly forbidden. -You are responsible for ensuring that Your use of Compatible Source Licensed -code does not violate either the RPSL or the Compatible Source License. - -The latest version of this list can be found at: -https://www.helixcommunity.org/content/complicense - - EXHIBIT C - -RealNetworks' Trademark policy. - -RealNetworks defines the following trademarks collectively as "Licensor -Trademarks": "RealNetworks", "RealPlayer", "RealJukebox", "RealSystem", -"RealAudio", "RealVideo", "RealOne Player", "RealMedia", "Helix" or any other -trademarks or trade names belonging to RealNetworks. - -RealNetworks "Licensor Trademark Policy" forbids any use of Licensor Trademarks -except as permitted by and in strict compliance at all times with RealNetworks' -third party trademark usage guidelines which are posted at -http://www.realnetworks.com/info/helixlogo.html. - +RealNetworks Public Source License Version 1.0 +(Rev. Date October 28, 2002) + +1. General Definitions. This License applies to any program or other work which +RealNetworks, Inc., or any other entity that elects to use this license, +("Licensor") makes publicly available and which contains a notice placed by +Licensor identifying such program or work as "Original Code" and stating that it +is subject to the terms of this RealNetworks Public Source License version 1.0 +(or subsequent version thereof) ("License"). You are not required to accept this +License. However, nothing else grants You permission to use, copy, modify or +distribute the software or its derivative works. These actions are prohibited by +law if You do not accept this License. Therefore, by modifying, copying or +distributing the software (or any work based on the software), You indicate your +acceptance of this License to do so, and all its terms and conditions. In +addition, you agree to the terms of this License by clicking the Accept button +or downloading the software. As used in this License: + +1.1 "Applicable Patent Rights" mean: (a) in the case where Licensor is the +grantor of rights, claims of patents that (i) are now or hereafter acquired, +owned by or assigned to Licensor and (ii) are necessarily infringed by using or +making the Original Code alone and not in combination with other software or +hardware; and (b) in the case where You are the grantor of rights, claims of +patents that (i) are now or hereafter acquired, owned by or assigned to You and +(ii) are infringed (directly or indirectly) by using or making Your +Modifications, taken alone or in combination with Original Code. + +1.2 "Compatible Source License" means any one of the licenses listed on Exhibit +B or at https://www.helixcommunity.org/content/complicense or other licenses +specifically identified by Licensor in writing. Notwithstanding any term to the +contrary in any Compatible Source License, any code covered by any Compatible +Source License that is used with Covered Code must be made readily available in +Source Code format for royalty-free use under the terms of the Compatible Source +License or this License. + +1.3 "Contributor" means any person or entity that creates or contributes to the +creation of Modifications. + +1.4 "Covered Code" means the Original Code, Modifications, the combination of +Original Code and any Modifications, and/or any respective portions thereof. + +1.5 "Deploy" means to use, sublicense or distribute Covered Code other than for +Your internal research and development (R&D) and/or Personal Use, and includes +without limitation, any and all internal use or distribution of Covered Code +within Your business or organization except for R&D use and/or Personal Use, as +well as direct or indirect sublicensing or distribution of Covered Code by You +to any third party in any form or manner. + +1.6 "Derivative Work" means either the Covered Code or any derivative work under +United States copyright law, and including any work containing or including any +portion of the Covered Code or Modifications, either verbatim or with +modifications and/or translated into another language. Derivative Work also +includes any work which combines any portion of Covered Code or Modifications +with code not otherwise governed by the terms of this License. + +1.7 "Externally Deploy" means to Deploy the Covered Code in any way that may be +accessed or used by anyone other than You, used to provide any services to +anyone other than You, or used in any way to deliver any content to anyone other +than You, whether the Covered Code is distributed to those parties, made +available as an application intended for use over a computer network, or used to +provide services or otherwise deliver content to anyone other than You. + +1.8. "Interface" means interfaces, functions, properties, class definitions, +APIs, header files, GUIDs, V-Tables, and/or protocols allowing one piece of +software, firmware or hardware to communicate or interoperate with another piece +of software, firmware or hardware. + +1.9 "Modifications" mean any addition to, deletion from, and/or change to, the +substance and/or structure of the Original Code, any previous Modifications, the +combination of Original Code and any previous Modifications, and/or any +respective portions thereof. When code is released as a series of files, a +Modification is: (a) any addition to or deletion from the contents of a file +containing Covered Code; and/or (b) any new file or other representation of +computer program statements that contains any part of Covered Code. + +1.10 "Original Code" means (a) the Source Code of a program or other work as +originally made available by Licensor under this License, including the Source +Code of any updates or upgrades to such programs or works made available by +Licensor under this License, and that has been expressly identified by Licensor +as such in the header file(s) of such work; and (b) the object code compiled +from such Source Code and originally made available by Licensor under this +License. + +1.11 "Personal Use" means use of Covered Code by an individual solely for his or +her personal, private and non-commercial purposes. An individual's use of +Covered Code in his or her capacity as an officer, employee, member, independent +contractor or agent of a corporation, business or organization (commercial or +non-commercial) does not qualify as Personal Use. + +1.12 "Source Code" means the human readable form of a program or other work that +is suitable for making modifications to it, including all modules it contains, +plus any associated interface definition files, scripts used to control +compilation and installation of an executable (object code). + +1.13 "You" or "Your" means an individual or a legal entity exercising rights +under this License. For legal entities, "You" or "Your" includes any entity +which controls, is controlled by, or is under common control with, You, where +"control" means (a) the power, direct or indirect, to cause the direction or +management of such entity, whether by contract or otherwise, or (b) ownership of +fifty percent (50%) or more of the outstanding shares or beneficial ownership of +such entity. + +2. Permitted Uses; Conditions & Restrictions. Subject to the terms and +conditions of this License, Licensor hereby grants You, effective on the date +You accept this License (via downloading or using Covered Code or otherwise +indicating your acceptance of this License), a worldwide, royalty-free, +non-exclusive copyright license, to the extent of Licensor's copyrights cover +the Original Code, to do the following: + +2.1 You may reproduce, display, perform, modify and Deploy Covered Code, +provided that in each instance: + +(a) You must retain and reproduce in all copies of Original Code the copyright +and other proprietary notices and disclaimers of Licensor as they appear in the +Original Code, and keep intact all notices in the Original Code that refer to +this License; + +(b) You must include a copy of this License with every copy of Source Code of +Covered Code and documentation You distribute, and You may not offer or impose +any terms on such Source Code that alter or restrict this License or the +recipients' rights hereunder, except as permitted under Section 6; + +(c) You must duplicate, to the extent it does not already exist, the notice in +Exhibit A in each file of the Source Code of all Your Modifications, and cause +the modified files to carry prominent notices stating that You changed the files +and the date of any change; + +(d) You must make Source Code of all Your Externally Deployed Modifications +publicly available under the terms of this License, including the license grants +set forth in Section 3 below, for as long as you Deploy the Covered Code or +twelve (12) months from the date of initial Deployment, whichever is longer. You +should preferably distribute the Source Code of Your Deployed Modifications +electronically (e.g. download from a web site); and + +(e) if You Deploy Covered Code in object code, executable form only, You must +include a prominent notice, in the code itself as well as in related +documentation, stating that Source Code of the Covered Code is available under +the terms of this License with information on how and where to obtain such +Source Code. You must also include the Object Code Notice set forth in Exhibit A +in the "about" box or other appropriate place where other copyright notices are +placed, including any packaging materials. + +2.2 You expressly acknowledge and agree that although Licensor and each +Contributor grants the licenses to their respective portions of the Covered Code +set forth herein, no assurances are provided by Licensor or any Contributor that +the Covered Code does not infringe the patent or other intellectual property +rights of any other entity. Licensor and each Contributor disclaim any liability +to You for claims brought by any other entity based on infringement of +intellectual property rights or otherwise. As a condition to exercising the +rights and licenses granted hereunder, You hereby assume sole responsibility to +secure any other intellectual property rights needed, if any. For example, if a +third party patent license is required to allow You to make, use, sell, import +or offer for sale the Covered Code, it is Your responsibility to acquire such +license(s). + +2.3 Subject to the terms and conditions of this License, Licensor hereby grants +You, effective on the date You accept this License (via downloading or using +Covered Code or otherwise indicating your acceptance of this License), a +worldwide, royalty-free, perpetual, non-exclusive patent license under +Licensor's Applicable Patent Rights to make, use, sell, offer for sale and +import the Covered Code, provided that in each instance you comply with the +terms of this License. + +3. Your Grants. In consideration of, and as a condition to, the licenses granted +to You under this License: + +(a) You grant to Licensor and all third parties a non-exclusive, perpetual, +irrevocable, royalty free license under Your Applicable Patent Rights and other +intellectual property rights owned or controlled by You, to make, sell, offer +for sale, use, import, reproduce, display, perform, modify, distribute and +Deploy Your Modifications of the same scope and extent as Licensor's licenses +under Sections 2.1 and 2.2; and + +(b) You grant to Licensor and its subsidiaries a non-exclusive, worldwide, +royalty-free, perpetual and irrevocable license, under Your Applicable Patent +Rights and other intellectual property rights owned or controlled by You, to +make, use, sell, offer for sale, import, reproduce, display, perform, +distribute, modify or have modified (for Licensor and/or its subsidiaries), +sublicense and distribute Your Modifications, in any form and for any purpose, +through multiple tiers of distribution. + +(c) You agree not use any information derived from Your use and review of the +Covered Code, including but not limited to any algorithms or inventions that may +be contained in the Covered Code, for the purpose of asserting any of Your +patent rights, or assisting a third party to assert any of its patent rights, +against Licensor or any Contributor. + +4. Derivative Works. You may create a Derivative Work by combining Covered Code +with other code not otherwise governed by the terms of this License and +distribute the Derivative Work as an integrated product. In each such instance, +You must make sure the requirements of this License are fulfilled for the +Covered Code or any portion thereof, including all Modifications. + +4.1 You must cause any Derivative Work that you distribute, publish or +Externally Deploy, that in whole or in part contains or is derived from the +Covered Code or any part thereof, to be licensed as a whole at no charge to all +third parties under the terms of this License and no other license except as +provided in Section 4.2. You also must make Source Code available for the +Derivative Work under the same terms as Modifications, described in Sections 2 +and 3, above. + +4.2 Compatible Source Licenses. Software modules that have been independently +developed without any use of Covered Code and which contain no portion of the +Covered Code, Modifications or other Derivative Works, but are used or combined +in any way wtih the Covered Code or any Derivative Work to form a larger +Derivative Work, are exempt from the conditions described in Section 4.1 but +only to the extent that: the software module, including any software that is +linked to, integrated with, or part of the same applications as, the software +module by any method must be wholly subject to one of the Compatible Source +Licenses. Notwithstanding the foregoing, all Covered Code must be subject to the +terms of this License. Thus, the entire Derivative Work must be licensed under a +combination of the RPSL (for Covered Code) and a Compatible Source License for +any independently developed software modules within the Derivative Work. The +foregoing requirement applies even if the Compatible Source License would +ordinarily allow the software module to link with, or form larger works with, +other software that is not subject to the Compatible Source License. For +example, although the Mozilla Public License v1.1 allows Mozilla code to be +combined with proprietary software that is not subject to the MPL, if +MPL-licensed code is used with Covered Code the MPL-licensed code could not be +combined or linked with any code not governed by the MPL. The general intent of +this section 4.2 is to enable use of Covered Code with applications that are +wholly subject to an acceptable open source license. You are responsible for +determining whether your use of software with Covered Code is allowed under Your +license to such software. + +4.3 Mere aggregation of another work not based on the Covered Code with the +Covered Code (or with a work based on the Covered Code) on a volume of a storage +or distribution medium does not bring the other work under the scope of this +License. If You deliver the Covered Code for combination and/or integration with +an application previously provided by You (for example, via automatic updating +technology), such combination and/or integration constitutes a Derivative Work +subject to the terms of this License. + +5. Exclusions From License Grant. Nothing in this License shall be deemed to +grant any rights to trademarks, copyrights, patents, trade secrets or any other +intellectual property of Licensor or any Contributor except as expressly stated +herein. No right is granted to the trademarks of Licensor or any Contributor +even if such marks are included in the Covered Code. Nothing in this License +shall be interpreted to prohibit Licensor from licensing under different terms +from this License any code that Licensor otherwise would have a right to +license. Modifications, Derivative Works and/or any use or combination of +Covered Code with other technology provided by Licensor or third parties may +require additional patent licenses from Licensor which Licensor may grant in its +sole discretion. No patent license is granted separate from the Original Code or +combinations of the Original Code with other software or hardware. + +5.1. Trademarks. This License does not grant any rights to use the trademarks or +trade names owned by Licensor ("Licensor Marks" defined in Exhibit C) or to any +trademark or trade name belonging to any Contributor. No Licensor Marks may be +used to endorse or promote products derived from the Original Code other than as +permitted by the Licensor Trademark Policy defined in Exhibit C. + +6. Additional Terms. You may choose to offer, and to charge a fee for, warranty, +support, indemnity or liability obligations and/or other rights consistent with +the scope of the license granted herein ("Additional Terms") to one or more +recipients of Covered Code. However, You may do so only on Your own behalf and +as Your sole responsibility, and not on behalf of Licensor or any Contributor. +You must obtain the recipient's agreement that any such Additional Terms are +offered by You alone, and You hereby agree to indemnify, defend and hold +Licensor and every Contributor harmless for any liability incurred by or claims +asserted against Licensor or such Contributor by reason of any such Additional +Terms. + +7. Versions of the License. Licensor may publish revised and/or new versions of +this License from time to time. Each version will be given a distinguishing +version number. Once Original Code has been published under a particular version +of this License, You may continue to use it under the terms of that version. You +may also choose to use such Original Code under the terms of any subsequent +version of this License published by Licensor. No one other than Licensor has +the right to modify the terms applicable to Covered Code created under this +License. + +8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in part +pre-release, untested, or not fully tested works. The Covered Code may contain +errors that could cause failures or loss of data, and may be incomplete or +contain inaccuracies. You expressly acknowledge and agree that use of the +Covered Code, or any portion thereof, is at Your sole and entire risk. THE +COVERED CODE IS PROVIDED "AS IS" AND WITHOUT WARRANTY, UPGRADES OR SUPPORT OF +ANY KIND AND LICENSOR AND LICENSOR'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS +"LICENSOR" FOR THE PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY +DISCLAIM ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT +NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, OF +SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY, OF QUIET +ENJOYMENT, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. LICENSOR AND EACH +CONTRIBUTOR DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE +COVERED CODE, THAT THE FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR +REQUIREMENTS, THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR +ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO ORAL OR +WRITTEN DOCUMENTATION, INFORMATION OR ADVICE GIVEN BY LICENSOR, A LICENSOR +AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY. You +acknowledge that the Covered Code is not intended for use in high risk +activities, including, but not limited to, the design, construction, operation +or maintenance of nuclear facilities, aircraft navigation, aircraft +communication systems, or air traffic control machines in which case the failure +of the Covered Code could lead to death, personal injury, or severe physical or +environmental damage. Licensor disclaims any express or implied warranty of +fitness for such uses. + +9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT +SHALL LICENSOR OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL, +INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO THIS LICENSE OR +YOUR USE OR INABILITY TO USE THE COVERED CODE, OR ANY PORTION THEREOF, WHETHER +UNDER A THEORY OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE OR STRICT +LIABILITY), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF LICENSOR OR SUCH +CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND +NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. SOME +JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF INCIDENTAL OR +CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event +shall Licensor's total liability to You for all damages (other than as may be +required by applicable law) under this License exceed the amount of ten dollars +($10.00). + +10. Ownership. Subject to the licenses granted under this License, each +Contributor retains all rights, title and interest in and to any Modifications +made by such Contributor. Licensor retains all rights, title and interest in and +to the Original Code and any Modifications made by or on behalf of Licensor +("Licensor Modifications"), and such Licensor Modifications will not be +automatically subject to this License. Licensor may, at its sole discretion, +choose to license such Licensor Modifications under this License, or on +different terms from those contained in this License or may choose not to +license them at all. + +11. Termination. + +11.1 Term and Termination. The term of this License is perpetual unless +terminated as provided below. This License and the rights granted hereunder will +terminate: + +(a) automatically without notice from Licensor if You fail to comply with any +term(s) of this License and fail to cure such breach within 30 days of becoming +aware of such breach; + +(b) immediately in the event of the circumstances described in Section 12.5(b); +or + +(c) automatically without notice from Licensor if You, at any time during the +term of this License, commence an action for patent infringement against +Licensor (including by cross-claim or counter claim in a lawsuit); + +(d) upon written notice from Licensor if You, at any time during the term of +this License, commence an action for patent infringement against any third party +alleging that the Covered Code itself (excluding combinations with other +software or hardware) infringes any patent (including by cross-claim or counter +claim in a lawsuit). + +11.2 Effect of Termination. Upon termination, You agree to immediately stop any +further use, reproduction, modification, sublicensing and distribution of the +Covered Code and to destroy all copies of the Covered Code that are in your +possession or control. All sublicenses to the Covered Code which have been +properly granted prior to termination shall survive any termination of this +License. Provisions which, by their nature, should remain in effect beyond the +termination of this License shall survive, including but not limited to Sections +3, 5, 8, 9, 10, 11, 12.2 and 13. No party will be liable to any other for +compensation, indemnity or damages of any sort solely as a result of terminating +this License in accordance with its terms, and termination of this License will +be without prejudice to any other right or remedy of any party. + +12. Miscellaneous. + +12.1 Government End Users. The Covered Code is a "commercial item" as defined in +FAR 2.101. Government software and technical data rights in the Covered Code +include only those rights customarily provided to the public as defined in this +License. This customary commercial license in technical data and software is +provided in accordance with FAR 12.211 (Technical Data) and 12.212 (Computer +Software) and, for Department of Defense purchases, DFAR 252.227-7015 (Technical +Data -- Commercial Items) and 227.7202-3 (Rights in Commercial Computer Software +or Computer Software Documentation). Accordingly, all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +12.2 Relationship of Parties. This License will not be construed as creating an +agency, partnership, joint venture or any other form of legal association +between or among You, Licensor or any Contributor, and You will not represent to +the contrary, whether expressly, by implication, appearance or otherwise. + +12.3 Independent Development. Nothing in this License will impair Licensor's +right to acquire, license, develop, have others develop for it, market and/or +distribute technology or products that perform the same or similar functions as, +or otherwise compete with, Modifications, Derivative Works, technology or +products that You may develop, produce, market or distribute. + +12.4 Waiver; Construction. Failure by Licensor or any Contributor to enforce any +provision of this License will not be deemed a waiver of future enforcement of +that or any other provision. Any law or regulation which provides that the +language of a contract shall be construed against the drafter will not apply to +this License. + +12.5 Severability. (a) If for any reason a court of competent jurisdiction finds +any provision of this License, or portion thereof, to be unenforceable, that +provision of the License will be enforced to the maximum extent permissible so +as to effect the economic benefits and intent of the parties, and the remainder +of this License will continue in full force and effect. (b) Notwithstanding the +foregoing, if applicable law prohibits or restricts You from fully and/or +specifically complying with Sections 2 and/or 3 or prevents the enforceability +of either of those Sections, this License will immediately terminate and You +must immediately discontinue any use of the Covered Code and destroy all copies +of it that are in your possession or control. + +12.6 Dispute Resolution. Any litigation or other dispute resolution between You +and Licensor relating to this License shall take place in the Seattle, +Washington, and You and Licensor hereby consent to the personal jurisdiction of, +and venue in, the state and federal courts within that District with respect to +this License. The application of the United Nations Convention on Contracts for +the International Sale of Goods is expressly excluded. + +12.7 Export/Import Laws. This software is subject to all export and import laws +and restrictions and regulations of the country in which you receive the Covered +Code and You are solely responsible for ensuring that You do not export, +re-export or import the Covered Code or any direct product thereof in violation +of any such restrictions, laws or regulations, or without all necessary +authorizations. + +12.8 Entire Agreement; Governing Law. This License constitutes the entire +agreement between the parties with respect to the subject matter hereof. This +License shall be governed by the laws of the United States and the State of +Washington. + +Where You are located in the province of Quebec, Canada, the following clause +applies: The parties hereby confirm that they have requested that this License +and all related documents be drafted in English. Les parties ont exigé +que le présent contrat et tous les documents connexes soient +rédigés en anglais. + + EXHIBIT A. + +"Copyright © 1995-2002 +RealNetworks, Inc. and/or its licensors. All Rights Reserved. + +The contents of this file, and the files included with this file, are subject to +the current version of the RealNetworks Public Source License Version 1.0 (the +"RPSL") available at https://www.helixcommunity.org/content/rpsl unless you have +licensed the file under the RealNetworks Community Source License Version 1.0 +(the "RCSL") available at https://www.helixcommunity.org/content/rcsl, in which +case the RCSL will apply. You may also obtain the license terms directly from +RealNetworks. You may not use this file except in compliance with the RPSL or, +if you have a valid RCSL with RealNetworks applicable to this file, the RCSL. +Please see the applicable RPSL or RCSL for the rights, obligations and +limitations governing use of the contents of the file. + +This file is part of the Helix DNA Technology. RealNetworks is the developer of +the Original code and owns the copyrights in the portions it created. + +This file, and the files included with this file, is distributed and made +available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR +IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING +WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + +Contributor(s): ____________________________________ + +Technology Compatibility Kit Test +Suite(s) Location (if licensed under the RCSL): ______________________________ + +Object Code Notice: Helix DNA Client technology included. Copyright (c) +RealNetworks, Inc., 1995-2002. All rights reserved. + + + EXHIBIT B + +Compatible Source Licenses for the RealNetworks Public Source License. The +following list applies to the most recent version of the license as of October +25, 2002, unless otherwise indicated. + +* Academic Free License +* Apache Software License +* Apple Public Source License +* Artistic license +* Attribution Assurance Licenses +* BSD license +* Common Public License (1) +* Eiffel Forum License +* GNU General Public License (GPL) (1) +* GNU Library or "Lesser" General Public License (LGPL) (1) +* IBM Public License +* Intel Open Source License +* Jabber Open Source License +* MIT license +* MITRE Collaborative Virtual Workspace License (CVW License) +* Motosoto License +* Mozilla Public License 1.0 (MPL) +* Mozilla Public License 1.1 (MPL) +* Nokia Open Source License +* Open Group Test Suite License +* Python Software Foundation License +* Ricoh Source Code Public License +* Sun Industry Standards Source License (SISSL) +* Sun Public License +* University of Illinois/NCSA Open Source License +* Vovida Software License v. 1.0 +* W3C License +* X.Net License +* Zope Public License +* zlib/libpng license + +(1) Note: because this license contains certain reciprocal licensing terms that +purport to extend to independently developed code, You may be prohibited under +the terms of this otherwise compatible license from using code licensed under +its terms with Covered Code because Covered Code may only be licensed under the +RealNetworks Public Source License. Any attempt to apply non RPSL license terms, +including without limitation the GPL, to Covered Code is expressly forbidden. +You are responsible for ensuring that Your use of Compatible Source Licensed +code does not violate either the RPSL or the Compatible Source License. + +The latest version of this list can be found at: +https://www.helixcommunity.org/content/complicense + + EXHIBIT C + +RealNetworks' Trademark policy. + +RealNetworks defines the following trademarks collectively as "Licensor +Trademarks": "RealNetworks", "RealPlayer", "RealJukebox", "RealSystem", +"RealAudio", "RealVideo", "RealOne Player", "RealMedia", "Helix" or any other +trademarks or trade names belonging to RealNetworks. + +RealNetworks "Licensor Trademark Policy" forbids any use of Licensor Trademarks +except as permitted by and in strict compliance at all times with RealNetworks' +third party trademark usage guidelines which are posted at +http://www.realnetworks.com/info/helixlogo.html. + diff --git a/source/arm7/helix/rpsl.txt b/source/arm7/helix/rpsl.txt index b7a122b..d040a45 100644 --- a/source/arm7/helix/rpsl.txt +++ b/source/arm7/helix/rpsl.txt @@ -1,518 +1,518 @@ -RealNetworks Public Source License Version 1.0 -(Rev. Date October 28, 2002) - -1. General Definitions. This License applies to any program or other work which -RealNetworks, Inc., or any other entity that elects to use this license, -("Licensor") makes publicly available and which contains a notice placed by -Licensor identifying such program or work as "Original Code" and stating that it -is subject to the terms of this RealNetworks Public Source License version 1.0 -(or subsequent version thereof) ("License"). You are not required to accept this -License. However, nothing else grants You permission to use, copy, modify or -distribute the software or its derivative works. These actions are prohibited by -law if You do not accept this License. Therefore, by modifying, copying or -distributing the software (or any work based on the software), You indicate your -acceptance of this License to do so, and all its terms and conditions. In -addition, you agree to the terms of this License by clicking the Accept button -or downloading the software. As used in this License: - -1.1 "Applicable Patent Rights" mean: (a) in the case where Licensor is the -grantor of rights, claims of patents that (i) are now or hereafter acquired, -owned by or assigned to Licensor and (ii) are necessarily infringed by using or -making the Original Code alone and not in combination with other software or -hardware; and (b) in the case where You are the grantor of rights, claims of -patents that (i) are now or hereafter acquired, owned by or assigned to You and -(ii) are infringed (directly or indirectly) by using or making Your -Modifications, taken alone or in combination with Original Code. - -1.2 "Compatible Source License" means any one of the licenses listed on Exhibit -B or at https://www.helixcommunity.org/content/complicense or other licenses -specifically identified by Licensor in writing. Notwithstanding any term to the -contrary in any Compatible Source License, any code covered by any Compatible -Source License that is used with Covered Code must be made readily available in -Source Code format for royalty-free use under the terms of the Compatible Source -License or this License. - -1.3 "Contributor" means any person or entity that creates or contributes to the -creation of Modifications. - -1.4 "Covered Code" means the Original Code, Modifications, the combination of -Original Code and any Modifications, and/or any respective portions thereof. - -1.5 "Deploy" means to use, sublicense or distribute Covered Code other than for -Your internal research and development (R&D) and/or Personal Use, and includes -without limitation, any and all internal use or distribution of Covered Code -within Your business or organization except for R&D use and/or Personal Use, as -well as direct or indirect sublicensing or distribution of Covered Code by You -to any third party in any form or manner. - -1.6 "Derivative Work" means either the Covered Code or any derivative work under -United States copyright law, and including any work containing or including any -portion of the Covered Code or Modifications, either verbatim or with -modifications and/or translated into another language. Derivative Work also -includes any work which combines any portion of Covered Code or Modifications -with code not otherwise governed by the terms of this License. - -1.7 "Externally Deploy" means to Deploy the Covered Code in any way that may be -accessed or used by anyone other than You, used to provide any services to -anyone other than You, or used in any way to deliver any content to anyone other -than You, whether the Covered Code is distributed to those parties, made -available as an application intended for use over a computer network, or used to -provide services or otherwise deliver content to anyone other than You. - -1.8. "Interface" means interfaces, functions, properties, class definitions, -APIs, header files, GUIDs, V-Tables, and/or protocols allowing one piece of -software, firmware or hardware to communicate or interoperate with another piece -of software, firmware or hardware. - -1.9 "Modifications" mean any addition to, deletion from, and/or change to, the -substance and/or structure of the Original Code, any previous Modifications, the -combination of Original Code and any previous Modifications, and/or any -respective portions thereof. When code is released as a series of files, a -Modification is: (a) any addition to or deletion from the contents of a file -containing Covered Code; and/or (b) any new file or other representation of -computer program statements that contains any part of Covered Code. - -1.10 "Original Code" means (a) the Source Code of a program or other work as -originally made available by Licensor under this License, including the Source -Code of any updates or upgrades to such programs or works made available by -Licensor under this License, and that has been expressly identified by Licensor -as such in the header file(s) of such work; and (b) the object code compiled -from such Source Code and originally made available by Licensor under this -License. - -1.11 "Personal Use" means use of Covered Code by an individual solely for his or -her personal, private and non-commercial purposes. An individual's use of -Covered Code in his or her capacity as an officer, employee, member, independent -contractor or agent of a corporation, business or organization (commercial or -non-commercial) does not qualify as Personal Use. - -1.12 "Source Code" means the human readable form of a program or other work that -is suitable for making modifications to it, including all modules it contains, -plus any associated interface definition files, scripts used to control -compilation and installation of an executable (object code). - -1.13 "You" or "Your" means an individual or a legal entity exercising rights -under this License. For legal entities, "You" or "Your" includes any entity -which controls, is controlled by, or is under common control with, You, where -"control" means (a) the power, direct or indirect, to cause the direction or -management of such entity, whether by contract or otherwise, or (b) ownership of -fifty percent (50%) or more of the outstanding shares or beneficial ownership of -such entity. - -2. Permitted Uses; Conditions & Restrictions. Subject to the terms and -conditions of this License, Licensor hereby grants You, effective on the date -You accept this License (via downloading or using Covered Code or otherwise -indicating your acceptance of this License), a worldwide, royalty-free, -non-exclusive copyright license, to the extent of Licensor's copyrights cover -the Original Code, to do the following: - -2.1 You may reproduce, display, perform, modify and Deploy Covered Code, -provided that in each instance: - -(a) You must retain and reproduce in all copies of Original Code the copyright -and other proprietary notices and disclaimers of Licensor as they appear in the -Original Code, and keep intact all notices in the Original Code that refer to -this License; - -(b) You must include a copy of this License with every copy of Source Code of -Covered Code and documentation You distribute, and You may not offer or impose -any terms on such Source Code that alter or restrict this License or the -recipients' rights hereunder, except as permitted under Section 6; - -(c) You must duplicate, to the extent it does not already exist, the notice in -Exhibit A in each file of the Source Code of all Your Modifications, and cause -the modified files to carry prominent notices stating that You changed the files -and the date of any change; - -(d) You must make Source Code of all Your Externally Deployed Modifications -publicly available under the terms of this License, including the license grants -set forth in Section 3 below, for as long as you Deploy the Covered Code or -twelve (12) months from the date of initial Deployment, whichever is longer. You -should preferably distribute the Source Code of Your Deployed Modifications -electronically (e.g. download from a web site); and - -(e) if You Deploy Covered Code in object code, executable form only, You must -include a prominent notice, in the code itself as well as in related -documentation, stating that Source Code of the Covered Code is available under -the terms of this License with information on how and where to obtain such -Source Code. You must also include the Object Code Notice set forth in Exhibit A -in the "about" box or other appropriate place where other copyright notices are -placed, including any packaging materials. - -2.2 You expressly acknowledge and agree that although Licensor and each -Contributor grants the licenses to their respective portions of the Covered Code -set forth herein, no assurances are provided by Licensor or any Contributor that -the Covered Code does not infringe the patent or other intellectual property -rights of any other entity. Licensor and each Contributor disclaim any liability -to You for claims brought by any other entity based on infringement of -intellectual property rights or otherwise. As a condition to exercising the -rights and licenses granted hereunder, You hereby assume sole responsibility to -secure any other intellectual property rights needed, if any. For example, if a -third party patent license is required to allow You to make, use, sell, import -or offer for sale the Covered Code, it is Your responsibility to acquire such -license(s). - -2.3 Subject to the terms and conditions of this License, Licensor hereby grants -You, effective on the date You accept this License (via downloading or using -Covered Code or otherwise indicating your acceptance of this License), a -worldwide, royalty-free, perpetual, non-exclusive patent license under -Licensor's Applicable Patent Rights to make, use, sell, offer for sale and -import the Covered Code, provided that in each instance you comply with the -terms of this License. - -3. Your Grants. In consideration of, and as a condition to, the licenses granted -to You under this License: - -(a) You grant to Licensor and all third parties a non-exclusive, perpetual, -irrevocable, royalty free license under Your Applicable Patent Rights and other -intellectual property rights owned or controlled by You, to make, sell, offer -for sale, use, import, reproduce, display, perform, modify, distribute and -Deploy Your Modifications of the same scope and extent as Licensor's licenses -under Sections 2.1 and 2.2; and - -(b) You grant to Licensor and its subsidiaries a non-exclusive, worldwide, -royalty-free, perpetual and irrevocable license, under Your Applicable Patent -Rights and other intellectual property rights owned or controlled by You, to -make, use, sell, offer for sale, import, reproduce, display, perform, -distribute, modify or have modified (for Licensor and/or its subsidiaries), -sublicense and distribute Your Modifications, in any form and for any purpose, -through multiple tiers of distribution. - -(c) You agree not use any information derived from Your use and review of the -Covered Code, including but not limited to any algorithms or inventions that may -be contained in the Covered Code, for the purpose of asserting any of Your -patent rights, or assisting a third party to assert any of its patent rights, -against Licensor or any Contributor. - -4. Derivative Works. You may create a Derivative Work by combining Covered Code -with other code not otherwise governed by the terms of this License and -distribute the Derivative Work as an integrated product. In each such instance, -You must make sure the requirements of this License are fulfilled for the -Covered Code or any portion thereof, including all Modifications. - -4.1 You must cause any Derivative Work that you distribute, publish or -Externally Deploy, that in whole or in part contains or is derived from the -Covered Code or any part thereof, to be licensed as a whole at no charge to all -third parties under the terms of this License and no other license except as -provided in Section 4.2. You also must make Source Code available for the -Derivative Work under the same terms as Modifications, described in Sections 2 -and 3, above. - -4.2 Compatible Source Licenses. Software modules that have been independently -developed without any use of Covered Code and which contain no portion of the -Covered Code, Modifications or other Derivative Works, but are used or combined -in any way wtih the Covered Code or any Derivative Work to form a larger -Derivative Work, are exempt from the conditions described in Section 4.1 but -only to the extent that: the software module, including any software that is -linked to, integrated with, or part of the same applications as, the software -module by any method must be wholly subject to one of the Compatible Source -Licenses. Notwithstanding the foregoing, all Covered Code must be subject to the -terms of this License. Thus, the entire Derivative Work must be licensed under a -combination of the RPSL (for Covered Code) and a Compatible Source License for -any independently developed software modules within the Derivative Work. The -foregoing requirement applies even if the Compatible Source License would -ordinarily allow the software module to link with, or form larger works with, -other software that is not subject to the Compatible Source License. For -example, although the Mozilla Public License v1.1 allows Mozilla code to be -combined with proprietary software that is not subject to the MPL, if -MPL-licensed code is used with Covered Code the MPL-licensed code could not be -combined or linked with any code not governed by the MPL. The general intent of -this section 4.2 is to enable use of Covered Code with applications that are -wholly subject to an acceptable open source license. You are responsible for -determining whether your use of software with Covered Code is allowed under Your -license to such software. - -4.3 Mere aggregation of another work not based on the Covered Code with the -Covered Code (or with a work based on the Covered Code) on a volume of a storage -or distribution medium does not bring the other work under the scope of this -License. If You deliver the Covered Code for combination and/or integration with -an application previously provided by You (for example, via automatic updating -technology), such combination and/or integration constitutes a Derivative Work -subject to the terms of this License. - -5. Exclusions From License Grant. Nothing in this License shall be deemed to -grant any rights to trademarks, copyrights, patents, trade secrets or any other -intellectual property of Licensor or any Contributor except as expressly stated -herein. No right is granted to the trademarks of Licensor or any Contributor -even if such marks are included in the Covered Code. Nothing in this License -shall be interpreted to prohibit Licensor from licensing under different terms -from this License any code that Licensor otherwise would have a right to -license. Modifications, Derivative Works and/or any use or combination of -Covered Code with other technology provided by Licensor or third parties may -require additional patent licenses from Licensor which Licensor may grant in its -sole discretion. No patent license is granted separate from the Original Code or -combinations of the Original Code with other software or hardware. - -5.1. Trademarks. This License does not grant any rights to use the trademarks or -trade names owned by Licensor ("Licensor Marks" defined in Exhibit C) or to any -trademark or trade name belonging to any Contributor. No Licensor Marks may be -used to endorse or promote products derived from the Original Code other than as -permitted by the Licensor Trademark Policy defined in Exhibit C. - -6. Additional Terms. You may choose to offer, and to charge a fee for, warranty, -support, indemnity or liability obligations and/or other rights consistent with -the scope of the license granted herein ("Additional Terms") to one or more -recipients of Covered Code. However, You may do so only on Your own behalf and -as Your sole responsibility, and not on behalf of Licensor or any Contributor. -You must obtain the recipient's agreement that any such Additional Terms are -offered by You alone, and You hereby agree to indemnify, defend and hold -Licensor and every Contributor harmless for any liability incurred by or claims -asserted against Licensor or such Contributor by reason of any such Additional -Terms. - -7. Versions of the License. Licensor may publish revised and/or new versions of -this License from time to time. Each version will be given a distinguishing -version number. Once Original Code has been published under a particular version -of this License, You may continue to use it under the terms of that version. You -may also choose to use such Original Code under the terms of any subsequent -version of this License published by Licensor. No one other than Licensor has -the right to modify the terms applicable to Covered Code created under this -License. - -8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in part -pre-release, untested, or not fully tested works. The Covered Code may contain -errors that could cause failures or loss of data, and may be incomplete or -contain inaccuracies. You expressly acknowledge and agree that use of the -Covered Code, or any portion thereof, is at Your sole and entire risk. THE -COVERED CODE IS PROVIDED "AS IS" AND WITHOUT WARRANTY, UPGRADES OR SUPPORT OF -ANY KIND AND LICENSOR AND LICENSOR'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS -"LICENSOR" FOR THE PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY -DISCLAIM ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT -NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, OF -SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY, OF QUIET -ENJOYMENT, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. LICENSOR AND EACH -CONTRIBUTOR DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE -COVERED CODE, THAT THE FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR -REQUIREMENTS, THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR -ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO ORAL OR -WRITTEN DOCUMENTATION, INFORMATION OR ADVICE GIVEN BY LICENSOR, A LICENSOR -AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY. You -acknowledge that the Covered Code is not intended for use in high risk -activities, including, but not limited to, the design, construction, operation -or maintenance of nuclear facilities, aircraft navigation, aircraft -communication systems, or air traffic control machines in which case the failure -of the Covered Code could lead to death, personal injury, or severe physical or -environmental damage. Licensor disclaims any express or implied warranty of -fitness for such uses. - -9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT -SHALL LICENSOR OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL, -INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO THIS LICENSE OR -YOUR USE OR INABILITY TO USE THE COVERED CODE, OR ANY PORTION THEREOF, WHETHER -UNDER A THEORY OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE OR STRICT -LIABILITY), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF LICENSOR OR SUCH -CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND -NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. SOME -JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF INCIDENTAL OR -CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event -shall Licensor's total liability to You for all damages (other than as may be -required by applicable law) under this License exceed the amount of ten dollars -($10.00). - -10. Ownership. Subject to the licenses granted under this License, each -Contributor retains all rights, title and interest in and to any Modifications -made by such Contributor. Licensor retains all rights, title and interest in and -to the Original Code and any Modifications made by or on behalf of Licensor -("Licensor Modifications"), and such Licensor Modifications will not be -automatically subject to this License. Licensor may, at its sole discretion, -choose to license such Licensor Modifications under this License, or on -different terms from those contained in this License or may choose not to -license them at all. - -11. Termination. - -11.1 Term and Termination. The term of this License is perpetual unless -terminated as provided below. This License and the rights granted hereunder will -terminate: - -(a) automatically without notice from Licensor if You fail to comply with any -term(s) of this License and fail to cure such breach within 30 days of becoming -aware of such breach; - -(b) immediately in the event of the circumstances described in Section 12.5(b); -or - -(c) automatically without notice from Licensor if You, at any time during the -term of this License, commence an action for patent infringement against -Licensor (including by cross-claim or counter claim in a lawsuit); - -(d) upon written notice from Licensor if You, at any time during the term of -this License, commence an action for patent infringement against any third party -alleging that the Covered Code itself (excluding combinations with other -software or hardware) infringes any patent (including by cross-claim or counter -claim in a lawsuit). - -11.2 Effect of Termination. Upon termination, You agree to immediately stop any -further use, reproduction, modification, sublicensing and distribution of the -Covered Code and to destroy all copies of the Covered Code that are in your -possession or control. All sublicenses to the Covered Code which have been -properly granted prior to termination shall survive any termination of this -License. Provisions which, by their nature, should remain in effect beyond the -termination of this License shall survive, including but not limited to Sections -3, 5, 8, 9, 10, 11, 12.2 and 13. No party will be liable to any other for -compensation, indemnity or damages of any sort solely as a result of terminating -this License in accordance with its terms, and termination of this License will -be without prejudice to any other right or remedy of any party. - -12. Miscellaneous. - -12.1 Government End Users. The Covered Code is a "commercial item" as defined in -FAR 2.101. Government software and technical data rights in the Covered Code -include only those rights customarily provided to the public as defined in this -License. This customary commercial license in technical data and software is -provided in accordance with FAR 12.211 (Technical Data) and 12.212 (Computer -Software) and, for Department of Defense purchases, DFAR 252.227-7015 (Technical -Data -- Commercial Items) and 227.7202-3 (Rights in Commercial Computer Software -or Computer Software Documentation). Accordingly, all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -12.2 Relationship of Parties. This License will not be construed as creating an -agency, partnership, joint venture or any other form of legal association -between or among You, Licensor or any Contributor, and You will not represent to -the contrary, whether expressly, by implication, appearance or otherwise. - -12.3 Independent Development. Nothing in this License will impair Licensor's -right to acquire, license, develop, have others develop for it, market and/or -distribute technology or products that perform the same or similar functions as, -or otherwise compete with, Modifications, Derivative Works, technology or -products that You may develop, produce, market or distribute. - -12.4 Waiver; Construction. Failure by Licensor or any Contributor to enforce any -provision of this License will not be deemed a waiver of future enforcement of -that or any other provision. Any law or regulation which provides that the -language of a contract shall be construed against the drafter will not apply to -this License. - -12.5 Severability. (a) If for any reason a court of competent jurisdiction finds -any provision of this License, or portion thereof, to be unenforceable, that -provision of the License will be enforced to the maximum extent permissible so -as to effect the economic benefits and intent of the parties, and the remainder -of this License will continue in full force and effect. (b) Notwithstanding the -foregoing, if applicable law prohibits or restricts You from fully and/or -specifically complying with Sections 2 and/or 3 or prevents the enforceability -of either of those Sections, this License will immediately terminate and You -must immediately discontinue any use of the Covered Code and destroy all copies -of it that are in your possession or control. - -12.6 Dispute Resolution. Any litigation or other dispute resolution between You -and Licensor relating to this License shall take place in the Seattle, -Washington, and You and Licensor hereby consent to the personal jurisdiction of, -and venue in, the state and federal courts within that District with respect to -this License. The application of the United Nations Convention on Contracts for -the International Sale of Goods is expressly excluded. - -12.7 Export/Import Laws. This software is subject to all export and import laws -and restrictions and regulations of the country in which you receive the Covered -Code and You are solely responsible for ensuring that You do not export, -re-export or import the Covered Code or any direct product thereof in violation -of any such restrictions, laws or regulations, or without all necessary -authorizations. - -12.8 Entire Agreement; Governing Law. This License constitutes the entire -agreement between the parties with respect to the subject matter hereof. This -License shall be governed by the laws of the United States and the State of -Washington. - -Where You are located in the province of Quebec, Canada, the following clause -applies: The parties hereby confirm that they have requested that this License -and all related documents be drafted in English. Les parties ont exigé -que le présent contrat et tous les documents connexes soient -rédigés en anglais. - - EXHIBIT A. - -"Copyright © 1995-2002 -RealNetworks, Inc. and/or its licensors. All Rights Reserved. - -The contents of this file, and the files included with this file, are subject to -the current version of the RealNetworks Public Source License Version 1.0 (the -"RPSL") available at https://www.helixcommunity.org/content/rpsl unless you have -licensed the file under the RealNetworks Community Source License Version 1.0 -(the "RCSL") available at https://www.helixcommunity.org/content/rcsl, in which -case the RCSL will apply. You may also obtain the license terms directly from -RealNetworks. You may not use this file except in compliance with the RPSL or, -if you have a valid RCSL with RealNetworks applicable to this file, the RCSL. -Please see the applicable RPSL or RCSL for the rights, obligations and -limitations governing use of the contents of the file. - -This file is part of the Helix DNA Technology. RealNetworks is the developer of -the Original code and owns the copyrights in the portions it created. - -This file, and the files included with this file, is distributed and made -available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR -IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING -WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - -Contributor(s): ____________________________________ - -Technology Compatibility Kit Test -Suite(s) Location (if licensed under the RCSL): ______________________________ - -Object Code Notice: Helix DNA Client technology included. Copyright (c) -RealNetworks, Inc., 1995-2002. All rights reserved. - - - EXHIBIT B - -Compatible Source Licenses for the RealNetworks Public Source License. The -following list applies to the most recent version of the license as of October -25, 2002, unless otherwise indicated. - -* Academic Free License -* Apache Software License -* Apple Public Source License -* Artistic license -* Attribution Assurance Licenses -* BSD license -* Common Public License (1) -* Eiffel Forum License -* GNU General Public License (GPL) (1) -* GNU Library or "Lesser" General Public License (LGPL) (1) -* IBM Public License -* Intel Open Source License -* Jabber Open Source License -* MIT license -* MITRE Collaborative Virtual Workspace License (CVW License) -* Motosoto License -* Mozilla Public License 1.0 (MPL) -* Mozilla Public License 1.1 (MPL) -* Nokia Open Source License -* Open Group Test Suite License -* Python Software Foundation License -* Ricoh Source Code Public License -* Sun Industry Standards Source License (SISSL) -* Sun Public License -* University of Illinois/NCSA Open Source License -* Vovida Software License v. 1.0 -* W3C License -* X.Net License -* Zope Public License -* zlib/libpng license - -(1) Note: because this license contains certain reciprocal licensing terms that -purport to extend to independently developed code, You may be prohibited under -the terms of this otherwise compatible license from using code licensed under -its terms with Covered Code because Covered Code may only be licensed under the -RealNetworks Public Source License. Any attempt to apply non RPSL license terms, -including without limitation the GPL, to Covered Code is expressly forbidden. -You are responsible for ensuring that Your use of Compatible Source Licensed -code does not violate either the RPSL or the Compatible Source License. - -The latest version of this list can be found at: -https://www.helixcommunity.org/content/complicense - - EXHIBIT C - -RealNetworks' Trademark policy. - -RealNetworks defines the following trademarks collectively as "Licensor -Trademarks": "RealNetworks", "RealPlayer", "RealJukebox", "RealSystem", -"RealAudio", "RealVideo", "RealOne Player", "RealMedia", "Helix" or any other -trademarks or trade names belonging to RealNetworks. - -RealNetworks "Licensor Trademark Policy" forbids any use of Licensor Trademarks -except as permitted by and in strict compliance at all times with RealNetworks' -third party trademark usage guidelines which are posted at -http://www.realnetworks.com/info/helixlogo.html. - +RealNetworks Public Source License Version 1.0 +(Rev. Date October 28, 2002) + +1. General Definitions. This License applies to any program or other work which +RealNetworks, Inc., or any other entity that elects to use this license, +("Licensor") makes publicly available and which contains a notice placed by +Licensor identifying such program or work as "Original Code" and stating that it +is subject to the terms of this RealNetworks Public Source License version 1.0 +(or subsequent version thereof) ("License"). You are not required to accept this +License. However, nothing else grants You permission to use, copy, modify or +distribute the software or its derivative works. These actions are prohibited by +law if You do not accept this License. Therefore, by modifying, copying or +distributing the software (or any work based on the software), You indicate your +acceptance of this License to do so, and all its terms and conditions. In +addition, you agree to the terms of this License by clicking the Accept button +or downloading the software. As used in this License: + +1.1 "Applicable Patent Rights" mean: (a) in the case where Licensor is the +grantor of rights, claims of patents that (i) are now or hereafter acquired, +owned by or assigned to Licensor and (ii) are necessarily infringed by using or +making the Original Code alone and not in combination with other software or +hardware; and (b) in the case where You are the grantor of rights, claims of +patents that (i) are now or hereafter acquired, owned by or assigned to You and +(ii) are infringed (directly or indirectly) by using or making Your +Modifications, taken alone or in combination with Original Code. + +1.2 "Compatible Source License" means any one of the licenses listed on Exhibit +B or at https://www.helixcommunity.org/content/complicense or other licenses +specifically identified by Licensor in writing. Notwithstanding any term to the +contrary in any Compatible Source License, any code covered by any Compatible +Source License that is used with Covered Code must be made readily available in +Source Code format for royalty-free use under the terms of the Compatible Source +License or this License. + +1.3 "Contributor" means any person or entity that creates or contributes to the +creation of Modifications. + +1.4 "Covered Code" means the Original Code, Modifications, the combination of +Original Code and any Modifications, and/or any respective portions thereof. + +1.5 "Deploy" means to use, sublicense or distribute Covered Code other than for +Your internal research and development (R&D) and/or Personal Use, and includes +without limitation, any and all internal use or distribution of Covered Code +within Your business or organization except for R&D use and/or Personal Use, as +well as direct or indirect sublicensing or distribution of Covered Code by You +to any third party in any form or manner. + +1.6 "Derivative Work" means either the Covered Code or any derivative work under +United States copyright law, and including any work containing or including any +portion of the Covered Code or Modifications, either verbatim or with +modifications and/or translated into another language. Derivative Work also +includes any work which combines any portion of Covered Code or Modifications +with code not otherwise governed by the terms of this License. + +1.7 "Externally Deploy" means to Deploy the Covered Code in any way that may be +accessed or used by anyone other than You, used to provide any services to +anyone other than You, or used in any way to deliver any content to anyone other +than You, whether the Covered Code is distributed to those parties, made +available as an application intended for use over a computer network, or used to +provide services or otherwise deliver content to anyone other than You. + +1.8. "Interface" means interfaces, functions, properties, class definitions, +APIs, header files, GUIDs, V-Tables, and/or protocols allowing one piece of +software, firmware or hardware to communicate or interoperate with another piece +of software, firmware or hardware. + +1.9 "Modifications" mean any addition to, deletion from, and/or change to, the +substance and/or structure of the Original Code, any previous Modifications, the +combination of Original Code and any previous Modifications, and/or any +respective portions thereof. When code is released as a series of files, a +Modification is: (a) any addition to or deletion from the contents of a file +containing Covered Code; and/or (b) any new file or other representation of +computer program statements that contains any part of Covered Code. + +1.10 "Original Code" means (a) the Source Code of a program or other work as +originally made available by Licensor under this License, including the Source +Code of any updates or upgrades to such programs or works made available by +Licensor under this License, and that has been expressly identified by Licensor +as such in the header file(s) of such work; and (b) the object code compiled +from such Source Code and originally made available by Licensor under this +License. + +1.11 "Personal Use" means use of Covered Code by an individual solely for his or +her personal, private and non-commercial purposes. An individual's use of +Covered Code in his or her capacity as an officer, employee, member, independent +contractor or agent of a corporation, business or organization (commercial or +non-commercial) does not qualify as Personal Use. + +1.12 "Source Code" means the human readable form of a program or other work that +is suitable for making modifications to it, including all modules it contains, +plus any associated interface definition files, scripts used to control +compilation and installation of an executable (object code). + +1.13 "You" or "Your" means an individual or a legal entity exercising rights +under this License. For legal entities, "You" or "Your" includes any entity +which controls, is controlled by, or is under common control with, You, where +"control" means (a) the power, direct or indirect, to cause the direction or +management of such entity, whether by contract or otherwise, or (b) ownership of +fifty percent (50%) or more of the outstanding shares or beneficial ownership of +such entity. + +2. Permitted Uses; Conditions & Restrictions. Subject to the terms and +conditions of this License, Licensor hereby grants You, effective on the date +You accept this License (via downloading or using Covered Code or otherwise +indicating your acceptance of this License), a worldwide, royalty-free, +non-exclusive copyright license, to the extent of Licensor's copyrights cover +the Original Code, to do the following: + +2.1 You may reproduce, display, perform, modify and Deploy Covered Code, +provided that in each instance: + +(a) You must retain and reproduce in all copies of Original Code the copyright +and other proprietary notices and disclaimers of Licensor as they appear in the +Original Code, and keep intact all notices in the Original Code that refer to +this License; + +(b) You must include a copy of this License with every copy of Source Code of +Covered Code and documentation You distribute, and You may not offer or impose +any terms on such Source Code that alter or restrict this License or the +recipients' rights hereunder, except as permitted under Section 6; + +(c) You must duplicate, to the extent it does not already exist, the notice in +Exhibit A in each file of the Source Code of all Your Modifications, and cause +the modified files to carry prominent notices stating that You changed the files +and the date of any change; + +(d) You must make Source Code of all Your Externally Deployed Modifications +publicly available under the terms of this License, including the license grants +set forth in Section 3 below, for as long as you Deploy the Covered Code or +twelve (12) months from the date of initial Deployment, whichever is longer. You +should preferably distribute the Source Code of Your Deployed Modifications +electronically (e.g. download from a web site); and + +(e) if You Deploy Covered Code in object code, executable form only, You must +include a prominent notice, in the code itself as well as in related +documentation, stating that Source Code of the Covered Code is available under +the terms of this License with information on how and where to obtain such +Source Code. You must also include the Object Code Notice set forth in Exhibit A +in the "about" box or other appropriate place where other copyright notices are +placed, including any packaging materials. + +2.2 You expressly acknowledge and agree that although Licensor and each +Contributor grants the licenses to their respective portions of the Covered Code +set forth herein, no assurances are provided by Licensor or any Contributor that +the Covered Code does not infringe the patent or other intellectual property +rights of any other entity. Licensor and each Contributor disclaim any liability +to You for claims brought by any other entity based on infringement of +intellectual property rights or otherwise. As a condition to exercising the +rights and licenses granted hereunder, You hereby assume sole responsibility to +secure any other intellectual property rights needed, if any. For example, if a +third party patent license is required to allow You to make, use, sell, import +or offer for sale the Covered Code, it is Your responsibility to acquire such +license(s). + +2.3 Subject to the terms and conditions of this License, Licensor hereby grants +You, effective on the date You accept this License (via downloading or using +Covered Code or otherwise indicating your acceptance of this License), a +worldwide, royalty-free, perpetual, non-exclusive patent license under +Licensor's Applicable Patent Rights to make, use, sell, offer for sale and +import the Covered Code, provided that in each instance you comply with the +terms of this License. + +3. Your Grants. In consideration of, and as a condition to, the licenses granted +to You under this License: + +(a) You grant to Licensor and all third parties a non-exclusive, perpetual, +irrevocable, royalty free license under Your Applicable Patent Rights and other +intellectual property rights owned or controlled by You, to make, sell, offer +for sale, use, import, reproduce, display, perform, modify, distribute and +Deploy Your Modifications of the same scope and extent as Licensor's licenses +under Sections 2.1 and 2.2; and + +(b) You grant to Licensor and its subsidiaries a non-exclusive, worldwide, +royalty-free, perpetual and irrevocable license, under Your Applicable Patent +Rights and other intellectual property rights owned or controlled by You, to +make, use, sell, offer for sale, import, reproduce, display, perform, +distribute, modify or have modified (for Licensor and/or its subsidiaries), +sublicense and distribute Your Modifications, in any form and for any purpose, +through multiple tiers of distribution. + +(c) You agree not use any information derived from Your use and review of the +Covered Code, including but not limited to any algorithms or inventions that may +be contained in the Covered Code, for the purpose of asserting any of Your +patent rights, or assisting a third party to assert any of its patent rights, +against Licensor or any Contributor. + +4. Derivative Works. You may create a Derivative Work by combining Covered Code +with other code not otherwise governed by the terms of this License and +distribute the Derivative Work as an integrated product. In each such instance, +You must make sure the requirements of this License are fulfilled for the +Covered Code or any portion thereof, including all Modifications. + +4.1 You must cause any Derivative Work that you distribute, publish or +Externally Deploy, that in whole or in part contains or is derived from the +Covered Code or any part thereof, to be licensed as a whole at no charge to all +third parties under the terms of this License and no other license except as +provided in Section 4.2. You also must make Source Code available for the +Derivative Work under the same terms as Modifications, described in Sections 2 +and 3, above. + +4.2 Compatible Source Licenses. Software modules that have been independently +developed without any use of Covered Code and which contain no portion of the +Covered Code, Modifications or other Derivative Works, but are used or combined +in any way wtih the Covered Code or any Derivative Work to form a larger +Derivative Work, are exempt from the conditions described in Section 4.1 but +only to the extent that: the software module, including any software that is +linked to, integrated with, or part of the same applications as, the software +module by any method must be wholly subject to one of the Compatible Source +Licenses. Notwithstanding the foregoing, all Covered Code must be subject to the +terms of this License. Thus, the entire Derivative Work must be licensed under a +combination of the RPSL (for Covered Code) and a Compatible Source License for +any independently developed software modules within the Derivative Work. The +foregoing requirement applies even if the Compatible Source License would +ordinarily allow the software module to link with, or form larger works with, +other software that is not subject to the Compatible Source License. For +example, although the Mozilla Public License v1.1 allows Mozilla code to be +combined with proprietary software that is not subject to the MPL, if +MPL-licensed code is used with Covered Code the MPL-licensed code could not be +combined or linked with any code not governed by the MPL. The general intent of +this section 4.2 is to enable use of Covered Code with applications that are +wholly subject to an acceptable open source license. You are responsible for +determining whether your use of software with Covered Code is allowed under Your +license to such software. + +4.3 Mere aggregation of another work not based on the Covered Code with the +Covered Code (or with a work based on the Covered Code) on a volume of a storage +or distribution medium does not bring the other work under the scope of this +License. If You deliver the Covered Code for combination and/or integration with +an application previously provided by You (for example, via automatic updating +technology), such combination and/or integration constitutes a Derivative Work +subject to the terms of this License. + +5. Exclusions From License Grant. Nothing in this License shall be deemed to +grant any rights to trademarks, copyrights, patents, trade secrets or any other +intellectual property of Licensor or any Contributor except as expressly stated +herein. No right is granted to the trademarks of Licensor or any Contributor +even if such marks are included in the Covered Code. Nothing in this License +shall be interpreted to prohibit Licensor from licensing under different terms +from this License any code that Licensor otherwise would have a right to +license. Modifications, Derivative Works and/or any use or combination of +Covered Code with other technology provided by Licensor or third parties may +require additional patent licenses from Licensor which Licensor may grant in its +sole discretion. No patent license is granted separate from the Original Code or +combinations of the Original Code with other software or hardware. + +5.1. Trademarks. This License does not grant any rights to use the trademarks or +trade names owned by Licensor ("Licensor Marks" defined in Exhibit C) or to any +trademark or trade name belonging to any Contributor. No Licensor Marks may be +used to endorse or promote products derived from the Original Code other than as +permitted by the Licensor Trademark Policy defined in Exhibit C. + +6. Additional Terms. You may choose to offer, and to charge a fee for, warranty, +support, indemnity or liability obligations and/or other rights consistent with +the scope of the license granted herein ("Additional Terms") to one or more +recipients of Covered Code. However, You may do so only on Your own behalf and +as Your sole responsibility, and not on behalf of Licensor or any Contributor. +You must obtain the recipient's agreement that any such Additional Terms are +offered by You alone, and You hereby agree to indemnify, defend and hold +Licensor and every Contributor harmless for any liability incurred by or claims +asserted against Licensor or such Contributor by reason of any such Additional +Terms. + +7. Versions of the License. Licensor may publish revised and/or new versions of +this License from time to time. Each version will be given a distinguishing +version number. Once Original Code has been published under a particular version +of this License, You may continue to use it under the terms of that version. You +may also choose to use such Original Code under the terms of any subsequent +version of this License published by Licensor. No one other than Licensor has +the right to modify the terms applicable to Covered Code created under this +License. + +8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in part +pre-release, untested, or not fully tested works. The Covered Code may contain +errors that could cause failures or loss of data, and may be incomplete or +contain inaccuracies. You expressly acknowledge and agree that use of the +Covered Code, or any portion thereof, is at Your sole and entire risk. THE +COVERED CODE IS PROVIDED "AS IS" AND WITHOUT WARRANTY, UPGRADES OR SUPPORT OF +ANY KIND AND LICENSOR AND LICENSOR'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS +"LICENSOR" FOR THE PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY +DISCLAIM ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT +NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, OF +SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY, OF QUIET +ENJOYMENT, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. LICENSOR AND EACH +CONTRIBUTOR DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE +COVERED CODE, THAT THE FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR +REQUIREMENTS, THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR +ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO ORAL OR +WRITTEN DOCUMENTATION, INFORMATION OR ADVICE GIVEN BY LICENSOR, A LICENSOR +AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY. You +acknowledge that the Covered Code is not intended for use in high risk +activities, including, but not limited to, the design, construction, operation +or maintenance of nuclear facilities, aircraft navigation, aircraft +communication systems, or air traffic control machines in which case the failure +of the Covered Code could lead to death, personal injury, or severe physical or +environmental damage. Licensor disclaims any express or implied warranty of +fitness for such uses. + +9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT +SHALL LICENSOR OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL, +INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO THIS LICENSE OR +YOUR USE OR INABILITY TO USE THE COVERED CODE, OR ANY PORTION THEREOF, WHETHER +UNDER A THEORY OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE OR STRICT +LIABILITY), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF LICENSOR OR SUCH +CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND +NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. SOME +JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF INCIDENTAL OR +CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event +shall Licensor's total liability to You for all damages (other than as may be +required by applicable law) under this License exceed the amount of ten dollars +($10.00). + +10. Ownership. Subject to the licenses granted under this License, each +Contributor retains all rights, title and interest in and to any Modifications +made by such Contributor. Licensor retains all rights, title and interest in and +to the Original Code and any Modifications made by or on behalf of Licensor +("Licensor Modifications"), and such Licensor Modifications will not be +automatically subject to this License. Licensor may, at its sole discretion, +choose to license such Licensor Modifications under this License, or on +different terms from those contained in this License or may choose not to +license them at all. + +11. Termination. + +11.1 Term and Termination. The term of this License is perpetual unless +terminated as provided below. This License and the rights granted hereunder will +terminate: + +(a) automatically without notice from Licensor if You fail to comply with any +term(s) of this License and fail to cure such breach within 30 days of becoming +aware of such breach; + +(b) immediately in the event of the circumstances described in Section 12.5(b); +or + +(c) automatically without notice from Licensor if You, at any time during the +term of this License, commence an action for patent infringement against +Licensor (including by cross-claim or counter claim in a lawsuit); + +(d) upon written notice from Licensor if You, at any time during the term of +this License, commence an action for patent infringement against any third party +alleging that the Covered Code itself (excluding combinations with other +software or hardware) infringes any patent (including by cross-claim or counter +claim in a lawsuit). + +11.2 Effect of Termination. Upon termination, You agree to immediately stop any +further use, reproduction, modification, sublicensing and distribution of the +Covered Code and to destroy all copies of the Covered Code that are in your +possession or control. All sublicenses to the Covered Code which have been +properly granted prior to termination shall survive any termination of this +License. Provisions which, by their nature, should remain in effect beyond the +termination of this License shall survive, including but not limited to Sections +3, 5, 8, 9, 10, 11, 12.2 and 13. No party will be liable to any other for +compensation, indemnity or damages of any sort solely as a result of terminating +this License in accordance with its terms, and termination of this License will +be without prejudice to any other right or remedy of any party. + +12. Miscellaneous. + +12.1 Government End Users. The Covered Code is a "commercial item" as defined in +FAR 2.101. Government software and technical data rights in the Covered Code +include only those rights customarily provided to the public as defined in this +License. This customary commercial license in technical data and software is +provided in accordance with FAR 12.211 (Technical Data) and 12.212 (Computer +Software) and, for Department of Defense purchases, DFAR 252.227-7015 (Technical +Data -- Commercial Items) and 227.7202-3 (Rights in Commercial Computer Software +or Computer Software Documentation). Accordingly, all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +12.2 Relationship of Parties. This License will not be construed as creating an +agency, partnership, joint venture or any other form of legal association +between or among You, Licensor or any Contributor, and You will not represent to +the contrary, whether expressly, by implication, appearance or otherwise. + +12.3 Independent Development. Nothing in this License will impair Licensor's +right to acquire, license, develop, have others develop for it, market and/or +distribute technology or products that perform the same or similar functions as, +or otherwise compete with, Modifications, Derivative Works, technology or +products that You may develop, produce, market or distribute. + +12.4 Waiver; Construction. Failure by Licensor or any Contributor to enforce any +provision of this License will not be deemed a waiver of future enforcement of +that or any other provision. Any law or regulation which provides that the +language of a contract shall be construed against the drafter will not apply to +this License. + +12.5 Severability. (a) If for any reason a court of competent jurisdiction finds +any provision of this License, or portion thereof, to be unenforceable, that +provision of the License will be enforced to the maximum extent permissible so +as to effect the economic benefits and intent of the parties, and the remainder +of this License will continue in full force and effect. (b) Notwithstanding the +foregoing, if applicable law prohibits or restricts You from fully and/or +specifically complying with Sections 2 and/or 3 or prevents the enforceability +of either of those Sections, this License will immediately terminate and You +must immediately discontinue any use of the Covered Code and destroy all copies +of it that are in your possession or control. + +12.6 Dispute Resolution. Any litigation or other dispute resolution between You +and Licensor relating to this License shall take place in the Seattle, +Washington, and You and Licensor hereby consent to the personal jurisdiction of, +and venue in, the state and federal courts within that District with respect to +this License. The application of the United Nations Convention on Contracts for +the International Sale of Goods is expressly excluded. + +12.7 Export/Import Laws. This software is subject to all export and import laws +and restrictions and regulations of the country in which you receive the Covered +Code and You are solely responsible for ensuring that You do not export, +re-export or import the Covered Code or any direct product thereof in violation +of any such restrictions, laws or regulations, or without all necessary +authorizations. + +12.8 Entire Agreement; Governing Law. This License constitutes the entire +agreement between the parties with respect to the subject matter hereof. This +License shall be governed by the laws of the United States and the State of +Washington. + +Where You are located in the province of Quebec, Canada, the following clause +applies: The parties hereby confirm that they have requested that this License +and all related documents be drafted in English. Les parties ont exigé +que le présent contrat et tous les documents connexes soient +rédigés en anglais. + + EXHIBIT A. + +"Copyright © 1995-2002 +RealNetworks, Inc. and/or its licensors. All Rights Reserved. + +The contents of this file, and the files included with this file, are subject to +the current version of the RealNetworks Public Source License Version 1.0 (the +"RPSL") available at https://www.helixcommunity.org/content/rpsl unless you have +licensed the file under the RealNetworks Community Source License Version 1.0 +(the "RCSL") available at https://www.helixcommunity.org/content/rcsl, in which +case the RCSL will apply. You may also obtain the license terms directly from +RealNetworks. You may not use this file except in compliance with the RPSL or, +if you have a valid RCSL with RealNetworks applicable to this file, the RCSL. +Please see the applicable RPSL or RCSL for the rights, obligations and +limitations governing use of the contents of the file. + +This file is part of the Helix DNA Technology. RealNetworks is the developer of +the Original code and owns the copyrights in the portions it created. + +This file, and the files included with this file, is distributed and made +available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR +IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING +WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + +Contributor(s): ____________________________________ + +Technology Compatibility Kit Test +Suite(s) Location (if licensed under the RCSL): ______________________________ + +Object Code Notice: Helix DNA Client technology included. Copyright (c) +RealNetworks, Inc., 1995-2002. All rights reserved. + + + EXHIBIT B + +Compatible Source Licenses for the RealNetworks Public Source License. The +following list applies to the most recent version of the license as of October +25, 2002, unless otherwise indicated. + +* Academic Free License +* Apache Software License +* Apple Public Source License +* Artistic license +* Attribution Assurance Licenses +* BSD license +* Common Public License (1) +* Eiffel Forum License +* GNU General Public License (GPL) (1) +* GNU Library or "Lesser" General Public License (LGPL) (1) +* IBM Public License +* Intel Open Source License +* Jabber Open Source License +* MIT license +* MITRE Collaborative Virtual Workspace License (CVW License) +* Motosoto License +* Mozilla Public License 1.0 (MPL) +* Mozilla Public License 1.1 (MPL) +* Nokia Open Source License +* Open Group Test Suite License +* Python Software Foundation License +* Ricoh Source Code Public License +* Sun Industry Standards Source License (SISSL) +* Sun Public License +* University of Illinois/NCSA Open Source License +* Vovida Software License v. 1.0 +* W3C License +* X.Net License +* Zope Public License +* zlib/libpng license + +(1) Note: because this license contains certain reciprocal licensing terms that +purport to extend to independently developed code, You may be prohibited under +the terms of this otherwise compatible license from using code licensed under +its terms with Covered Code because Covered Code may only be licensed under the +RealNetworks Public Source License. Any attempt to apply non RPSL license terms, +including without limitation the GPL, to Covered Code is expressly forbidden. +You are responsible for ensuring that Your use of Compatible Source Licensed +code does not violate either the RPSL or the Compatible Source License. + +The latest version of this list can be found at: +https://www.helixcommunity.org/content/complicense + + EXHIBIT C + +RealNetworks' Trademark policy. + +RealNetworks defines the following trademarks collectively as "Licensor +Trademarks": "RealNetworks", "RealPlayer", "RealJukebox", "RealSystem", +"RealAudio", "RealVideo", "RealOne Player", "RealMedia", "Helix" or any other +trademarks or trade names belonging to RealNetworks. + +RealNetworks "Licensor Trademark Policy" forbids any use of Licensor Trademarks +except as permitted by and in strict compliance at all times with RealNetworks' +third party trademark usage guidelines which are posted at +http://www.realnetworks.com/info/helixlogo.html. + diff --git a/source/arm9/BitmapFont/PAGfx.ini b/source/arm9/BitmapFont/PAGfx.ini index 0b82a0e..287f48d 100644 --- a/source/arm9/BitmapFont/PAGfx.ini +++ b/source/arm9/BitmapFont/PAGfx.ini @@ -1,13 +1,13 @@ -#TranspColor White - -#Sprites : - -#Backgrounds : -PA_BmpFont0.png 1bitfont -PA_BmpFont1.png 1bitfont -PA_BmpFont2.png 1bitfont -PA_BmpFont3.png 1bitfont -PA_BmpFont4.png 1bitfont - -#Textures : - +#TranspColor White + +#Sprites : + +#Backgrounds : +PA_BmpFont0.png 1bitfont +PA_BmpFont1.png 1bitfont +PA_BmpFont2.png 1bitfont +PA_BmpFont3.png 1bitfont +PA_BmpFont4.png 1bitfont + +#Textures : + diff --git a/source/arm9/BitmapFont/PAGfx.log b/source/arm9/BitmapFont/PAGfx.log index dddee1f..931fc42 100644 --- a/source/arm9/BitmapFont/PAGfx.log +++ b/source/arm9/BitmapFont/PAGfx.log @@ -1,18 +1,18 @@ -PAGfx Converter v0.10 -- by Mollusk -- resurrected by fincs -- forum.palib.info -If you have suggestions, problems or anything please mail me at mollusk@palib.info +PAGfx Converter v0.10 -- by Mollusk -- resurrected by fincs -- forum.palib.info +If you have suggestions, problems or anything please mail me at mollusk@palib.info -Converting PAGfx.ini -Transparent Color: White - -5 backgrounds: - PA_BmpFont0 : 1bitFont, 256x64, Pal: PA_BmpFont0_Pal, 100 tiles -> PA_BmpFont0_Tiles and PA_BmpFont0_Map - PA_BmpFont1 : 1bitFont, 256x64, Pal: PA_BmpFont1_Pal, 105 tiles -> PA_BmpFont1_Tiles and PA_BmpFont1_Map - PA_BmpFont2 : 1bitFont, 512x128, Pal: PA_BmpFont2_Pal, 115 tiles -> PA_BmpFont2_Tiles and PA_BmpFont2_Map - PA_BmpFont3 : 1bitFont, 512x128, Pal: PA_BmpFont3_Pal, 196 tiles -> PA_BmpFont3_Tiles and PA_BmpFont3_Map - PA_BmpFont4 : 1bitFont, 512x128, Pal: PA_BmpFont4_Pal, 262 tiles -> PA_BmpFont4_Tiles and PA_BmpFont4_Map - -5 palettes: - -Converted in 0 minutes and 0 seconds - -Finished! +Converting PAGfx.ini +Transparent Color: White + +5 backgrounds: + PA_BmpFont0 : 1bitFont, 256x64, Pal: PA_BmpFont0_Pal, 100 tiles -> PA_BmpFont0_Tiles and PA_BmpFont0_Map + PA_BmpFont1 : 1bitFont, 256x64, Pal: PA_BmpFont1_Pal, 105 tiles -> PA_BmpFont1_Tiles and PA_BmpFont1_Map + PA_BmpFont2 : 1bitFont, 512x128, Pal: PA_BmpFont2_Pal, 115 tiles -> PA_BmpFont2_Tiles and PA_BmpFont2_Map + PA_BmpFont3 : 1bitFont, 512x128, Pal: PA_BmpFont3_Pal, 196 tiles -> PA_BmpFont3_Tiles and PA_BmpFont3_Map + PA_BmpFont4 : 1bitFont, 512x128, Pal: PA_BmpFont4_Pal, 262 tiles -> PA_BmpFont4_Tiles and PA_BmpFont4_Map + +5 palettes: + +Converted in 0 minutes and 0 seconds + +Finished! diff --git a/source/arm9/BitmapFont/all_gfx.h b/source/arm9/BitmapFont/all_gfx.h index 3c6ac7d..77402ae 100644 --- a/source/arm9/BitmapFont/all_gfx.h +++ b/source/arm9/BitmapFont/all_gfx.h @@ -1,24 +1,24 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#define _GFX_ALIGN __attribute__((aligned (4))) - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct PA_BmpFont0; -extern const PA_BgStruct PA_BmpFont1; -extern const PA_BgStruct PA_BmpFont2; -extern const PA_BgStruct PA_BmpFont3; -extern const PA_BgStruct PA_BmpFont4; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#define _GFX_ALIGN __attribute__((aligned (4))) + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct PA_BmpFont0; +extern const PA_BgStruct PA_BmpFont1; +extern const PA_BgStruct PA_BmpFont2; +extern const PA_BgStruct PA_BmpFont3; +extern const PA_BgStruct PA_BmpFont4; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/source/arm9/BitmapFont/bin/PA_BmpFont0.c b/source/arm9/BitmapFont/bin/PA_BmpFont0.c index a518bd4..8b4b3e3 100644 --- a/source/arm9/BitmapFont/bin/PA_BmpFont0.c +++ b/source/arm9/BitmapFont/bin/PA_BmpFont0.c @@ -1,17 +1,17 @@ -#include - -#include "PA_BmpFont0_Tiles_bin.h" -#include "PA_BmpFont0_Map_bin.h" -#include "PA_BmpFont0_Sizes_bin.h" - -const PA_BgStruct PA_BmpFont0 = { - PA_Font1bit, - 256, 64, - - PA_BmpFont0_Tiles_bin, - PA_BmpFont0_Map_bin, - {PA_BmpFont0_Sizes_bin}, - - 6400, - {6} -}; +#include + +#include "PA_BmpFont0_Tiles_bin.h" +#include "PA_BmpFont0_Map_bin.h" +#include "PA_BmpFont0_Sizes_bin.h" + +const PA_BgStruct PA_BmpFont0 = { + PA_Font1bit, + 256, 64, + + PA_BmpFont0_Tiles_bin, + PA_BmpFont0_Map_bin, + {PA_BmpFont0_Sizes_bin}, + + 6400, + {6} +}; diff --git a/source/arm9/BitmapFont/bin/PA_BmpFont1.c b/source/arm9/BitmapFont/bin/PA_BmpFont1.c index 14d9b4d..f9adec5 100644 --- a/source/arm9/BitmapFont/bin/PA_BmpFont1.c +++ b/source/arm9/BitmapFont/bin/PA_BmpFont1.c @@ -1,17 +1,17 @@ -#include - -#include "PA_BmpFont1_Tiles_bin.h" -#include "PA_BmpFont1_Map_bin.h" -#include "PA_BmpFont1_Sizes_bin.h" - -const PA_BgStruct PA_BmpFont1 = { - PA_Font1bit, - 256, 64, - - PA_BmpFont1_Tiles_bin, - PA_BmpFont1_Map_bin, - {PA_BmpFont1_Sizes_bin}, - - 6720, - {8} -}; +#include + +#include "PA_BmpFont1_Tiles_bin.h" +#include "PA_BmpFont1_Map_bin.h" +#include "PA_BmpFont1_Sizes_bin.h" + +const PA_BgStruct PA_BmpFont1 = { + PA_Font1bit, + 256, 64, + + PA_BmpFont1_Tiles_bin, + PA_BmpFont1_Map_bin, + {PA_BmpFont1_Sizes_bin}, + + 6720, + {8} +}; diff --git a/source/arm9/BitmapFont/bin/PA_BmpFont2.c b/source/arm9/BitmapFont/bin/PA_BmpFont2.c index 4a75b86..21e5f6d 100644 --- a/source/arm9/BitmapFont/bin/PA_BmpFont2.c +++ b/source/arm9/BitmapFont/bin/PA_BmpFont2.c @@ -1,17 +1,17 @@ -#include - -#include "PA_BmpFont2_Tiles_bin.h" -#include "PA_BmpFont2_Map_bin.h" -#include "PA_BmpFont2_Sizes_bin.h" - -const PA_BgStruct PA_BmpFont2 = { - PA_Font1bit, - 512, 128, - - PA_BmpFont2_Tiles_bin, - PA_BmpFont2_Map_bin, - {PA_BmpFont2_Sizes_bin}, - - 7360, - {9} -}; +#include + +#include "PA_BmpFont2_Tiles_bin.h" +#include "PA_BmpFont2_Map_bin.h" +#include "PA_BmpFont2_Sizes_bin.h" + +const PA_BgStruct PA_BmpFont2 = { + PA_Font1bit, + 512, 128, + + PA_BmpFont2_Tiles_bin, + PA_BmpFont2_Map_bin, + {PA_BmpFont2_Sizes_bin}, + + 7360, + {9} +}; diff --git a/source/arm9/BitmapFont/bin/PA_BmpFont3.c b/source/arm9/BitmapFont/bin/PA_BmpFont3.c index 1cf31f6..ea9f457 100644 --- a/source/arm9/BitmapFont/bin/PA_BmpFont3.c +++ b/source/arm9/BitmapFont/bin/PA_BmpFont3.c @@ -1,17 +1,17 @@ -#include - -#include "PA_BmpFont3_Tiles_bin.h" -#include "PA_BmpFont3_Map_bin.h" -#include "PA_BmpFont3_Sizes_bin.h" - -const PA_BgStruct PA_BmpFont3 = { - PA_Font1bit, - 512, 128, - - PA_BmpFont3_Tiles_bin, - PA_BmpFont3_Map_bin, - {PA_BmpFont3_Sizes_bin}, - - 12544, - {12} -}; +#include + +#include "PA_BmpFont3_Tiles_bin.h" +#include "PA_BmpFont3_Map_bin.h" +#include "PA_BmpFont3_Sizes_bin.h" + +const PA_BgStruct PA_BmpFont3 = { + PA_Font1bit, + 512, 128, + + PA_BmpFont3_Tiles_bin, + PA_BmpFont3_Map_bin, + {PA_BmpFont3_Sizes_bin}, + + 12544, + {12} +}; diff --git a/source/arm9/BitmapFont/bin/PA_BmpFont4.c b/source/arm9/BitmapFont/bin/PA_BmpFont4.c index 3a64ad0..0d5a5d6 100644 --- a/source/arm9/BitmapFont/bin/PA_BmpFont4.c +++ b/source/arm9/BitmapFont/bin/PA_BmpFont4.c @@ -1,17 +1,17 @@ -#include - -#include "PA_BmpFont4_Tiles_bin.h" -#include "PA_BmpFont4_Map_bin.h" -#include "PA_BmpFont4_Sizes_bin.h" - -const PA_BgStruct PA_BmpFont4 = { - PA_Font1bit, - 512, 128, - - PA_BmpFont4_Tiles_bin, - PA_BmpFont4_Map_bin, - {PA_BmpFont4_Sizes_bin}, - - 16768, - {14} -}; +#include + +#include "PA_BmpFont4_Tiles_bin.h" +#include "PA_BmpFont4_Map_bin.h" +#include "PA_BmpFont4_Sizes_bin.h" + +const PA_BgStruct PA_BmpFont4 = { + PA_Font1bit, + 512, 128, + + PA_BmpFont4_Tiles_bin, + PA_BmpFont4_Map_bin, + {PA_BmpFont4_Sizes_bin}, + + 16768, + {14} +}; diff --git a/source/arm9/PA.c b/source/arm9/PA.c index 20acfa2..ea691ea 100644 --- a/source/arm9/PA.c +++ b/source/arm9/PA.c @@ -1,84 +1,84 @@ -#include - -u8 pa_checklid; -u16 pa_giftotexcolor = 0; - -// TODO: Ensure that this is in uncached memory on the ARM9 -volatile PA_IPCType PA_IPC; // This is deprecated - -typedef struct{ - s16 x, y, oldx, oldy, vx, vy; // Coordonnées - u8 stylus; // Si on déplace ou non - u8 moving; // Si la boule est en mouvement ou non -}positions; - -u32 PA_bgmap[2][4]; // Pointeur vers les maps, 4 maps par screen -u8 PA_Screen = 0; - -s16 PA_ScreenSpace; // Espace entre les 2 écrans...+192 - -PA_GifInfos PA_GifInfo; - -Pads Pad; -PA_Pad* PadPointer; - -PA_Stylus Stylus; - -PA_movingsprite PA_MovedSprite; // Pour les sprites que l'on bouge... - -u8 PA_MoveSpriteType = 0; - -void PA_SetBrightness(u8 screen, s8 bright){ - u16 mode = 1 << 14; - if(bright < 0){ - mode = 2 << 14; - bright = -bright; - } - if(bright > 31) bright = 31; - - u16 brightreg = mode | bright; - if(screen) REG_MASTER_BRIGHT_SUB = brightreg; - else REG_MASTER_BRIGHT = brightreg; -} - -void PA_Nothing(){ -} - -u8 PA_CheckLid(){ - if(!PA_LidClosed()) return 0; - - // Power down the ARM7 - fifoSendValue32(FIFO_PM, PM_REQ_SLEEP); - - // Wait 100 milliseconds - swiDelay(419000); - - // Disable interrupts - except VBlank (though with no handler) - u32 backup_if = REG_IF; - REG_IF = 0; - irqSet(IRQ_VBLANK, 0); - REG_IF = IRQ_VBLANK; - - // Power down all ARM9 devices - u16 backup_power = REG_POWERCNT; - REG_POWERCNT = 0; - - // Wait for the lid to be opened again - for(;;){ - swiWaitForVBlank(); - - if(!(keysCurrent() & KEY_LID)) - break; - } - - // Return the power - REG_POWERCNT = backup_power; - - // Wait 100 milliseconds - swiDelay(419000); - - // Reinit interrupts - irqSet(IRQ_VBLANK, PA_vblFunc); - REG_IF = backup_if; - return 1; -} +#include + +u8 pa_checklid; +u16 pa_giftotexcolor = 0; + +// TODO: Ensure that this is in uncached memory on the ARM9 +volatile PA_IPCType PA_IPC; // This is deprecated + +typedef struct{ + s16 x, y, oldx, oldy, vx, vy; // Coordonnées + u8 stylus; // Si on déplace ou non + u8 moving; // Si la boule est en mouvement ou non +}positions; + +u32 PA_bgmap[2][4]; // Pointeur vers les maps, 4 maps par screen +u8 PA_Screen = 0; + +s16 PA_ScreenSpace; // Espace entre les 2 écrans...+192 + +PA_GifInfos PA_GifInfo; + +Pads Pad; +PA_Pad* PadPointer; + +PA_Stylus Stylus; + +PA_movingsprite PA_MovedSprite; // Pour les sprites que l'on bouge... + +u8 PA_MoveSpriteType = 0; + +void PA_SetBrightness(u8 screen, s8 bright){ + u16 mode = 1 << 14; + if(bright < 0){ + mode = 2 << 14; + bright = -bright; + } + if(bright > 31) bright = 31; + + u16 brightreg = mode | bright; + if(screen) REG_MASTER_BRIGHT_SUB = brightreg; + else REG_MASTER_BRIGHT = brightreg; +} + +void PA_Nothing(){ +} + +u8 PA_CheckLid(){ + if(!PA_LidClosed()) return 0; + + // Power down the ARM7 + fifoSendValue32(FIFO_PM, PM_REQ_SLEEP); + + // Wait 100 milliseconds + swiDelay(419000); + + // Disable interrupts - except VBlank (though with no handler) + u32 backup_if = REG_IF; + REG_IF = 0; + irqSet(IRQ_VBLANK, 0); + REG_IF = IRQ_VBLANK; + + // Power down all ARM9 devices + u16 backup_power = REG_POWERCNT; + REG_POWERCNT = 0; + + // Wait for the lid to be opened again + for(;;){ + swiWaitForVBlank(); + + if(!(keysCurrent() & KEY_LID)) + break; + } + + // Return the power + REG_POWERCNT = backup_power; + + // Wait 100 milliseconds + swiDelay(419000); + + // Reinit interrupts + irqSet(IRQ_VBLANK, PA_vblFunc); + REG_IF = backup_if; + return 1; +} diff --git a/source/arm9/PA_16c.c b/source/arm9/PA_16c.c index c681924..2dc7045 100644 --- a/source/arm9/PA_16c.c +++ b/source/arm9/PA_16c.c @@ -1,134 +1,134 @@ -#include -#include "PA_TextBits.h" - -#include "PA_BmpFont0_Tiles_bin.h" -#include "PA_BmpFont1_Tiles_bin.h" -#include "PA_BmpFont2_Tiles_bin.h" -#include "PA_BmpFont3_Tiles_bin.h" -#include "PA_BmpFont4_Tiles_bin.h" - -u32* c16_tiles[10] = { - (u32*)PA_BmpFont0_Tiles_bin, - (u32*)PA_BmpFont1_Tiles_bin, - (u32*)PA_BmpFont2_Tiles_bin, - (u32*)PA_BmpFont3_Tiles_bin, - (u32*)PA_BmpFont4_Tiles_bin -}; - -// Pointers... -u16 *PA_Draw16[2]; -u32 *PA_Draw1632[2]; - -void PA_16c8X8Color(u8 screen, s16 x, s16 y, u32 *image, u8 color){ - x += 8; - y += 8; - - u16 temp = (x&7)<<2; - u16 pos = PA_16cPos(x, y); - PA_Draw1632[screen][pos] |= (image[0]<>temp)*color; - PA_Draw1632[screen][pos+1] |= (image[1]>>temp)*color; - PA_Draw1632[screen][pos+2] |= (image[2]>>temp)*color; - PA_Draw1632[screen][pos+3] |= (image[3]>>temp)*color; - PA_Draw1632[screen][pos+4] |= (image[4]>>temp)*color; - PA_Draw1632[screen][pos+5] |= (image[5]>>temp)*color; - PA_Draw1632[screen][pos+6] |= (image[6]>>temp)*color; - PA_Draw1632[screen][pos+7] |= (image[7]>>temp)*color; -} - -void PA_Init16cBgEx(u8 screen, u8 bg, u8 npalette){ - //PA_LoadBg(screen, bg, NULL, ((8*4*34*26)+8)>>1, NULL, BG_512X256, 0, 0); - PA_LoadBgTilesEx(screen, bg, NULL, ((8*4*34*26)+8)>>1); - PA_LoadBgMap(screen, bg, NULL, BG_512X256); - PA_InitBg(screen, bg, BG_512X256, 0, 0); - PA_BGScrollXY(screen, bg, 8, 8); - - int i, j; - s32 k = 1; - for(i = 0; i < 34; i ++) - for (j = 0; j < 26; j ++, k ++) - PA_SetLargeMapTile(screen, bg, i, j, k + ((npalette) << 12)); - - PA_Draw16[screen] = (u16*)CharBaseBlock(screen, PA_BgInfo[screen][bg].TileSetChar); - PA_Draw1632[screen] = (u32*)CharBaseBlock(screen, PA_BgInfo[screen][bg].TileSetChar); - - PA_SetBgPalCol(screen, (npalette<<4)+1, PA_RGB(31, 31, 31)); - PA_SetBgPalCol(screen, (npalette<<4)+2, PA_RGB(31, 0, 0)); - PA_SetBgPalCol(screen, (npalette<<4)+3, PA_RGB(0, 31, 0)); - PA_SetBgPalCol(screen, (npalette<<4)+4, PA_RGB(0, 0, 31)); - PA_SetBgPalCol(screen, (npalette<<4)+5, PA_RGB(31, 0, 31)); - PA_SetBgPalCol(screen, (npalette<<4)+6, PA_RGB(0, 31, 31)); - PA_SetBgPalCol(screen, (npalette<<4)+7, PA_RGB(31, 31, 0)); - PA_SetBgPalCol(screen, (npalette<<4)+8, PA_RGB(25, 25, 25)); - PA_SetBgPalCol(screen, (npalette<<4)+9, PA_RGB(20, 20, 20)); - PA_SetBgPalCol(screen, (npalette<<4)+10, PA_RGB(0, 0, 0)); -} - -void pa_16cTextDecompress(u8 size){ - int i; - if((size < 5)&&(((void*)bittext_tiles_blank[size]) == ((void*)c16_tiles[size]))){ // Using default font and still compressed - u32 tilesize = pa_bittextsizes[size]; - c16_tiles[size] = (u32*) malloc(tilesize << 2); - for(i = 0; i < tilesize; i ++) - c16_tiles[size][i] = (bittext_tiles_blank[size][i]&1) | (((bittext_tiles_blank[size][i]>>1)&1)<<4) | (((bittext_tiles_blank[size][i]>>2)&1)<<8) | (((bittext_tiles_blank[size][i]>>3)&1)<<12) | - (((bittext_tiles_blank[size][i]>>4)&1)<<16) | (((bittext_tiles_blank[size][i]>>5)&1)<<20) | (((bittext_tiles_blank[size][i]>>6)&1)<<24) | (((bittext_tiles_blank[size][i]>>7)&1)<<28); - } -} - -s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, s32 limit){ - int i; - - pa_16cTextDecompress(size); - - PA_DoLetterPos(basex, basey, maxx, maxy, text, color, size, limit); - - if(limit > PA_LetterPos.NLetters) limit = PA_LetterPos.NLetters; // Plus short que prévu - - for(i = 0; i < limit; i ++) - PA_16cLetter(screen, PA_LetterPos.Letter[i].X, PA_LetterPos.Letter[i].Y, PA_LetterPos.Letter[i].Letter, PA_LetterPos.Letter[i].Size, PA_LetterPos.Letter[i].Color); - - return limit; -} - -void PA_16cErase(u8 screen){ - dmaFillWords(0, PA_Draw1632[screen], 26*8*34*4); -} - -void PA_16cClearZone(u8 screen, s16 x1, s16 y1, s16 x2, s16 y2){ - x1 += 8; - y1 += 8; - y2 += 8; - u16 temp, pos, temp2, pos2; - int i, j; - s16 minx = x1 & (0xffffffff - 7); - if (minx != x1) minx += 8; - s16 maxx = x2 & (0xffffffff - 7); - - pos = PA_16cPos(x1, y1); - temp = (x1&7) << 2; - pos2 = PA_16cPos(x2, y1); - temp2 = (x2&7) << 2; - for (j = 0; j <= y2-y1; j ++){ - PA_Draw1632[screen][pos] &= (0xffffffff>>(32-temp)); - PA_Draw1632[screen][pos+(26*8)] &= (0xffffffff<>(32-temp2)); - PA_Draw1632[screen][pos2+(26*8)] &= (0xffffffff< +#include "PA_TextBits.h" + +#include "PA_BmpFont0_Tiles_bin.h" +#include "PA_BmpFont1_Tiles_bin.h" +#include "PA_BmpFont2_Tiles_bin.h" +#include "PA_BmpFont3_Tiles_bin.h" +#include "PA_BmpFont4_Tiles_bin.h" + +u32* c16_tiles[10] = { + (u32*)PA_BmpFont0_Tiles_bin, + (u32*)PA_BmpFont1_Tiles_bin, + (u32*)PA_BmpFont2_Tiles_bin, + (u32*)PA_BmpFont3_Tiles_bin, + (u32*)PA_BmpFont4_Tiles_bin +}; + +// Pointers... +u16 *PA_Draw16[2]; +u32 *PA_Draw1632[2]; + +void PA_16c8X8Color(u8 screen, s16 x, s16 y, u32 *image, u8 color){ + x += 8; + y += 8; + + u16 temp = (x&7)<<2; + u16 pos = PA_16cPos(x, y); + PA_Draw1632[screen][pos] |= (image[0]<>temp)*color; + PA_Draw1632[screen][pos+1] |= (image[1]>>temp)*color; + PA_Draw1632[screen][pos+2] |= (image[2]>>temp)*color; + PA_Draw1632[screen][pos+3] |= (image[3]>>temp)*color; + PA_Draw1632[screen][pos+4] |= (image[4]>>temp)*color; + PA_Draw1632[screen][pos+5] |= (image[5]>>temp)*color; + PA_Draw1632[screen][pos+6] |= (image[6]>>temp)*color; + PA_Draw1632[screen][pos+7] |= (image[7]>>temp)*color; +} + +void PA_Init16cBgEx(u8 screen, u8 bg, u8 npalette){ + //PA_LoadBg(screen, bg, NULL, ((8*4*34*26)+8)>>1, NULL, BG_512X256, 0, 0); + PA_LoadBgTilesEx(screen, bg, NULL, ((8*4*34*26)+8)>>1); + PA_LoadBgMap(screen, bg, NULL, BG_512X256); + PA_InitBg(screen, bg, BG_512X256, 0, 0); + PA_BGScrollXY(screen, bg, 8, 8); + + int i, j; + s32 k = 1; + for(i = 0; i < 34; i ++) + for (j = 0; j < 26; j ++, k ++) + PA_SetLargeMapTile(screen, bg, i, j, k + ((npalette) << 12)); + + PA_Draw16[screen] = (u16*)CharBaseBlock(screen, PA_BgInfo[screen][bg].TileSetChar); + PA_Draw1632[screen] = (u32*)CharBaseBlock(screen, PA_BgInfo[screen][bg].TileSetChar); + + PA_SetBgPalCol(screen, (npalette<<4)+1, PA_RGB(31, 31, 31)); + PA_SetBgPalCol(screen, (npalette<<4)+2, PA_RGB(31, 0, 0)); + PA_SetBgPalCol(screen, (npalette<<4)+3, PA_RGB(0, 31, 0)); + PA_SetBgPalCol(screen, (npalette<<4)+4, PA_RGB(0, 0, 31)); + PA_SetBgPalCol(screen, (npalette<<4)+5, PA_RGB(31, 0, 31)); + PA_SetBgPalCol(screen, (npalette<<4)+6, PA_RGB(0, 31, 31)); + PA_SetBgPalCol(screen, (npalette<<4)+7, PA_RGB(31, 31, 0)); + PA_SetBgPalCol(screen, (npalette<<4)+8, PA_RGB(25, 25, 25)); + PA_SetBgPalCol(screen, (npalette<<4)+9, PA_RGB(20, 20, 20)); + PA_SetBgPalCol(screen, (npalette<<4)+10, PA_RGB(0, 0, 0)); +} + +void pa_16cTextDecompress(u8 size){ + int i; + if((size < 5)&&(((void*)bittext_tiles_blank[size]) == ((void*)c16_tiles[size]))){ // Using default font and still compressed + u32 tilesize = pa_bittextsizes[size]; + c16_tiles[size] = (u32*) malloc(tilesize << 2); + for(i = 0; i < tilesize; i ++) + c16_tiles[size][i] = (bittext_tiles_blank[size][i]&1) | (((bittext_tiles_blank[size][i]>>1)&1)<<4) | (((bittext_tiles_blank[size][i]>>2)&1)<<8) | (((bittext_tiles_blank[size][i]>>3)&1)<<12) | + (((bittext_tiles_blank[size][i]>>4)&1)<<16) | (((bittext_tiles_blank[size][i]>>5)&1)<<20) | (((bittext_tiles_blank[size][i]>>6)&1)<<24) | (((bittext_tiles_blank[size][i]>>7)&1)<<28); + } +} + +s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, s32 limit){ + int i; + + pa_16cTextDecompress(size); + + PA_DoLetterPos(basex, basey, maxx, maxy, text, color, size, limit); + + if(limit > PA_LetterPos.NLetters) limit = PA_LetterPos.NLetters; // Plus short que prévu + + for(i = 0; i < limit; i ++) + PA_16cLetter(screen, PA_LetterPos.Letter[i].X, PA_LetterPos.Letter[i].Y, PA_LetterPos.Letter[i].Letter, PA_LetterPos.Letter[i].Size, PA_LetterPos.Letter[i].Color); + + return limit; +} + +void PA_16cErase(u8 screen){ + dmaFillWords(0, PA_Draw1632[screen], 26*8*34*4); +} + +void PA_16cClearZone(u8 screen, s16 x1, s16 y1, s16 x2, s16 y2){ + x1 += 8; + y1 += 8; + y2 += 8; + u16 temp, pos, temp2, pos2; + int i, j; + s16 minx = x1 & (0xffffffff - 7); + if (minx != x1) minx += 8; + s16 maxx = x2 & (0xffffffff - 7); + + pos = PA_16cPos(x1, y1); + temp = (x1&7) << 2; + pos2 = PA_16cPos(x2, y1); + temp2 = (x2&7) << 2; + for (j = 0; j <= y2-y1; j ++){ + PA_Draw1632[screen][pos] &= (0xffffffff>>(32-temp)); + PA_Draw1632[screen][pos+(26*8)] &= (0xffffffff<>(32-temp2)); + PA_Draw1632[screen][pos2+(26*8)] &= (0xffffffff< -#include "PA_TextBits.h" -//#include "16c/all_gfx.h" - -u32 buffer16c[8]; - -void pa_16cTextDecompress(u8 size); - -void PA_16cRotate8x8(u32 *data, u32 *buffer) { - u8 i; - - for (i = 0; i < 8; i++) { - buffer[i] = ((data[7] >> (i * 4)) & 15) | (((data[6] >> (i * 4)) & 15) << 4) | (((data[5] >> (i * 4)) & 15) << 8) | (((data[4] >> (i * 4)) & 15) << 12) | - (((data[3] >> (i * 4)) & 15) << 16) | (((data[2] >> (i * 4)) & 15) << 20) | (((data[1] >> (i * 4)) & 15) << 24) | (((data[0] >> (i * 4)) & 15) << 28); - } -} - -void PA_16c16X16LetterRot(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color) { - u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); - PA_16cRotate8x8((c16_tiles[size] + (bittext_maps[size][firstpos] << 3)), buffer16c); - PA_16c8X8Color(screen, 247 - y, x, buffer16c, color); - PA_16cRotate8x8((c16_tiles[size] + (bittext_maps[size][firstpos+64] << 3)), buffer16c); - PA_16c8X8Color(screen, 239 - y, x, buffer16c, color); - firstpos ++; - PA_16cRotate8x8((c16_tiles[size] + (bittext_maps[size][firstpos] << 3)), buffer16c); - PA_16c8X8Color(screen, 247 - y, x + 8, buffer16c, color); - PA_16cRotate8x8((c16_tiles[size] + (bittext_maps[size][firstpos+64] << 3)), buffer16c); - PA_16c8X8Color(screen, 239 - y, x + 8, buffer16c, color); -} - -void PA_16c8X8LetterRot(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color) { - PA_16cRotate8x8((c16_tiles[size] + (bittext_maps[size][letter] << 3)), buffer16c); - PA_16c8X8Color(screen, 247 - y, x, buffer16c, color); -} - -void PA_16cLetterRot(u8 screen, s16 x, s16 y, char letter, u8 size, u8 color) { - if (pa_bittextpoliceheight[size] <= 8) PA_16c8X8LetterRot(screen, x, y, letter, size, color); - else PA_16c16X16LetterRot(screen, x, y, letter, size, color); -} - -void PA_16cRotate8x8b(u32 *data, u32 *buffer) { - u8 i; - - for (i = 0; i < 8; i++) { - buffer[7-i] = ((data[0] >> (i * 4)) & 15) | (((data[1] >> (i * 4)) & 15) << 4) | (((data[2] >> (i * 4)) & 15) << 8) | (((data[3] >> (i * 4)) & 15) << 12) | - (((data[4] >> (i * 4)) & 15) << 16) | (((data[5] >> (i * 4)) & 15) << 20) | (((data[6] >> (i * 4)) & 15) << 24) | (((data[7] >> (i * 4)) & 15) << 28); - } -} - -void PA_16c16X16LetterRot2(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color) { - u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); - PA_16cRotate8x8b((c16_tiles[size] + (bittext_maps[size][firstpos] << 3)), buffer16c); - PA_16c8X8Color(screen, y, 183 - x, buffer16c, color); - PA_16cRotate8x8b((c16_tiles[size] + (bittext_maps[size][firstpos+64] << 3)), buffer16c); - PA_16c8X8Color(screen, y + 8, 183 - x, buffer16c, color); - firstpos ++; - PA_16cRotate8x8b((c16_tiles[size] + (bittext_maps[size][firstpos] << 3)), buffer16c); - PA_16c8X8Color(screen, y, 175 - x, buffer16c, color); - PA_16cRotate8x8b((c16_tiles[size] + (bittext_maps[size][firstpos+64] << 3)), buffer16c); - PA_16c8X8Color(screen, y + 8, 175 - x, buffer16c, color); -} - -void PA_16c8X8LetterRot2(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color) { - PA_16cRotate8x8b((c16_tiles[size] + (bittext_maps[size][letter] << 3)), buffer16c); - PA_16c8X8Color(screen, y, 183 - x, buffer16c, color); -} - -void PA_16cLetterRot2(u8 screen, s16 x, s16 y, char letter, u8 size, u8 color) { - if (pa_bittextpoliceheight[size] <= 8) PA_16c8X8LetterRot2(screen, x, y, letter, size, color); - else PA_16c16X16LetterRot2(screen, x, y, letter, size, color); -} - -s16 PA_16cTextRot(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text, u8 color, u8 size, s32 limit) { - s32 i; - pa_16cTextDecompress(size); - PA_DoLetterPos(basex, basey, maxx, maxy, text, color, size, limit); - - if (limit > PA_LetterPos.NLetters) limit = PA_LetterPos.NLetters; // Plus short que prévu - - if (textinfo.rot == 1) for (i = 0; i < limit; i++) PA_16cLetterRot(screen, PA_LetterPos.Letter[i].X, PA_LetterPos.Letter[i].Y, - PA_LetterPos.Letter[i].Letter, PA_LetterPos.Letter[i].Size, PA_LetterPos.Letter[i].Color); - else for (i = 0; i < limit; i++) PA_16cLetterRot2(screen, PA_LetterPos.Letter[i].X - 1, PA_LetterPos.Letter[i].Y + 1, - PA_LetterPos.Letter[i].Letter, PA_LetterPos.Letter[i].Size, PA_LetterPos.Letter[i].Color); - return limit; -} +#include +#include "PA_TextBits.h" +//#include "16c/all_gfx.h" + +u32 buffer16c[8]; + +void pa_16cTextDecompress(u8 size); + +void PA_16cRotate8x8(u32 *data, u32 *buffer) { + u8 i; + + for (i = 0; i < 8; i++) { + buffer[i] = ((data[7] >> (i * 4)) & 15) | (((data[6] >> (i * 4)) & 15) << 4) | (((data[5] >> (i * 4)) & 15) << 8) | (((data[4] >> (i * 4)) & 15) << 12) | + (((data[3] >> (i * 4)) & 15) << 16) | (((data[2] >> (i * 4)) & 15) << 20) | (((data[1] >> (i * 4)) & 15) << 24) | (((data[0] >> (i * 4)) & 15) << 28); + } +} + +void PA_16c16X16LetterRot(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color) { + u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); + PA_16cRotate8x8((c16_tiles[size] + (bittext_maps[size][firstpos] << 3)), buffer16c); + PA_16c8X8Color(screen, 247 - y, x, buffer16c, color); + PA_16cRotate8x8((c16_tiles[size] + (bittext_maps[size][firstpos+64] << 3)), buffer16c); + PA_16c8X8Color(screen, 239 - y, x, buffer16c, color); + firstpos ++; + PA_16cRotate8x8((c16_tiles[size] + (bittext_maps[size][firstpos] << 3)), buffer16c); + PA_16c8X8Color(screen, 247 - y, x + 8, buffer16c, color); + PA_16cRotate8x8((c16_tiles[size] + (bittext_maps[size][firstpos+64] << 3)), buffer16c); + PA_16c8X8Color(screen, 239 - y, x + 8, buffer16c, color); +} + +void PA_16c8X8LetterRot(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color) { + PA_16cRotate8x8((c16_tiles[size] + (bittext_maps[size][letter] << 3)), buffer16c); + PA_16c8X8Color(screen, 247 - y, x, buffer16c, color); +} + +void PA_16cLetterRot(u8 screen, s16 x, s16 y, char letter, u8 size, u8 color) { + if (pa_bittextpoliceheight[size] <= 8) PA_16c8X8LetterRot(screen, x, y, letter, size, color); + else PA_16c16X16LetterRot(screen, x, y, letter, size, color); +} + +void PA_16cRotate8x8b(u32 *data, u32 *buffer) { + u8 i; + + for (i = 0; i < 8; i++) { + buffer[7-i] = ((data[0] >> (i * 4)) & 15) | (((data[1] >> (i * 4)) & 15) << 4) | (((data[2] >> (i * 4)) & 15) << 8) | (((data[3] >> (i * 4)) & 15) << 12) | + (((data[4] >> (i * 4)) & 15) << 16) | (((data[5] >> (i * 4)) & 15) << 20) | (((data[6] >> (i * 4)) & 15) << 24) | (((data[7] >> (i * 4)) & 15) << 28); + } +} + +void PA_16c16X16LetterRot2(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color) { + u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); + PA_16cRotate8x8b((c16_tiles[size] + (bittext_maps[size][firstpos] << 3)), buffer16c); + PA_16c8X8Color(screen, y, 183 - x, buffer16c, color); + PA_16cRotate8x8b((c16_tiles[size] + (bittext_maps[size][firstpos+64] << 3)), buffer16c); + PA_16c8X8Color(screen, y + 8, 183 - x, buffer16c, color); + firstpos ++; + PA_16cRotate8x8b((c16_tiles[size] + (bittext_maps[size][firstpos] << 3)), buffer16c); + PA_16c8X8Color(screen, y, 175 - x, buffer16c, color); + PA_16cRotate8x8b((c16_tiles[size] + (bittext_maps[size][firstpos+64] << 3)), buffer16c); + PA_16c8X8Color(screen, y + 8, 175 - x, buffer16c, color); +} + +void PA_16c8X8LetterRot2(u8 screen, s16 x, s16 y, u8 letter, u8 size, u8 color) { + PA_16cRotate8x8b((c16_tiles[size] + (bittext_maps[size][letter] << 3)), buffer16c); + PA_16c8X8Color(screen, y, 183 - x, buffer16c, color); +} + +void PA_16cLetterRot2(u8 screen, s16 x, s16 y, char letter, u8 size, u8 color) { + if (pa_bittextpoliceheight[size] <= 8) PA_16c8X8LetterRot2(screen, x, y, letter, size, color); + else PA_16c16X16LetterRot2(screen, x, y, letter, size, color); +} + +s16 PA_16cTextRot(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text, u8 color, u8 size, s32 limit) { + s32 i; + pa_16cTextDecompress(size); + PA_DoLetterPos(basex, basey, maxx, maxy, text, color, size, limit); + + if (limit > PA_LetterPos.NLetters) limit = PA_LetterPos.NLetters; // Plus short que prévu + + if (textinfo.rot == 1) for (i = 0; i < limit; i++) PA_16cLetterRot(screen, PA_LetterPos.Letter[i].X, PA_LetterPos.Letter[i].Y, + PA_LetterPos.Letter[i].Letter, PA_LetterPos.Letter[i].Size, PA_LetterPos.Letter[i].Color); + else for (i = 0; i < limit; i++) PA_16cLetterRot2(screen, PA_LetterPos.Letter[i].X - 1, PA_LetterPos.Letter[i].Y + 1, + PA_LetterPos.Letter[i].Letter, PA_LetterPos.Letter[i].Size, PA_LetterPos.Letter[i].Color); + return limit; +} diff --git a/source/arm9/PA_3D.c b/source/arm9/PA_3D.c index 66e107d..9703949 100644 --- a/source/arm9/PA_3D.c +++ b/source/arm9/PA_3D.c @@ -1,46 +1,46 @@ -#include - -extern u8 pa_3Dscreen; -extern u8 pa_3Ddual; - -void PADefault3DInit(){ - // this should do the same as the normal gl call - glInit(); - glViewport(0, 0, 255, 191); - - glClearDepth(0x7FFF); - GFX_CLEAR_COLOR = 0; - - if(pa_3Dscreen) PA_SwitchScreens(); - pa_3Dscreen = 0; - pa_3Ddual = 0; -} - -void PA_Init3D(){ - videoSetMode(MODE_0_3D); // Set 3D on... - REG_DISPCNT |= DISPLAY_BG_EXT_PALETTE; // BG extended palettes - - vramSetBankA(VRAM_A_TEXTURE); // Say good-bye to sprites ^^ - vramSetBankF(VRAM_F_TEX_PALETTE); // Palettes for the textures... - - PA_BGScrollXY(0, 0, 0, 0); - - PADefault3DInit(); -} - -void PA_Init3D2Banks(){ - videoSetMode(MODE_0_3D); // Set 3D on... - REG_DISPCNT |= DISPLAY_BG_EXT_PALETTE; // BG extended palettes - - vramSetBankA(VRAM_A_TEXTURE); // Say good-bye to sprites ^^ - vramSetBankB(VRAM_B_TEXTURE); // Say good-bye to sprites ^^ - vramSetBankF(VRAM_F_TEX_PALETTE); // Palettes for the textures... - - PADefault3DInit(); -} - -void PA_Load3DSpritePal(u16 palette_number, void* palette){ - vramSetBankF(VRAM_F_LCD); - DMA_Copy(palette, VRAM_F + (palette_number << 9), 256, DMA_16NOW); - vramSetBankF(VRAM_F_TEX_PALETTE); -} +#include + +extern u8 pa_3Dscreen; +extern u8 pa_3Ddual; + +void PADefault3DInit(){ + // this should do the same as the normal gl call + glInit(); + glViewport(0, 0, 255, 191); + + glClearDepth(0x7FFF); + GFX_CLEAR_COLOR = 0; + + if(pa_3Dscreen) PA_SwitchScreens(); + pa_3Dscreen = 0; + pa_3Ddual = 0; +} + +void PA_Init3D(){ + videoSetMode(MODE_0_3D); // Set 3D on... + REG_DISPCNT |= DISPLAY_BG_EXT_PALETTE; // BG extended palettes + + vramSetBankA(VRAM_A_TEXTURE); // Say good-bye to sprites ^^ + vramSetBankF(VRAM_F_TEX_PALETTE); // Palettes for the textures... + + PA_BGScrollXY(0, 0, 0, 0); + + PADefault3DInit(); +} + +void PA_Init3D2Banks(){ + videoSetMode(MODE_0_3D); // Set 3D on... + REG_DISPCNT |= DISPLAY_BG_EXT_PALETTE; // BG extended palettes + + vramSetBankA(VRAM_A_TEXTURE); // Say good-bye to sprites ^^ + vramSetBankB(VRAM_B_TEXTURE); // Say good-bye to sprites ^^ + vramSetBankF(VRAM_F_TEX_PALETTE); // Palettes for the textures... + + PADefault3DInit(); +} + +void PA_Load3DSpritePal(u16 palette_number, void* palette){ + vramSetBankF(VRAM_F_LCD); + DMA_Copy(palette, VRAM_F + (palette_number << 9), 256, DMA_16NOW); + vramSetBankF(VRAM_F_TEX_PALETTE); +} diff --git a/source/arm9/PA_3DSprites.c b/source/arm9/PA_3DSprites.c index 20dbb8d..d134dad 100644 --- a/source/arm9/PA_3DSprites.c +++ b/source/arm9/PA_3DSprites.c @@ -1,517 +1,517 @@ -#include - -pa3dsprites pa_3dsprites[PA_NMAXSPRITES]; // 3D Sprite infos - -s16 pa_freetextures; - -#define N_TEXTURES 1024 - -u16 n_free_mem3D; // nombre d'emplacements libres -u16 used_mem3D[16384]; // Note la quantit� de m�moire utilis�e en chaque point de la m�moire pour pouvoir effacer les gfx... -s16 obj_per_gfx3D[N_TEXTURES]; // Nombre de sprites utilisant un gfx donn�... -mem_usage free_mem3D[16384]; - -type_3danims sprite3danims[PA_NMAXSPRITES]; - -u16 n3Dspriteanims; - -u16 freetexslots[N_TEXTURES]; // Free Texture Slots... - -u8 pa_3Dbanks; - -uint32 textures[MAX_TEXTURES]; -void* texturesptr[MAX_TEXTURES]; // for updates... -uint32 activeTexture; - -void PA_3DUpdateSpriteAnims(); -void PA_3DCapture(); - -u8 pa_3Ddual = 0; -u8 pa_3Dscreen = 0; - -void PA_SetRegCapture(bool enable, uint8 srcBlend, uint8 destBlend, uint8 bank, uint8 offset, uint8 size, uint8 source, uint8 srcOffset){ - uint32 value = 0; - if(enable) value |= 1 << 31; // 31 is enable - value |= 3 << 29; // 29-30 seems to have something to do with the blending - value |= (srcOffset & 0x3) << 26; // capture source offset is 26-27 - value |= (source & 0x3) << 24; // capture source is 24-25 - value |= (size & 0x3) << 20; // capture data write size is 20-21 - value |= (offset & 0x3) << 18; // write offset is 18-19 - value |= (bank & 0x3) << 16; // vram bank select is 16-17 - value |= (srcBlend & 0xFF) << 8; // graphics blend evb is 8..12 - value |= (destBlend & 0xFF) << 0; // ram blend EVA is bits 0..4 - REG_DISPCAPCNT = value; -} - -/* 40004A4h - Cmd 29h - POLYGON_ATTR - 0-3 Light 0..3 Enable Flags (each bit: 0=Disable, 1=Enable) - 4-5 Polygon Mode (0=Modulation,1=Decal,2=Toon/Highlight Shading,3=Shadow) - 6 Polygon Back Surface (0=Hide, 1=Render) ;Line-segments are always - 7 Polygon Front Surface (0=Hide, 1=Render) ;rendered (no front/back) - 8-10 Not used - 11 Depth-value for Translucent Polygons (0=Keep Old, 1=Set New Depth) - 12 Far-plane intersecting polygons (0=Hide, 1=Render/clipped) - 13 1-Dot polygons behind DISP_1DOT_DEPTH (0=Hide, 1=Render) - 14 Depth Test, Draw Pixels with Depth (0=Less, 1=Equal) (usually 0) - 15 Fog Enable (0=Disable, 1=Enable) - 16-20 Alpha (0=Wire-Frame, 1..30=Translucent, 31=Solid) - 21-23 Not used - 24-29 Polygon ID (00h..3Fh, used for translucent, shadow, and edge-marking) - 30-31 Not used - */ - -#define PA_glRotateX(a) glRotateXi((a)<<6) -#define PA_glRotateY(a) glRotateYi((a)<<6) -#define PA_glRotateZ(a) glRotateZi((a)<<6) - -static inline void PA_glVertex(u16 x, u16 y, u16 z){ - GFX_VERTEX16 = (y << 16) | (x & 0xFFFF); - GFX_VERTEX16 = ((uint32)z); -} - -static inline void PA_glTranslate(s32 x, s32 y, s32 z){ - MATRIX_TRANSLATE = x; - MATRIX_TRANSLATE = y; - MATRIX_TRANSLATE = z; -} - -#define PA_StartQuad() GFX_BEGIN = GL_QUAD - -void PA_3DSpriteToScreen(u16 sprite, s16 ydecal){ - MATRIX_PUSH = 0; - - PA_glTranslate(pa_3dsprites[sprite].X, (192-(pa_3dsprites[sprite].Y+ydecal)), pa_3dsprites[sprite].Priority); - - GFX_TEX_FORMAT = textures[pa_3dsprites[sprite].textureID]; - activeTexture = pa_3dsprites[sprite].textureID; - - PA_glRotateX(pa_3dsprites[sprite].RotX); - PA_glRotateY(pa_3dsprites[sprite].RotY); - PA_glRotateZ(pa_3dsprites[sprite].RotZ); - - GFX_POLY_FORMAT = (1<<6) | (1<<7) | (pa_3dsprites[sprite].alpha << 16) | (pa_3dsprites[sprite].polyID << 24); - GFX_PAL_FORMAT = pa_3dsprites[sprite].palette << 5; - - u32 x1, x2, y1, y2; - u8 hflip = pa_3dsprites[sprite].Hflip; - u8 vflip = pa_3dsprites[sprite].Vflip; - - x1 = inttot16(pa_3dsprites[sprite].ImgWidth) * hflip; - x2 = inttot16(pa_3dsprites[sprite].ImgWidth) * (!hflip); - y1 = inttot16(pa_3dsprites[sprite].ImgHeight) * (!vflip); - y2 = inttot16(pa_3dsprites[sprite].ImgHeight) * vflip; - - s32 zoomx0 = pa_3dsprites[sprite].Width >> 1; - s32 zoomx1 = (pa_3dsprites[sprite].Width + 1) >> 1; - s32 zoomy0 = pa_3dsprites[sprite].Height >> 1; - s32 zoomy1 = (pa_3dsprites[sprite].Height + 1) >> 1; - - // Start drawing texture - PA_StartQuad(); - - GFX_NORMAL = NORMAL_PACK(0, inttov10(-1), 0); - - GFX_TEX_COORD = TEXTURE_PACK(x1, y1); - PA_glVertex(-zoomx1 + pa_3dsprites[sprite].corner[2].x, -zoomy1 - pa_3dsprites[sprite].corner[2].y, 0); - - GFX_TEX_COORD = TEXTURE_PACK(x2, y1); - PA_glVertex(zoomx0 + pa_3dsprites[sprite].corner[3].x, -zoomy1 - pa_3dsprites[sprite].corner[3].y, 0); - - GFX_TEX_COORD = TEXTURE_PACK(x2, y2); - PA_glVertex(zoomx0 + pa_3dsprites[sprite].corner[1].x, zoomy0 - pa_3dsprites[sprite].corner[1].y, 0); - - GFX_TEX_COORD = TEXTURE_PACK(x1, y2); - PA_glVertex(-zoomx1 + pa_3dsprites[sprite].corner[0].x, zoomy0 - pa_3dsprites[sprite].corner[0].y, 0); - - // An 'end' signal isn't needed by the Nintendo DS nor no$gba. - - MATRIX_POP = 1; -} - -void PA_glReset(){ - while(GFX_BUSY); // wait until the gfx engine is not busy - - // Clear the FIFO - GFX_STATUS |= (1 << 29); - - // Clear overflows for list memory - GFX_CONTROL = (1 << 12) | (1 << 13) | GL_TEXTURE_2D; - glResetMatrixStack(); - - GFX_TEX_FORMAT = 0; - GFX_POLY_FORMAT = 0; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - -void PA_3DProcess(){ - if(pa_3Ddual) PA_3DCapture(); - - PA_3DUpdateSpriteAnims(); // Update animations... - PA_glReset(); - glEnable(GL_BLEND); - glAlphaFunc(BLEND_ALPHA); - - MATRIX_CONTROL = GL_PROJECTION; - glLoadIdentity(); - - glOrthof32(0, 256, 0, 192, 0, 8192); - - gluLookAtf32(0, 0, 4096, // Camera position - 0, 0, 0, // Look-at - 0, 4096, 0); // Up - - MATRIX_CONTROL = GL_TEXTURE; - glLoadIdentity(); - - MATRIX_CONTROL = GL_MODELVIEW; - - glMaterialf(GL_AMBIENT, RGB15(31, 31, 31)); - glMaterialf(GL_DIFFUSE, RGB15(31, 31, 31)); - glMaterialf(GL_SPECULAR, BIT(15) | RGB15(15, 15, 15)); - glMaterialf(GL_EMISSION, RGB15(31, 31, 31)); - - // The DS uses a table for shinyness... This generates a halfassed one - glMaterialShinyness(); - - GFX_TEX_FORMAT |= (1 << 29); // Palette index 0 = transparent - - int i; - - if(pa_3Ddual){ - if(pa_3Dscreen == 1){ - for(i = 0; i < PA_NMAXSPRITES; i ++) - if(pa_3dsprites[i].Alive) - PA_3DSpriteToScreen(i, 0); - }else{ - for(i = 0; i < PA_NMAXSPRITES; i ++) - if(pa_3dsprites[i].Alive) - PA_3DSpriteToScreen(i, -PA_ScreenSpace); - } - PA_SwitchScreens(); - pa_3Dscreen = !pa_3Dscreen; - }else // Normal - for(i = 0; i < PA_NMAXSPRITES; i++) - if(pa_3dsprites[i].Alive) - PA_3DSpriteToScreen(i, 0); - - GFX_FLUSH = 0; -} - -void PA_3DDeleteTex(u32 tex_gfx){ - u16 i; - u16 j; - u8 exit = 0; - s8 decal = 0; // D�calage que l'on aura � faire pour classer le tableau... - obj_per_gfx3D[tex_gfx] = 0; - freetexslots[pa_freetextures] = tex_gfx; - pa_freetextures ++; - tex_gfx = (textures[tex_gfx] & (0xFFFF)) >> 1; - - // Gestion dynamique de la m�moire... - for(i = 0; ((i < n_free_mem3D) && !exit); i ++){ // On regarde les diff�rents emplacements m�moire pour ajouter le morceau libre dans le tas... - if(tex_gfx < free_mem3D[i].mem_block){ // Si on a un trou qui pr�c�de le premier trou dispo, on va devoir tout d�caler...peut-etre ! - exit = 1; // On va pourvoir sortir, apr�s avir ordonn� le tableau... - decal = 1; - - if((i > 0) && (tex_gfx > 0) && (free_mem3D[i - 1].mem_block + free_mem3D[i - 1].free == tex_gfx)){ // On a 2 cases c�tes � c�tes, donc pas besoin de d�caler, on ajouter la mem dispo... - free_mem3D[i-1].free += used_mem3D[tex_gfx]; - tex_gfx = free_mem3D[i-1].mem_block; - used_mem3D[tex_gfx] = free_mem3D[i-1].free; - decal = 0; - } - - if(tex_gfx + used_mem3D[tex_gfx] == free_mem3D[i].mem_block){ // Si le bloc d'apr�s suit parfaitement le bloc qu'on vient d'ajouter... - -- decal; - free_mem3D[i].mem_block = tex_gfx; - free_mem3D[i].free += used_mem3D[tex_gfx]; - } - - // Si le d�calage est de 0, on touche � rien - if(decal == -1){ // On doit d�caler vers la gauche... les donn�es sont d�j� dans le tableau - for(j = i - 1; j < n_free_mem3D; j ++) // On recopie la liste plus loin... - free_mem3D[j] = free_mem3D[j + 1]; - n_free_mem3D --; - }else if(decal == 1){ // On doit tout d�caler pour faire rentrer la case vide... - n_free_mem3D ++; - - for (j = n_free_mem3D; j > i; j --) // On recopie la liste plus loin... - free_mem3D[j] = free_mem3D[j - 1]; - - free_mem3D[i].mem_block = tex_gfx; - free_mem3D[i].free = used_mem3D[tex_gfx]; - } - } - } - - used_mem3D[tex_gfx] = 0; -} - -s16 PA_3DCreateTex(void* obj_data, u16 width, u16 height, u8 type){ - pa_freetextures--; // One less texture slot - s16 currenttex = freetexslots[pa_freetextures]; - GFX_TEX_FORMAT = textures[currenttex]; - activeTexture = currenttex; - int i; - s16 texwidth = -1; - s16 texheight = -1; - - for(i = 0; i < 7; i ++){ // Get height... - if(width == (1 << (i + 3))) texwidth = i; - - if(height == (1 << (i + 3))) texheight = i; - } - - u32 mem_size = width * height; - - // Correct size - switch(type){ - case TEX_16BITS: - mem_size = mem_size << 1; - break; - case TEX_4COL: - mem_size = mem_size >> 2; - break; - case TEX_16COL: - mem_size = mem_size >> 1; - break; - default: - break; - } - - u32 block_size = mem_size >> 4; // block size - u8 exit = 0; - u16 n_mem = 0; - u32 truenumber; - - for(i = 0; (i < n_free_mem3D) && !exit; i ++) - if(block_size <= free_mem3D[i].free){ - n_mem = i; - exit = 1; - } - - i = free_mem3D[n_mem].mem_block; // On met la valeur de cot� pour la renvoyer... - truenumber = (u32) &VRAM_A[i << 3]; - used_mem3D[i] = block_size; // Nombre de blocks - - // Start Copy... - vramSetBankA(VRAM_A_LCD); - - if(pa_3Dbanks == 2) vramSetBankB(VRAM_B_LCD); - DMA_Copy(obj_data, (void*) truenumber, mem_size >> 1, DMA_16NOW); - if(pa_3Dbanks == 2) vramSetBankB(VRAM_B_TEXTURE); - - vramSetBankA(VRAM_A_TEXTURE); - - PA_glTexParameter(texwidth, texheight, (u32*)truenumber, type, TEXGEN_TEXCOORD); - free_mem3D[n_mem].free -= block_size; - - if(free_mem3D[n_mem].free > 0) - free_mem3D[n_mem].mem_block += block_size; // S'il reste un bout libre, on garde... - else {// On doit tout d�caler d'un cran... vers la gauche - for (i = n_mem; i < n_free_mem3D; i++) // On recopie la liste plus loin... - free_mem3D[i] = free_mem3D[i + 1]; - --n_free_mem3D; - } - - texturesptr[currenttex] = (void*) obj_data; // Save pointer for animations - obj_per_gfx3D[currenttex] = 1; // Nombre d'objets sur ce gfx... - return currenttex; -} - -void PA_3DCreateSpriteFromTex(u16 sprite, u16 texture, u16 width, u16 height, u8 palette, s16 x, s16 y){ - pa_3dsprites[sprite].Alive = 1; - pa_3dsprites[sprite].X = x; pa_3dsprites[sprite].Y = y; - pa_3dsprites[sprite].ImgWidth = width; - pa_3dsprites[sprite].ImgHeight = height; - pa_3dsprites[sprite].Width = width; - pa_3dsprites[sprite].Height = height; - pa_3dsprites[sprite].Hflip = 0; pa_3dsprites[sprite].Vflip = 0; - pa_3dsprites[sprite].RotX = 0; pa_3dsprites[sprite].RotY = 0; pa_3dsprites[sprite].RotZ = 0; - pa_3dsprites[sprite].textureID = texture; - pa_3dsprites[sprite].Priority = 1024; - pa_3dsprites[sprite].alpha = 31; // Solid - pa_3dsprites[sprite].polyID = 0; // 0 polyID by default - - int i; - for(i = 0; i < 4; i++){ - pa_3dsprites[sprite].corner[i].x = 0; - pa_3dsprites[sprite].corner[i].y = 0; - } - - if(((textures[texture]>>26)&7) == TEX_4COL) - pa_3dsprites[sprite].palette = palette << 1; // 1 more... - else - pa_3dsprites[sprite].palette = palette; - - obj_per_gfx3D[texture]++; -} - -void PA_Reset3DSprites(){ - n_free_mem3D = 1; - free_mem3D[0].mem_block = 0; - free_mem3D[0].free = 8192; // Number of free blocks in memory - int i; - for(i = 0; i < PA_NMAXSPRITES; i ++){ - pa_3dsprites[i].Alive = 0; // Delete sprite - sprite3danims[i].play = 0; // No animation - } - for(i = 0; i < 1024; i ++) freetexslots[i] = 1023 - i; // free slots... - pa_freetextures = 1024; - n3Dspriteanims = 0; - pa_3Dbanks = 1; -} - -void PA_Reset3DSprites2Banks(){ - n_free_mem3D = 1; - free_mem3D[0].mem_block = 0; free_mem3D[0].free = 16384; // Number of free blocks in memory - int i; - for(i = 0; i < PA_NMAXSPRITES; i ++){ - pa_3dsprites[i].Alive = 0; // Delete sprite - sprite3danims[i].play = 0; // No animation - } - for(i = 0; i < 1024; i ++) freetexslots[i] = 1023 - i; // free slots... - pa_freetextures = 1024; - n3Dspriteanims = 0; - pa_3Dbanks = 2; -} - -void PA_3DUpdateGfx(u16 texture, void* image){ - s32 mem_size = 1 <<(6+((textures[texture]>>20)&7)+((textures[texture]>>23)&7)); - u8 type = ((textures[texture]>>26)&7); - switch(type){ - case TEX_16BITS: - mem_size = mem_size << 1; - break; - case TEX_4COL: - mem_size = mem_size >> 2; - break; - case TEX_16COL: - mem_size = mem_size >> 1; - break; - } - vramSetBankA(VRAM_A_LCD); - if(pa_3Dbanks == 2) vramSetBankB(VRAM_B_LCD); - DMA_Copy(image, (void*) &VRAM_A[(textures[texture] & 0xFFFF) << 2], mem_size >> 1, DMA_16NOW); - if(pa_3Dbanks == 2) vramSetBankB(VRAM_B_TEXTURE); - vramSetBankA(VRAM_A_TEXTURE); -} - -void PA_3DSetSpriteFrame(u16 sprite, u16 frame){ - u16 texture = pa_3dsprites[sprite].textureID; - s16 mem_size = pa_3dsprites[sprite].ImgWidth * pa_3dsprites[sprite].ImgHeight; - u8 type = ((textures[texture]>>26)&7); - switch(type){ - case TEX_16BITS: - mem_size = mem_size << 1; - break; - case TEX_4COL: - mem_size = mem_size >> 2; - break; - case TEX_16COL: - mem_size = mem_size >> 1; - break; - } - PA_3DUpdateGfx(texture, texturesptr[texture] + mem_size*frame); -} - -void PA_3DUpdateSpriteAnims(){ - // BEWARE: Horrible code!!!!!! -- fincs - u16 anims = n3Dspriteanims; - u16 currentsprite = 0; - - for(; (anims > 0) && (currentsprite < PA_NMAXSPRITES); currentsprite ++) - if(sprite3danims[currentsprite].play){ - sprite3danims[currentsprite].time += sprite3danims[currentsprite].speed; - if(sprite3danims[currentsprite].time >= 60){ - while(sprite3danims[currentsprite].time >= 60){ - sprite3danims[currentsprite].time -= 60; - sprite3danims[currentsprite].currentframe += sprite3danims[currentsprite].framechange; - // I'M SPEECHLESS - OMGWTFBBQ?!?!?! Nominations for THE LONGEST if() CONDITION EVER -- fincs - if(((sprite3danims[currentsprite].framechange > 0) && (sprite3danims[currentsprite].currentframe > sprite3danims[currentsprite].lastframe))||((sprite3danims[currentsprite].framechange < 0) && (sprite3danims[currentsprite].currentframe < sprite3danims[currentsprite].firstframe))){ - if (sprite3danims[currentsprite].type == ANIM_LOOP) // Loop - sprite3danims[currentsprite].currentframe = sprite3danims[currentsprite].firstframe; - else{ // Don't loop, go back -> switch speed and first/last frames - sprite3danims[currentsprite].framechange = -sprite3danims[currentsprite].framechange; - if(sprite3danims[currentsprite].ncycles == 1) // It was the last one - sprite3danims[currentsprite].currentframe+=sprite3danims[currentsprite].framechange; - else - sprite3danims[currentsprite].currentframe+=sprite3danims[currentsprite].framechange<<1; // continue going back and forth - } - // In all cases: - sprite3danims[currentsprite].ncycles --; // 1 less to do - if (sprite3danims[currentsprite].ncycles == 0) - PA_3DStopSpriteAnim(currentsprite); - else if(sprite3danims[currentsprite].ncycles < 0) - sprite3danims[currentsprite].ncycles = -1; // Inifinite - } - } - PA_3DSetSpriteFrame(currentsprite, sprite3danims[currentsprite].currentframe); - } - anims--; // Une de faite ! - } -} - -void PA_3DStartSpriteAnimEx(u16 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles){ - sprite3danims[sprite].currentframe = sprite3danims[sprite].firstframe = firstframe; - sprite3danims[sprite].lastframe = lastframe; - sprite3danims[sprite].speed = speed; - sprite3danims[sprite].time = 0; - sprite3danims[sprite].type = type; - sprite3danims[sprite].ncycles = ncycles; - sprite3danims[sprite].framechange = 1; // normal change to start - - if(!sprite3danims[sprite].play) // Counts number of sprites playing... - n3Dspriteanims += 1; - - PA_3DSetSpriteFrame(sprite, firstframe); // Set first animation frame - sprite3danims[sprite].play = 1; // playing... -} - -void PA_Init3DDual(){ - PA_Init3D2Banks(); - PA_Reset3DSprites2Banks(); - - // Init the Sub screen (test if eli can set this up correctly) - // Set the Sub screen for 15 bit 2D - videoSetModeSub(MODE_5_2D | DISPLAY_BG2_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_2D_BMP_256); - - REG_BG2CNT_SUB = BG_BMP16_256x256; - REG_BG2PA_SUB = 256; - REG_BG2PB_SUB = 0; - REG_BG2PC_SUB = 0; - REG_BG2PD_SUB = 256; - REG_BG2X_SUB = 0; - REG_BG2Y_SUB = 0; - - vramSetBankC(VRAM_C_SUB_BG); - vramSetBankD(VRAM_D_SUB_SPRITE); - - int x, y; - - PA_ResetSpriteSysScreen(1); - - for (y = 0; y < 3; y ++)for (x = 0; x < 4; x ++){ - PA_Create16bitSpriteFromGfx(1, x + y*4, x*8 + y*256, OBJ_SIZE_64X64, x*64, y*64); - } - PA_UpdateOAM1(); - - pa_3Ddual = 1; - pa_3Dscreen = 0; -} - -void PA_3DCapture(){ - if(pa_3Dscreen){ - vramSetBankC(VRAM_C_LCD); - vramSetBankD(VRAM_D_SUB_SPRITE); - PA_SetRegCapture(true, 0, 31, 2, 0, 3, 0, 0); - }else{ - vramSetBankC(VRAM_C_SUB_BG); - vramSetBankD(VRAM_D_LCD); - PA_SetRegCapture(true, 0, 31, 3, 0, 3, 0, 0); - } -} +#include + +pa3dsprites pa_3dsprites[PA_NMAXSPRITES]; // 3D Sprite infos + +s16 pa_freetextures; + +#define N_TEXTURES 1024 + +u16 n_free_mem3D; // nombre d'emplacements libres +u16 used_mem3D[16384]; // Note la quantit� de m�moire utilis�e en chaque point de la m�moire pour pouvoir effacer les gfx... +s16 obj_per_gfx3D[N_TEXTURES]; // Nombre de sprites utilisant un gfx donn�... +mem_usage free_mem3D[16384]; + +type_3danims sprite3danims[PA_NMAXSPRITES]; + +u16 n3Dspriteanims; + +u16 freetexslots[N_TEXTURES]; // Free Texture Slots... + +u8 pa_3Dbanks; + +uint32 textures[MAX_TEXTURES]; +void* texturesptr[MAX_TEXTURES]; // for updates... +uint32 activeTexture; + +void PA_3DUpdateSpriteAnims(); +void PA_3DCapture(); + +u8 pa_3Ddual = 0; +u8 pa_3Dscreen = 0; + +void PA_SetRegCapture(bool enable, uint8 srcBlend, uint8 destBlend, uint8 bank, uint8 offset, uint8 size, uint8 source, uint8 srcOffset){ + uint32 value = 0; + if(enable) value |= 1 << 31; // 31 is enable + value |= 3 << 29; // 29-30 seems to have something to do with the blending + value |= (srcOffset & 0x3) << 26; // capture source offset is 26-27 + value |= (source & 0x3) << 24; // capture source is 24-25 + value |= (size & 0x3) << 20; // capture data write size is 20-21 + value |= (offset & 0x3) << 18; // write offset is 18-19 + value |= (bank & 0x3) << 16; // vram bank select is 16-17 + value |= (srcBlend & 0xFF) << 8; // graphics blend evb is 8..12 + value |= (destBlend & 0xFF) << 0; // ram blend EVA is bits 0..4 + REG_DISPCAPCNT = value; +} + +/* 40004A4h - Cmd 29h - POLYGON_ATTR + 0-3 Light 0..3 Enable Flags (each bit: 0=Disable, 1=Enable) + 4-5 Polygon Mode (0=Modulation,1=Decal,2=Toon/Highlight Shading,3=Shadow) + 6 Polygon Back Surface (0=Hide, 1=Render) ;Line-segments are always + 7 Polygon Front Surface (0=Hide, 1=Render) ;rendered (no front/back) + 8-10 Not used + 11 Depth-value for Translucent Polygons (0=Keep Old, 1=Set New Depth) + 12 Far-plane intersecting polygons (0=Hide, 1=Render/clipped) + 13 1-Dot polygons behind DISP_1DOT_DEPTH (0=Hide, 1=Render) + 14 Depth Test, Draw Pixels with Depth (0=Less, 1=Equal) (usually 0) + 15 Fog Enable (0=Disable, 1=Enable) + 16-20 Alpha (0=Wire-Frame, 1..30=Translucent, 31=Solid) + 21-23 Not used + 24-29 Polygon ID (00h..3Fh, used for translucent, shadow, and edge-marking) + 30-31 Not used + */ + +#define PA_glRotateX(a) glRotateXi((a)<<6) +#define PA_glRotateY(a) glRotateYi((a)<<6) +#define PA_glRotateZ(a) glRotateZi((a)<<6) + +static inline void PA_glVertex(u16 x, u16 y, u16 z){ + GFX_VERTEX16 = (y << 16) | (x & 0xFFFF); + GFX_VERTEX16 = ((uint32)z); +} + +static inline void PA_glTranslate(s32 x, s32 y, s32 z){ + MATRIX_TRANSLATE = x; + MATRIX_TRANSLATE = y; + MATRIX_TRANSLATE = z; +} + +#define PA_StartQuad() GFX_BEGIN = GL_QUAD + +void PA_3DSpriteToScreen(u16 sprite, s16 ydecal){ + MATRIX_PUSH = 0; + + PA_glTranslate(pa_3dsprites[sprite].X, (192-(pa_3dsprites[sprite].Y+ydecal)), pa_3dsprites[sprite].Priority); + + GFX_TEX_FORMAT = textures[pa_3dsprites[sprite].textureID]; + activeTexture = pa_3dsprites[sprite].textureID; + + PA_glRotateX(pa_3dsprites[sprite].RotX); + PA_glRotateY(pa_3dsprites[sprite].RotY); + PA_glRotateZ(pa_3dsprites[sprite].RotZ); + + GFX_POLY_FORMAT = (1<<6) | (1<<7) | (pa_3dsprites[sprite].alpha << 16) | (pa_3dsprites[sprite].polyID << 24); + GFX_PAL_FORMAT = pa_3dsprites[sprite].palette << 5; + + u32 x1, x2, y1, y2; + u8 hflip = pa_3dsprites[sprite].Hflip; + u8 vflip = pa_3dsprites[sprite].Vflip; + + x1 = inttot16(pa_3dsprites[sprite].ImgWidth) * hflip; + x2 = inttot16(pa_3dsprites[sprite].ImgWidth) * (!hflip); + y1 = inttot16(pa_3dsprites[sprite].ImgHeight) * (!vflip); + y2 = inttot16(pa_3dsprites[sprite].ImgHeight) * vflip; + + s32 zoomx0 = pa_3dsprites[sprite].Width >> 1; + s32 zoomx1 = (pa_3dsprites[sprite].Width + 1) >> 1; + s32 zoomy0 = pa_3dsprites[sprite].Height >> 1; + s32 zoomy1 = (pa_3dsprites[sprite].Height + 1) >> 1; + + // Start drawing texture + PA_StartQuad(); + + GFX_NORMAL = NORMAL_PACK(0, inttov10(-1), 0); + + GFX_TEX_COORD = TEXTURE_PACK(x1, y1); + PA_glVertex(-zoomx1 + pa_3dsprites[sprite].corner[2].x, -zoomy1 - pa_3dsprites[sprite].corner[2].y, 0); + + GFX_TEX_COORD = TEXTURE_PACK(x2, y1); + PA_glVertex(zoomx0 + pa_3dsprites[sprite].corner[3].x, -zoomy1 - pa_3dsprites[sprite].corner[3].y, 0); + + GFX_TEX_COORD = TEXTURE_PACK(x2, y2); + PA_glVertex(zoomx0 + pa_3dsprites[sprite].corner[1].x, zoomy0 - pa_3dsprites[sprite].corner[1].y, 0); + + GFX_TEX_COORD = TEXTURE_PACK(x1, y2); + PA_glVertex(-zoomx1 + pa_3dsprites[sprite].corner[0].x, zoomy0 - pa_3dsprites[sprite].corner[0].y, 0); + + // An 'end' signal isn't needed by the Nintendo DS nor no$gba. + + MATRIX_POP = 1; +} + +void PA_glReset(){ + while(GFX_BUSY); // wait until the gfx engine is not busy + + // Clear the FIFO + GFX_STATUS |= (1 << 29); + + // Clear overflows for list memory + GFX_CONTROL = (1 << 12) | (1 << 13) | GL_TEXTURE_2D; + glResetMatrixStack(); + + GFX_TEX_FORMAT = 0; + GFX_POLY_FORMAT = 0; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +void PA_3DProcess(){ + if(pa_3Ddual) PA_3DCapture(); + + PA_3DUpdateSpriteAnims(); // Update animations... + PA_glReset(); + glEnable(GL_BLEND); + glAlphaFunc(BLEND_ALPHA); + + MATRIX_CONTROL = GL_PROJECTION; + glLoadIdentity(); + + glOrthof32(0, 256, 0, 192, 0, 8192); + + gluLookAtf32(0, 0, 4096, // Camera position + 0, 0, 0, // Look-at + 0, 4096, 0); // Up + + MATRIX_CONTROL = GL_TEXTURE; + glLoadIdentity(); + + MATRIX_CONTROL = GL_MODELVIEW; + + glMaterialf(GL_AMBIENT, RGB15(31, 31, 31)); + glMaterialf(GL_DIFFUSE, RGB15(31, 31, 31)); + glMaterialf(GL_SPECULAR, BIT(15) | RGB15(15, 15, 15)); + glMaterialf(GL_EMISSION, RGB15(31, 31, 31)); + + // The DS uses a table for shinyness... This generates a halfassed one + glMaterialShinyness(); + + GFX_TEX_FORMAT |= (1 << 29); // Palette index 0 = transparent + + int i; + + if(pa_3Ddual){ + if(pa_3Dscreen == 1){ + for(i = 0; i < PA_NMAXSPRITES; i ++) + if(pa_3dsprites[i].Alive) + PA_3DSpriteToScreen(i, 0); + }else{ + for(i = 0; i < PA_NMAXSPRITES; i ++) + if(pa_3dsprites[i].Alive) + PA_3DSpriteToScreen(i, -PA_ScreenSpace); + } + PA_SwitchScreens(); + pa_3Dscreen = !pa_3Dscreen; + }else // Normal + for(i = 0; i < PA_NMAXSPRITES; i++) + if(pa_3dsprites[i].Alive) + PA_3DSpriteToScreen(i, 0); + + GFX_FLUSH = 0; +} + +void PA_3DDeleteTex(u32 tex_gfx){ + u16 i; + u16 j; + u8 exit = 0; + s8 decal = 0; // D�calage que l'on aura � faire pour classer le tableau... + obj_per_gfx3D[tex_gfx] = 0; + freetexslots[pa_freetextures] = tex_gfx; + pa_freetextures ++; + tex_gfx = (textures[tex_gfx] & (0xFFFF)) >> 1; + + // Gestion dynamique de la m�moire... + for(i = 0; ((i < n_free_mem3D) && !exit); i ++){ // On regarde les diff�rents emplacements m�moire pour ajouter le morceau libre dans le tas... + if(tex_gfx < free_mem3D[i].mem_block){ // Si on a un trou qui pr�c�de le premier trou dispo, on va devoir tout d�caler...peut-etre ! + exit = 1; // On va pourvoir sortir, apr�s avir ordonn� le tableau... + decal = 1; + + if((i > 0) && (tex_gfx > 0) && (free_mem3D[i - 1].mem_block + free_mem3D[i - 1].free == tex_gfx)){ // On a 2 cases c�tes � c�tes, donc pas besoin de d�caler, on ajouter la mem dispo... + free_mem3D[i-1].free += used_mem3D[tex_gfx]; + tex_gfx = free_mem3D[i-1].mem_block; + used_mem3D[tex_gfx] = free_mem3D[i-1].free; + decal = 0; + } + + if(tex_gfx + used_mem3D[tex_gfx] == free_mem3D[i].mem_block){ // Si le bloc d'apr�s suit parfaitement le bloc qu'on vient d'ajouter... + -- decal; + free_mem3D[i].mem_block = tex_gfx; + free_mem3D[i].free += used_mem3D[tex_gfx]; + } + + // Si le d�calage est de 0, on touche � rien + if(decal == -1){ // On doit d�caler vers la gauche... les donn�es sont d�j� dans le tableau + for(j = i - 1; j < n_free_mem3D; j ++) // On recopie la liste plus loin... + free_mem3D[j] = free_mem3D[j + 1]; + n_free_mem3D --; + }else if(decal == 1){ // On doit tout d�caler pour faire rentrer la case vide... + n_free_mem3D ++; + + for (j = n_free_mem3D; j > i; j --) // On recopie la liste plus loin... + free_mem3D[j] = free_mem3D[j - 1]; + + free_mem3D[i].mem_block = tex_gfx; + free_mem3D[i].free = used_mem3D[tex_gfx]; + } + } + } + + used_mem3D[tex_gfx] = 0; +} + +s16 PA_3DCreateTex(void* obj_data, u16 width, u16 height, u8 type){ + pa_freetextures--; // One less texture slot + s16 currenttex = freetexslots[pa_freetextures]; + GFX_TEX_FORMAT = textures[currenttex]; + activeTexture = currenttex; + int i; + s16 texwidth = -1; + s16 texheight = -1; + + for(i = 0; i < 7; i ++){ // Get height... + if(width == (1 << (i + 3))) texwidth = i; + + if(height == (1 << (i + 3))) texheight = i; + } + + u32 mem_size = width * height; + + // Correct size + switch(type){ + case TEX_16BITS: + mem_size = mem_size << 1; + break; + case TEX_4COL: + mem_size = mem_size >> 2; + break; + case TEX_16COL: + mem_size = mem_size >> 1; + break; + default: + break; + } + + u32 block_size = mem_size >> 4; // block size + u8 exit = 0; + u16 n_mem = 0; + u32 truenumber; + + for(i = 0; (i < n_free_mem3D) && !exit; i ++) + if(block_size <= free_mem3D[i].free){ + n_mem = i; + exit = 1; + } + + i = free_mem3D[n_mem].mem_block; // On met la valeur de cot� pour la renvoyer... + truenumber = (u32) &VRAM_A[i << 3]; + used_mem3D[i] = block_size; // Nombre de blocks + + // Start Copy... + vramSetBankA(VRAM_A_LCD); + + if(pa_3Dbanks == 2) vramSetBankB(VRAM_B_LCD); + DMA_Copy(obj_data, (void*) truenumber, mem_size >> 1, DMA_16NOW); + if(pa_3Dbanks == 2) vramSetBankB(VRAM_B_TEXTURE); + + vramSetBankA(VRAM_A_TEXTURE); + + PA_glTexParameter(texwidth, texheight, (u32*)truenumber, type, TEXGEN_TEXCOORD); + free_mem3D[n_mem].free -= block_size; + + if(free_mem3D[n_mem].free > 0) + free_mem3D[n_mem].mem_block += block_size; // S'il reste un bout libre, on garde... + else {// On doit tout d�caler d'un cran... vers la gauche + for (i = n_mem; i < n_free_mem3D; i++) // On recopie la liste plus loin... + free_mem3D[i] = free_mem3D[i + 1]; + --n_free_mem3D; + } + + texturesptr[currenttex] = (void*) obj_data; // Save pointer for animations + obj_per_gfx3D[currenttex] = 1; // Nombre d'objets sur ce gfx... + return currenttex; +} + +void PA_3DCreateSpriteFromTex(u16 sprite, u16 texture, u16 width, u16 height, u8 palette, s16 x, s16 y){ + pa_3dsprites[sprite].Alive = 1; + pa_3dsprites[sprite].X = x; pa_3dsprites[sprite].Y = y; + pa_3dsprites[sprite].ImgWidth = width; + pa_3dsprites[sprite].ImgHeight = height; + pa_3dsprites[sprite].Width = width; + pa_3dsprites[sprite].Height = height; + pa_3dsprites[sprite].Hflip = 0; pa_3dsprites[sprite].Vflip = 0; + pa_3dsprites[sprite].RotX = 0; pa_3dsprites[sprite].RotY = 0; pa_3dsprites[sprite].RotZ = 0; + pa_3dsprites[sprite].textureID = texture; + pa_3dsprites[sprite].Priority = 1024; + pa_3dsprites[sprite].alpha = 31; // Solid + pa_3dsprites[sprite].polyID = 0; // 0 polyID by default + + int i; + for(i = 0; i < 4; i++){ + pa_3dsprites[sprite].corner[i].x = 0; + pa_3dsprites[sprite].corner[i].y = 0; + } + + if(((textures[texture]>>26)&7) == TEX_4COL) + pa_3dsprites[sprite].palette = palette << 1; // 1 more... + else + pa_3dsprites[sprite].palette = palette; + + obj_per_gfx3D[texture]++; +} + +void PA_Reset3DSprites(){ + n_free_mem3D = 1; + free_mem3D[0].mem_block = 0; + free_mem3D[0].free = 8192; // Number of free blocks in memory + int i; + for(i = 0; i < PA_NMAXSPRITES; i ++){ + pa_3dsprites[i].Alive = 0; // Delete sprite + sprite3danims[i].play = 0; // No animation + } + for(i = 0; i < 1024; i ++) freetexslots[i] = 1023 - i; // free slots... + pa_freetextures = 1024; + n3Dspriteanims = 0; + pa_3Dbanks = 1; +} + +void PA_Reset3DSprites2Banks(){ + n_free_mem3D = 1; + free_mem3D[0].mem_block = 0; free_mem3D[0].free = 16384; // Number of free blocks in memory + int i; + for(i = 0; i < PA_NMAXSPRITES; i ++){ + pa_3dsprites[i].Alive = 0; // Delete sprite + sprite3danims[i].play = 0; // No animation + } + for(i = 0; i < 1024; i ++) freetexslots[i] = 1023 - i; // free slots... + pa_freetextures = 1024; + n3Dspriteanims = 0; + pa_3Dbanks = 2; +} + +void PA_3DUpdateGfx(u16 texture, void* image){ + s32 mem_size = 1 <<(6+((textures[texture]>>20)&7)+((textures[texture]>>23)&7)); + u8 type = ((textures[texture]>>26)&7); + switch(type){ + case TEX_16BITS: + mem_size = mem_size << 1; + break; + case TEX_4COL: + mem_size = mem_size >> 2; + break; + case TEX_16COL: + mem_size = mem_size >> 1; + break; + } + vramSetBankA(VRAM_A_LCD); + if(pa_3Dbanks == 2) vramSetBankB(VRAM_B_LCD); + DMA_Copy(image, (void*) &VRAM_A[(textures[texture] & 0xFFFF) << 2], mem_size >> 1, DMA_16NOW); + if(pa_3Dbanks == 2) vramSetBankB(VRAM_B_TEXTURE); + vramSetBankA(VRAM_A_TEXTURE); +} + +void PA_3DSetSpriteFrame(u16 sprite, u16 frame){ + u16 texture = pa_3dsprites[sprite].textureID; + s16 mem_size = pa_3dsprites[sprite].ImgWidth * pa_3dsprites[sprite].ImgHeight; + u8 type = ((textures[texture]>>26)&7); + switch(type){ + case TEX_16BITS: + mem_size = mem_size << 1; + break; + case TEX_4COL: + mem_size = mem_size >> 2; + break; + case TEX_16COL: + mem_size = mem_size >> 1; + break; + } + PA_3DUpdateGfx(texture, texturesptr[texture] + mem_size*frame); +} + +void PA_3DUpdateSpriteAnims(){ + // BEWARE: Horrible code!!!!!! -- fincs + u16 anims = n3Dspriteanims; + u16 currentsprite = 0; + + for(; (anims > 0) && (currentsprite < PA_NMAXSPRITES); currentsprite ++) + if(sprite3danims[currentsprite].play){ + sprite3danims[currentsprite].time += sprite3danims[currentsprite].speed; + if(sprite3danims[currentsprite].time >= 60){ + while(sprite3danims[currentsprite].time >= 60){ + sprite3danims[currentsprite].time -= 60; + sprite3danims[currentsprite].currentframe += sprite3danims[currentsprite].framechange; + // I'M SPEECHLESS - OMGWTFBBQ?!?!?! Nominations for THE LONGEST if() CONDITION EVER -- fincs + if(((sprite3danims[currentsprite].framechange > 0) && (sprite3danims[currentsprite].currentframe > sprite3danims[currentsprite].lastframe))||((sprite3danims[currentsprite].framechange < 0) && (sprite3danims[currentsprite].currentframe < sprite3danims[currentsprite].firstframe))){ + if (sprite3danims[currentsprite].type == ANIM_LOOP) // Loop + sprite3danims[currentsprite].currentframe = sprite3danims[currentsprite].firstframe; + else{ // Don't loop, go back -> switch speed and first/last frames + sprite3danims[currentsprite].framechange = -sprite3danims[currentsprite].framechange; + if(sprite3danims[currentsprite].ncycles == 1) // It was the last one + sprite3danims[currentsprite].currentframe+=sprite3danims[currentsprite].framechange; + else + sprite3danims[currentsprite].currentframe+=sprite3danims[currentsprite].framechange<<1; // continue going back and forth + } + // In all cases: + sprite3danims[currentsprite].ncycles --; // 1 less to do + if (sprite3danims[currentsprite].ncycles == 0) + PA_3DStopSpriteAnim(currentsprite); + else if(sprite3danims[currentsprite].ncycles < 0) + sprite3danims[currentsprite].ncycles = -1; // Inifinite + } + } + PA_3DSetSpriteFrame(currentsprite, sprite3danims[currentsprite].currentframe); + } + anims--; // Une de faite ! + } +} + +void PA_3DStartSpriteAnimEx(u16 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles){ + sprite3danims[sprite].currentframe = sprite3danims[sprite].firstframe = firstframe; + sprite3danims[sprite].lastframe = lastframe; + sprite3danims[sprite].speed = speed; + sprite3danims[sprite].time = 0; + sprite3danims[sprite].type = type; + sprite3danims[sprite].ncycles = ncycles; + sprite3danims[sprite].framechange = 1; // normal change to start + + if(!sprite3danims[sprite].play) // Counts number of sprites playing... + n3Dspriteanims += 1; + + PA_3DSetSpriteFrame(sprite, firstframe); // Set first animation frame + sprite3danims[sprite].play = 1; // playing... +} + +void PA_Init3DDual(){ + PA_Init3D2Banks(); + PA_Reset3DSprites2Banks(); + + // Init the Sub screen (test if eli can set this up correctly) + // Set the Sub screen for 15 bit 2D + videoSetModeSub(MODE_5_2D | DISPLAY_BG2_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_2D_BMP_256); + + REG_BG2CNT_SUB = BG_BMP16_256x256; + REG_BG2PA_SUB = 256; + REG_BG2PB_SUB = 0; + REG_BG2PC_SUB = 0; + REG_BG2PD_SUB = 256; + REG_BG2X_SUB = 0; + REG_BG2Y_SUB = 0; + + vramSetBankC(VRAM_C_SUB_BG); + vramSetBankD(VRAM_D_SUB_SPRITE); + + int x, y; + + PA_ResetSpriteSysScreen(1); + + for (y = 0; y < 3; y ++)for (x = 0; x < 4; x ++){ + PA_Create16bitSpriteFromGfx(1, x + y*4, x*8 + y*256, OBJ_SIZE_64X64, x*64, y*64); + } + PA_UpdateOAM1(); + + pa_3Ddual = 1; + pa_3Dscreen = 0; +} + +void PA_3DCapture(){ + if(pa_3Dscreen){ + vramSetBankC(VRAM_C_LCD); + vramSetBankD(VRAM_D_SUB_SPRITE); + PA_SetRegCapture(true, 0, 31, 2, 0, 3, 0, 0); + }else{ + vramSetBankC(VRAM_C_SUB_BG); + vramSetBankD(VRAM_D_LCD); + PA_SetRegCapture(true, 0, 31, 3, 0, 3, 0, 0); + } +} diff --git a/source/arm9/PA_ASM.s b/source/arm9/PA_ASM.s index e3cfe2d..c967af6 100644 --- a/source/arm9/PA_ASM.s +++ b/source/arm9/PA_ASM.s @@ -1,29 +1,29 @@ -.arch armv5te - -.text -.arm -.align 2 - -.global PA_IsEmulator -PA_IsEmulator: @ based on the "emulators don't emulate instruction fetching" exploit - ldr r0, .Lmov_r0_r0 - ldr r2, .Lmov_r0_0 - mov r1, pc @ r1 = two instructions ahead of the current instruction - str r0, [r1] - mov r0, #0 - str r2, [r1] - bx lr - -.Lmov_r0_r0: mov r0, r0 -.Lmov_r0_0: mov r0, #0 - -.global _PA_iDeaS_OutputText -_PA_iDeaS_OutputText: - swi 0xFC000 - bx lr - -.global _PA_iDeaS_Breakpoint -_PA_iDeaS_Breakpoint: - swi 0xFD000 - bx lr +.arch armv5te + +.text +.arm +.align 2 + +.global PA_IsEmulator +PA_IsEmulator: @ based on the "emulators don't emulate instruction fetching" exploit + ldr r0, .Lmov_r0_r0 + ldr r2, .Lmov_r0_0 + mov r1, pc @ r1 = two instructions ahead of the current instruction + str r0, [r1] + mov r0, #0 + str r2, [r1] + bx lr + +.Lmov_r0_r0: mov r0, r0 +.Lmov_r0_0: mov r0, #0 + +.global _PA_iDeaS_OutputText +_PA_iDeaS_OutputText: + swi 0xFC000 + bx lr + +.global _PA_iDeaS_Breakpoint +_PA_iDeaS_Breakpoint: + swi 0xFD000 + bx lr \ No newline at end of file diff --git a/source/arm9/PA_BgEasy.c b/source/arm9/PA_BgEasy.c index 61367d6..2d53a56 100644 --- a/source/arm9/PA_BgEasy.c +++ b/source/arm9/PA_BgEasy.c @@ -1,53 +1,53 @@ -#include - -void PA_EasyBgScrollX(u8 screen, u8 bg_number, s32 x) { - if ((PA_BgInfo[screen][bg_number].BgMode == BG_TILEDBG) || (PA_BgInfo[screen][bg_number].BgMode == 0)) - PA_BGScrollX(screen, bg_number, x&511); - else PA_InfLargeScrollX(screen, bg_number, x); -} - -void PA_EasyBgScrollY(u8 screen, u8 bg_number, s32 y) { - if ((PA_BgInfo[screen][bg_number].BgMode == BG_TILEDBG) || (PA_BgInfo[screen][bg_number].BgMode == 0)) - PA_BGScrollY(screen, bg_number, y&511); - else PA_InfLargeScrollY(screen, bg_number, y); -} - -void PA_StoreEasyBgInfos(u8 screen, u8 bg_number, u32 Type, u32 Width, u32 Height, void *Tiles, u32 TileSize, void *Map, u32 MapSize, void *Palette) { - PA_BgInfo[screen][bg_number].Infos.Type = Type; - PA_BgInfo[screen][bg_number].Infos.Width = Width; - PA_BgInfo[screen][bg_number].Infos.Height = Height; - //PA_OutputText(1, 0,5, "%d - %d ", PA_BgInfo[screen][bg_number].Infos.Width, PA_BgInfo[screen][bg_number].Infos.Height); - PA_BgInfo[screen][bg_number].Infos.Tiles = Tiles; - PA_BgInfo[screen][bg_number].Infos.TileSize = TileSize; - PA_BgInfo[screen][bg_number].Infos.Map = Map; - PA_BgInfo[screen][bg_number].Infos.MapSize = MapSize; - PA_BgInfo[screen][bg_number].Infos.Palette = Palette; - PA_BgInfo[screen][bg_number].BgMode = Type; -} - -void PA_EasyBgLoadEx(u8 screen, u8 bg_number, u32 *Infos, void *Tiles, u32 TileSize, void *Map, u32 MapSize, void *Palette) { - PA_StoreEasyBgInfos(screen, bg_number, Infos[0], Infos[1], Infos[2], Tiles, TileSize, Map, MapSize, Palette); - PA_LoadBgPal(screen, bg_number, Palette); - PA_DeleteBg(screen, bg_number); - - if (PA_BgInfo[screen][bg_number].BgMode == BG_TILEDBG) { - PA_LoadBgTilesEx(screen, bg_number, Tiles, TileSize >> 1); - PA_LoadBgMap(screen, bg_number, Map, PA_GetPAGfxBgSize(Infos[1], Infos[2])); - PA_InitBg(screen, bg_number, PA_GetPAGfxBgSize(Infos[1], Infos[2]), 0, 1); - } else { - PA_BgInfo[screen][bg_number].NTiles = TileSize >> 5; - - if (PA_BgInfo[screen][bg_number].BgMode == BG_LARGEMAP) { - PA_LoadBgTilesEx(screen, bg_number, Tiles, TileSize >> 1); - } else { - PA_LoadBgTilesEx(screen, bg_number, NULL, (1008 << 5)); - } - - PA_BgInfo[screen][bg_number].Tiles = Tiles; - PA_LoadBgMap(screen, bg_number, NULL, BG_512X256); - PA_InitBg(screen, bg_number, BG_512X256, 0, 1); - PA_InitLargeBg(screen, bg_number, Infos[1] >> 3, Infos[2] >> 3, Map); - } - - PA_BGScrollXY(screen, bg_number, 0, 0); -} +#include + +void PA_EasyBgScrollX(u8 screen, u8 bg_number, s32 x) { + if ((PA_BgInfo[screen][bg_number].BgMode == BG_TILEDBG) || (PA_BgInfo[screen][bg_number].BgMode == 0)) + PA_BGScrollX(screen, bg_number, x&511); + else PA_InfLargeScrollX(screen, bg_number, x); +} + +void PA_EasyBgScrollY(u8 screen, u8 bg_number, s32 y) { + if ((PA_BgInfo[screen][bg_number].BgMode == BG_TILEDBG) || (PA_BgInfo[screen][bg_number].BgMode == 0)) + PA_BGScrollY(screen, bg_number, y&511); + else PA_InfLargeScrollY(screen, bg_number, y); +} + +void PA_StoreEasyBgInfos(u8 screen, u8 bg_number, u32 Type, u32 Width, u32 Height, void *Tiles, u32 TileSize, void *Map, u32 MapSize, void *Palette) { + PA_BgInfo[screen][bg_number].Infos.Type = Type; + PA_BgInfo[screen][bg_number].Infos.Width = Width; + PA_BgInfo[screen][bg_number].Infos.Height = Height; + //PA_OutputText(1, 0,5, "%d - %d ", PA_BgInfo[screen][bg_number].Infos.Width, PA_BgInfo[screen][bg_number].Infos.Height); + PA_BgInfo[screen][bg_number].Infos.Tiles = Tiles; + PA_BgInfo[screen][bg_number].Infos.TileSize = TileSize; + PA_BgInfo[screen][bg_number].Infos.Map = Map; + PA_BgInfo[screen][bg_number].Infos.MapSize = MapSize; + PA_BgInfo[screen][bg_number].Infos.Palette = Palette; + PA_BgInfo[screen][bg_number].BgMode = Type; +} + +void PA_EasyBgLoadEx(u8 screen, u8 bg_number, u32 *Infos, void *Tiles, u32 TileSize, void *Map, u32 MapSize, void *Palette) { + PA_StoreEasyBgInfos(screen, bg_number, Infos[0], Infos[1], Infos[2], Tiles, TileSize, Map, MapSize, Palette); + PA_LoadBgPal(screen, bg_number, Palette); + PA_DeleteBg(screen, bg_number); + + if (PA_BgInfo[screen][bg_number].BgMode == BG_TILEDBG) { + PA_LoadBgTilesEx(screen, bg_number, Tiles, TileSize >> 1); + PA_LoadBgMap(screen, bg_number, Map, PA_GetPAGfxBgSize(Infos[1], Infos[2])); + PA_InitBg(screen, bg_number, PA_GetPAGfxBgSize(Infos[1], Infos[2]), 0, 1); + } else { + PA_BgInfo[screen][bg_number].NTiles = TileSize >> 5; + + if (PA_BgInfo[screen][bg_number].BgMode == BG_LARGEMAP) { + PA_LoadBgTilesEx(screen, bg_number, Tiles, TileSize >> 1); + } else { + PA_LoadBgTilesEx(screen, bg_number, NULL, (1008 << 5)); + } + + PA_BgInfo[screen][bg_number].Tiles = Tiles; + PA_LoadBgMap(screen, bg_number, NULL, BG_512X256); + PA_InitBg(screen, bg_number, BG_512X256, 0, 1); + PA_InitLargeBg(screen, bg_number, Infos[1] >> 3, Infos[2] >> 3, Map); + } + + PA_BGScrollXY(screen, bg_number, 0, 0); +} diff --git a/source/arm9/PA_BgGetPixel.c b/source/arm9/PA_BgGetPixel.c index 86380ec..50c26c9 100644 --- a/source/arm9/PA_BgGetPixel.c +++ b/source/arm9/PA_BgGetPixel.c @@ -1,72 +1,72 @@ -#include - -EasyBgPixels PA_EasyBgPixel[6] = {PANoPixel, PANoPixel, PAEasyBgGetPixelTiled, PANoPixel, PAEasyBgGetPixelLarge, PAEasyBgGetPixelInf}; // Background types - -u8 PAEasyBgGetPixelTiled(u8 screen, u8 bg_number, s32 x, s32 y) { - // Adjust X/Y values - x += PA_BgInfo[screen][bg_number].ScrollX; x &= (PA_BgInfo[screen][bg_number].Infos.Width - 1); - y += PA_BgInfo[screen][bg_number].ScrollY; y %= (PA_BgInfo[screen][bg_number].Infos.Height); - s32 mappos; - - if ((x <= 256) && (y <= 256)) {// Normal default size - mappos = (x >> 3) + ((y >> 3) * 32); // Adjust position in map - } else if ((x > 256) && (y <= 256)) { - mappos = 32 * 32 + ((x & 255) >> 3) + ((y >> 3) * 32); // Adjust position in map - } else if ((x <= 256) && (y > 256)) { // Tall - mappos = 64 * 32 + (x >> 3) + (((y - 256) >> 3) * 32); // Adjust position in map - } else { - mappos = 96 * 32 + ((x - 256) >> 3) + (((y - 256) >> 3) * 32); // Adjust position in map - } - - u16 *Map = (u16*)PA_BgInfo[screen][bg_number].Infos.Map; - s32 tilepix = (Map[mappos] & 1023) << 6; - u8 hflip = (Map[mappos] >> 10) & 1; - u8 vflip = (Map[mappos] >> 11) & 1; - x &= 7; y &= 7; // Adjust in tile... - - if (hflip) x = 7 - x; - if (vflip) y = 7 - y; // Adjust flips... - - u8 *Tiles = (u8*)PA_BgInfo[screen][bg_number].Infos.Tiles; - return Tiles[tilepix+x+(y<<3)]; -} - -u8 PAEasyBgGetPixelLarge(u8 screen, u8 bg_number, s32 x, s32 y) { - // Adjust X/Y values - x += PA_BgInfo[screen][bg_number].ScrollX; x = PA_Modulo(x, PA_BgInfo[screen][bg_number].Infos.Width); - y += PA_BgInfo[screen][bg_number].ScrollY; y = PA_Modulo(y, PA_BgInfo[screen][bg_number].Infos.Height); - s32 mappos = (x >> 3) + ((y >> 3) * (PA_BgInfo[screen][bg_number].Infos.Width >> 3)); // Adjust position in map - u16 *Map = (u16*)PA_BgInfo[screen][bg_number].Infos.Map; - s32 tilepix = (Map[mappos] & 1023) << 6; - u8 hflip = (Map[mappos] >> 10) & 1; - u8 vflip = (Map[mappos] >> 11) & 1; - x &= 7; y &= 7; // Adjust in tile... - - if (hflip) x = 7 - x; - if (vflip) y = 7 - y; // Adjust flips... - - u8 *Tiles = (u8*)PA_BgInfo[screen][bg_number].Infos.Tiles; - return Tiles[tilepix+x+(y<<3)]; -} - -u8 PANoPixel(u8 screen, u8 bg_number, s32 x, s32 y) { - return 0; -} - -u8 PAEasyBgGetPixelInf(u8 screen, u8 bg_number, s32 x, s32 y) { - // Adjust X/Y values - x += PA_BgInfo[screen][bg_number].ScrollX; x = PA_Modulo(x, PA_BgInfo[screen][bg_number].Infos.Width); - y += PA_BgInfo[screen][bg_number].ScrollY; y = PA_Modulo(y, PA_BgInfo[screen][bg_number].Infos.Height); - s32 mappos = (x >> 3) + ((y >> 3) * (PA_BgInfo[screen][bg_number].Infos.Width >> 3)); // Adjust position in map - u32 *Map = (u32*)PA_BgInfo[screen][bg_number].Infos.Map; - s32 tilepix = (Map[mappos] & INF_JUSTTILE) << 6; - u8 hflip = (Map[mappos] >> 29) & 1; - u8 vflip = (Map[mappos] >> 30) & 1; - x &= 7; y &= 7; // Adjust in tile... - - if (hflip) x = 7 - x; - if (vflip) y = 7 - y; // Adjust flips... - - u8 *Tiles = (u8*)PA_BgInfo[screen][bg_number].Infos.Tiles; - return Tiles[tilepix+x+(y<<3)]; -} +#include + +EasyBgPixels PA_EasyBgPixel[6] = {PANoPixel, PANoPixel, PAEasyBgGetPixelTiled, PANoPixel, PAEasyBgGetPixelLarge, PAEasyBgGetPixelInf}; // Background types + +u8 PAEasyBgGetPixelTiled(u8 screen, u8 bg_number, s32 x, s32 y) { + // Adjust X/Y values + x += PA_BgInfo[screen][bg_number].ScrollX; x &= (PA_BgInfo[screen][bg_number].Infos.Width - 1); + y += PA_BgInfo[screen][bg_number].ScrollY; y %= (PA_BgInfo[screen][bg_number].Infos.Height); + s32 mappos; + + if ((x <= 256) && (y <= 256)) {// Normal default size + mappos = (x >> 3) + ((y >> 3) * 32); // Adjust position in map + } else if ((x > 256) && (y <= 256)) { + mappos = 32 * 32 + ((x & 255) >> 3) + ((y >> 3) * 32); // Adjust position in map + } else if ((x <= 256) && (y > 256)) { // Tall + mappos = 64 * 32 + (x >> 3) + (((y - 256) >> 3) * 32); // Adjust position in map + } else { + mappos = 96 * 32 + ((x - 256) >> 3) + (((y - 256) >> 3) * 32); // Adjust position in map + } + + u16 *Map = (u16*)PA_BgInfo[screen][bg_number].Infos.Map; + s32 tilepix = (Map[mappos] & 1023) << 6; + u8 hflip = (Map[mappos] >> 10) & 1; + u8 vflip = (Map[mappos] >> 11) & 1; + x &= 7; y &= 7; // Adjust in tile... + + if (hflip) x = 7 - x; + if (vflip) y = 7 - y; // Adjust flips... + + u8 *Tiles = (u8*)PA_BgInfo[screen][bg_number].Infos.Tiles; + return Tiles[tilepix+x+(y<<3)]; +} + +u8 PAEasyBgGetPixelLarge(u8 screen, u8 bg_number, s32 x, s32 y) { + // Adjust X/Y values + x += PA_BgInfo[screen][bg_number].ScrollX; x = PA_Modulo(x, PA_BgInfo[screen][bg_number].Infos.Width); + y += PA_BgInfo[screen][bg_number].ScrollY; y = PA_Modulo(y, PA_BgInfo[screen][bg_number].Infos.Height); + s32 mappos = (x >> 3) + ((y >> 3) * (PA_BgInfo[screen][bg_number].Infos.Width >> 3)); // Adjust position in map + u16 *Map = (u16*)PA_BgInfo[screen][bg_number].Infos.Map; + s32 tilepix = (Map[mappos] & 1023) << 6; + u8 hflip = (Map[mappos] >> 10) & 1; + u8 vflip = (Map[mappos] >> 11) & 1; + x &= 7; y &= 7; // Adjust in tile... + + if (hflip) x = 7 - x; + if (vflip) y = 7 - y; // Adjust flips... + + u8 *Tiles = (u8*)PA_BgInfo[screen][bg_number].Infos.Tiles; + return Tiles[tilepix+x+(y<<3)]; +} + +u8 PANoPixel(u8 screen, u8 bg_number, s32 x, s32 y) { + return 0; +} + +u8 PAEasyBgGetPixelInf(u8 screen, u8 bg_number, s32 x, s32 y) { + // Adjust X/Y values + x += PA_BgInfo[screen][bg_number].ScrollX; x = PA_Modulo(x, PA_BgInfo[screen][bg_number].Infos.Width); + y += PA_BgInfo[screen][bg_number].ScrollY; y = PA_Modulo(y, PA_BgInfo[screen][bg_number].Infos.Height); + s32 mappos = (x >> 3) + ((y >> 3) * (PA_BgInfo[screen][bg_number].Infos.Width >> 3)); // Adjust position in map + u32 *Map = (u32*)PA_BgInfo[screen][bg_number].Infos.Map; + s32 tilepix = (Map[mappos] & INF_JUSTTILE) << 6; + u8 hflip = (Map[mappos] >> 29) & 1; + u8 vflip = (Map[mappos] >> 30) & 1; + x &= 7; y &= 7; // Adjust in tile... + + if (hflip) x = 7 - x; + if (vflip) y = 7 - y; // Adjust flips... + + u8 *Tiles = (u8*)PA_BgInfo[screen][bg_number].Infos.Tiles; + return Tiles[tilepix+x+(y<<3)]; +} diff --git a/source/arm9/PA_BgLargeMap.c b/source/arm9/PA_BgLargeMap.c index a093e7a..bb75631 100644 --- a/source/arm9/PA_BgLargeMap.c +++ b/source/arm9/PA_BgLargeMap.c @@ -1,272 +1,272 @@ -#include "PA_BgLargeMap.h" -#include "PA_Math.h" - -void PA_LargeScrollXN(u8 screen, u8 bg_select, s32 x) { - s32 i, j, lx, tilex, tempx, tempy; - lx = scrollpos[screen][bg_select].lx; - - if (x < 0) x = 0; - - if (x >= lx - 256) x = lx - 257; - - lx = lx >> 3; - PA_BGScrollX(screen, bg_select, x&511); - tempx = scrollpos[screen][bg_select].scrollx >> 3; - tempy = scrollpos[screen][bg_select].scrolly >> 3; - -// Dans un sens... - while (x - scrollpos[screen][bg_select].scrollx >= 8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante - scrollpos[screen][bg_select].scrollx += 8; // On a décalé de la taille d'un tile... - tempx = scrollpos[screen][bg_select].scrollx >> 3; - // On fait le decallage en copiant tout comme il faut - i = (tempx + 34) & 63; - tilex = tempx + 34; - - for (j = -2; j < 27; j++) PA_SetLargeMapTile(screen, bg_select, i, (tempy + j)&31, scrollpos[screen][bg_select].bg_map[tilex + ((tempy+j) * lx)]); - } - -// Et dans l'autre - while (x - scrollpos[screen][bg_select].scrollx <= -8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante - scrollpos[screen][bg_select].scrollx -= 8; // On a décalé de la taille d'un tile... - tempx = scrollpos[screen][bg_select].scrollx >> 3; - // On fait le decallage en copiant tout comme il faut - i = (tempx - 2) & 63; - tilex = tempx - 2; - - for (j = -2; j < 27; j++) PA_SetLargeMapTile(screen, bg_select, i, (tempy + j)&31, scrollpos[screen][bg_select].bg_map[tilex + ((tempy+j) * lx)]); - } -} - -void PA_LargeScrollYN(u8 screen, u8 bg_select, s32 y) { - s32 i, j, lx, ly, tiley, tempx, tempy; - lx = scrollpos[screen][bg_select].lx; - ly = scrollpos[screen][bg_select].ly; - - if (y < 0) y = 0; - - if (y >= ly - 192) y = ly - 193; - - lx = lx >> 3; - ly = ly >> 3; - PA_BGScrollY(screen, bg_select, y&255); - tempx = scrollpos[screen][bg_select].scrollx >> 3; - tempy = scrollpos[screen][bg_select].scrolly >> 3; - -// Verticalement -// Dans un sens... - while (y - scrollpos[screen][bg_select].scrolly >= 8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante - scrollpos[screen][bg_select].scrolly += 8; // On a décalé de la taille d'un tile... - tempy = scrollpos[screen][bg_select].scrolly >> 3; - // On fait le decallage en copiant tout comme il faut - j = (tempy + 25) & 31; - tiley = tempy + 25; - - for (i = -2; i < 35; i++) PA_SetLargeMapTile(screen, bg_select, (tempx + i)&63, j, scrollpos[screen][bg_select].bg_map[(tempx + i) + (tiley * lx)]); - } - -// Et dans l'autre - while (y - scrollpos[screen][bg_select].scrolly <= -8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante - scrollpos[screen][bg_select].scrolly -= 8; // On a décalé de la taille d'un tile... - tempy = scrollpos[screen][bg_select].scrolly >> 3; - // On fait le decallage en copiant tout comme il faut - j = (tempy - 2) & 31; - tiley = tempy - 2; - - for (i = -2; i < 35; i++) PA_SetLargeMapTile(screen, bg_select, (tempx + i)&63, j, scrollpos[screen][bg_select].bg_map[(tempx + i) + (tiley * lx)]); - } -} - -void PA_InfLargeScrollXN(u8 screen, u8 bg_select, s32 x) { - s32 i, j, lx, ly, tilex, tempx, tempy; - lx = scrollpos[screen][bg_select].lx >> 3; - ly = scrollpos[screen][bg_select].ly >> 3; - PA_BGScrollX(screen, bg_select, x&511); - tempx = scrollpos[screen][bg_select].scrollx >> 3; - tempy = scrollpos[screen][bg_select].scrolly >> 3; -// Dans un sens... - while (x - scrollpos[screen][bg_select].scrollx >= 8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante - scrollpos[screen][bg_select].scrollx += 8; // On a décalé de la taille d'un tile... - tempx = scrollpos[screen][bg_select].scrollx >> 3; - // On fait le decallage en copiant tout comme il faut - i = (tempx + 34) & 63; - tilex = PA_Modulo((tempx + 34), lx); - - for (j = -2; j < 26; j++) PA_SetLargeMapTile(screen, bg_select, i, (tempy + j)&31, scrollpos[screen][bg_select].bg_map[tilex + (PA_Modulo((tempy+j), ly) * lx)]); - } - -// Et dans l'autre - while (x - scrollpos[screen][bg_select].scrollx <= -8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante - scrollpos[screen][bg_select].scrollx -= 8; // On a décalé de la taille d'un tile... - tempx = scrollpos[screen][bg_select].scrollx >> 3; - // On fait le decallage en copiant tout comme il faut - i = (tempx - 2) & 63; - tilex = PA_Modulo((tempx - 2), lx); - - for (j = -2; j < 26; j++) PA_SetLargeMapTile(screen, bg_select, i, (tempy + j)&31, scrollpos[screen][bg_select].bg_map[tilex + (PA_Modulo((tempy+j), ly) * lx)]); - } -} - - - -void PA_InfLargeScrollYN(u8 screen, u8 bg_select, s32 y) { - s32 i, j, lx, ly, tiley, tempx, tempy; - lx = scrollpos[screen][bg_select].lx >> 3; - ly = scrollpos[screen][bg_select].ly >> 3; - PA_BGScrollY(screen, bg_select, y&255); - tempx = scrollpos[screen][bg_select].scrollx >> 3; - tempy = scrollpos[screen][bg_select].scrolly >> 3; - -// Verticalement -// Dans un sens... - while (y - scrollpos[screen][bg_select].scrolly >= 8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante - scrollpos[screen][bg_select].scrolly += 8; // On a décalé de la taille d'un tile... - tempy = scrollpos[screen][bg_select].scrolly >> 3; - // On fait le decallage en copiant tout comme il faut - j = (tempy + 25) & 31; - tiley = PA_Modulo((tempy + 25), ly); - - for (i = -2; i < 35; i++) PA_SetLargeMapTile(screen, bg_select, (tempx + i)&63, j, scrollpos[screen][bg_select].bg_map[PA_Modulo((tempx + i), lx) + (tiley * lx)]); - } - -// Et dans l'autre - while (y - scrollpos[screen][bg_select].scrolly <= -8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante - scrollpos[screen][bg_select].scrolly -= 8; // On a décalé de la taille d'un tile... - tempy = scrollpos[screen][bg_select].scrolly >> 3; - // On fait le decallage en copiant tout comme il faut - j = (tempy - 2) & 31; - tiley = PA_Modulo((tempy - 2), ly); - - for (i = -2; i < 35; i++) PA_SetLargeMapTile(screen, bg_select, (tempx + i)&63, j, scrollpos[screen][bg_select].bg_map[PA_Modulo((tempx + i), lx) + (tiley * lx)]); - } -} - - -void PA_UpdateTileEngineX(u8 screen, u8 bg_select, s32 x, s32 y) { - s32 tilenumber; - s32 modulj; - s32 lx = scrollpos[screen][bg_select].lx >> 3; - s32 ly = scrollpos[screen][bg_select].ly >> 3; - s32 modulx = PA_Modulo(x, lx); - u32 *map = (u32*)scrollpos[screen][bg_select].bg_map; - s32 j; - - for (j = y - 2; j < 26 + y; j++) { - modulj = PA_Modulo(j, ly); - tilenumber = PA_TileNumber(x, j); - PA_SetLargeMapTile(screen, bg_select, x&63, j&31, - (tilenumber - | ((TILE_HFLIP | TILE_VFLIP)&(map[modulx+(modulj*lx)] >> 19)) - ) - ); // Tile numbers... - PA_UpdateBgTile(screen, bg_select, tilenumber, - (void*)(PA_BgInfo[screen][bg_select].Tiles + - ((map[modulx+(modulj*lx)]&INF_JUSTTILE) << 6) - )); - } -} - -void PA_UpdateTileEngineY(u8 screen, u8 bg_select, s32 x, s32 y) { - s32 tilenumber; - s32 moduli; - s32 lx = scrollpos[screen][bg_select].lx >> 3; - s32 ly = scrollpos[screen][bg_select].ly >> 3; - s32 moduly = PA_Modulo(y, ly); - u32 *map = (u32*)scrollpos[screen][bg_select].bg_map; - s32 i; - - for (i = x - 2; i < 34 + x; i++) { - moduli = PA_Modulo(i, lx); - tilenumber = PA_TileNumber(i, y); - PA_SetLargeMapTile(screen, bg_select, i&63, y&31, - (tilenumber - | ((TILE_HFLIP | TILE_VFLIP)&(map[moduli+(moduly*lx)] >> 19)) - ) - ); // Tile numbers... - PA_UpdateBgTile(screen, bg_select, tilenumber, - (void*)(PA_BgInfo[screen][bg_select].Tiles + - ((map[moduli+(moduly*lx)]&INF_JUSTTILE) << 6) - )); - } -} - - -void PA_InfTilesScrollX(u8 screen, u8 bg_select, s32 x) { - PA_BGScrollX(screen, bg_select, x&511); - s32 tempx = scrollpos[screen][bg_select].scrollx >> 3; - s32 tempy = scrollpos[screen][bg_select].scrolly >> 3; - scrollpos[screen][bg_select].scrollx = x; // updated - x = x >> 3; - - while (x < tempx) { - tempx--; - PA_UpdateTileEngineX(screen, bg_select, tempx - 2, tempy); - } - - while (x > tempx) { - tempx++; - PA_UpdateTileEngineX(screen, bg_select, 33 + tempx, tempy); - } -} - -void PA_InfTilesScrollY(u8 screen, u8 bg_select, s32 y) { - PA_BGScrollY(screen, bg_select, y&255); - s32 tempx = scrollpos[screen][bg_select].scrollx >> 3; - s32 tempy = scrollpos[screen][bg_select].scrolly >> 3; - scrollpos[screen][bg_select].scrolly = y; // updated - y = y >> 3; - - while (y < tempy) { - tempy--; - PA_UpdateTileEngineY(screen, bg_select, tempx, tempy - 2); - } - - while (y > tempy) { - tempy++; - PA_UpdateTileEngineY(screen, bg_select, tempx, tempy + 25); - } -} - -void PA_InitLargeBg(u8 screen, u8 bg_select, s32 lx, s32 ly, void* bg_map) { - s32 i, j; - scrollpos[screen][bg_select].infscroll = 1; // On active le scrolling infini - scrollpos[screen][bg_select].scrollx = 0; - scrollpos[screen][bg_select].scrolly = 0; - scrollpos[screen][bg_select].lx = lx << 3; // Tailles en pixels... - scrollpos[screen][bg_select].ly = ly << 3; - - if (lx > 62) scrollpos[screen][bg_select].maxx = 62; - else { - scrollpos[screen][bg_select].maxx = lx; // pas de scrolling infini en largeur necessaire... - } - - scrollpos[screen][bg_select].bg_map = (u16*)bg_map; - - if (PA_BgInfo[screen][bg_select].NTiles < 884) { // Normal largemap - u16 *map = scrollpos[screen][bg_select].bg_map; - - for (i = -2; i < scrollpos[screen][bg_select].maxx; i++) - for (j = -2; j < 30; j++) - PA_SetLargeMapTile(screen, bg_select, i&63, j&31, map[PA_Modulo(i, lx) + (PA_Modulo(j, ly) * lx)]); - } else { // Tile engine active - s32 moduli, modulj; - u32 *map = (u32*)scrollpos[screen][bg_select].bg_map; - u16 tilenumber; - - for (i = -2; i < 34; i++) { - for (j = -2; j < 26; j++) { - tilenumber = PA_TileNumber(i, j); - moduli = PA_Modulo(i, lx); - modulj = PA_Modulo(j, ly); - PA_SetLargeMapTile(screen, bg_select, i&63, j&31, - (tilenumber - | ((TILE_HFLIP | TILE_VFLIP)&(map[moduli+((modulj)*lx)] >> 19)) - ) - ); // Tile numbers... - PA_UpdateBgTile(screen, bg_select, tilenumber, - (void*)(PA_BgInfo[screen][bg_select].Tiles + - ((map[moduli+((modulj)*lx)]&INF_JUSTTILE) << 6) - )); - } - } - } -} +#include "PA_BgLargeMap.h" +#include "PA_Math.h" + +void PA_LargeScrollXN(u8 screen, u8 bg_select, s32 x) { + s32 i, j, lx, tilex, tempx, tempy; + lx = scrollpos[screen][bg_select].lx; + + if (x < 0) x = 0; + + if (x >= lx - 256) x = lx - 257; + + lx = lx >> 3; + PA_BGScrollX(screen, bg_select, x&511); + tempx = scrollpos[screen][bg_select].scrollx >> 3; + tempy = scrollpos[screen][bg_select].scrolly >> 3; + +// Dans un sens... + while (x - scrollpos[screen][bg_select].scrollx >= 8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante + scrollpos[screen][bg_select].scrollx += 8; // On a décalé de la taille d'un tile... + tempx = scrollpos[screen][bg_select].scrollx >> 3; + // On fait le decallage en copiant tout comme il faut + i = (tempx + 34) & 63; + tilex = tempx + 34; + + for (j = -2; j < 27; j++) PA_SetLargeMapTile(screen, bg_select, i, (tempy + j)&31, scrollpos[screen][bg_select].bg_map[tilex + ((tempy+j) * lx)]); + } + +// Et dans l'autre + while (x - scrollpos[screen][bg_select].scrollx <= -8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante + scrollpos[screen][bg_select].scrollx -= 8; // On a décalé de la taille d'un tile... + tempx = scrollpos[screen][bg_select].scrollx >> 3; + // On fait le decallage en copiant tout comme il faut + i = (tempx - 2) & 63; + tilex = tempx - 2; + + for (j = -2; j < 27; j++) PA_SetLargeMapTile(screen, bg_select, i, (tempy + j)&31, scrollpos[screen][bg_select].bg_map[tilex + ((tempy+j) * lx)]); + } +} + +void PA_LargeScrollYN(u8 screen, u8 bg_select, s32 y) { + s32 i, j, lx, ly, tiley, tempx, tempy; + lx = scrollpos[screen][bg_select].lx; + ly = scrollpos[screen][bg_select].ly; + + if (y < 0) y = 0; + + if (y >= ly - 192) y = ly - 193; + + lx = lx >> 3; + ly = ly >> 3; + PA_BGScrollY(screen, bg_select, y&255); + tempx = scrollpos[screen][bg_select].scrollx >> 3; + tempy = scrollpos[screen][bg_select].scrolly >> 3; + +// Verticalement +// Dans un sens... + while (y - scrollpos[screen][bg_select].scrolly >= 8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante + scrollpos[screen][bg_select].scrolly += 8; // On a décalé de la taille d'un tile... + tempy = scrollpos[screen][bg_select].scrolly >> 3; + // On fait le decallage en copiant tout comme il faut + j = (tempy + 25) & 31; + tiley = tempy + 25; + + for (i = -2; i < 35; i++) PA_SetLargeMapTile(screen, bg_select, (tempx + i)&63, j, scrollpos[screen][bg_select].bg_map[(tempx + i) + (tiley * lx)]); + } + +// Et dans l'autre + while (y - scrollpos[screen][bg_select].scrolly <= -8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante + scrollpos[screen][bg_select].scrolly -= 8; // On a décalé de la taille d'un tile... + tempy = scrollpos[screen][bg_select].scrolly >> 3; + // On fait le decallage en copiant tout comme il faut + j = (tempy - 2) & 31; + tiley = tempy - 2; + + for (i = -2; i < 35; i++) PA_SetLargeMapTile(screen, bg_select, (tempx + i)&63, j, scrollpos[screen][bg_select].bg_map[(tempx + i) + (tiley * lx)]); + } +} + +void PA_InfLargeScrollXN(u8 screen, u8 bg_select, s32 x) { + s32 i, j, lx, ly, tilex, tempx, tempy; + lx = scrollpos[screen][bg_select].lx >> 3; + ly = scrollpos[screen][bg_select].ly >> 3; + PA_BGScrollX(screen, bg_select, x&511); + tempx = scrollpos[screen][bg_select].scrollx >> 3; + tempy = scrollpos[screen][bg_select].scrolly >> 3; +// Dans un sens... + while (x - scrollpos[screen][bg_select].scrollx >= 8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante + scrollpos[screen][bg_select].scrollx += 8; // On a décalé de la taille d'un tile... + tempx = scrollpos[screen][bg_select].scrollx >> 3; + // On fait le decallage en copiant tout comme il faut + i = (tempx + 34) & 63; + tilex = PA_Modulo((tempx + 34), lx); + + for (j = -2; j < 26; j++) PA_SetLargeMapTile(screen, bg_select, i, (tempy + j)&31, scrollpos[screen][bg_select].bg_map[tilex + (PA_Modulo((tempy+j), ly) * lx)]); + } + +// Et dans l'autre + while (x - scrollpos[screen][bg_select].scrollx <= -8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante + scrollpos[screen][bg_select].scrollx -= 8; // On a décalé de la taille d'un tile... + tempx = scrollpos[screen][bg_select].scrollx >> 3; + // On fait le decallage en copiant tout comme il faut + i = (tempx - 2) & 63; + tilex = PA_Modulo((tempx - 2), lx); + + for (j = -2; j < 26; j++) PA_SetLargeMapTile(screen, bg_select, i, (tempy + j)&31, scrollpos[screen][bg_select].bg_map[tilex + (PA_Modulo((tempy+j), ly) * lx)]); + } +} + + + +void PA_InfLargeScrollYN(u8 screen, u8 bg_select, s32 y) { + s32 i, j, lx, ly, tiley, tempx, tempy; + lx = scrollpos[screen][bg_select].lx >> 3; + ly = scrollpos[screen][bg_select].ly >> 3; + PA_BGScrollY(screen, bg_select, y&255); + tempx = scrollpos[screen][bg_select].scrollx >> 3; + tempy = scrollpos[screen][bg_select].scrolly >> 3; + +// Verticalement +// Dans un sens... + while (y - scrollpos[screen][bg_select].scrolly >= 8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante + scrollpos[screen][bg_select].scrolly += 8; // On a décalé de la taille d'un tile... + tempy = scrollpos[screen][bg_select].scrolly >> 3; + // On fait le decallage en copiant tout comme il faut + j = (tempy + 25) & 31; + tiley = PA_Modulo((tempy + 25), ly); + + for (i = -2; i < 35; i++) PA_SetLargeMapTile(screen, bg_select, (tempx + i)&63, j, scrollpos[screen][bg_select].bg_map[PA_Modulo((tempx + i), lx) + (tiley * lx)]); + } + +// Et dans l'autre + while (y - scrollpos[screen][bg_select].scrolly <= -8) { // Tant qu'on a du retour sur l'affichage de la carte, on fait afficher la ligne suivante + scrollpos[screen][bg_select].scrolly -= 8; // On a décalé de la taille d'un tile... + tempy = scrollpos[screen][bg_select].scrolly >> 3; + // On fait le decallage en copiant tout comme il faut + j = (tempy - 2) & 31; + tiley = PA_Modulo((tempy - 2), ly); + + for (i = -2; i < 35; i++) PA_SetLargeMapTile(screen, bg_select, (tempx + i)&63, j, scrollpos[screen][bg_select].bg_map[PA_Modulo((tempx + i), lx) + (tiley * lx)]); + } +} + + +void PA_UpdateTileEngineX(u8 screen, u8 bg_select, s32 x, s32 y) { + s32 tilenumber; + s32 modulj; + s32 lx = scrollpos[screen][bg_select].lx >> 3; + s32 ly = scrollpos[screen][bg_select].ly >> 3; + s32 modulx = PA_Modulo(x, lx); + u32 *map = (u32*)scrollpos[screen][bg_select].bg_map; + s32 j; + + for (j = y - 2; j < 26 + y; j++) { + modulj = PA_Modulo(j, ly); + tilenumber = PA_TileNumber(x, j); + PA_SetLargeMapTile(screen, bg_select, x&63, j&31, + (tilenumber + | ((TILE_HFLIP | TILE_VFLIP)&(map[modulx+(modulj*lx)] >> 19)) + ) + ); // Tile numbers... + PA_UpdateBgTile(screen, bg_select, tilenumber, + (void*)(PA_BgInfo[screen][bg_select].Tiles + + ((map[modulx+(modulj*lx)]&INF_JUSTTILE) << 6) + )); + } +} + +void PA_UpdateTileEngineY(u8 screen, u8 bg_select, s32 x, s32 y) { + s32 tilenumber; + s32 moduli; + s32 lx = scrollpos[screen][bg_select].lx >> 3; + s32 ly = scrollpos[screen][bg_select].ly >> 3; + s32 moduly = PA_Modulo(y, ly); + u32 *map = (u32*)scrollpos[screen][bg_select].bg_map; + s32 i; + + for (i = x - 2; i < 34 + x; i++) { + moduli = PA_Modulo(i, lx); + tilenumber = PA_TileNumber(i, y); + PA_SetLargeMapTile(screen, bg_select, i&63, y&31, + (tilenumber + | ((TILE_HFLIP | TILE_VFLIP)&(map[moduli+(moduly*lx)] >> 19)) + ) + ); // Tile numbers... + PA_UpdateBgTile(screen, bg_select, tilenumber, + (void*)(PA_BgInfo[screen][bg_select].Tiles + + ((map[moduli+(moduly*lx)]&INF_JUSTTILE) << 6) + )); + } +} + + +void PA_InfTilesScrollX(u8 screen, u8 bg_select, s32 x) { + PA_BGScrollX(screen, bg_select, x&511); + s32 tempx = scrollpos[screen][bg_select].scrollx >> 3; + s32 tempy = scrollpos[screen][bg_select].scrolly >> 3; + scrollpos[screen][bg_select].scrollx = x; // updated + x = x >> 3; + + while (x < tempx) { + tempx--; + PA_UpdateTileEngineX(screen, bg_select, tempx - 2, tempy); + } + + while (x > tempx) { + tempx++; + PA_UpdateTileEngineX(screen, bg_select, 33 + tempx, tempy); + } +} + +void PA_InfTilesScrollY(u8 screen, u8 bg_select, s32 y) { + PA_BGScrollY(screen, bg_select, y&255); + s32 tempx = scrollpos[screen][bg_select].scrollx >> 3; + s32 tempy = scrollpos[screen][bg_select].scrolly >> 3; + scrollpos[screen][bg_select].scrolly = y; // updated + y = y >> 3; + + while (y < tempy) { + tempy--; + PA_UpdateTileEngineY(screen, bg_select, tempx, tempy - 2); + } + + while (y > tempy) { + tempy++; + PA_UpdateTileEngineY(screen, bg_select, tempx, tempy + 25); + } +} + +void PA_InitLargeBg(u8 screen, u8 bg_select, s32 lx, s32 ly, void* bg_map) { + s32 i, j; + scrollpos[screen][bg_select].infscroll = 1; // On active le scrolling infini + scrollpos[screen][bg_select].scrollx = 0; + scrollpos[screen][bg_select].scrolly = 0; + scrollpos[screen][bg_select].lx = lx << 3; // Tailles en pixels... + scrollpos[screen][bg_select].ly = ly << 3; + + if (lx > 62) scrollpos[screen][bg_select].maxx = 62; + else { + scrollpos[screen][bg_select].maxx = lx; // pas de scrolling infini en largeur necessaire... + } + + scrollpos[screen][bg_select].bg_map = (u16*)bg_map; + + if (PA_BgInfo[screen][bg_select].NTiles < 884) { // Normal largemap + u16 *map = scrollpos[screen][bg_select].bg_map; + + for (i = -2; i < scrollpos[screen][bg_select].maxx; i++) + for (j = -2; j < 30; j++) + PA_SetLargeMapTile(screen, bg_select, i&63, j&31, map[PA_Modulo(i, lx) + (PA_Modulo(j, ly) * lx)]); + } else { // Tile engine active + s32 moduli, modulj; + u32 *map = (u32*)scrollpos[screen][bg_select].bg_map; + u16 tilenumber; + + for (i = -2; i < 34; i++) { + for (j = -2; j < 26; j++) { + tilenumber = PA_TileNumber(i, j); + moduli = PA_Modulo(i, lx); + modulj = PA_Modulo(j, ly); + PA_SetLargeMapTile(screen, bg_select, i&63, j&31, + (tilenumber + | ((TILE_HFLIP | TILE_VFLIP)&(map[moduli+((modulj)*lx)] >> 19)) + ) + ); // Tile numbers... + PA_UpdateBgTile(screen, bg_select, tilenumber, + (void*)(PA_BgInfo[screen][bg_select].Tiles + + ((map[moduli+((modulj)*lx)]&INF_JUSTTILE) << 6) + )); + } + } + } +} diff --git a/source/arm9/PA_BgRot.c b/source/arm9/PA_BgRot.c index d86fa06..ea30ff2 100644 --- a/source/arm9/PA_BgRot.c +++ b/source/arm9/PA_BgRot.c @@ -1,34 +1,34 @@ -#include - -u8 rotbg_size[2][4]; // Background size of each possible rotbg -u8 rotbg_place[4] = {1, 1, 2, 8}; -u16 rotbg_sizes[4] = {1024, 1024, 2048, 8192}; - -void PA_LoadRotBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size) { - s16 charset = -1; - u8 charsetok = 0; - u8 blocksize = rotbg_place[bg_size]; - u8 i; - u8 tempsize; - rotbg_size[screen][bg_select] = bg_size; // Save rot bg size (values 0-3 for 128, 256, 512 and 1024) - PA_DeleteMap(screen, bg_select); - - while ((charset < 31) && (!charsetok)) { - ++charset; - tempsize = blocksize; - - for (i = 0; i < blocksize; i++) { - if (charblocks[screen][charset + i] == 0) { // Si on a de la place... - --tempsize; - } - } - - charsetok = !tempsize; // Si on a trouvé suffisament de blocs, on peut continuer - } - - PA_BgInfo[screen][bg_select].mapchar = charset; // On place la map à un endroit précis... - PA_BgInfo[screen][bg_select].mapsize = blocksize; - DMA_Copy(bg_map, (void*)ScreenBaseBlock(screen, charset), rotbg_sizes[bg_size], DMA_16NOW); - - for (i = 0; i < blocksize; i++) charblocks[screen][charset + i] = 1; // Les blocs sont occupés -} +#include + +u8 rotbg_size[2][4]; // Background size of each possible rotbg +u8 rotbg_place[4] = {1, 1, 2, 8}; +u16 rotbg_sizes[4] = {1024, 1024, 2048, 8192}; + +void PA_LoadRotBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size) { + s16 charset = -1; + u8 charsetok = 0; + u8 blocksize = rotbg_place[bg_size]; + u8 i; + u8 tempsize; + rotbg_size[screen][bg_select] = bg_size; // Save rot bg size (values 0-3 for 128, 256, 512 and 1024) + PA_DeleteMap(screen, bg_select); + + while ((charset < 31) && (!charsetok)) { + ++charset; + tempsize = blocksize; + + for (i = 0; i < blocksize; i++) { + if (charblocks[screen][charset + i] == 0) { // Si on a de la place... + --tempsize; + } + } + + charsetok = !tempsize; // Si on a trouvé suffisament de blocs, on peut continuer + } + + PA_BgInfo[screen][bg_select].mapchar = charset; // On place la map à un endroit précis... + PA_BgInfo[screen][bg_select].mapsize = blocksize; + DMA_Copy(bg_map, (void*)ScreenBaseBlock(screen, charset), rotbg_sizes[bg_size], DMA_16NOW); + + for (i = 0; i < blocksize; i++) charblocks[screen][charset + i] = 1; // Les blocs sont occupés +} diff --git a/source/arm9/PA_BgTiles.c b/source/arm9/PA_BgTiles.c index 674a010..b3ed20d 100644 --- a/source/arm9/PA_BgTiles.c +++ b/source/arm9/PA_BgTiles.c @@ -1,206 +1,206 @@ -#include - -PA_BgInfos PA_BgInfo[2][4]; - -// Quantité de données à charger en fonction de la taille de la map... -u16 bg_sizes[4] = {1024, 2048, 2048, 4096}; -u8 bg_place[4] = {1, 2, 2, 4}; - -// Pour le parallax scrolling... -s32 PA_parallaxX[2][4]; -s32 PA_parallaxY[2][4]; - -scrollpositions scrollpos[2][4]; // Pour chaque écran et pour chaque fond :) - -u8 charblocks[2][70]; // On met à 0 les emplacements libres... pour chaque écran... -//u8 tilesetchar[2][4]; // Emplacement mémoire de chaque tileset -u16 tempsize; - -extern u16 *PA_DrawBg[2]; // Fond dessinable -u8 charsetstart[2] = {8, 8}; - -void PA_ResetBgSysScreen(u8 screen) { - u8 i; - PA_SetBgColor(screen, 0); - PA_SetVideoMode(screen, 0); - - for (i = 0; i < 4; i++) { - PA_DeleteBg(screen, i); - } - - for (i = 0; i < 64; i++) - charblocks[screen][i] = 0; - - // Emplacements pris à la suite, faut pas déborder... - for (i = 64; i < 70; i++) - charblocks[screen][i] = 1; - - charsetstart[screen] = 8; // Par défaut à 8, pour dire de tout utiliser -} - -void PA_ResetBgSys(void) { - PA_ResetBgSysScreen(0); - PA_ResetBgSysScreen(1); -} - -void PA_LoadBgTilesEx(u8 screen, u8 bg_select, void* bg_tiles, u32 size) { - u32 blocksize = (size + 1023) >> 10; - s8 charset = charsetstart[screen]; // On commence par le dernier... soit le 8ème, et on ira vers le bas - u8 charsetok = 0; - u8 i; - u8 tempsize; - PA_DeleteTiles(screen, bg_select); - - // On va chercher dans le tableau des emplacements suffisament grand pour mettre les tiles - while ((charset >= 0) && (!charsetok)) { - --charset; - tempsize = blocksize; - - for (i = 0; i < blocksize; i++) { - // if (charblocks[screen][(charset << 3) + i] == 0) { // Si on a de la place... - if (charblocks[screen][(charset << 3) + i] == 0) { // Si on a de la place... - --tempsize; - } - } - - charsetok = !tempsize; // Si on a trouvé suffisament de blocs, on peut continuer - } - - if (!charsetok) { - u8 j; - u8 usedblocks[64]; - - for (i = 0; i < 64; i++) usedblocks[i] = charblocks[screen][i]; - - PA_Error( - "\n" - " Sorry, but there's not enough\n" - " VRAM to load all your\n" - "backgrounds! You must reduce the\n" - " number of tiles of your\n" - "backgrounds to fix this problem.\n" - "\n" - " Désolé, mais là il n'y a plus\n" - " assez de VRAM pour charger ton\n" - " arrière-plans ! Tu dois réduire\n" - " le nombre de tiles de ton\n" - " arrière-plans pour corriger ce\n" - " problème." - ); - PA_InitText(0, 0); - - // Display debug info - for (j = 0; j < 8; j ++) - for (i = 0; i < 8; i ++) - PA_OutputText(0, i, j, "%d", usedblocks[i + (j << 3)]); - - PA_OutputText(0, 1, 10, "%d free blocks were needed", blocksize); - // Hang - irqDisable(IRQ_ALL); - irqSet(IRQ_VBLANK, 0); - irqEnable(IRQ_VBLANK); - - for (;;) swiWaitForVBlank(); - } - - PA_BgInfo[screen][bg_select].TileSetChar = charset; // On place les tiles à un endroit précis... - PA_BgInfo[screen][bg_select].tilesetsize = size; // On mémorise aussi la taille que ca fait pour pouvoir effacer plus tard... - DC_FlushRange((void*)CharBaseBlock(screen, charset), size); - DMA_Copy(bg_tiles, (void*)CharBaseBlock(screen, charset), size, DMA_16NOW); - // Save tiles pointer and position in VRAM - PA_BgInfo[screen][bg_select].Tiles = bg_tiles; - PA_BgInfo[screen][bg_select].TilePos = (u32*)CharBaseBlock(screen, PA_BgInfo[screen][bg_select].TileSetChar); // used for tile swapping - - for (i = 0; i < blocksize; i++) charblocks[screen][(charset << 3) + i] = 1; // Les blocs sont occupés -} - - -void PA_ReLoadBgTiles(u8 screen, u8 bg_select, void* bg_tiles) { - s8 charset = PA_BgInfo[screen][bg_select].TileSetChar; - u32 size = PA_BgInfo[screen][bg_select].tilesetsize; - int i; - - for (i = 0; i < size; i++) { - ((uint16*)CharBaseBlock(screen, charset))[i] = ((uint16*)bg_tiles)[i]; - } -} - -void PA_LoadBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size) { - s16 charset = -1; - u8 charsetok = 0; - u8 blocksize = bg_place[bg_size]; - u8 i; - u8 tempsize; - PA_DeleteMap(screen, bg_select); - - while ((charset < 31) && (!charsetok)) { - ++charset; - tempsize = blocksize; - - for (i = 0; i < blocksize; i++) { - if (charblocks[screen][charset + i] == 0) { // Si on a de la place... - --tempsize; - } - } - - charsetok = !tempsize; // Si on a trouvé suffisament de blocs, on peut continuer - } - - PA_BgInfo[screen][bg_select].mapchar = charset; // On place la map à un endroit précis... - PA_BgInfo[screen][bg_select].mapsize = blocksize; - DMA_Copy(bg_map, (void*)ScreenBaseBlock(screen, charset), bg_sizes[bg_size], DMA_16NOW); - - for (i = 0; i < blocksize; i++) charblocks[screen][charset + i] = 1; // Les blocs sont occupés -} - -void PA_InitBg(u8 screen, u8 bg_select, u8 bg_size, u8 wraparound, u8 color_mode) { - scrollpos[screen][bg_select].infscroll = 0; // Par défaut pas de scrolling infini... - PA_BgInfo[screen][bg_select].Map = ScreenBaseBlock(screen, PA_BgInfo[screen][bg_select].mapchar); - - if (!screen) { - videoBgEnable(bg_select); - BGCTRL[bg_select] = bg_select | // Priority - (bg_size << 14) | // Size - BG_MAP_BASE(PA_BgInfo[screen][bg_select].mapchar) | // Map base - (wraparound << 13) | // Wraparound - BG_TILE_BASE(PA_BgInfo[screen][bg_select].TileSetChar) | // Tile base - (color_mode << 7); // Color mode? - } else { - videoBgEnableSub(bg_select); - BGCTRL_SUB[bg_select] = bg_select | // Priority - (bg_size << 14) | // Size - BG_MAP_BASE(PA_BgInfo[screen][bg_select].mapchar) | // Map base - (wraparound << 13) | // Wraparound - BG_TILE_BASE(PA_BgInfo[screen][bg_select].TileSetChar) | // Tile base - (color_mode << 7); // Color mode? - } -} - -void PA_DeleteTiles(u8 screen, u8 bg_select) { - if (PA_BgInfo[screen][bg_select].tilesetsize) { // Si y'a un truc, on efface - u8 i; - u8 charset = PA_BgInfo[screen][bg_select].TileSetChar; - u16 size = PA_BgInfo[screen][bg_select].tilesetsize; - u16 blocksize = (size + 1023) >> 10; - dmaFillWords(0, (void*)CharBaseBlock(screen, charset), size*2); - - for (i = 0; i < blocksize; i++) { - charblocks[screen][(charset << 3) + i] = 0; - } - } -} - -void PA_DeleteMap(u8 screen, u8 bg_select) { - if (PA_BgInfo[screen][bg_select].mapsize) { // Si y'a un truc, on efface - u8 i; - u8 charset = PA_BgInfo[screen][bg_select].mapchar; - u16 blocksize = PA_BgInfo[screen][bg_select].mapsize; - // On efface le carte en mémoire - dmaFillWords(0, (void*)ScreenBaseBlock(screen, charset), (blocksize << 10)*2); - - // On remet le tableau à 0... - for (i = 0; i < blocksize; i++) { - charblocks[screen][charset + i] = 0; - } - } -} +#include + +PA_BgInfos PA_BgInfo[2][4]; + +// Quantité de données à charger en fonction de la taille de la map... +u16 bg_sizes[4] = {1024, 2048, 2048, 4096}; +u8 bg_place[4] = {1, 2, 2, 4}; + +// Pour le parallax scrolling... +s32 PA_parallaxX[2][4]; +s32 PA_parallaxY[2][4]; + +scrollpositions scrollpos[2][4]; // Pour chaque écran et pour chaque fond :) + +u8 charblocks[2][70]; // On met à 0 les emplacements libres... pour chaque écran... +//u8 tilesetchar[2][4]; // Emplacement mémoire de chaque tileset +u16 tempsize; + +extern u16 *PA_DrawBg[2]; // Fond dessinable +u8 charsetstart[2] = {8, 8}; + +void PA_ResetBgSysScreen(u8 screen) { + u8 i; + PA_SetBgColor(screen, 0); + PA_SetVideoMode(screen, 0); + + for (i = 0; i < 4; i++) { + PA_DeleteBg(screen, i); + } + + for (i = 0; i < 64; i++) + charblocks[screen][i] = 0; + + // Emplacements pris à la suite, faut pas déborder... + for (i = 64; i < 70; i++) + charblocks[screen][i] = 1; + + charsetstart[screen] = 8; // Par défaut à 8, pour dire de tout utiliser +} + +void PA_ResetBgSys(void) { + PA_ResetBgSysScreen(0); + PA_ResetBgSysScreen(1); +} + +void PA_LoadBgTilesEx(u8 screen, u8 bg_select, void* bg_tiles, u32 size) { + u32 blocksize = (size + 1023) >> 10; + s8 charset = charsetstart[screen]; // On commence par le dernier... soit le 8ème, et on ira vers le bas + u8 charsetok = 0; + u8 i; + u8 tempsize; + PA_DeleteTiles(screen, bg_select); + + // On va chercher dans le tableau des emplacements suffisament grand pour mettre les tiles + while ((charset >= 0) && (!charsetok)) { + --charset; + tempsize = blocksize; + + for (i = 0; i < blocksize; i++) { + // if (charblocks[screen][(charset << 3) + i] == 0) { // Si on a de la place... + if (charblocks[screen][(charset << 3) + i] == 0) { // Si on a de la place... + --tempsize; + } + } + + charsetok = !tempsize; // Si on a trouvé suffisament de blocs, on peut continuer + } + + if (!charsetok) { + u8 j; + u8 usedblocks[64]; + + for (i = 0; i < 64; i++) usedblocks[i] = charblocks[screen][i]; + + PA_Error( + "\n" + " Sorry, but there's not enough\n" + " VRAM to load all your\n" + "backgrounds! You must reduce the\n" + " number of tiles of your\n" + "backgrounds to fix this problem.\n" + "\n" + " Désolé, mais là il n'y a plus\n" + " assez de VRAM pour charger ton\n" + " arrière-plans ! Tu dois réduire\n" + " le nombre de tiles de ton\n" + " arrière-plans pour corriger ce\n" + " problème." + ); + PA_InitText(0, 0); + + // Display debug info + for (j = 0; j < 8; j ++) + for (i = 0; i < 8; i ++) + PA_OutputText(0, i, j, "%d", usedblocks[i + (j << 3)]); + + PA_OutputText(0, 1, 10, "%d free blocks were needed", blocksize); + // Hang + irqDisable(IRQ_ALL); + irqSet(IRQ_VBLANK, 0); + irqEnable(IRQ_VBLANK); + + for (;;) swiWaitForVBlank(); + } + + PA_BgInfo[screen][bg_select].TileSetChar = charset; // On place les tiles à un endroit précis... + PA_BgInfo[screen][bg_select].tilesetsize = size; // On mémorise aussi la taille que ca fait pour pouvoir effacer plus tard... + DC_FlushRange((void*)CharBaseBlock(screen, charset), size); + DMA_Copy(bg_tiles, (void*)CharBaseBlock(screen, charset), size, DMA_16NOW); + // Save tiles pointer and position in VRAM + PA_BgInfo[screen][bg_select].Tiles = bg_tiles; + PA_BgInfo[screen][bg_select].TilePos = (u32*)CharBaseBlock(screen, PA_BgInfo[screen][bg_select].TileSetChar); // used for tile swapping + + for (i = 0; i < blocksize; i++) charblocks[screen][(charset << 3) + i] = 1; // Les blocs sont occupés +} + + +void PA_ReLoadBgTiles(u8 screen, u8 bg_select, void* bg_tiles) { + s8 charset = PA_BgInfo[screen][bg_select].TileSetChar; + u32 size = PA_BgInfo[screen][bg_select].tilesetsize; + int i; + + for (i = 0; i < size; i++) { + ((uint16*)CharBaseBlock(screen, charset))[i] = ((uint16*)bg_tiles)[i]; + } +} + +void PA_LoadBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size) { + s16 charset = -1; + u8 charsetok = 0; + u8 blocksize = bg_place[bg_size]; + u8 i; + u8 tempsize; + PA_DeleteMap(screen, bg_select); + + while ((charset < 31) && (!charsetok)) { + ++charset; + tempsize = blocksize; + + for (i = 0; i < blocksize; i++) { + if (charblocks[screen][charset + i] == 0) { // Si on a de la place... + --tempsize; + } + } + + charsetok = !tempsize; // Si on a trouvé suffisament de blocs, on peut continuer + } + + PA_BgInfo[screen][bg_select].mapchar = charset; // On place la map à un endroit précis... + PA_BgInfo[screen][bg_select].mapsize = blocksize; + DMA_Copy(bg_map, (void*)ScreenBaseBlock(screen, charset), bg_sizes[bg_size], DMA_16NOW); + + for (i = 0; i < blocksize; i++) charblocks[screen][charset + i] = 1; // Les blocs sont occupés +} + +void PA_InitBg(u8 screen, u8 bg_select, u8 bg_size, u8 wraparound, u8 color_mode) { + scrollpos[screen][bg_select].infscroll = 0; // Par défaut pas de scrolling infini... + PA_BgInfo[screen][bg_select].Map = ScreenBaseBlock(screen, PA_BgInfo[screen][bg_select].mapchar); + + if (!screen) { + videoBgEnable(bg_select); + BGCTRL[bg_select] = bg_select | // Priority + (bg_size << 14) | // Size + BG_MAP_BASE(PA_BgInfo[screen][bg_select].mapchar) | // Map base + (wraparound << 13) | // Wraparound + BG_TILE_BASE(PA_BgInfo[screen][bg_select].TileSetChar) | // Tile base + (color_mode << 7); // Color mode? + } else { + videoBgEnableSub(bg_select); + BGCTRL_SUB[bg_select] = bg_select | // Priority + (bg_size << 14) | // Size + BG_MAP_BASE(PA_BgInfo[screen][bg_select].mapchar) | // Map base + (wraparound << 13) | // Wraparound + BG_TILE_BASE(PA_BgInfo[screen][bg_select].TileSetChar) | // Tile base + (color_mode << 7); // Color mode? + } +} + +void PA_DeleteTiles(u8 screen, u8 bg_select) { + if (PA_BgInfo[screen][bg_select].tilesetsize) { // Si y'a un truc, on efface + u8 i; + u8 charset = PA_BgInfo[screen][bg_select].TileSetChar; + u16 size = PA_BgInfo[screen][bg_select].tilesetsize; + u16 blocksize = (size + 1023) >> 10; + dmaFillWords(0, (void*)CharBaseBlock(screen, charset), size*2); + + for (i = 0; i < blocksize; i++) { + charblocks[screen][(charset << 3) + i] = 0; + } + } +} + +void PA_DeleteMap(u8 screen, u8 bg_select) { + if (PA_BgInfo[screen][bg_select].mapsize) { // Si y'a un truc, on efface + u8 i; + u8 charset = PA_BgInfo[screen][bg_select].mapchar; + u16 blocksize = PA_BgInfo[screen][bg_select].mapsize; + // On efface le carte en mémoire + dmaFillWords(0, (void*)ScreenBaseBlock(screen, charset), (blocksize << 10)*2); + + // On remet le tableau à 0... + for (i = 0; i < blocksize; i++) { + charblocks[screen][charset + i] = 0; + } + } +} diff --git a/source/arm9/PA_BgTrans.c b/source/arm9/PA_BgTrans.c index 75b8af7..b7a1f2c 100644 --- a/source/arm9/PA_BgTrans.c +++ b/source/arm9/PA_BgTrans.c @@ -1,142 +1,142 @@ -#include - -#include "TransBg/all_gfx.h" - -u8 pa_bg_trans[2]; - -void PA_InitBgTransEx(u8 screen, u8 bg) { - pa_bg_trans[screen] = bg; - PA_LoadBackground(screen, bg, &PA_TransBg); - PA_BgTransUpDown(screen, 0, 0, TRANS_LENGTH); // Hide -} - -void PA_BgTransTile(u8 screen, u16 type, s16 x, s16 y, s16 temptile) { - u16* map = (u16*) PA_TransBg.BgMap; - PA_SetMapTileAll(screen, pa_bg_trans[screen], x, y, map[temptile*2+type]); - PA_SetMapTileAll(screen, pa_bg_trans[screen], x + 1, y, map[temptile*2+1+type]); - PA_SetMapTileAll(screen, pa_bg_trans[screen], x, y + 1, map[temptile*2+32+type]); - PA_SetMapTileAll(screen, pa_bg_trans[screen], x + 1, y + 1, map[temptile*2+1+32+type]); -} - -void PA_BgTransUpDown(u8 screen, u16 type, u8 vflip, s16 state) { - int i, j; - s16 tile = state >> 1; - s16 temptile; - int y; - type = type << 6; - int x; - - for (j = 0; j < 12; j++) { - y = j * 2; - - if (vflip) y = (11 - j) * 2; - - temptile = tile; - - if (temptile > 15) temptile = 15; // limit range... - - for (i = 0; i < 16; i++) { - x = i * 2; - PA_BgTransTile(screen, type, x, y, temptile); - } - - if (tile) tile--; - } -} - -void PA_BgTransLeftRight(u8 screen, u16 type, u8 hflip, s16 state) { - int i, j; - s16 tile = state >> 1; - s16 temptile; - int y; - type = type << 6; - int x; - - for (j = 0; j < 16; j++) { - x = j * 2; - - if (hflip) x = (15 - j) * 2; - - temptile = tile; - - if (temptile > 15) temptile = 15; // limit range... - - for (i = 0; i < 12; i++) { - y = i * 2; - PA_BgTransTile(screen, type, x, y, temptile); - } - - if (tile) tile--; - } -} - - -void PA_BgTransDiag(u8 screen, u16 type, u8 hflip, u8 vflip, s16 state) { - int i, j; - s16 tile = state >> 1; - s16 temptile; - int y; - type = type << 6; - y = 0; - int tempx, tempy; - - for (j = 0; j < 32; j++) { - y = j; - temptile = tile; - - if (temptile > 15) temptile = 15; // limit range... - - for (i = 0; (i < 16) && (y >= 0); i++) { - - tempx = i * 2; if (hflip) tempx = (15 - i) * 2; - - if ((y >= 0) && (y < 12)) { - - tempy = y * 2; if (vflip) tempy = (11 - y) * 2; - - PA_BgTransTile(screen, type, tempx, tempy, temptile); - } - - if (i&1)y--; - - // y--; - } - - if (tile) tile--; - } -} - - - -void PA_BgTransCenter(u8 screen, u16 type, u8 invert, s16 state) { - int i, j; - s16 tile = state >> 1; - s16 temptile; - int y; - type = type << 6; - y = 0; - - for (j = 0; j < 16; j++) { - y = j; - - if (invert) y = 15 - j; - - temptile = tile; - - if (temptile > 15) temptile = 15; // limit range... - - for (i = 0; (i < 8) && (y >= 0); i++) { - if ((y >= 0) && (y < 6)) { - PA_BgTransTile(screen, type, i*2, y*2, temptile); - PA_BgTransTile(screen, type, i*2, (11 - y)*2, temptile); - PA_BgTransTile(screen, type, (15 - i)*2, y*2, temptile); - PA_BgTransTile(screen, type, (15 - i)*2, (11 - y)*2, temptile); - } - - if (i&1)y--; - - } - - if (tile) tile--; - } -} +#include + +#include "TransBg/all_gfx.h" + +u8 pa_bg_trans[2]; + +void PA_InitBgTransEx(u8 screen, u8 bg) { + pa_bg_trans[screen] = bg; + PA_LoadBackground(screen, bg, &PA_TransBg); + PA_BgTransUpDown(screen, 0, 0, TRANS_LENGTH); // Hide +} + +void PA_BgTransTile(u8 screen, u16 type, s16 x, s16 y, s16 temptile) { + u16* map = (u16*) PA_TransBg.BgMap; + PA_SetMapTileAll(screen, pa_bg_trans[screen], x, y, map[temptile*2+type]); + PA_SetMapTileAll(screen, pa_bg_trans[screen], x + 1, y, map[temptile*2+1+type]); + PA_SetMapTileAll(screen, pa_bg_trans[screen], x, y + 1, map[temptile*2+32+type]); + PA_SetMapTileAll(screen, pa_bg_trans[screen], x + 1, y + 1, map[temptile*2+1+32+type]); +} + +void PA_BgTransUpDown(u8 screen, u16 type, u8 vflip, s16 state) { + int i, j; + s16 tile = state >> 1; + s16 temptile; + int y; + type = type << 6; + int x; + + for (j = 0; j < 12; j++) { + y = j * 2; + + if (vflip) y = (11 - j) * 2; + + temptile = tile; + + if (temptile > 15) temptile = 15; // limit range... + + for (i = 0; i < 16; i++) { + x = i * 2; + PA_BgTransTile(screen, type, x, y, temptile); + } + + if (tile) tile--; + } +} + +void PA_BgTransLeftRight(u8 screen, u16 type, u8 hflip, s16 state) { + int i, j; + s16 tile = state >> 1; + s16 temptile; + int y; + type = type << 6; + int x; + + for (j = 0; j < 16; j++) { + x = j * 2; + + if (hflip) x = (15 - j) * 2; + + temptile = tile; + + if (temptile > 15) temptile = 15; // limit range... + + for (i = 0; i < 12; i++) { + y = i * 2; + PA_BgTransTile(screen, type, x, y, temptile); + } + + if (tile) tile--; + } +} + + +void PA_BgTransDiag(u8 screen, u16 type, u8 hflip, u8 vflip, s16 state) { + int i, j; + s16 tile = state >> 1; + s16 temptile; + int y; + type = type << 6; + y = 0; + int tempx, tempy; + + for (j = 0; j < 32; j++) { + y = j; + temptile = tile; + + if (temptile > 15) temptile = 15; // limit range... + + for (i = 0; (i < 16) && (y >= 0); i++) { + + tempx = i * 2; if (hflip) tempx = (15 - i) * 2; + + if ((y >= 0) && (y < 12)) { + + tempy = y * 2; if (vflip) tempy = (11 - y) * 2; + + PA_BgTransTile(screen, type, tempx, tempy, temptile); + } + + if (i&1)y--; + + // y--; + } + + if (tile) tile--; + } +} + + + +void PA_BgTransCenter(u8 screen, u16 type, u8 invert, s16 state) { + int i, j; + s16 tile = state >> 1; + s16 temptile; + int y; + type = type << 6; + y = 0; + + for (j = 0; j < 16; j++) { + y = j; + + if (invert) y = 15 - j; + + temptile = tile; + + if (temptile > 15) temptile = 15; // limit range... + + for (i = 0; (i < 8) && (y >= 0); i++) { + if ((y >= 0) && (y < 6)) { + PA_BgTransTile(screen, type, i*2, y*2, temptile); + PA_BgTransTile(screen, type, i*2, (11 - y)*2, temptile); + PA_BgTransTile(screen, type, (15 - i)*2, y*2, temptile); + PA_BgTransTile(screen, type, (15 - i)*2, (11 - y)*2, temptile); + } + + if (i&1)y--; + + } + + if (tile) tile--; + } +} diff --git a/source/arm9/PA_Debug.c b/source/arm9/PA_Debug.c index 7eea0f2..e3caa79 100644 --- a/source/arm9/PA_Debug.c +++ b/source/arm9/PA_Debug.c @@ -1,36 +1,36 @@ -#include "PA9.h" -#include "PA_Debug.h" -#include - -//#define DISABLE_DEBUG - -void _PA_iDeaS_OutputText(const char*); -void _PA_iDeaS_Breakpoint(); - -void PA_iDeaS_DebugOutput(const char* str){ -#ifndef DISABLE_DEBUG - if(PA_IsEmulator()) _PA_iDeaS_OutputText(str); -#endif -} - -void PA_iDeaS_Breakpoint(){ -#ifndef DISABLE_DEBUG - if(PA_IsEmulator()) _PA_iDeaS_Breakpoint(); -#endif -} - -char _PA_DebugText[256]; - -void PA_iDeaS_DebugPrintf(const char* str, ...){ -#ifndef DISABLE_DEBUG - if(!PA_IsEmulator()) return; - - va_list args; - - va_start(args, 0); - vsnprintf(_PA_DebugText, sizeof(_PA_DebugText), str, args); - va_end(args); - - _PA_iDeaS_OutputText(_PA_DebugText); -#endif -} +#include "PA9.h" +#include "PA_Debug.h" +#include + +//#define DISABLE_DEBUG + +void _PA_iDeaS_OutputText(const char*); +void _PA_iDeaS_Breakpoint(); + +void PA_iDeaS_DebugOutput(const char* str){ +#ifndef DISABLE_DEBUG + if(PA_IsEmulator()) _PA_iDeaS_OutputText(str); +#endif +} + +void PA_iDeaS_Breakpoint(){ +#ifndef DISABLE_DEBUG + if(PA_IsEmulator()) _PA_iDeaS_Breakpoint(); +#endif +} + +char _PA_DebugText[256]; + +void PA_iDeaS_DebugPrintf(const char* str, ...){ +#ifndef DISABLE_DEBUG + if(!PA_IsEmulator()) return; + + va_list args; + + va_start(args, 0); + vsnprintf(_PA_DebugText, sizeof(_PA_DebugText), str, args); + va_end(args); + + _PA_iDeaS_OutputText(_PA_DebugText); +#endif +} diff --git a/source/arm9/PA_Draw.c b/source/arm9/PA_Draw.c index f33ec87..3156c8b 100644 --- a/source/arm9/PA_Draw.c +++ b/source/arm9/PA_Draw.c @@ -1,96 +1,96 @@ -#include - -////////////////////////////////////////////////////////////////////// -// Buffer mode -////////////////////////////////////////////////////////////////////// - -u16 PA_oldx[2], PA_oldy[2]; -s16 PA_olddowntime[2]; -u8 PA_drawsize[2]; -u16 *PA_DrawBg[2]; -u32 *PA_DrawBg32[2]; -u8 PA_nBit[2]; // 8 or 16 on each screen... - -u16 PA_temppal[256]; - - -u16 tempvar; - -void PA_LoadBmpToBuffer(u16 *Buffer, s16 x, s16 y, void *bmp, s16 SWidth) { - u8 *temp = (u8*)bmp; - BMPHeader0 *Bmpinfo0 = (BMPHeader0 *)(temp); - BMP_Headers *Bmpinfo = (BMP_Headers*)(temp + 14); -// u8 *gfx = temp+54; - u32 start = Bmpinfo0->ImageStart1 + ((Bmpinfo0->ImageStart2) << 16); - u8 *gfx = temp + start; - u16 *gfx2 = (u16*)(temp + start); -// u16 *gfx2 = (u16*)(temp+54); // Pour le mode 16 bit... - s32 r, g, b; s16 tempx, tempy; - s16 lx = Bmpinfo->Width; s16 ly = Bmpinfo->Height; - u16 Bits = Bmpinfo->BitsperPixel; - //Buffer = (u16*)(Buffer + ((x + (y*SWidth)) << 1)); // Position de départ - s32 i = 0; - - if (Bits > 16) { // Pour 24 et 32 bits - for (tempy = ly - 1; tempy > -1; tempy--) { - for (tempx = 0; tempx < lx; tempx++) { - b = (gfx[i] >> 3) & 31; i++; - g = (gfx[i] >> 3) & 31; i++; - r = (gfx[i] >> 3) & 31; i++; - - if (Bits == 32) i++; // On passe le bit alpha - - //PA_Put16bitPixel(screen, x + tempx, y + tempy, PA_RGB(r, g, b)); - Buffer[x + tempx + ((y + tempy) * SWidth)] = PA_RGB(r, g, b); - } - - while (i&3) i++; // Padding.... - } - } else if (Bits == 16) { - for (tempy = ly - 1; tempy > -1; tempy--) { - for (tempx = 0; tempx < lx; tempx++) { - b = *gfx2 & 31; - g = (*gfx2 >> 5) & 31; - r = (*gfx2 >> 10) & 31; - //PA_Put16bitPixel(screen, x + tempx, y + tempy, PA_RGB(r, g, b)); - Buffer[x + tempx + ((y + tempy) * SWidth)] = PA_RGB(r, g, b); - gfx2++; // On passe au pixel suivant - } - - s32 temp = (s32)gfx2; - - while (temp&3) temp++; // Padding.... - - gfx2 = (u16*)temp; - } - } - - if (Bits == 8) { - // look for palette data if present // - u8 *colormap = temp + 14 + Bmpinfo->SizeofHeader; - u16 palette[256]; - s32 colors; - - if (Bmpinfo->NColors != 0) { - colors = Bmpinfo->NColors & 0xff; - } else { - colors = 256; - } - - for (i = 0; i < colors; i++) { - b = ((colormap[(i<<2)+0]) >> 3) & 31; - g = ((colormap[(i<<2)+1]) >> 3) & 31; - r = ((colormap[(i<<2)+2]) >> 3) & 31; - palette[i] = PA_RGB(r, g, b); - } - - i = 0; - - for (tempy = ly - 1; tempy > -1; tempy--) { - for (tempx = 0; tempx < lx; tempx++) { - Buffer[x + tempx + ((y + tempy) * SWidth)] = palette[gfx[i]]; - i++; - } - } - } -} +#include + +////////////////////////////////////////////////////////////////////// +// Buffer mode +////////////////////////////////////////////////////////////////////// + +u16 PA_oldx[2], PA_oldy[2]; +s16 PA_olddowntime[2]; +u8 PA_drawsize[2]; +u16 *PA_DrawBg[2]; +u32 *PA_DrawBg32[2]; +u8 PA_nBit[2]; // 8 or 16 on each screen... + +u16 PA_temppal[256]; + + +u16 tempvar; + +void PA_LoadBmpToBuffer(u16 *Buffer, s16 x, s16 y, void *bmp, s16 SWidth) { + u8 *temp = (u8*)bmp; + BMPHeader0 *Bmpinfo0 = (BMPHeader0 *)(temp); + BMP_Headers *Bmpinfo = (BMP_Headers*)(temp + 14); +// u8 *gfx = temp+54; + u32 start = Bmpinfo0->ImageStart1 + ((Bmpinfo0->ImageStart2) << 16); + u8 *gfx = temp + start; + u16 *gfx2 = (u16*)(temp + start); +// u16 *gfx2 = (u16*)(temp+54); // Pour le mode 16 bit... + s32 r, g, b; s16 tempx, tempy; + s16 lx = Bmpinfo->Width; s16 ly = Bmpinfo->Height; + u16 Bits = Bmpinfo->BitsperPixel; + //Buffer = (u16*)(Buffer + ((x + (y*SWidth)) << 1)); // Position de départ + s32 i = 0; + + if (Bits > 16) { // Pour 24 et 32 bits + for (tempy = ly - 1; tempy > -1; tempy--) { + for (tempx = 0; tempx < lx; tempx++) { + b = (gfx[i] >> 3) & 31; i++; + g = (gfx[i] >> 3) & 31; i++; + r = (gfx[i] >> 3) & 31; i++; + + if (Bits == 32) i++; // On passe le bit alpha + + //PA_Put16bitPixel(screen, x + tempx, y + tempy, PA_RGB(r, g, b)); + Buffer[x + tempx + ((y + tempy) * SWidth)] = PA_RGB(r, g, b); + } + + while (i&3) i++; // Padding.... + } + } else if (Bits == 16) { + for (tempy = ly - 1; tempy > -1; tempy--) { + for (tempx = 0; tempx < lx; tempx++) { + b = *gfx2 & 31; + g = (*gfx2 >> 5) & 31; + r = (*gfx2 >> 10) & 31; + //PA_Put16bitPixel(screen, x + tempx, y + tempy, PA_RGB(r, g, b)); + Buffer[x + tempx + ((y + tempy) * SWidth)] = PA_RGB(r, g, b); + gfx2++; // On passe au pixel suivant + } + + s32 temp = (s32)gfx2; + + while (temp&3) temp++; // Padding.... + + gfx2 = (u16*)temp; + } + } + + if (Bits == 8) { + // look for palette data if present // + u8 *colormap = temp + 14 + Bmpinfo->SizeofHeader; + u16 palette[256]; + s32 colors; + + if (Bmpinfo->NColors != 0) { + colors = Bmpinfo->NColors & 0xff; + } else { + colors = 256; + } + + for (i = 0; i < colors; i++) { + b = ((colormap[(i<<2)+0]) >> 3) & 31; + g = ((colormap[(i<<2)+1]) >> 3) & 31; + r = ((colormap[(i<<2)+2]) >> 3) & 31; + palette[i] = PA_RGB(r, g, b); + } + + i = 0; + + for (tempy = ly - 1; tempy > -1; tempy--) { + for (tempx = 0; tempx < lx; tempx++) { + Buffer[x + tempx + ((y + tempy) * SWidth)] = palette[gfx[i]]; + i++; + } + } + } +} diff --git a/source/arm9/PA_Draw16bit.c b/source/arm9/PA_Draw16bit.c index 578b181..c527e40 100644 --- a/source/arm9/PA_Draw16bit.c +++ b/source/arm9/PA_Draw16bit.c @@ -1,53 +1,53 @@ -#include - -void PA_Default16bitInit(u8 screen, u8 bg_priority) { - PA_DeleteBg(screen, 3); - PA_nBit[screen] = 1; // 16 bit - PA_BGXPA(screen, 3) = 1 << 8; - PA_BGXPB(screen, 3) = 0; - PA_BGXPC(screen, 3) = 0; - PA_BGXPD(screen, 3) = 1 << 8; - PA_BGXX(screen, 3) = 0; - PA_BGXY(screen, 3) = 0; - _REG16(REG_BGSCREEN(screen)) &= ~7; - _REG16(REG_BGSCREEN(screen)) |= (0x100 << (3)) | MODE_3_2D; -} - -void PA_Init16bitBg(u8 screen, u8 bg_priority) { - PA_Default16bitInit(screen, bg_priority); - PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 128 * 256); - PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; - dmaFillWords(0, (void*)PA_DrawBg[screen], 256*192*2); - //this is just used so we can write red color bits to one frame and green to the - //other - charsetstart[screen] = 2; // On se r�serve la moiti� de la m�moire... - charblocks[screen][16] = 1; // Block la m�moire - _REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP16_256x256 | BG_BMP_BASE(2); - PA_SetDrawSize(screen, 1); -} - -u8 pa16bitbuffer[2]; - -void PA_Init16bitDblBuffer(u8 screen, u8 bg_priority) { - PA_Default16bitInit(screen, bg_priority); - dmaFillWords(0, (void*)(0x06000000 + (0x200000 * screen)), 256*384*2); - PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 192 * 512); - PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; - pa16bitbuffer[screen] = 0; // First buffer... - charsetstart[screen] = 0; // On se r�serve la moiti� de la m�moire... - _REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP16_256x256 | BG_BMP_BASE(0); - PA_SetDrawSize(screen, 1); - //vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_BG_0x06020000, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE); - vramSetBankA(VRAM_A_MAIN_BG_0x06000000); - vramSetBankB(VRAM_B_MAIN_BG_0x06020000); - vramSetBankC(VRAM_C_SUB_BG); - vramSetBankD(VRAM_D_SUB_SPRITE); -} - -void PA_16bitSwapBuffer(u8 screen) { - pa16bitbuffer[screen] = !pa16bitbuffer[screen]; - PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + (192 - pa16bitbuffer[screen] * 192) * 512); - PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; - _REG16(REG_BGCNT(screen, 3)) &= ~(BG_BMP_BASE(7)); - _REG16(REG_BGCNT(screen, 3)) |= BG_BMP_BASE(pa16bitbuffer[screen] * 6); -} +#include + +void PA_Default16bitInit(u8 screen, u8 bg_priority) { + PA_DeleteBg(screen, 3); + PA_nBit[screen] = 1; // 16 bit + PA_BGXPA(screen, 3) = 1 << 8; + PA_BGXPB(screen, 3) = 0; + PA_BGXPC(screen, 3) = 0; + PA_BGXPD(screen, 3) = 1 << 8; + PA_BGXX(screen, 3) = 0; + PA_BGXY(screen, 3) = 0; + _REG16(REG_BGSCREEN(screen)) &= ~7; + _REG16(REG_BGSCREEN(screen)) |= (0x100 << (3)) | MODE_3_2D; +} + +void PA_Init16bitBg(u8 screen, u8 bg_priority) { + PA_Default16bitInit(screen, bg_priority); + PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 128 * 256); + PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; + dmaFillWords(0, (void*)PA_DrawBg[screen], 256*192*2); + //this is just used so we can write red color bits to one frame and green to the + //other + charsetstart[screen] = 2; // On se r�serve la moiti� de la m�moire... + charblocks[screen][16] = 1; // Block la m�moire + _REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP16_256x256 | BG_BMP_BASE(2); + PA_SetDrawSize(screen, 1); +} + +u8 pa16bitbuffer[2]; + +void PA_Init16bitDblBuffer(u8 screen, u8 bg_priority) { + PA_Default16bitInit(screen, bg_priority); + dmaFillWords(0, (void*)(0x06000000 + (0x200000 * screen)), 256*384*2); + PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 192 * 512); + PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; + pa16bitbuffer[screen] = 0; // First buffer... + charsetstart[screen] = 0; // On se r�serve la moiti� de la m�moire... + _REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP16_256x256 | BG_BMP_BASE(0); + PA_SetDrawSize(screen, 1); + //vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_BG_0x06020000, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE); + vramSetBankA(VRAM_A_MAIN_BG_0x06000000); + vramSetBankB(VRAM_B_MAIN_BG_0x06020000); + vramSetBankC(VRAM_C_SUB_BG); + vramSetBankD(VRAM_D_SUB_SPRITE); +} + +void PA_16bitSwapBuffer(u8 screen) { + pa16bitbuffer[screen] = !pa16bitbuffer[screen]; + PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + (192 - pa16bitbuffer[screen] * 192) * 512); + PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; + _REG16(REG_BGCNT(screen, 3)) &= ~(BG_BMP_BASE(7)); + _REG16(REG_BGCNT(screen, 3)) |= BG_BMP_BASE(pa16bitbuffer[screen] * 6); +} diff --git a/source/arm9/PA_Draw16bitEx.c b/source/arm9/PA_Draw16bitEx.c index c910a0b..aaebb0b 100644 --- a/source/arm9/PA_Draw16bitEx.c +++ b/source/arm9/PA_Draw16bitEx.c @@ -1,195 +1,195 @@ -#include - -void PA_Draw16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color) { - int i, dx, dy, sdx, sdy, dxabs, dyabs, x, y, px, py; - dx = x2 - x1; /* the horizontal distance of the line */ - dy = y2 - y1; /* the vertical distance of the line */ - dxabs = dx; - sdx = 1; - - if (dx < 0) { - dxabs = -dx; - sdx = -1; - } - - dyabs = dy; - sdy = 1; - - if (dy < 0) { - dyabs = -dy; - sdy = -1; - } - - x = dyabs >> 1; - y = dxabs >> 1; - px = x1; - py = y1; - PA_Put16bitPixel(screen, px, py, color); - - if (dxabs >= dyabs) { - for (i = 0; i < dxabs; i++) { - y += dyabs; - - if (y >= dxabs) { - y -= dxabs; - py += sdy; - } - - px += sdx; - PA_Put16bitPixel(screen, px, py, color); - } - } else { - for (i = 0; i < dyabs; i++) { - x += dxabs; - - if (x >= dyabs) { - x -= dyabs; - px += sdx; - } - - py += sdy; - PA_Put16bitPixel(screen, px, py, color); - } - } -} - -void PA_16bitDraw(u8 screen, u16 color) { -// Si nouvelle pression, on fait juste un point. Sinon, on trace un trait entre les 2 points... - if (Stylus.Newpress) { - s16 low = (PA_drawsize[screen] >> 1) - PA_drawsize[screen] + 1; - s16 high = (PA_drawsize[screen] >> 1) + 1; - s16 i = 0, j = 0; - - for (i = low; i < high; i++) - for (j = low; j < high; j++) - if ((Stylus.X + i >= 0) && (Stylus.Y + j >= 0) && (Stylus.X + i < 256) && (Stylus.Y + j < 192)) - PA_Put16bitPixel(screen, Stylus.X + i, Stylus.Y + j, color); - } else if (Stylus.Held) { - if (PA_olddowntime[screen] != (Stylus.Downtime - 1)) { - PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y; - } - - PA_Draw16bitLineEx(screen, Stylus.X, Stylus.Y, PA_oldx[screen], PA_oldy[screen], color, PA_drawsize[screen]); - } - - PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y; PA_olddowntime[screen] = Stylus.Downtime; -} - -void PA_Draw16bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color, s8 size) { - s8 low = (size >> 1) - size + 1; - s8 high = (size >> 1) + 1; - s16 i, j; - s16 x1, x2, y1, y2; - - for (i = low; i < high; i++) { - for (j = low; j < high; j++) { - if ((basex + i >= 0) && (basey + j >= 0) && (basex + i < 256) && (basey + j < 192)) { - PA_Put16bitPixel(screen, basex + i, basey + j, color); - } - } - } - - for (i = low; i < high; i++) { - j = low; - x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; - - while (x1 < 0) x1++; - while (x1 > 255) x1--; - - while (x2 < 0) x2++; - while (x2 > 255) x2--; - - while (y1 < 0) y1++; - while (y1 > 191) y1--; - - while (y2 < 0) y2++; - while (y2 > 191) y2--; - - PA_Draw16bitLine(screen, x1, y1, x2, y2, color); - j = high - 1; - x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; - - while (x1 < 0) x1++; - while (x1 > 255) x1--; - - while (x2 < 0) x2++; - while (x2 > 255) x2--; - - while (y1 < 0) y1++; - while (y1 > 191) y1--; - - while (y2 < 0) y2++; - while (y2 > 191) y2--; - - PA_Draw16bitLine(screen, x1, y1, x2, y2, color); - } - - for (j = low; j < high; j++) { - i = low; - x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; - - while (x1 < 0) x1++; - while (x1 > 255) x1--; - - while (x2 < 0) x2++; - while (x2 > 255) x2--; - - while (y1 < 0) y1++; - while (y1 > 191) y1--; - - while (y2 < 0) y2++; - while (y2 > 191) y2--; - - PA_Draw16bitLine(screen, x1, y1, x2, y2, color); - i = high - 1; - x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; - - while (x1 < 0) x1++; - while (x1 > 255) x1--; - - while (x2 < 0) x2++; - while (x2 > 255) x2--; - - while (y1 < 0) y1++; - while (y1 > 191) y1--; - - while (y2 < 0) y2++; - while (y2 > 191) y2--; - - PA_Draw16bitLine(screen, x1, y1, x2, y2, color); - } -} - -void PA_Draw16bitRect(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color) { - s16 i, j; - -// On met dans le bon ordre... - if (endx < basex) { - i = basex; basex = endx; endx = i; - } - - if (basex < 0) basex = 0; - - if (endx > 255) endx = 255; - - s16 lx = endx - basex; - - if (lx) { // Si y'a une surface � faire - if (endy < basey) { - i = basey; basey = endy; endy = i; - } - - if (basey < 0) basey = 0; - - if (endy > 191) endy = 191; - - //u16 *start = (u16*)PA_DrawBg[screen] + basex; - //tempvar = color; - for (j = basey; j < endy; j++) { - for (i = basex; i < endx; i++) { - PA_Put16bitPixel(screen, i, j, color); - //DMA_Force(tempvar, (void*)(start + (j << 8)), lx, DMA_16NOW); - } - } - } -} +#include + +void PA_Draw16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color) { + int i, dx, dy, sdx, sdy, dxabs, dyabs, x, y, px, py; + dx = x2 - x1; /* the horizontal distance of the line */ + dy = y2 - y1; /* the vertical distance of the line */ + dxabs = dx; + sdx = 1; + + if (dx < 0) { + dxabs = -dx; + sdx = -1; + } + + dyabs = dy; + sdy = 1; + + if (dy < 0) { + dyabs = -dy; + sdy = -1; + } + + x = dyabs >> 1; + y = dxabs >> 1; + px = x1; + py = y1; + PA_Put16bitPixel(screen, px, py, color); + + if (dxabs >= dyabs) { + for (i = 0; i < dxabs; i++) { + y += dyabs; + + if (y >= dxabs) { + y -= dxabs; + py += sdy; + } + + px += sdx; + PA_Put16bitPixel(screen, px, py, color); + } + } else { + for (i = 0; i < dyabs; i++) { + x += dxabs; + + if (x >= dyabs) { + x -= dyabs; + px += sdx; + } + + py += sdy; + PA_Put16bitPixel(screen, px, py, color); + } + } +} + +void PA_16bitDraw(u8 screen, u16 color) { +// Si nouvelle pression, on fait juste un point. Sinon, on trace un trait entre les 2 points... + if (Stylus.Newpress) { + s16 low = (PA_drawsize[screen] >> 1) - PA_drawsize[screen] + 1; + s16 high = (PA_drawsize[screen] >> 1) + 1; + s16 i = 0, j = 0; + + for (i = low; i < high; i++) + for (j = low; j < high; j++) + if ((Stylus.X + i >= 0) && (Stylus.Y + j >= 0) && (Stylus.X + i < 256) && (Stylus.Y + j < 192)) + PA_Put16bitPixel(screen, Stylus.X + i, Stylus.Y + j, color); + } else if (Stylus.Held) { + if (PA_olddowntime[screen] != (Stylus.Downtime - 1)) { + PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y; + } + + PA_Draw16bitLineEx(screen, Stylus.X, Stylus.Y, PA_oldx[screen], PA_oldy[screen], color, PA_drawsize[screen]); + } + + PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y; PA_olddowntime[screen] = Stylus.Downtime; +} + +void PA_Draw16bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color, s8 size) { + s8 low = (size >> 1) - size + 1; + s8 high = (size >> 1) + 1; + s16 i, j; + s16 x1, x2, y1, y2; + + for (i = low; i < high; i++) { + for (j = low; j < high; j++) { + if ((basex + i >= 0) && (basey + j >= 0) && (basex + i < 256) && (basey + j < 192)) { + PA_Put16bitPixel(screen, basex + i, basey + j, color); + } + } + } + + for (i = low; i < high; i++) { + j = low; + x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; + + while (x1 < 0) x1++; + while (x1 > 255) x1--; + + while (x2 < 0) x2++; + while (x2 > 255) x2--; + + while (y1 < 0) y1++; + while (y1 > 191) y1--; + + while (y2 < 0) y2++; + while (y2 > 191) y2--; + + PA_Draw16bitLine(screen, x1, y1, x2, y2, color); + j = high - 1; + x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; + + while (x1 < 0) x1++; + while (x1 > 255) x1--; + + while (x2 < 0) x2++; + while (x2 > 255) x2--; + + while (y1 < 0) y1++; + while (y1 > 191) y1--; + + while (y2 < 0) y2++; + while (y2 > 191) y2--; + + PA_Draw16bitLine(screen, x1, y1, x2, y2, color); + } + + for (j = low; j < high; j++) { + i = low; + x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; + + while (x1 < 0) x1++; + while (x1 > 255) x1--; + + while (x2 < 0) x2++; + while (x2 > 255) x2--; + + while (y1 < 0) y1++; + while (y1 > 191) y1--; + + while (y2 < 0) y2++; + while (y2 > 191) y2--; + + PA_Draw16bitLine(screen, x1, y1, x2, y2, color); + i = high - 1; + x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; + + while (x1 < 0) x1++; + while (x1 > 255) x1--; + + while (x2 < 0) x2++; + while (x2 > 255) x2--; + + while (y1 < 0) y1++; + while (y1 > 191) y1--; + + while (y2 < 0) y2++; + while (y2 > 191) y2--; + + PA_Draw16bitLine(screen, x1, y1, x2, y2, color); + } +} + +void PA_Draw16bitRect(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color) { + s16 i, j; + +// On met dans le bon ordre... + if (endx < basex) { + i = basex; basex = endx; endx = i; + } + + if (basex < 0) basex = 0; + + if (endx > 255) endx = 255; + + s16 lx = endx - basex; + + if (lx) { // Si y'a une surface � faire + if (endy < basey) { + i = basey; basey = endy; endy = i; + } + + if (basey < 0) basey = 0; + + if (endy > 191) endy = 191; + + //u16 *start = (u16*)PA_DrawBg[screen] + basex; + //tempvar = color; + for (j = basey; j < endy; j++) { + for (i = basex; i < endx; i++) { + PA_Put16bitPixel(screen, i, j, color); + //DMA_Force(tempvar, (void*)(start + (j << 8)), lx, DMA_16NOW); + } + } + } +} diff --git a/source/arm9/PA_Draw8bit.c b/source/arm9/PA_Draw8bit.c index ada1122..10f91aa 100644 --- a/source/arm9/PA_Draw8bit.c +++ b/source/arm9/PA_Draw8bit.c @@ -1,63 +1,63 @@ -#include -void PA_Default8bitInit(u8 screen, u8 bg_priority) { - PA_DeleteBg(screen, 3); - PA_nBit[screen] = 0; // 8 bit - PA_BGXPA(screen, 3) = 1 << 8; - PA_BGXPB(screen, 3) = 0; - PA_BGXPC(screen, 3) = 0; - PA_BGXPD(screen, 3) = 1 << 8; - PA_BGXX(screen, 3) = 0; - PA_BGXY(screen, 3) = 0; - _REG16(REG_BGSCREEN(screen)) &= ~7; - _REG16(REG_BGSCREEN(screen)) |= (0x100 << (3)) | MODE_3_2D; -} - -void PA_Init8bitBg(u8 screen, u8 bg_priority) { - PA_Default8bitInit(screen, bg_priority); - PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 320 * 256); - PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; - dmaFillWords(0, (void*)PA_DrawBg[screen], 256*96*2); - charsetstart[screen] = 5; // On se réserve la moitié de la mémoire... - - int i; for (i = 40; i < 64; i++) charblocks[screen][i] = 1; // Block la mémoire - - _REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP8_256x256 | BG_BMP_BASE(5); - PA_SetDrawSize(screen, 1); -} - -void PA_InitBig8bitBg(u8 screen, u8 bg_priority) { - PA_Default8bitInit(screen, bg_priority); - PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 256 * 256); - PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; - dmaFillWords(0, (void*)PA_DrawBg[screen], 256*128*2); - charsetstart[screen] = 4; // On se réserve la moitié de la mémoire... - - int i; for (i = 32; i < 64; i++) charblocks[screen][i] = 1; // Block la mémoire - - _REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP8_256x256 | BG_BMP_BASE(4); - PA_SetDrawSize(screen, 1); -} - -u8 pa8bitbuffer[2]; - -void PA_8bitSwapBuffer(u8 screen) { - pa8bitbuffer[screen] = !pa8bitbuffer[screen]; - PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + (320 - pa8bitbuffer[screen] * 192) * 256); - PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; - _REG16(REG_BGCNT(screen, 3)) &= ~(BG_BMP_BASE(7)); - _REG16(REG_BGCNT(screen, 3)) |= BG_BMP_BASE(2 + pa8bitbuffer[screen] * 3); -} - -void PA_Init8bitDblBuffer(u8 screen, u8 bg_priority) { - PA_Default8bitInit(screen, bg_priority); - dmaFillWords(0, (void*)(0x06000000 + (0x200000 * screen) + 128 * 256), 256*192*2); - PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 320 * 256); - PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; - pa8bitbuffer[screen] = 0; // First buffer... - charsetstart[screen] = 2; // On se réserve la moitié de la mémoire... - - int i; for (i = 8; i < 64; i++) charblocks[screen][i] = 1; // Block la mémoire - - _REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP8_256x256 | BG_BMP_BASE(2); - PA_SetDrawSize(screen, 1); -} +#include +void PA_Default8bitInit(u8 screen, u8 bg_priority) { + PA_DeleteBg(screen, 3); + PA_nBit[screen] = 0; // 8 bit + PA_BGXPA(screen, 3) = 1 << 8; + PA_BGXPB(screen, 3) = 0; + PA_BGXPC(screen, 3) = 0; + PA_BGXPD(screen, 3) = 1 << 8; + PA_BGXX(screen, 3) = 0; + PA_BGXY(screen, 3) = 0; + _REG16(REG_BGSCREEN(screen)) &= ~7; + _REG16(REG_BGSCREEN(screen)) |= (0x100 << (3)) | MODE_3_2D; +} + +void PA_Init8bitBg(u8 screen, u8 bg_priority) { + PA_Default8bitInit(screen, bg_priority); + PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 320 * 256); + PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; + dmaFillWords(0, (void*)PA_DrawBg[screen], 256*96*2); + charsetstart[screen] = 5; // On se réserve la moitié de la mémoire... + + int i; for (i = 40; i < 64; i++) charblocks[screen][i] = 1; // Block la mémoire + + _REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP8_256x256 | BG_BMP_BASE(5); + PA_SetDrawSize(screen, 1); +} + +void PA_InitBig8bitBg(u8 screen, u8 bg_priority) { + PA_Default8bitInit(screen, bg_priority); + PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 256 * 256); + PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; + dmaFillWords(0, (void*)PA_DrawBg[screen], 256*128*2); + charsetstart[screen] = 4; // On se réserve la moitié de la mémoire... + + int i; for (i = 32; i < 64; i++) charblocks[screen][i] = 1; // Block la mémoire + + _REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP8_256x256 | BG_BMP_BASE(4); + PA_SetDrawSize(screen, 1); +} + +u8 pa8bitbuffer[2]; + +void PA_8bitSwapBuffer(u8 screen) { + pa8bitbuffer[screen] = !pa8bitbuffer[screen]; + PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + (320 - pa8bitbuffer[screen] * 192) * 256); + PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; + _REG16(REG_BGCNT(screen, 3)) &= ~(BG_BMP_BASE(7)); + _REG16(REG_BGCNT(screen, 3)) |= BG_BMP_BASE(2 + pa8bitbuffer[screen] * 3); +} + +void PA_Init8bitDblBuffer(u8 screen, u8 bg_priority) { + PA_Default8bitInit(screen, bg_priority); + dmaFillWords(0, (void*)(0x06000000 + (0x200000 * screen) + 128 * 256), 256*192*2); + PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 320 * 256); + PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen]; + pa8bitbuffer[screen] = 0; // First buffer... + charsetstart[screen] = 2; // On se réserve la moitié de la mémoire... + + int i; for (i = 8; i < 64; i++) charblocks[screen][i] = 1; // Block la mémoire + + _REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP8_256x256 | BG_BMP_BASE(2); + PA_SetDrawSize(screen, 1); +} diff --git a/source/arm9/PA_Draw8bitEx.c b/source/arm9/PA_Draw8bitEx.c index 35c723f..62b8fa2 100644 --- a/source/arm9/PA_Draw8bitEx.c +++ b/source/arm9/PA_Draw8bitEx.c @@ -1,161 +1,161 @@ -#include - -void PA_Draw8bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u8 color) { - int i, dx, dy, sdx, sdy, dxabs, dyabs, x, y, px, py; - dx = x2 - x1; /* the horizontal distance of the line */ - dy = y2 - y1; /* the vertical distance of the line */ - dxabs = dx; - sdx = 1; - - if (dx < 0) { - dxabs = -dx; - sdx = -1; - } - - dyabs = dy; - sdy = 1; - - if (dy < 0) { - dyabs = -dy; - sdy = -1; - } - - x = dyabs >> 1; - y = dxabs >> 1; - px = x1; - py = y1; - PA_Put8bitPixel(screen, px, py, color); - - if (dxabs >= dyabs) { - for (i = 0; i < dxabs; i++) { - y += dyabs; - - if (y >= dxabs) { - y -= dxabs; - py += sdy; - } - - px += sdx; - PA_Put8bitPixel(screen, px, py, color); - } - } else { - for (i = 0; i < dyabs; i++) { - x += dxabs; - - if (x >= dyabs) { - x -= dyabs; - px += sdx; - } - - py += sdy; - PA_Put8bitPixel(screen, px, py, color); - } - } -} - -void PA_8bitDraw(u8 screen, u8 color) { -// Si nouvelle pression, on fait juste un point. Sinon, on trace un trait entre les 2 points... - if (Stylus.Newpress) { - s16 low = (PA_drawsize[screen] >> 1) - PA_drawsize[screen] + 1; - s16 high = (PA_drawsize[screen] >> 1) + 1; - s16 i = 0, j = 0; - - for (i = low; i < high; i++) - for (j = low; j < high; j++) - if ((Stylus.X + i >= 0) && (Stylus.Y + j >= 0) && (Stylus.X + i < 256) && (Stylus.Y + j < 192)) - PA_Put8bitPixel(screen, Stylus.X + i, Stylus.Y + j, color); - } else if (Stylus.Held) { - if (PA_olddowntime[screen] != (Stylus.Downtime - 1)) { - PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y; - } - - PA_Draw8bitLineEx(screen, Stylus.X, Stylus.Y, PA_oldx[screen], PA_oldy[screen], color, PA_drawsize[screen]); - } - - PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y; PA_olddowntime[screen] = Stylus.Downtime; -} - -void PA_Draw8bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u8 color, s8 size) { - s8 low = (size >> 1) - size + 1; - s8 high = (size >> 1) + 1; - s16 i, j; - s16 x1, x2, y1, y2; - - for (i = low; i < high; i++) { - for (j = low; j < high; j++) { - if ((basex + i >= 0) && (basey + j >= 0) && (basex + i < 256) && (basey + j < 192)) { - PA_Put8bitPixel(screen, basex + i, basey + j, color); - } - } - } - - for (i = low; i < high; i++) { - j = low; - x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; - - while (x1 < 0) x1++; - while (x1 > 255) x1--; - - while (x2 < 0) x2++; - while (x2 > 255) x2--; - - while (y1 < 0) y1++; - while (y1 > 191) y1--; - - while (y2 < 0) y2++; - while (y2 > 191) y2--; - - PA_Draw8bitLine(screen, x1, y1, x2, y2, color); - j = high - 1; - x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; - - while (x1 < 0) x1++; - while (x1 > 255) x1--; - - while (x2 < 0) x2++; - while (x2 > 255) x2--; - - while (y1 < 0) y1++; - while (y1 > 191) y1--; - - while (y2 < 0) y2++; - while (y2 > 191) y2--; - - PA_Draw8bitLine(screen, x1, y1, x2, y2, color); - } - - for (j = low; j < high; j++) { - i = low; - x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; - - while (x1 < 0) x1++; - while (x1 > 255) x1--; - - while (x2 < 0) x2++; - while (x2 > 255) x2--; - - while (y1 < 0) y1++; - while (y1 > 191) y1--; - - while (y2 < 0) y2++; - while (y2 > 191) y2--; - - PA_Draw8bitLine(screen, x1, y1, x2, y2, color); - i = high - 1; - x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; - - while (x1 < 0) x1++; - while (x1 > 255) x1--; - - while (x2 < 0) x2++; - while (x2 > 255) x2--; - - while (y1 < 0) y1++; - while (y1 > 191) y1--; - - while (y2 < 0) y2++; - while (y2 > 191) y2--; - - PA_Draw8bitLine(screen, x1, y1, x2, y2, color); - } -} +#include + +void PA_Draw8bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u8 color) { + int i, dx, dy, sdx, sdy, dxabs, dyabs, x, y, px, py; + dx = x2 - x1; /* the horizontal distance of the line */ + dy = y2 - y1; /* the vertical distance of the line */ + dxabs = dx; + sdx = 1; + + if (dx < 0) { + dxabs = -dx; + sdx = -1; + } + + dyabs = dy; + sdy = 1; + + if (dy < 0) { + dyabs = -dy; + sdy = -1; + } + + x = dyabs >> 1; + y = dxabs >> 1; + px = x1; + py = y1; + PA_Put8bitPixel(screen, px, py, color); + + if (dxabs >= dyabs) { + for (i = 0; i < dxabs; i++) { + y += dyabs; + + if (y >= dxabs) { + y -= dxabs; + py += sdy; + } + + px += sdx; + PA_Put8bitPixel(screen, px, py, color); + } + } else { + for (i = 0; i < dyabs; i++) { + x += dxabs; + + if (x >= dyabs) { + x -= dyabs; + px += sdx; + } + + py += sdy; + PA_Put8bitPixel(screen, px, py, color); + } + } +} + +void PA_8bitDraw(u8 screen, u8 color) { +// Si nouvelle pression, on fait juste un point. Sinon, on trace un trait entre les 2 points... + if (Stylus.Newpress) { + s16 low = (PA_drawsize[screen] >> 1) - PA_drawsize[screen] + 1; + s16 high = (PA_drawsize[screen] >> 1) + 1; + s16 i = 0, j = 0; + + for (i = low; i < high; i++) + for (j = low; j < high; j++) + if ((Stylus.X + i >= 0) && (Stylus.Y + j >= 0) && (Stylus.X + i < 256) && (Stylus.Y + j < 192)) + PA_Put8bitPixel(screen, Stylus.X + i, Stylus.Y + j, color); + } else if (Stylus.Held) { + if (PA_olddowntime[screen] != (Stylus.Downtime - 1)) { + PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y; + } + + PA_Draw8bitLineEx(screen, Stylus.X, Stylus.Y, PA_oldx[screen], PA_oldy[screen], color, PA_drawsize[screen]); + } + + PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y; PA_olddowntime[screen] = Stylus.Downtime; +} + +void PA_Draw8bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u8 color, s8 size) { + s8 low = (size >> 1) - size + 1; + s8 high = (size >> 1) + 1; + s16 i, j; + s16 x1, x2, y1, y2; + + for (i = low; i < high; i++) { + for (j = low; j < high; j++) { + if ((basex + i >= 0) && (basey + j >= 0) && (basex + i < 256) && (basey + j < 192)) { + PA_Put8bitPixel(screen, basex + i, basey + j, color); + } + } + } + + for (i = low; i < high; i++) { + j = low; + x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; + + while (x1 < 0) x1++; + while (x1 > 255) x1--; + + while (x2 < 0) x2++; + while (x2 > 255) x2--; + + while (y1 < 0) y1++; + while (y1 > 191) y1--; + + while (y2 < 0) y2++; + while (y2 > 191) y2--; + + PA_Draw8bitLine(screen, x1, y1, x2, y2, color); + j = high - 1; + x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; + + while (x1 < 0) x1++; + while (x1 > 255) x1--; + + while (x2 < 0) x2++; + while (x2 > 255) x2--; + + while (y1 < 0) y1++; + while (y1 > 191) y1--; + + while (y2 < 0) y2++; + while (y2 > 191) y2--; + + PA_Draw8bitLine(screen, x1, y1, x2, y2, color); + } + + for (j = low; j < high; j++) { + i = low; + x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; + + while (x1 < 0) x1++; + while (x1 > 255) x1--; + + while (x2 < 0) x2++; + while (x2 > 255) x2--; + + while (y1 < 0) y1++; + while (y1 > 191) y1--; + + while (y2 < 0) y2++; + while (y2 > 191) y2--; + + PA_Draw8bitLine(screen, x1, y1, x2, y2, color); + i = high - 1; + x1 = basex + i; x2 = endx + i; y1 = basey + j; y2 = endy + j; + + while (x1 < 0) x1++; + while (x1 > 255) x1--; + + while (x2 < 0) x2++; + while (x2 > 255) x2--; + + while (y1 < 0) y1++; + while (y1 > 191) y1--; + + while (y2 < 0) y2++; + while (y2 > 191) y2--; + + PA_Draw8bitLine(screen, x1, y1, x2, y2, color); + } +} diff --git a/source/arm9/PA_Error.c b/source/arm9/PA_Error.c index 351e77f..85757ca 100644 --- a/source/arm9/PA_Error.c +++ b/source/arm9/PA_Error.c @@ -1,18 +1,18 @@ -#include - -void PA_Error(const char* text){ - PA_Init2D(); - PA_InitText(1, 0); - PA_OutputSimpleText(1, 0, 0, text); -} - -void _PA_Assert(const char* condition, const char* message, const char* file, int linen){ - PA_Init2D(); - PA_InitText(1, 0); - PA_OutputSimpleText(1, 1, 1, "Assertion failed!"); - PA_OutputSimpleText(1, 1, 3, condition); - PA_OutputSimpleText(1, 1, 5, message); - PA_OutputText(1, 1, 7, "Line #%d in file:", linen); - PA_OutputSimpleText(1, 1, 8, file); - for(;;) swiWaitForVBlank(); -} +#include + +void PA_Error(const char* text){ + PA_Init2D(); + PA_InitText(1, 0); + PA_OutputSimpleText(1, 0, 0, text); +} + +void _PA_Assert(const char* condition, const char* message, const char* file, int linen){ + PA_Init2D(); + PA_InitText(1, 0); + PA_OutputSimpleText(1, 1, 1, "Assertion failed!"); + PA_OutputSimpleText(1, 1, 3, condition); + PA_OutputSimpleText(1, 1, 5, message); + PA_OutputText(1, 1, 7, "Line #%d in file:", linen); + PA_OutputSimpleText(1, 1, 8, file); + for(;;) swiWaitForVBlank(); +} diff --git a/source/arm9/PA_Fake16bitBg.c b/source/arm9/PA_Fake16bitBg.c index 3e4ee59..0fa91d9 100644 --- a/source/arm9/PA_Fake16bitBg.c +++ b/source/arm9/PA_Fake16bitBg.c @@ -1,94 +1,94 @@ -// Fake 16 bit Background mode - -#include "PA_Fake16bit.h" - -u16* PA_DrawFake16[2]; -bool PA_HasFake16bitBg[2]; - -// Function to get the current scanline -static inline int PA_GetScanline(){ - int __temp = PA_GetVcount()+1; - if(__temp == 192) __temp = 0; // Adjust value: if we got 192, it's 0 really - return __temp; -} - -void fake16bit_hbl(){ - // Fake a 16 bit background - - // Get the scanline the hardware is about to draw - int vc = PA_GetScanline(); - - if(vc < 192){ // If scanline is a valid scanline - // Load palette based on the line the hardware is about to draw - // for screen 0 - if(PA_HasFake16bitBg[0]) - PA_Load8bitBgPal(0, (void*) &PA_DrawFake16[0][vc << 8]); - // for screen 1 - if(PA_HasFake16bitBg[1]) - PA_Load8bitBgPal(1, (void*) &PA_DrawFake16[1][vc << 8]); - } -} - -void PA_InitFake16bitBg(u8 screen, u8 prio){ - // Function to make a fake 16 bit background! - // Caution: fake 16 bit bgs and mode 7 DON'T MIX - bool hadbg = false; - - // Disable fake 16 bit backgrounds - if(PA_HasFake16bitBg[screen]){ - PA_HasFake16bitBg[screen] = false; - free(PA_DrawFake16[screen]); // Free the memory - hadbg = true; - } - // Allocate memory for a 16 bit background - PA_DrawFake16[screen] = calloc(256*192, sizeof(u16)); - if(!PA_DrawFake16[screen]){ - // ERROR!! - // Just hang up - PA_Error("Can't allocate buffer\nfor fake 16bit background!"); - for(;;) swiWaitForVBlank(); - } - // Initialize an 8 bit background on bg 3 at the specified screen - if(!hadbg) // Only initialize if that screen never had a fake 16 bit background before - PA_Init8bitBg(screen, prio); - // Make each scanline display the entire palette - int x, y; - for(y = 0; y < 192; y ++) - for(x = 0; x < 256; x ++) - PA_Put8bitPixel(screen, x, y, x); - // Set the horizontal blank handler - irqSet(IRQ_HBLANK, fake16bit_hbl); - irqEnable(IRQ_HBLANK); - // Confirm that we have a fake 16 bit background - PA_ClearFake16bitBg(screen); // Make sure the background is empty - PA_HasFake16bitBg[screen] = true; -} - -void PA_DrawFake16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color){ - // Draws a line on a fake 16 bit background - - // Copypasted (and shorted) from the real 16 bit background function - int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py; - - dx=x2-x1, dy=y2-y1, dxabs = dx, sdx = 1; - if(dx < 0) dxabs = -dx, sdx = -1; - dyabs = dy, sdy = 1; - if (dy < 0) dyabs = -dy, sdy = -1; - x=dyabs>>1, y=dxabs>>1, px=x1, py=y1; - PA_DrawFake16[screen][px + 256 * py] = color; - if (dxabs>=dyabs) { - for(i=0;i=dxabs) y-=dxabs, py+=sdy; - px+=sdx; - PA_DrawFake16[screen][px + 256 * py] = color; - } - }else{ - for(i=0;i=dyabs) x-=dyabs, px+=sdx; - py+=sdy; - PA_DrawFake16[screen][px + 256 * py] = color; - } - } -} +// Fake 16 bit Background mode + +#include "PA_Fake16bit.h" + +u16* PA_DrawFake16[2]; +bool PA_HasFake16bitBg[2]; + +// Function to get the current scanline +static inline int PA_GetScanline(){ + int __temp = PA_GetVcount()+1; + if(__temp == 192) __temp = 0; // Adjust value: if we got 192, it's 0 really + return __temp; +} + +void fake16bit_hbl(){ + // Fake a 16 bit background + + // Get the scanline the hardware is about to draw + int vc = PA_GetScanline(); + + if(vc < 192){ // If scanline is a valid scanline + // Load palette based on the line the hardware is about to draw + // for screen 0 + if(PA_HasFake16bitBg[0]) + PA_Load8bitBgPal(0, (void*) &PA_DrawFake16[0][vc << 8]); + // for screen 1 + if(PA_HasFake16bitBg[1]) + PA_Load8bitBgPal(1, (void*) &PA_DrawFake16[1][vc << 8]); + } +} + +void PA_InitFake16bitBg(u8 screen, u8 prio){ + // Function to make a fake 16 bit background! + // Caution: fake 16 bit bgs and mode 7 DON'T MIX + bool hadbg = false; + + // Disable fake 16 bit backgrounds + if(PA_HasFake16bitBg[screen]){ + PA_HasFake16bitBg[screen] = false; + free(PA_DrawFake16[screen]); // Free the memory + hadbg = true; + } + // Allocate memory for a 16 bit background + PA_DrawFake16[screen] = calloc(256*192, sizeof(u16)); + if(!PA_DrawFake16[screen]){ + // ERROR!! + // Just hang up + PA_Error("Can't allocate buffer\nfor fake 16bit background!"); + for(;;) swiWaitForVBlank(); + } + // Initialize an 8 bit background on bg 3 at the specified screen + if(!hadbg) // Only initialize if that screen never had a fake 16 bit background before + PA_Init8bitBg(screen, prio); + // Make each scanline display the entire palette + int x, y; + for(y = 0; y < 192; y ++) + for(x = 0; x < 256; x ++) + PA_Put8bitPixel(screen, x, y, x); + // Set the horizontal blank handler + irqSet(IRQ_HBLANK, fake16bit_hbl); + irqEnable(IRQ_HBLANK); + // Confirm that we have a fake 16 bit background + PA_ClearFake16bitBg(screen); // Make sure the background is empty + PA_HasFake16bitBg[screen] = true; +} + +void PA_DrawFake16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color){ + // Draws a line on a fake 16 bit background + + // Copypasted (and shorted) from the real 16 bit background function + int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py; + + dx=x2-x1, dy=y2-y1, dxabs = dx, sdx = 1; + if(dx < 0) dxabs = -dx, sdx = -1; + dyabs = dy, sdy = 1; + if (dy < 0) dyabs = -dy, sdy = -1; + x=dyabs>>1, y=dxabs>>1, px=x1, py=y1; + PA_DrawFake16[screen][px + 256 * py] = color; + if (dxabs>=dyabs) { + for(i=0;i=dxabs) y-=dxabs, py+=sdy; + px+=sdx; + PA_DrawFake16[screen][px + 256 * py] = color; + } + }else{ + for(i=0;i=dyabs) x-=dyabs, px+=sdx; + py+=sdy; + PA_DrawFake16[screen][px + 256 * py] = color; + } + } +} diff --git a/source/arm9/PA_Fifo.c b/source/arm9/PA_Fifo.c index 7ba3ace..b77d21e 100644 --- a/source/arm9/PA_Fifo.c +++ b/source/arm9/PA_Fifo.c @@ -1,23 +1,23 @@ -#include - -void PA_FifoMsgHandler(int bytes, void* dummy); - -void PA_InitFifo(){ - fifoSetDatamsgHandler(FIFO_PALIB, PA_FifoMsgHandler, 0); -} - -void PA_FifoMsgHandler(int bytes, void* dummy){ - PA_FifoMsg msg; - PA_GetFifoMsg(msg, bytes); - - switch(msg.type){ - // Extra input data from the ARM7 - case PA_MSG_INPUT: - // Copy the data to the transfer region - PA_Transfer->temperature = msg.InputMsg.temperature; - PA_Transfer->battery = msg.InputMsg.battery; - PA_Transfer->micvol = msg.InputMsg.micvol; - PA_Transfer->extra = msg.InputMsg.extra; - break; - } -} +#include + +void PA_FifoMsgHandler(int bytes, void* dummy); + +void PA_InitFifo(){ + fifoSetDatamsgHandler(FIFO_PALIB, PA_FifoMsgHandler, 0); +} + +void PA_FifoMsgHandler(int bytes, void* dummy){ + PA_FifoMsg msg; + PA_GetFifoMsg(msg, bytes); + + switch(msg.type){ + // Extra input data from the ARM7 + case PA_MSG_INPUT: + // Copy the data to the transfer region + PA_Transfer->temperature = msg.InputMsg.temperature; + PA_Transfer->battery = msg.InputMsg.battery; + PA_Transfer->micvol = msg.InputMsg.micvol; + PA_Transfer->extra = msg.InputMsg.extra; + break; + } +} diff --git a/source/arm9/PA_Gif.c b/source/arm9/PA_Gif.c index a5e4221..81e9570 100644 --- a/source/arm9/PA_Gif.c +++ b/source/arm9/PA_Gif.c @@ -1,216 +1,216 @@ -#include - -s16 gifwidth, gifheight; -u16 *temppalette; // Utilis� pour stocker la palette des gifs... -GifFileType* gifinfo; -u8 *tempscreen; // Ecran temporaire... -extern u8 PA_nBit[2]; - -/* -extern u16 pa_giftotexcolor; - -void PA_GifToTexTransp(u16 color) { - pa_giftotexcolor = color; -} -*/ - -u8 GifBits; // Mode 8 ou 16 bits - -const short InterlacedOffset[] = { 0, 4, 2, 1 }; /* The way Interlaced image should. */ -const short InterlacedJumps[] = { 8, 8, 4, 2 }; /* be read - offsets and jumps... */ - -int m; - -GifPixelType LineBuf[2048]; // Buffer temporaire - -#define GifAssert(c) PA_Assert(c, "GIF decoding error") - - -//s32 PA_GifSpeed = 6; - - -int readFunc(GifFileType* GifFile, GifByteType* buf, int count) { - char* ptr = (char*)GifFile->UserData; - memcpy(buf, ptr, count); - GifFile->UserData = ptr + count; - return count; -} - -void CopyLine(void* dst, void* src, int count) { // Pour 8 bit - /*s16 temp = (count +1) >> 1; - DMA_Copy(src, dst, temp, DMA_16NOW); // Copy rapide*/ - do { - *(u16*) dst = *(u16*) src; - src = (u8*)src + 2; - dst = (u8*)dst + 2; - count -= 2; - } while (count > 0); // On fait 4 par 4, puis 2 par 2... - -// if (count >= 0) *(u16*) dst = *(u16*) src; // On finit les 2 derniers -} - -void CopyLine2(void* dst, void* src, int count) { // Pour 16 bit - u8 *temp = (u8*)src; - - do { - *(u16*)dst = temppalette[*temp]; // On prend la couleur de la palette - temp++; - dst = (u8*)dst + 2; - count -= 1; - } while (count > 0); -} - -int DGifGetLineByte(GifFileType *GifFile, GifPixelType *Line, int LineLen) { - if (GifBits == 0) CopyLine(LineBuf, Line, LineLen); // On fait un backup - - int result = DGifGetLine(GifFile, LineBuf, LineLen); // Nouvelle ligne - - if (PA_GifInfo.CurrentFrame >= PA_GifInfo.StartFrame) { - if (GifBits == 0) CopyLine(Line, LineBuf, LineLen); // Copie 8 bit - - if (GifBits == 1) CopyLine2(Line, LineBuf, LineLen); // Copie 8 bit - } - - return result; -} - -#define GAMMA(x) (x) - -/****************************************************************************** -* Interpret the command line and scan the given GIF file. * -******************************************************************************/ - -int DecodeGif(const u8 *userData, u8 *ScreenBuff, u16* Palette, u8 nBits, s16 SWidth) { - int i, j, Row, Col, Width, Height, ExtCode; - GifRecordType RecordType; - GifByteType *Extension; - GifFileType *GifFile; - ColorMapObject *ColorMap; - PA_GifAnimSpeed(1); // normal speed when starting out... - PA_GifAnimPlay(); - PA_GifInfo.CurrentFrame = 0; - GifBits = nBits; - - if (GifBits == 1) { // On utilise une palette temporaire... - // Using alloca() instead of malloc() for the temporary buffer - temppalette = (u16*)alloca(512); // Ecran temporaire - Palette = temppalette; - } - - GifFile = DGifOpen((void*)userData, readFunc); - - /* Scan the content of the GIF file and load the image(s) in: */ - do { // Je vire les messages d'erreur pour gagner du temps - DGifGetRecordType(GifFile, &RecordType); - - switch (RecordType) { - case IMAGE_DESC_RECORD_TYPE: - GifAssert(DGifGetImageDesc(GifFile) != GIF_ERROR); - /*if (DGifGetImageDesc(GifFile) == GIF_ERROR) { - PrintGifError(); - return EXIT_FAILURE; - }*/ - Row = GifFile->Image.Top; /* Image Position relative to Screen. */ - Col = GifFile->Image.Left; - Width = GifFile->Image.Width; - Height = GifFile->Image.Height; - // Update Color map - ColorMap = (GifFile->Image.ColorMap ? GifFile->Image.ColorMap : GifFile->SColorMap); - - if (PA_GifInfo.CurrentFrame >= PA_GifInfo.StartFrame) {// Load Palette only if correct frame - i = ColorMap->ColorCount; - - while (--i >= 0) { - GifColorType* pColor = &ColorMap->Colors[i]; - Palette[i] = PA_RGB8(GAMMA(pColor->Red), GAMMA(pColor->Green), GAMMA(pColor->Blue)); - } - } - - GifAssert(!(GifFile->Image.Left + GifFile->Image.Width > GifFile->SWidth || - GifFile->Image.Top + GifFile->Image.Height > GifFile->SHeight)); - //GifFile->Image.Delay; - /* - if (GifFile->Image.Left + GifFile->Image.Width > GifFile->SWidth || - GifFile->Image.Top + GifFile->Image.Height > GifFile->SHeight) { - return EXIT_FAILURE; - }*/ - - if (GifFile->Image.Interlace) { - /* Need to perform 4 passes on the images: */ - for (i = 0; i < 4; i++) { - for (j = Row + InterlacedOffset[i]; j < Row + Height; - j += InterlacedJumps[i]) { - GifAssert(DGifGetLineByte(GifFile, (ScreenBuff + (((SWidth*j) + Col) << GifBits)), Width) != GIF_ERROR); - /*if (DGifGetLineByte(GifFile, &ScreenBuff[j][Col], - Width) == GIF_ERROR) { - PrintGifError(); - return EXIT_FAILURE; - }*/ - } - } - } else { - for (i = 0; i < Height; i++) { - GifAssert(DGifGetLineByte(GifFile, (ScreenBuff + (((SWidth*Row) + Col) << GifBits)), Width) != GIF_ERROR); - Row++; - /* - if (DGifGetLineByte(GifFile, &ScreenBuff[Row++][Col], - Width) == GIF_ERROR) { - PrintGifError(); - return EXIT_FAILURE; - }*/ - } - } - - break; - case EXTENSION_RECORD_TYPE: - /* Skip any extension blocks in file: */ - DGifGetExtension(GifFile, &ExtCode, &Extension); - - while (Extension != NULL) { - if (ExtCode == GRAPHICS_EXT_FUNC_CODE) { -// if((Extension[1] & 1) == 1) // transparency color exists -// pd->transColor = Extension[4]; - int tmpDelay = 0; - double tmpNumber = 0; - tmpDelay = Extension[2]; - tmpDelay += Extension[3] << 8; - tmpNumber = (double)(tmpDelay) * (double)60; - tmpNumber = tmpNumber / (double)100; - tmpDelay = (int)tmpNumber; - s32 time; - PA_GifInfo.CurrentFrame++; - - if (PA_GifInfo.CurrentFrame > PA_GifInfo.EndFrame) PA_GifInfo.Play = 0; // Last frame... - - if (PA_GifInfo.CurrentFrame - 1 >= PA_GifInfo.StartFrame) { // Don't wait if not at the right frame yet - for (time = 0; time*PA_GifInfo.Speed < tmpNumber; time++) { - PA_WaitForVBL(); - - while (PA_GifInfo.Play == 2) PA_WaitForVBL(); // Pause animation ! - - if (PA_GifInfo.Play == 0) goto GifStop; - } - } - -// pd->aniDelay = tmpDelay; - } - - DGifGetExtensionNext(GifFile, &Extension); - } - - break; - case TERMINATE_RECORD_TYPE: - break; - default: /* Should be traps by DGifGetRecordType. */ - break; - } - } while (RecordType != TERMINATE_RECORD_TYPE); - - /* Close file when done */ -GifStop: - DGifCloseFile(GifFile); - - //if (GifBits == 1) free(temppalette); // On vire la m�moire allou�e - - return 0; -} +#include + +s16 gifwidth, gifheight; +u16 *temppalette; // Utilis� pour stocker la palette des gifs... +GifFileType* gifinfo; +u8 *tempscreen; // Ecran temporaire... +extern u8 PA_nBit[2]; + +/* +extern u16 pa_giftotexcolor; + +void PA_GifToTexTransp(u16 color) { + pa_giftotexcolor = color; +} +*/ + +u8 GifBits; // Mode 8 ou 16 bits + +const short InterlacedOffset[] = { 0, 4, 2, 1 }; /* The way Interlaced image should. */ +const short InterlacedJumps[] = { 8, 8, 4, 2 }; /* be read - offsets and jumps... */ + +int m; + +GifPixelType LineBuf[2048]; // Buffer temporaire + +#define GifAssert(c) PA_Assert(c, "GIF decoding error") + + +//s32 PA_GifSpeed = 6; + + +int readFunc(GifFileType* GifFile, GifByteType* buf, int count) { + char* ptr = (char*)GifFile->UserData; + memcpy(buf, ptr, count); + GifFile->UserData = ptr + count; + return count; +} + +void CopyLine(void* dst, void* src, int count) { // Pour 8 bit + /*s16 temp = (count +1) >> 1; + DMA_Copy(src, dst, temp, DMA_16NOW); // Copy rapide*/ + do { + *(u16*) dst = *(u16*) src; + src = (u8*)src + 2; + dst = (u8*)dst + 2; + count -= 2; + } while (count > 0); // On fait 4 par 4, puis 2 par 2... + +// if (count >= 0) *(u16*) dst = *(u16*) src; // On finit les 2 derniers +} + +void CopyLine2(void* dst, void* src, int count) { // Pour 16 bit + u8 *temp = (u8*)src; + + do { + *(u16*)dst = temppalette[*temp]; // On prend la couleur de la palette + temp++; + dst = (u8*)dst + 2; + count -= 1; + } while (count > 0); +} + +int DGifGetLineByte(GifFileType *GifFile, GifPixelType *Line, int LineLen) { + if (GifBits == 0) CopyLine(LineBuf, Line, LineLen); // On fait un backup + + int result = DGifGetLine(GifFile, LineBuf, LineLen); // Nouvelle ligne + + if (PA_GifInfo.CurrentFrame >= PA_GifInfo.StartFrame) { + if (GifBits == 0) CopyLine(Line, LineBuf, LineLen); // Copie 8 bit + + if (GifBits == 1) CopyLine2(Line, LineBuf, LineLen); // Copie 8 bit + } + + return result; +} + +#define GAMMA(x) (x) + +/****************************************************************************** +* Interpret the command line and scan the given GIF file. * +******************************************************************************/ + +int DecodeGif(const u8 *userData, u8 *ScreenBuff, u16* Palette, u8 nBits, s16 SWidth) { + int i, j, Row, Col, Width, Height, ExtCode; + GifRecordType RecordType; + GifByteType *Extension; + GifFileType *GifFile; + ColorMapObject *ColorMap; + PA_GifAnimSpeed(1); // normal speed when starting out... + PA_GifAnimPlay(); + PA_GifInfo.CurrentFrame = 0; + GifBits = nBits; + + if (GifBits == 1) { // On utilise une palette temporaire... + // Using alloca() instead of malloc() for the temporary buffer + temppalette = (u16*)alloca(512); // Ecran temporaire + Palette = temppalette; + } + + GifFile = DGifOpen((void*)userData, readFunc); + + /* Scan the content of the GIF file and load the image(s) in: */ + do { // Je vire les messages d'erreur pour gagner du temps + DGifGetRecordType(GifFile, &RecordType); + + switch (RecordType) { + case IMAGE_DESC_RECORD_TYPE: + GifAssert(DGifGetImageDesc(GifFile) != GIF_ERROR); + /*if (DGifGetImageDesc(GifFile) == GIF_ERROR) { + PrintGifError(); + return EXIT_FAILURE; + }*/ + Row = GifFile->Image.Top; /* Image Position relative to Screen. */ + Col = GifFile->Image.Left; + Width = GifFile->Image.Width; + Height = GifFile->Image.Height; + // Update Color map + ColorMap = (GifFile->Image.ColorMap ? GifFile->Image.ColorMap : GifFile->SColorMap); + + if (PA_GifInfo.CurrentFrame >= PA_GifInfo.StartFrame) {// Load Palette only if correct frame + i = ColorMap->ColorCount; + + while (--i >= 0) { + GifColorType* pColor = &ColorMap->Colors[i]; + Palette[i] = PA_RGB8(GAMMA(pColor->Red), GAMMA(pColor->Green), GAMMA(pColor->Blue)); + } + } + + GifAssert(!(GifFile->Image.Left + GifFile->Image.Width > GifFile->SWidth || + GifFile->Image.Top + GifFile->Image.Height > GifFile->SHeight)); + //GifFile->Image.Delay; + /* + if (GifFile->Image.Left + GifFile->Image.Width > GifFile->SWidth || + GifFile->Image.Top + GifFile->Image.Height > GifFile->SHeight) { + return EXIT_FAILURE; + }*/ + + if (GifFile->Image.Interlace) { + /* Need to perform 4 passes on the images: */ + for (i = 0; i < 4; i++) { + for (j = Row + InterlacedOffset[i]; j < Row + Height; + j += InterlacedJumps[i]) { + GifAssert(DGifGetLineByte(GifFile, (ScreenBuff + (((SWidth*j) + Col) << GifBits)), Width) != GIF_ERROR); + /*if (DGifGetLineByte(GifFile, &ScreenBuff[j][Col], + Width) == GIF_ERROR) { + PrintGifError(); + return EXIT_FAILURE; + }*/ + } + } + } else { + for (i = 0; i < Height; i++) { + GifAssert(DGifGetLineByte(GifFile, (ScreenBuff + (((SWidth*Row) + Col) << GifBits)), Width) != GIF_ERROR); + Row++; + /* + if (DGifGetLineByte(GifFile, &ScreenBuff[Row++][Col], + Width) == GIF_ERROR) { + PrintGifError(); + return EXIT_FAILURE; + }*/ + } + } + + break; + case EXTENSION_RECORD_TYPE: + /* Skip any extension blocks in file: */ + DGifGetExtension(GifFile, &ExtCode, &Extension); + + while (Extension != NULL) { + if (ExtCode == GRAPHICS_EXT_FUNC_CODE) { +// if((Extension[1] & 1) == 1) // transparency color exists +// pd->transColor = Extension[4]; + int tmpDelay = 0; + double tmpNumber = 0; + tmpDelay = Extension[2]; + tmpDelay += Extension[3] << 8; + tmpNumber = (double)(tmpDelay) * (double)60; + tmpNumber = tmpNumber / (double)100; + tmpDelay = (int)tmpNumber; + s32 time; + PA_GifInfo.CurrentFrame++; + + if (PA_GifInfo.CurrentFrame > PA_GifInfo.EndFrame) PA_GifInfo.Play = 0; // Last frame... + + if (PA_GifInfo.CurrentFrame - 1 >= PA_GifInfo.StartFrame) { // Don't wait if not at the right frame yet + for (time = 0; time*PA_GifInfo.Speed < tmpNumber; time++) { + PA_WaitForVBL(); + + while (PA_GifInfo.Play == 2) PA_WaitForVBL(); // Pause animation ! + + if (PA_GifInfo.Play == 0) goto GifStop; + } + } + +// pd->aniDelay = tmpDelay; + } + + DGifGetExtensionNext(GifFile, &Extension); + } + + break; + case TERMINATE_RECORD_TYPE: + break; + default: /* Should be traps by DGifGetRecordType. */ + break; + } + } while (RecordType != TERMINATE_RECORD_TYPE); + + /* Close file when done */ +GifStop: + DGifCloseFile(GifFile); + + //if (GifBits == 1) free(temppalette); // On vire la m�moire allou�e + + return 0; +} diff --git a/source/arm9/PA_IA.c b/source/arm9/PA_IA.c index ab4a727..35da0d7 100644 --- a/source/arm9/PA_IA.c +++ b/source/arm9/PA_IA.c @@ -1,79 +1,79 @@ -#include - -u16 *maze[255]; -//u16 mazex, mazey; - -s8 PA_Astar(u16 width, u16 height) { - u16 maze2[width][height]; - u8 chemin[width][height]; - u8 bloc[width][height]; - u8 arriveex = 0, arriveey = 0, debutx = 0, debuty = 0; - u8 i, j; - u8 exit; - - for (j = 0; j < height; j++)for (i = 0; i < width; i++)maze2[i][j] = maze[i][j]; - - for (j = 0; j < height; j++)for (i = 0; i < width; i++)bloc[i][j] = 0; - - for (j = 0; j < height; j++)for (i = 0; i < width; i++) { - if (maze2[i][j] == 1) { - debutx = i; debuty = j; - } - - if (maze2[i][j] == 2) { - maze2[i][j] = 0; arriveex = i; arriveey = j; - } - - if (maze2[i][j] == 5) { - maze2[i][j] = 0; bloc[i][j] = 1; - } - } - - while (1) { - if (maze2[arriveex][arriveey] != 0)break; - - exit = 1; - - for (j = 0; j < height; j++) for (i = 0; i < width; i++) { - if (maze2[i][j] > 0) { - if (j < height - 1 && maze2[i][j+1] == 0 && bloc[i][j+1] == 0) { - maze2[i][j+1] = maze2[i][j] + 1; exit = 0; - } - - if (j > 0 && maze2[i][j-1] == 0 && bloc[i][j-1] == 0) { - maze2[i][j-1] = maze2[i][j] + 1; exit = 0; - } - - if (i < width - 1 && maze2[i+1][j] == 0 && bloc[i+1][j] == 0) { - maze2[i+1][j] = maze2[i][j] + 1; exit = 0; - } - - if (i > 0 && maze2[i-1][j] == 0 && bloc[i-1][j] == 0) { - maze2[i-1][j] = maze2[i][j] + 1; exit = 0; - } - } - } - - if (exit == 1) return -1; - } - - for (j = 0; j < height; j++)for (i = 0; i < width; i++)chemin[i][j] = 0; - - while (1) { - if (chemin[debutx][debuty] == 1)break; - - chemin[arriveex][arriveey] = 1; - - if (arriveey < height - 1 && maze2[arriveex][arriveey+1] < maze2[arriveex][arriveey] && maze2[arriveex][arriveey+1] != 0 && bloc[arriveex][arriveey+1] == 0) arriveey++; - else if (arriveey > 0 && maze2[arriveex][arriveey-1] < maze2[arriveex][arriveey] && maze2[arriveex][arriveey-1] != 0 && bloc[arriveex][arriveey-1] == 0) arriveey--; - else if (arriveex < width - 1 && maze2[arriveex+1][arriveey] < maze2[arriveex][arriveey] && maze2[arriveex+1][arriveey] != 0 && bloc[arriveex+1][arriveey] == 0) arriveex++; - else if (arriveex > 0 && maze2[arriveex-1][arriveey] < maze2[arriveex][arriveey] && maze2[arriveex-1][arriveey] != 0 && bloc[arriveex-1][arriveey] == 0) arriveex--; - } - - if (chemin[debutx-1][debuty] == 1)return 1; - else if (chemin[debutx+1][debuty] == 1)return 2; - else if (chemin[debutx][debuty-1] == 1)return 3; - else if (chemin[debutx][debuty+1] == 1)return 4; - - return 0; -} +#include + +u16 *maze[255]; +//u16 mazex, mazey; + +s8 PA_Astar(u16 width, u16 height) { + u16 maze2[width][height]; + u8 chemin[width][height]; + u8 bloc[width][height]; + u8 arriveex = 0, arriveey = 0, debutx = 0, debuty = 0; + u8 i, j; + u8 exit; + + for (j = 0; j < height; j++)for (i = 0; i < width; i++)maze2[i][j] = maze[i][j]; + + for (j = 0; j < height; j++)for (i = 0; i < width; i++)bloc[i][j] = 0; + + for (j = 0; j < height; j++)for (i = 0; i < width; i++) { + if (maze2[i][j] == 1) { + debutx = i; debuty = j; + } + + if (maze2[i][j] == 2) { + maze2[i][j] = 0; arriveex = i; arriveey = j; + } + + if (maze2[i][j] == 5) { + maze2[i][j] = 0; bloc[i][j] = 1; + } + } + + while (1) { + if (maze2[arriveex][arriveey] != 0)break; + + exit = 1; + + for (j = 0; j < height; j++) for (i = 0; i < width; i++) { + if (maze2[i][j] > 0) { + if (j < height - 1 && maze2[i][j+1] == 0 && bloc[i][j+1] == 0) { + maze2[i][j+1] = maze2[i][j] + 1; exit = 0; + } + + if (j > 0 && maze2[i][j-1] == 0 && bloc[i][j-1] == 0) { + maze2[i][j-1] = maze2[i][j] + 1; exit = 0; + } + + if (i < width - 1 && maze2[i+1][j] == 0 && bloc[i+1][j] == 0) { + maze2[i+1][j] = maze2[i][j] + 1; exit = 0; + } + + if (i > 0 && maze2[i-1][j] == 0 && bloc[i-1][j] == 0) { + maze2[i-1][j] = maze2[i][j] + 1; exit = 0; + } + } + } + + if (exit == 1) return -1; + } + + for (j = 0; j < height; j++)for (i = 0; i < width; i++)chemin[i][j] = 0; + + while (1) { + if (chemin[debutx][debuty] == 1)break; + + chemin[arriveex][arriveey] = 1; + + if (arriveey < height - 1 && maze2[arriveex][arriveey+1] < maze2[arriveex][arriveey] && maze2[arriveex][arriveey+1] != 0 && bloc[arriveex][arriveey+1] == 0) arriveey++; + else if (arriveey > 0 && maze2[arriveex][arriveey-1] < maze2[arriveex][arriveey] && maze2[arriveex][arriveey-1] != 0 && bloc[arriveex][arriveey-1] == 0) arriveey--; + else if (arriveex < width - 1 && maze2[arriveex+1][arriveey] < maze2[arriveex][arriveey] && maze2[arriveex+1][arriveey] != 0 && bloc[arriveex+1][arriveey] == 0) arriveex++; + else if (arriveex > 0 && maze2[arriveex-1][arriveey] < maze2[arriveex][arriveey] && maze2[arriveex-1][arriveey] != 0 && bloc[arriveex-1][arriveey] == 0) arriveex--; + } + + if (chemin[debutx-1][debuty] == 1)return 1; + else if (chemin[debutx+1][debuty] == 1)return 2; + else if (chemin[debutx][debuty-1] == 1)return 3; + else if (chemin[debutx][debuty+1] == 1)return 4; + + return 0; +} diff --git a/source/arm9/PA_Inits.c b/source/arm9/PA_Inits.c index 1f46f8c..96b7b1d 100644 --- a/source/arm9/PA_Inits.c +++ b/source/arm9/PA_Inits.c @@ -1,151 +1,151 @@ -#include -#include - -// Text stuff -#include "PA_TiledFont_Map_bin.h" -#include "PA_TiledFont_Tiles_bin.h" -#include "PA_TiledFont_Pal_bin.h" - -#include "BitmapFont/all_gfx.h" - -#include "PA_BmpFont0_Tiles_bin.h" -#include "PA_BmpFont1_Tiles_bin.h" -#include "PA_BmpFont2_Tiles_bin.h" -#include "PA_BmpFont3_Tiles_bin.h" -#include "PA_BmpFont4_Tiles_bin.h" - -static void PAFillBitTextSizes(){ - pa_bittextsizes[0] = PA_BmpFont0_Tiles_bin_size; - pa_bittextsizes[1] = PA_BmpFont1_Tiles_bin_size; - pa_bittextsizes[2] = PA_BmpFont2_Tiles_bin_size; - pa_bittextsizes[3] = PA_BmpFont3_Tiles_bin_size; - pa_bittextsizes[4] = PA_BmpFont4_Tiles_bin_size; - - pa_bittextpoliceheight[0] = PA_BmpFont0.FontHeight; - pa_bittextpoliceheight[1] = PA_BmpFont1.FontHeight; - pa_bittextpoliceheight[2] = PA_BmpFont2.FontHeight; - pa_bittextpoliceheight[3] = PA_BmpFont3.FontHeight; - pa_bittextpoliceheight[4] = PA_BmpFont4.FontHeight; -} - -// For the window fade system -const s16 winfades[][4] = { - {4, 3, -4, -3}, - {4, 0, -4, 0}, - {8, 0, 0, 0}, - {0, 0, -8, 0}, - {0, 6, -8, 0}, - {8, 0, 0, -6}, - {0, 0, -8, -6}, - {8, 6, 0, 0}, -}; - -void PA_UpdateSpriteVBL(void); -extern funcpointer SpriteVBL; - -void PA_Init2D(){ - // Turn on the 2D cores and unset the switch screens flag - REG_POWERCNT &= ~SWITCH_SCREENS; - powerOn(POWER_2D_A | POWER_2D_B); - - // Set up the 2D cores - videoSetMode (MODE_0_2D | // mode 0 (3D/text - text - text - text) - DISPLAY_SPR_ACTIVE | // enable sprites - DISPLAY_SPR_1D | // sprite VRAM 1D mapping - DISPLAY_SPR_1D_SIZE_128 | // sprite VRAM boundary 128 - DISPLAY_SPR_1D_BMP); // bitmap sprite VRAM 1D mapping - - videoSetModeSub(MODE_0_2D | // mode 0 (3D/text - text - text - text) - DISPLAY_SPR_ACTIVE | // enable sprites - DISPLAY_SPR_1D | // sprite VRAM 1D mapping - DISPLAY_SPR_1D_SIZE_128 | // sprite VRAM boundary 128 - DISPLAY_SPR_1D_BMP); // bitmap sprite VRAM 1D mapping - - // Prepare some VRAM banks for graphics - vramSetPrimaryBanks(VRAM_A_MAIN_SPRITE, VRAM_B_MAIN_BG_0x06000000, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE); - - // Initialize extended palettes - PA_InitBgExtPal(); - PA_InitSpriteExtPal(); - - // Initialize the background and sprite system - PA_ResetBgSys(); - PA_ResetSpriteSys(); - - // VBL Inits - SpriteVBL = PA_UpdateSpriteVBL; -} - -extern funcpointer MotionVBL; -extern funcpointer PaddleVBL; -extern funcpointer GHPadVBL; - -// The shared memory base address used to be 0x02FFF100, and it went up to -// 0x03000000 (0xF00 bytes). -// -// In DS mode, this is an uncached mirror of main RAM. It is required to use -// unchached memory to communicate between the ARM9 and ARM7 because the code of -// PAlib and its associated libraries isn't prepared to handle the cache of the -// ARM9. -// -// In DSi mode this is in cached main RAM (because it's 4 times bigger), so we -// need a more intelligent way to define the location of the buffer. PAlib -// allocates this buffer in main RAM, and the ARM9 is in charge of using the -// uncached mirror of this address (using memUncached()) and passing the regular -// address in main RAM to the ARM7. -ALIGN(CACHE_LINE_SIZE) static char PA_TransferBuffer[0xF00] = { 0 }; -volatile PA_TransferRegion *volatile PA_Transfer = NULL; - -static void PA_SetupSharedMemory(void) -{ - PA_Transfer = memUncached(PA_TransferBuffer); - - DC_FlushRange(PA_TransferBuffer, sizeof(PA_TransferBuffer)); - - PA_FifoMsg msg; - msg.type = PA_SHARED_MEM_SET; - msg.SharedMemSet.address = PA_TransferBuffer; - PA_SendFifoMsg(msg); -} - -void PA_Init(){ - // Wait a couple frames to provide a sensible starting point - swiWaitForVBlank(); - swiWaitForVBlank(); - - PA_InitFifo(); - PA_SetupSharedMemory(); - - PA_Init2D(); - pa_checklid = 1; // Autocheck lid by default - _PA_LidDown = 0; - //setlocale(LC_ALL, "C"); // Disable UTF-8 in newlib (TODO: Is this needed?) - PA_VBLCountersReset(); - PA_VBLFunctionReset(); - - PAFillBitTextSizes(); - - for(int i = 0; i < 2; i ++){ - PA_SetBrightness(i, 0); - PA_font[i] = 0; - PA_textmap[i] = (u16*) PA_TiledFont_Map_bin; - PA_texttiles[i] = (u8*) PA_TiledFont_Tiles_bin; - PA_textpal[i] = (u16*) PA_TiledFont_Pal_bin; - } - - PA_UpdateUserInfo(); - PA_ResetRecoSys(); // Reco system init - PA_SetScreenSpace(48); // Default spacing - PA_GifInfo.StartFrame = 0; // start from the beginning - PA_GifInfo.EndFrame = 10000; // random high number - MotionVBL = PA_Nothing; - PaddleVBL = PA_Nothing; - GHPadVBL = PA_Nothing; - - PA_UpdateRTC(); - PA_InitRand(); - - // Initialize the VBlank function - irqSet(IRQ_VBLANK, PA_vblFunc); - //irqEnable(IRQ_VBLANK); // libnds already does this -} +#include +#include + +// Text stuff +#include "PA_TiledFont_Map_bin.h" +#include "PA_TiledFont_Tiles_bin.h" +#include "PA_TiledFont_Pal_bin.h" + +#include "BitmapFont/all_gfx.h" + +#include "PA_BmpFont0_Tiles_bin.h" +#include "PA_BmpFont1_Tiles_bin.h" +#include "PA_BmpFont2_Tiles_bin.h" +#include "PA_BmpFont3_Tiles_bin.h" +#include "PA_BmpFont4_Tiles_bin.h" + +static void PAFillBitTextSizes(){ + pa_bittextsizes[0] = PA_BmpFont0_Tiles_bin_size; + pa_bittextsizes[1] = PA_BmpFont1_Tiles_bin_size; + pa_bittextsizes[2] = PA_BmpFont2_Tiles_bin_size; + pa_bittextsizes[3] = PA_BmpFont3_Tiles_bin_size; + pa_bittextsizes[4] = PA_BmpFont4_Tiles_bin_size; + + pa_bittextpoliceheight[0] = PA_BmpFont0.FontHeight; + pa_bittextpoliceheight[1] = PA_BmpFont1.FontHeight; + pa_bittextpoliceheight[2] = PA_BmpFont2.FontHeight; + pa_bittextpoliceheight[3] = PA_BmpFont3.FontHeight; + pa_bittextpoliceheight[4] = PA_BmpFont4.FontHeight; +} + +// For the window fade system +const s16 winfades[][4] = { + {4, 3, -4, -3}, + {4, 0, -4, 0}, + {8, 0, 0, 0}, + {0, 0, -8, 0}, + {0, 6, -8, 0}, + {8, 0, 0, -6}, + {0, 0, -8, -6}, + {8, 6, 0, 0}, +}; + +void PA_UpdateSpriteVBL(void); +extern funcpointer SpriteVBL; + +void PA_Init2D(){ + // Turn on the 2D cores and unset the switch screens flag + REG_POWERCNT &= ~SWITCH_SCREENS; + powerOn(POWER_2D_A | POWER_2D_B); + + // Set up the 2D cores + videoSetMode (MODE_0_2D | // mode 0 (3D/text - text - text - text) + DISPLAY_SPR_ACTIVE | // enable sprites + DISPLAY_SPR_1D | // sprite VRAM 1D mapping + DISPLAY_SPR_1D_SIZE_128 | // sprite VRAM boundary 128 + DISPLAY_SPR_1D_BMP); // bitmap sprite VRAM 1D mapping + + videoSetModeSub(MODE_0_2D | // mode 0 (3D/text - text - text - text) + DISPLAY_SPR_ACTIVE | // enable sprites + DISPLAY_SPR_1D | // sprite VRAM 1D mapping + DISPLAY_SPR_1D_SIZE_128 | // sprite VRAM boundary 128 + DISPLAY_SPR_1D_BMP); // bitmap sprite VRAM 1D mapping + + // Prepare some VRAM banks for graphics + vramSetPrimaryBanks(VRAM_A_MAIN_SPRITE, VRAM_B_MAIN_BG_0x06000000, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE); + + // Initialize extended palettes + PA_InitBgExtPal(); + PA_InitSpriteExtPal(); + + // Initialize the background and sprite system + PA_ResetBgSys(); + PA_ResetSpriteSys(); + + // VBL Inits + SpriteVBL = PA_UpdateSpriteVBL; +} + +extern funcpointer MotionVBL; +extern funcpointer PaddleVBL; +extern funcpointer GHPadVBL; + +// The shared memory base address used to be 0x02FFF100, and it went up to +// 0x03000000 (0xF00 bytes). +// +// In DS mode, this is an uncached mirror of main RAM. It is required to use +// unchached memory to communicate between the ARM9 and ARM7 because the code of +// PAlib and its associated libraries isn't prepared to handle the cache of the +// ARM9. +// +// In DSi mode this is in cached main RAM (because it's 4 times bigger), so we +// need a more intelligent way to define the location of the buffer. PAlib +// allocates this buffer in main RAM, and the ARM9 is in charge of using the +// uncached mirror of this address (using memUncached()) and passing the regular +// address in main RAM to the ARM7. +ALIGN(CACHE_LINE_SIZE) static char PA_TransferBuffer[0xF00] = { 0 }; +volatile PA_TransferRegion *volatile PA_Transfer = NULL; + +static void PA_SetupSharedMemory(void) +{ + PA_Transfer = memUncached(PA_TransferBuffer); + + DC_FlushRange(PA_TransferBuffer, sizeof(PA_TransferBuffer)); + + PA_FifoMsg msg; + msg.type = PA_SHARED_MEM_SET; + msg.SharedMemSet.address = PA_TransferBuffer; + PA_SendFifoMsg(msg); +} + +void PA_Init(){ + // Wait a couple frames to provide a sensible starting point + swiWaitForVBlank(); + swiWaitForVBlank(); + + PA_InitFifo(); + PA_SetupSharedMemory(); + + PA_Init2D(); + pa_checklid = 1; // Autocheck lid by default + _PA_LidDown = 0; + //setlocale(LC_ALL, "C"); // Disable UTF-8 in newlib (TODO: Is this needed?) + PA_VBLCountersReset(); + PA_VBLFunctionReset(); + + PAFillBitTextSizes(); + + for(int i = 0; i < 2; i ++){ + PA_SetBrightness(i, 0); + PA_font[i] = 0; + PA_textmap[i] = (u16*) PA_TiledFont_Map_bin; + PA_texttiles[i] = (u8*) PA_TiledFont_Tiles_bin; + PA_textpal[i] = (u16*) PA_TiledFont_Pal_bin; + } + + PA_UpdateUserInfo(); + PA_ResetRecoSys(); // Reco system init + PA_SetScreenSpace(48); // Default spacing + PA_GifInfo.StartFrame = 0; // start from the beginning + PA_GifInfo.EndFrame = 10000; // random high number + MotionVBL = PA_Nothing; + PaddleVBL = PA_Nothing; + GHPadVBL = PA_Nothing; + + PA_UpdateRTC(); + PA_InitRand(); + + // Initialize the VBlank function + irqSet(IRQ_VBLANK, PA_vblFunc); + //irqEnable(IRQ_VBLANK); // libnds already does this +} diff --git a/source/arm9/PA_Interrupt.c b/source/arm9/PA_Interrupt.c index 20336f1..fa8a4fc 100644 --- a/source/arm9/PA_Interrupt.c +++ b/source/arm9/PA_Interrupt.c @@ -1,54 +1,54 @@ -#define PA_NO_DEPRECATION -#include - -////////////////////////////////////////////////////////////////////// -// Interrupts -////////////////////////////////////////////////////////////////////// - -funcpointer CustomVBL = PA_Nothing; -funcpointer MotionVBL = PA_Nothing; -funcpointer GHPadVBL = PA_Nothing; -funcpointer PaddleVBL = PA_Nothing; -funcpointer SpriteVBL = PA_Nothing; - -s32 PA_VBLCounter[16]; // VBL counters -bool PA_VBLCounterOn[16]; // VBL counters enable/disable flag - -//static bool PA_RandInit = false; - -void PA_VBLCountersReset(){ - for (int i = 0; i < 16; i++) { - PA_VBLCounter[i] = 0; // Ready to start - PA_VBLCounterOn[i] = 0; // Not counting yet - } -} - -static inline void PA_RunCounters(){ - for(int i = 0; i < 16; i++) - PA_VBLCounter[i] += PA_VBLCounterOn[i]; -} - -void PA_vblFunc(){ - // Flush the legacy IPC - DC_FlushRange((void*) &PA_IPC, sizeof(PA_IPCType)); - - // Update the Pad and the Stylus - PA_UpdatePad(); - PA_UpdateStylus(); - - SpriteVBL(); - - // Update the external pads - MotionVBL(); - GHPadVBL(); - PaddleVBL(); - - // Update the RTC - PA_UpdateRTC(); - - // Run the counters - PA_RunCounters(); - - // Run the user's custom VBL function - CustomVBL(); -} +#define PA_NO_DEPRECATION +#include + +////////////////////////////////////////////////////////////////////// +// Interrupts +////////////////////////////////////////////////////////////////////// + +funcpointer CustomVBL = PA_Nothing; +funcpointer MotionVBL = PA_Nothing; +funcpointer GHPadVBL = PA_Nothing; +funcpointer PaddleVBL = PA_Nothing; +funcpointer SpriteVBL = PA_Nothing; + +s32 PA_VBLCounter[16]; // VBL counters +bool PA_VBLCounterOn[16]; // VBL counters enable/disable flag + +//static bool PA_RandInit = false; + +void PA_VBLCountersReset(){ + for (int i = 0; i < 16; i++) { + PA_VBLCounter[i] = 0; // Ready to start + PA_VBLCounterOn[i] = 0; // Not counting yet + } +} + +static inline void PA_RunCounters(){ + for(int i = 0; i < 16; i++) + PA_VBLCounter[i] += PA_VBLCounterOn[i]; +} + +void PA_vblFunc(){ + // Flush the legacy IPC + DC_FlushRange((void*) &PA_IPC, sizeof(PA_IPCType)); + + // Update the Pad and the Stylus + PA_UpdatePad(); + PA_UpdateStylus(); + + SpriteVBL(); + + // Update the external pads + MotionVBL(); + GHPadVBL(); + PaddleVBL(); + + // Update the RTC + PA_UpdateRTC(); + + // Run the counters + PA_RunCounters(); + + // Run the user's custom VBL function + CustomVBL(); +} diff --git a/source/arm9/PA_Keyboard.c b/source/arm9/PA_Keyboard.c index bf3411c..b8730c9 100644 --- a/source/arm9/PA_Keyboard.c +++ b/source/arm9/PA_Keyboard.c @@ -1,178 +1,178 @@ -#define PA_NO_DEPRECATION -#include - -// In files keyboard.map.c, keyboard.pal.c and keyboard.raw.c -extern const unsigned char keyboard_Tiles[10400]; -extern const unsigned short keyboard_Map[4096]; -extern const unsigned short keyboard_Palette[16]; - -u8 keyb_screen = 0; - -Keyboards PA_Keyboard_Struct; -void PA_ReloadKeyboardCol(void); - -void PA_LoadDefaultKeyboard(u8 bg_number) { -// On charge le fond... - PA_LoadSimpleBg(keyb_screen, bg_number, keyboard_Tiles, keyboard_Map, BG_256X512, 0, 0); - PA_Keyboard_Struct.Bg = bg_number; - PA_Keyboard_Struct.Type = 0; - PA_Keyboard_Struct.Repeat = 0; - /* - PA_LoadBgExtPal(0, base_palette, (void*)keyboardPal1); - PA_LoadBgExtPal(0, held_palette, (void*)keyboardPal2);*/ - PA_ReloadKeyboardCol(); - int i, j; - - for (j = 0; j < 12; j++) // On parcourt tout le fond pour mettre la bonne palette... - for (i = 0; i < 32; i++) - PA_SetMapTilePal(keyb_screen, bg_number, i, j, 15); - - PA_SetKeyboardColor(0, 1); // Blue and Red -} - - - - - -void PA_ReloadKeyboardCol(void) { - int i; - u16 r, g, b, color; - u8 tempr, tempg, tempb; - - for (i = 1; i < 11; i++) { // On va mettre appuyé en rouge - color = keyboard_Palette[i]; - tempb = b = (color >> 10) & 31; tempg = g = (color >> 5) & 31; - tempr = r = (color) & 31; - - // Si dominante rouge - if (PA_Keyboard_Struct.Color1 == 1) { - tempr = b; tempb = r; - } //rouge - else if (PA_Keyboard_Struct.Color1 == 2) { - tempg = b; tempb = g; - } //vert - - BG_PALETTE[(keyb_screen << 9) + (15 << 4) + i] = PA_RGB(tempr, tempg, tempb); - - if (PA_Keyboard_Struct.Color2 == 1) { - tempr = b; tempb = r; - } //rouge - else if (PA_Keyboard_Struct.Color2 == 2) { - tempg = b; tempb = g; - } //vert - - BG_PALETTE[(keyb_screen << 9) + (14 << 4) + i] = PA_RGB(tempr, tempg, tempb); - } -} - - -// Clavier, avec 5 lignes de 12 touches... -const u8 PA_Keyboard[2][5][24] = { - { - {'1', '1', '2', '2', '3', '3', '4', '4', '5', '5', '6', '6', '7', '7', '8', '8', '9', '9', '0', '0', '-', '-', '=', '='}, // Touches de 0 à 9, puis - et = - {PA_TAB, 'q', 'q', 'w', 'w', 'e', 'e', 'r', 'r', 't', 't', 'y', 'y', 'u', 'u', 'i', 'i', 'o', 'o', 'p', 'p', PA_BACKSPACE, PA_BACKSPACE, PA_BACKSPACE}, // qwertyuiop, Backspace - {PA_CAPS, PA_CAPS, 'a', 'a', 's', 's', 'd', 'd', 'f', 'f', 'g', 'g', 'h', 'h', 'j', 'j', 'k', 'k', 'l', 'l', PA_ENTER, PA_ENTER, PA_ENTER, PA_ENTER}, // Caps, asdfghjkl, Enter - {PA_SHIFT, PA_SHIFT, PA_SHIFT, 'z', 'z', 'x', 'x', 'c', 'c', 'v', 'v', 'b', 'b', 'n', 'n', 'm', 'm', ',', ',', '.', '.', '/', '/', PA_RIEN}, // Shift, zxcvbnm , . / - {PA_RIEN, PA_RIEN, '`', '`', ';', ';', '\'', '\'', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '[', '[', ']', ']', '\\', '\\'} - }, - { - {'!', '!' , '@', '@', '#', '#', '$', '$', '%', '%', '^', '^', '&', '&', '*', '*', '(', '(', ')', ')', '_', '_', '+', '+'}, // Touches de 0 à 9, puis - et = - {PA_TAB, 'Q', 'Q', 'W', 'W', 'E', 'E', 'R', 'R', 'T', 'T', 'Y', 'Y', 'U', 'U', 'I', 'I', 'O', 'O', 'P', 'P', PA_BACKSPACE, PA_BACKSPACE, PA_BACKSPACE}, // qwertyuiop, Backspace - {PA_CAPS, PA_CAPS, 'A', 'A', 'S', 'S', 'D', 'D', 'F', 'F', 'G', 'G', 'H', 'H', 'J', 'J', 'K', 'K', 'L', 'L', PA_ENTER, PA_ENTER, PA_ENTER, PA_ENTER}, // Caps, asdfghjkl, Enter - {PA_SHIFT, PA_SHIFT, PA_SHIFT, 'Z', 'Z', 'X', 'X', 'C', 'C', 'V', 'V', 'B', 'B', 'N', 'N', 'M', 'M', '<', '<', '>', '>', '?', '?', PA_RIEN}, // Shift, zxcvbnm , . / - {PA_RIEN, PA_RIEN, '~', '~', ':', ':', '"', '"', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '{', '{', '}', '}', '|', '|'} - } -}; // On prend en compte les trous... - -// A noter : début du clavier : x = 57, y = 109... fin du clavier : x = 250, y = 186 - - - -void PA_ChangeKeyboardType(void) { - PA_Keyboard_Struct.Type = !PA_Keyboard_Struct.Type; - int i, j; - - if (!PA_Keyboard_Struct.Custom) { - DMA_Copy((void*)(keyboard_Map + (PA_Keyboard_Struct.Type << 11)), (void*)ScreenBaseBlock(keyb_screen, PA_BgInfo[keyb_screen][PA_Keyboard_Struct.Bg].mapchar), 32*12 , DMA_16NOW); - - for (j = 0; j < 12; j++) // On parcourt tout le fond pour mettre la bonne palette... - for (i = 0; i < 32; i++) - PA_SetMapTilePal(keyb_screen, PA_Keyboard_Struct.Bg, i, j, 15); - } else { - DMA_Copy((void*)(PA_BgInfo[keyb_screen][PA_Keyboard_Struct.Bg].Map + (PA_Keyboard_Struct.Type << 12)), (void*)ScreenBaseBlock(keyb_screen, PA_BgInfo[keyb_screen][PA_Keyboard_Struct.Bg].mapchar), 32*12 , DMA_16NOW); - } -} - - - -char PA_CheckKeyboard(void) { // Vérifier si on appuye sur le clavier avec ces touches... -// Vont prendre la position que l'on appuye sur le clavier... - int x = Stylus.X; - int y = Stylus.Y; - x -= PA_Keyboard_Struct.ScrollX + 8; // Ca commence à 57, donc c'est comme si en 57 on était à 0 - y -= PA_Keyboard_Struct.ScrollY + 8; // Pareil mais pour y... - // On commence par vérifier si on est bien sur le clavier... Si ce n'est pas le cas, on renverra 0. - if ((x >= 0) && (x < 192) && (y >= 0) && (y < 80)) { - //Les cases font 8 de largeur, donc de 0-7 c'est la case 0... il faut diviser par 8 - y = y >> 4; - x = x >> 3; - - if (Stylus.Newpress) { - PA_Keyboard_Struct.oldX = x; - PA_Keyboard_Struct.oldY = y; - PA_Keyboard_Struct.Repeat = 50; - - if (PA_Keyboard[PA_Keyboard_Struct.Type][y][x] == PA_CAPS) { - PA_ChangeKeyboardType(); - } - - // Majuscule si jamais c'est Shift appuyé - if (PA_Keyboard_Struct.Letter == PA_SHIFT) { - // Si on rappuye sur Shift ca le vire sans rien faire - if (PA_Keyboard[PA_Keyboard_Struct.Type][y][x] == PA_SHIFT) PA_Keyboard_Struct.Letter = 0; - else PA_Keyboard_Struct.Letter = PA_Keyboard[PA_Keyboard_Struct.Type][y][x]; - - PA_SetLetterPal(0, 3, 15); // On efface le shift - PA_ChangeKeyboardType(); - } else { - PA_Keyboard_Struct.Letter = PA_Keyboard[PA_Keyboard_Struct.Type][y][x]; - - if (PA_Keyboard_Struct.Letter == PA_SHIFT) PA_ChangeKeyboardType(); - } - - PA_SetLetterPal(x, y, 14); - return (PA_Keyboard_Struct.Letter); // Renvoie la valeur dans le clavier... si nouvelle pression - } else { - if (Stylus.Held && (PA_Keyboard[PA_Keyboard_Struct.Type][y][x] == PA_Keyboard_Struct.Letter)) { - --PA_Keyboard_Struct.Repeat; - - if (PA_Keyboard_Struct.Repeat == 0) { - PA_Keyboard_Struct.Repeat = 10; - return(PA_Keyboard_Struct.Letter); - } - } - } - } - - if (!Stylus.Held) { - if (PA_Keyboard_Struct.Letter != PA_SHIFT) PA_SetLetterPal(PA_Keyboard_Struct.oldX, PA_Keyboard_Struct.oldY, 15); - } - - return 0; -} - - - -void PA_SetLetterPal(s16 x, s16 y, u8 Pal) { - u8 value = PA_Keyboard[0][y][x]; - - if (value && (!PA_Keyboard_Struct.Custom)) { - while (PA_Keyboard[0][y][x-1] == value) --x; - - while (PA_Keyboard[0][y][x] == value) { - PA_SetMapTilePal(keyb_screen, PA_Keyboard_Struct.Bg, x + 1, (y << 1) + 1, Pal); - PA_SetMapTilePal(keyb_screen, PA_Keyboard_Struct.Bg, x + 1, (y << 1) + 2, Pal); - x++; - } - } -} +#define PA_NO_DEPRECATION +#include + +// In files keyboard.map.c, keyboard.pal.c and keyboard.raw.c +extern const unsigned char keyboard_Tiles[10400]; +extern const unsigned short keyboard_Map[4096]; +extern const unsigned short keyboard_Palette[16]; + +u8 keyb_screen = 0; + +Keyboards PA_Keyboard_Struct; +void PA_ReloadKeyboardCol(void); + +void PA_LoadDefaultKeyboard(u8 bg_number) { +// On charge le fond... + PA_LoadSimpleBg(keyb_screen, bg_number, keyboard_Tiles, keyboard_Map, BG_256X512, 0, 0); + PA_Keyboard_Struct.Bg = bg_number; + PA_Keyboard_Struct.Type = 0; + PA_Keyboard_Struct.Repeat = 0; + /* + PA_LoadBgExtPal(0, base_palette, (void*)keyboardPal1); + PA_LoadBgExtPal(0, held_palette, (void*)keyboardPal2);*/ + PA_ReloadKeyboardCol(); + int i, j; + + for (j = 0; j < 12; j++) // On parcourt tout le fond pour mettre la bonne palette... + for (i = 0; i < 32; i++) + PA_SetMapTilePal(keyb_screen, bg_number, i, j, 15); + + PA_SetKeyboardColor(0, 1); // Blue and Red +} + + + + + +void PA_ReloadKeyboardCol(void) { + int i; + u16 r, g, b, color; + u8 tempr, tempg, tempb; + + for (i = 1; i < 11; i++) { // On va mettre appuyé en rouge + color = keyboard_Palette[i]; + tempb = b = (color >> 10) & 31; tempg = g = (color >> 5) & 31; + tempr = r = (color) & 31; + + // Si dominante rouge + if (PA_Keyboard_Struct.Color1 == 1) { + tempr = b; tempb = r; + } //rouge + else if (PA_Keyboard_Struct.Color1 == 2) { + tempg = b; tempb = g; + } //vert + + BG_PALETTE[(keyb_screen << 9) + (15 << 4) + i] = PA_RGB(tempr, tempg, tempb); + + if (PA_Keyboard_Struct.Color2 == 1) { + tempr = b; tempb = r; + } //rouge + else if (PA_Keyboard_Struct.Color2 == 2) { + tempg = b; tempb = g; + } //vert + + BG_PALETTE[(keyb_screen << 9) + (14 << 4) + i] = PA_RGB(tempr, tempg, tempb); + } +} + + +// Clavier, avec 5 lignes de 12 touches... +const u8 PA_Keyboard[2][5][24] = { + { + {'1', '1', '2', '2', '3', '3', '4', '4', '5', '5', '6', '6', '7', '7', '8', '8', '9', '9', '0', '0', '-', '-', '=', '='}, // Touches de 0 à 9, puis - et = + {PA_TAB, 'q', 'q', 'w', 'w', 'e', 'e', 'r', 'r', 't', 't', 'y', 'y', 'u', 'u', 'i', 'i', 'o', 'o', 'p', 'p', PA_BACKSPACE, PA_BACKSPACE, PA_BACKSPACE}, // qwertyuiop, Backspace + {PA_CAPS, PA_CAPS, 'a', 'a', 's', 's', 'd', 'd', 'f', 'f', 'g', 'g', 'h', 'h', 'j', 'j', 'k', 'k', 'l', 'l', PA_ENTER, PA_ENTER, PA_ENTER, PA_ENTER}, // Caps, asdfghjkl, Enter + {PA_SHIFT, PA_SHIFT, PA_SHIFT, 'z', 'z', 'x', 'x', 'c', 'c', 'v', 'v', 'b', 'b', 'n', 'n', 'm', 'm', ',', ',', '.', '.', '/', '/', PA_RIEN}, // Shift, zxcvbnm , . / + {PA_RIEN, PA_RIEN, '`', '`', ';', ';', '\'', '\'', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '[', '[', ']', ']', '\\', '\\'} + }, + { + {'!', '!' , '@', '@', '#', '#', '$', '$', '%', '%', '^', '^', '&', '&', '*', '*', '(', '(', ')', ')', '_', '_', '+', '+'}, // Touches de 0 à 9, puis - et = + {PA_TAB, 'Q', 'Q', 'W', 'W', 'E', 'E', 'R', 'R', 'T', 'T', 'Y', 'Y', 'U', 'U', 'I', 'I', 'O', 'O', 'P', 'P', PA_BACKSPACE, PA_BACKSPACE, PA_BACKSPACE}, // qwertyuiop, Backspace + {PA_CAPS, PA_CAPS, 'A', 'A', 'S', 'S', 'D', 'D', 'F', 'F', 'G', 'G', 'H', 'H', 'J', 'J', 'K', 'K', 'L', 'L', PA_ENTER, PA_ENTER, PA_ENTER, PA_ENTER}, // Caps, asdfghjkl, Enter + {PA_SHIFT, PA_SHIFT, PA_SHIFT, 'Z', 'Z', 'X', 'X', 'C', 'C', 'V', 'V', 'B', 'B', 'N', 'N', 'M', 'M', '<', '<', '>', '>', '?', '?', PA_RIEN}, // Shift, zxcvbnm , . / + {PA_RIEN, PA_RIEN, '~', '~', ':', ':', '"', '"', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '{', '{', '}', '}', '|', '|'} + } +}; // On prend en compte les trous... + +// A noter : début du clavier : x = 57, y = 109... fin du clavier : x = 250, y = 186 + + + +void PA_ChangeKeyboardType(void) { + PA_Keyboard_Struct.Type = !PA_Keyboard_Struct.Type; + int i, j; + + if (!PA_Keyboard_Struct.Custom) { + DMA_Copy((void*)(keyboard_Map + (PA_Keyboard_Struct.Type << 11)), (void*)ScreenBaseBlock(keyb_screen, PA_BgInfo[keyb_screen][PA_Keyboard_Struct.Bg].mapchar), 32*12 , DMA_16NOW); + + for (j = 0; j < 12; j++) // On parcourt tout le fond pour mettre la bonne palette... + for (i = 0; i < 32; i++) + PA_SetMapTilePal(keyb_screen, PA_Keyboard_Struct.Bg, i, j, 15); + } else { + DMA_Copy((void*)(PA_BgInfo[keyb_screen][PA_Keyboard_Struct.Bg].Map + (PA_Keyboard_Struct.Type << 12)), (void*)ScreenBaseBlock(keyb_screen, PA_BgInfo[keyb_screen][PA_Keyboard_Struct.Bg].mapchar), 32*12 , DMA_16NOW); + } +} + + + +char PA_CheckKeyboard(void) { // Vérifier si on appuye sur le clavier avec ces touches... +// Vont prendre la position que l'on appuye sur le clavier... + int x = Stylus.X; + int y = Stylus.Y; + x -= PA_Keyboard_Struct.ScrollX + 8; // Ca commence à 57, donc c'est comme si en 57 on était à 0 + y -= PA_Keyboard_Struct.ScrollY + 8; // Pareil mais pour y... + // On commence par vérifier si on est bien sur le clavier... Si ce n'est pas le cas, on renverra 0. + if ((x >= 0) && (x < 192) && (y >= 0) && (y < 80)) { + //Les cases font 8 de largeur, donc de 0-7 c'est la case 0... il faut diviser par 8 + y = y >> 4; + x = x >> 3; + + if (Stylus.Newpress) { + PA_Keyboard_Struct.oldX = x; + PA_Keyboard_Struct.oldY = y; + PA_Keyboard_Struct.Repeat = 50; + + if (PA_Keyboard[PA_Keyboard_Struct.Type][y][x] == PA_CAPS) { + PA_ChangeKeyboardType(); + } + + // Majuscule si jamais c'est Shift appuyé + if (PA_Keyboard_Struct.Letter == PA_SHIFT) { + // Si on rappuye sur Shift ca le vire sans rien faire + if (PA_Keyboard[PA_Keyboard_Struct.Type][y][x] == PA_SHIFT) PA_Keyboard_Struct.Letter = 0; + else PA_Keyboard_Struct.Letter = PA_Keyboard[PA_Keyboard_Struct.Type][y][x]; + + PA_SetLetterPal(0, 3, 15); // On efface le shift + PA_ChangeKeyboardType(); + } else { + PA_Keyboard_Struct.Letter = PA_Keyboard[PA_Keyboard_Struct.Type][y][x]; + + if (PA_Keyboard_Struct.Letter == PA_SHIFT) PA_ChangeKeyboardType(); + } + + PA_SetLetterPal(x, y, 14); + return (PA_Keyboard_Struct.Letter); // Renvoie la valeur dans le clavier... si nouvelle pression + } else { + if (Stylus.Held && (PA_Keyboard[PA_Keyboard_Struct.Type][y][x] == PA_Keyboard_Struct.Letter)) { + --PA_Keyboard_Struct.Repeat; + + if (PA_Keyboard_Struct.Repeat == 0) { + PA_Keyboard_Struct.Repeat = 10; + return(PA_Keyboard_Struct.Letter); + } + } + } + } + + if (!Stylus.Held) { + if (PA_Keyboard_Struct.Letter != PA_SHIFT) PA_SetLetterPal(PA_Keyboard_Struct.oldX, PA_Keyboard_Struct.oldY, 15); + } + + return 0; +} + + + +void PA_SetLetterPal(s16 x, s16 y, u8 Pal) { + u8 value = PA_Keyboard[0][y][x]; + + if (value && (!PA_Keyboard_Struct.Custom)) { + while (PA_Keyboard[0][y][x-1] == value) --x; + + while (PA_Keyboard[0][y][x] == value) { + PA_SetMapTilePal(keyb_screen, PA_Keyboard_Struct.Bg, x + 1, (y << 1) + 1, Pal); + PA_SetMapTilePal(keyb_screen, PA_Keyboard_Struct.Bg, x + 1, (y << 1) + 2, Pal); + x++; + } + } +} diff --git a/source/arm9/PA_Keys.c b/source/arm9/PA_Keys.c index 7b3ed92..d2c5a9f 100644 --- a/source/arm9/PA_Keys.c +++ b/source/arm9/PA_Keys.c @@ -1,71 +1,71 @@ -#include - -#define PA_UPDATEPAD(pad, var) do{ \ - Pad.pad.A = (var & KEY_A) != 0; \ - Pad.pad.B = (var & KEY_B) != 0; \ - Pad.pad.X = (var & KEY_X) != 0; \ - Pad.pad.Y = (var & KEY_Y) != 0; \ - Pad.pad.L = (var & KEY_L) != 0; \ - Pad.pad.R = (var & KEY_R) != 0; \ - Pad.pad.Select = (var & KEY_SELECT) != 0; \ - Pad.pad.Start = (var & KEY_START) != 0; \ - Pad.pad.Up = (var & KEY_UP) != 0; \ - Pad.pad.Down = (var & KEY_DOWN) != 0; \ - Pad.pad.Left = (var & KEY_LEFT) != 0; \ - Pad.pad.Right = (var & KEY_RIGHT) != 0; \ - Pad.pad.Anykey = (var & 0xFFF) != 0; \ - }while(0) - -vu8 _PA_LidDown; - -void PA_UpdatePad() { - // Read the pad using libnds - scanKeys(); - u32 k_held = keysHeld(); - u32 k_down = keysDown(); - u32 k_up = keysUp(); - // Update the structures - PA_UPDATEPAD(Held, k_held); - PA_UPDATEPAD(Newpress, k_down); - PA_UPDATEPAD(Released, k_up); - // This also updates part of the stylus... - Stylus.Held = (k_held & KEY_TOUCH) != 0; - Stylus.Newpress = (k_down & KEY_TOUCH) != 0; - Stylus.Released = (k_up & KEY_TOUCH) != 0; - // ...and the lid. - _PA_LidDown = (k_held & KEY_LID) != 0; -} - -void PA_UpdateStylus() { - touchPosition t_data; - touchRead(&t_data); - - if(t_data.z1 != 0) - Stylus.Pressure = (((t_data.px * t_data.z2) >> 6) / t_data.z1) - (t_data.px >> 6); - else - Stylus.Pressure = -1; - - Stylus.DblClick = Stylus.Newpress && ((Stylus.Downtime + Stylus.Uptime) < 45); - Stylus.Downtime *= !Stylus.Newpress; // = 0 if newpress - Stylus.Downtime += Stylus.Held; - Stylus.Uptime *= !Stylus.Released; // = 0 when released - Stylus.Uptime += !Stylus.Held; - - if (Stylus.Held) { // On en met à jour que si on touche l'écran, histoire de pas avoir un truc faussé - Stylus.altX = (t_data.rawx - 0x0113) / 14; - Stylus.altY = (t_data.rawy - 0x00E0) / 19; - - if (Stylus.Newpress) { - Stylus.Vx = Stylus.oldVx = 0; - Stylus.Vy = Stylus.oldVy = 0; - } else { - Stylus.oldVx = Stylus.Vx; - Stylus.oldVy = Stylus.Vy; - Stylus.Vx = t_data.px - Stylus.X; - Stylus.Vy = t_data.py - Stylus.Y; - } - - Stylus.X = t_data.px; - Stylus.Y = t_data.py; - } -} +#include + +#define PA_UPDATEPAD(pad, var) do{ \ + Pad.pad.A = (var & KEY_A) != 0; \ + Pad.pad.B = (var & KEY_B) != 0; \ + Pad.pad.X = (var & KEY_X) != 0; \ + Pad.pad.Y = (var & KEY_Y) != 0; \ + Pad.pad.L = (var & KEY_L) != 0; \ + Pad.pad.R = (var & KEY_R) != 0; \ + Pad.pad.Select = (var & KEY_SELECT) != 0; \ + Pad.pad.Start = (var & KEY_START) != 0; \ + Pad.pad.Up = (var & KEY_UP) != 0; \ + Pad.pad.Down = (var & KEY_DOWN) != 0; \ + Pad.pad.Left = (var & KEY_LEFT) != 0; \ + Pad.pad.Right = (var & KEY_RIGHT) != 0; \ + Pad.pad.Anykey = (var & 0xFFF) != 0; \ + }while(0) + +vu8 _PA_LidDown; + +void PA_UpdatePad() { + // Read the pad using libnds + scanKeys(); + u32 k_held = keysHeld(); + u32 k_down = keysDown(); + u32 k_up = keysUp(); + // Update the structures + PA_UPDATEPAD(Held, k_held); + PA_UPDATEPAD(Newpress, k_down); + PA_UPDATEPAD(Released, k_up); + // This also updates part of the stylus... + Stylus.Held = (k_held & KEY_TOUCH) != 0; + Stylus.Newpress = (k_down & KEY_TOUCH) != 0; + Stylus.Released = (k_up & KEY_TOUCH) != 0; + // ...and the lid. + _PA_LidDown = (k_held & KEY_LID) != 0; +} + +void PA_UpdateStylus() { + touchPosition t_data; + touchRead(&t_data); + + if(t_data.z1 != 0) + Stylus.Pressure = (((t_data.px * t_data.z2) >> 6) / t_data.z1) - (t_data.px >> 6); + else + Stylus.Pressure = -1; + + Stylus.DblClick = Stylus.Newpress && ((Stylus.Downtime + Stylus.Uptime) < 45); + Stylus.Downtime *= !Stylus.Newpress; // = 0 if newpress + Stylus.Downtime += Stylus.Held; + Stylus.Uptime *= !Stylus.Released; // = 0 when released + Stylus.Uptime += !Stylus.Held; + + if (Stylus.Held) { // On en met à jour que si on touche l'écran, histoire de pas avoir un truc faussé + Stylus.altX = (t_data.rawx - 0x0113) / 14; + Stylus.altY = (t_data.rawy - 0x00E0) / 19; + + if (Stylus.Newpress) { + Stylus.Vx = Stylus.oldVx = 0; + Stylus.Vy = Stylus.oldVy = 0; + } else { + Stylus.oldVx = Stylus.Vx; + Stylus.oldVy = Stylus.Vy; + Stylus.Vx = t_data.px - Stylus.X; + Stylus.Vy = t_data.py - Stylus.Y; + } + + Stylus.X = t_data.px; + Stylus.Y = t_data.py; + } +} diff --git a/source/arm9/PA_KeysSpecial.c b/source/arm9/PA_KeysSpecial.c index cfe3e29..a0a307e 100644 --- a/source/arm9/PA_KeysSpecial.c +++ b/source/arm9/PA_KeysSpecial.c @@ -1,81 +1,81 @@ -#include - -GH_Pad GHPad; - -u16 GHCompletePad, GHExPad, GHTempPad; - -extern funcpointer GHPadVBL; - -bool PA_DetectGHPad(void) { - REG_EXMEMCNT &= ~0x8080; - - if ((GBA_BUS[0] == 0xF9FF) && (GBA_BUS[1] == 0xF9FF) && (GBA_BUS[2] == 0xF9FF) && (GBA_BUS[3] == 0xF9FF)) return 1; - - REG_EXMEMCNT &= ~0x8000; - return 0; -} - -bool PA_InitGHPad(void) { - if (PA_DetectGHPad()) { - GHPadVBL = PA_UpdateGHPad; - return 1; - } - - return 0; -} - -void PA_DeInitGHPad(void) { - REG_EXMEMCNT &= ~0x8000; - GHPadVBL = PA_Nothing; -} - -void PA_UpdateGHPad(void) { - GHExPad = GHCompletePad; - GHCompletePad = ~(GH_POLL); - UPDATEGHPAD(GHPad.Held, GHCompletePad); - UPDATEGHPAD(GHPad.Released, (GHExPad & (~GHCompletePad))); - UPDATEGHPAD(GHPad.Newpress, (GHCompletePad & (~GHExPad))); -} - - - -PaddleInfo Paddle; - -extern funcpointer PaddleVBL; - -bool PA_DetectPaddle(void) { - REG_EXMEMCNT &= ~0x8080; - REG_EXMEMCNT |= 0x23; - - if ((GBA_BUS[0] == 0xEFFF) && (GBA_BUS[1] == 0xEFFF) && (GBA_BUS[2] == 0xEFFF) && (GBA_BUS[3] == 0xEFFF)) return 1; - - REG_EXMEMCNT &= ~0x8000; - return 0; -} - -bool PA_InitPaddle(void) { - if (PA_DetectPaddle()) { - PaddleVBL = PA_UpdatePaddle; - return 1; - } - - return 0; -} - -void PA_DeInitPaddle(void) { - REG_EXMEMCNT &= ~0x8000; - PaddleVBL = PA_Nothing; -} - -void PA_UpdatePaddle(void) { - Paddle.OldLow = Paddle.Low; - Paddle.OldHigh = Paddle.High; - Paddle.OldCount = Paddle.Count; - Paddle.Low = PADDLE_LOW; - Paddle.High = PADDLE_HIGH; - Paddle.Count = (Paddle.High << 8) + Paddle.Low; - Paddle.Speed = Paddle.Count - Paddle.OldCount; - - if (Paddle.High - Paddle.OldHigh == 15) Paddle.Speed -= 4096; - else if (Paddle.High - Paddle.OldHigh == -15) Paddle.Speed += 4096; -} +#include + +GH_Pad GHPad; + +u16 GHCompletePad, GHExPad, GHTempPad; + +extern funcpointer GHPadVBL; + +bool PA_DetectGHPad(void) { + REG_EXMEMCNT &= ~0x8080; + + if ((GBA_BUS[0] == 0xF9FF) && (GBA_BUS[1] == 0xF9FF) && (GBA_BUS[2] == 0xF9FF) && (GBA_BUS[3] == 0xF9FF)) return 1; + + REG_EXMEMCNT &= ~0x8000; + return 0; +} + +bool PA_InitGHPad(void) { + if (PA_DetectGHPad()) { + GHPadVBL = PA_UpdateGHPad; + return 1; + } + + return 0; +} + +void PA_DeInitGHPad(void) { + REG_EXMEMCNT &= ~0x8000; + GHPadVBL = PA_Nothing; +} + +void PA_UpdateGHPad(void) { + GHExPad = GHCompletePad; + GHCompletePad = ~(GH_POLL); + UPDATEGHPAD(GHPad.Held, GHCompletePad); + UPDATEGHPAD(GHPad.Released, (GHExPad & (~GHCompletePad))); + UPDATEGHPAD(GHPad.Newpress, (GHCompletePad & (~GHExPad))); +} + + + +PaddleInfo Paddle; + +extern funcpointer PaddleVBL; + +bool PA_DetectPaddle(void) { + REG_EXMEMCNT &= ~0x8080; + REG_EXMEMCNT |= 0x23; + + if ((GBA_BUS[0] == 0xEFFF) && (GBA_BUS[1] == 0xEFFF) && (GBA_BUS[2] == 0xEFFF) && (GBA_BUS[3] == 0xEFFF)) return 1; + + REG_EXMEMCNT &= ~0x8000; + return 0; +} + +bool PA_InitPaddle(void) { + if (PA_DetectPaddle()) { + PaddleVBL = PA_UpdatePaddle; + return 1; + } + + return 0; +} + +void PA_DeInitPaddle(void) { + REG_EXMEMCNT &= ~0x8000; + PaddleVBL = PA_Nothing; +} + +void PA_UpdatePaddle(void) { + Paddle.OldLow = Paddle.Low; + Paddle.OldHigh = Paddle.High; + Paddle.OldCount = Paddle.Count; + Paddle.Low = PADDLE_LOW; + Paddle.High = PADDLE_HIGH; + Paddle.Count = (Paddle.High << 8) + Paddle.Low; + Paddle.Speed = Paddle.Count - Paddle.OldCount; + + if (Paddle.High - Paddle.OldHigh == 15) Paddle.Speed -= 4096; + else if (Paddle.High - Paddle.OldHigh == -15) Paddle.Speed += 4096; +} diff --git a/source/arm9/PA_Math.c b/source/arm9/PA_Math.c index 794a8c4..42098f4 100644 --- a/source/arm9/PA_Math.c +++ b/source/arm9/PA_Math.c @@ -1,69 +1,69 @@ -#include - -u32 RandomValue = 1; - -u16 PA_AdjustAngle(u16 angle, s16 anglerot, s32 startx, s32 starty, s32 targetx, s32 targety) { - u64 distances[3]; - startx = startx << 8; // Fixed point... - starty = starty << 8; // Fixed point... - targetx = targetx << 8; // Fixed point... - targety = targety << 8; // Fixed point... - u16 tempangle = (angle - anglerot) & 511; - // Calcul des distances en fonction des angles - distances[0] = PA_Distance(startx + PA_Cos(tempangle), starty - PA_Sin(tempangle), targetx, targety); - tempangle += anglerot; - tempangle &= 511; - distances[1] = PA_Distance(startx + PA_Cos(tempangle), starty - PA_Sin(tempangle), targetx, targety); - tempangle += anglerot; - tempangle &= 511; - distances[2] = PA_Distance(startx + PA_Cos(tempangle), starty - PA_Sin(tempangle), targetx, targety); - - // On regarde si l'angle est optimal. Si ce n'est pas le cas, - // on fait tourner toujours dans le meme sens... - if (distances[0] < distances[1]) angle -= anglerot; - else if (distances[2] < distances[1]) angle += anglerot; - - return (angle&511); -} - -const s16 PA_SIN[512] = { - 0x0000, 0x0003, 0x0006, 0x0009, 0x000D, 0x0010, 0x0013, 0x0016, 0x0019, 0x001C, 0x001F, 0x0022, 0x0026, 0x0029, 0x002C, 0x002F, - 0x0032, 0x0035, 0x0038, 0x003B, 0x003E, 0x0041, 0x0044, 0x0047, 0x004A, 0x004D, 0x0050, 0x0053, 0x0056, 0x0059, 0x005C, 0x005F, - 0x0062, 0x0065, 0x0068, 0x006B, 0x006D, 0x0070, 0x0073, 0x0076, 0x0079, 0x007B, 0x007E, 0x0081, 0x0084, 0x0086, 0x0089, 0x008C, - 0x008E, 0x0091, 0x0093, 0x0096, 0x0098, 0x009B, 0x009D, 0x00A0, 0x00A2, 0x00A5, 0x00A7, 0x00AA, 0x00AC, 0x00AE, 0x00B1, 0x00B3, - - 0x00B5, 0x00B7, 0x00B9, 0x00BC, 0x00BE, 0x00C0, 0x00C2, 0x00C4, 0x00C6, 0x00C8, 0x00CA, 0x00CC, 0x00CE, 0x00CF, 0x00D1, 0x00D3, - 0x00D5, 0x00D7, 0x00D8, 0x00DA, 0x00DC, 0x00DD, 0x00DF, 0x00E0, 0x00E2, 0x00E3, 0x00E5, 0x00E6, 0x00E7, 0x00E9, 0x00EA, 0x00EB, - 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F8, 0x00F9, 0x00FA, 0x00FA, - 0x00FB, 0x00FC, 0x00FC, 0x00FD, 0x00FD, 0x00FE, 0x00FE, 0x00FE, 0x00FF, 0x00FF, 0x00FF, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, - - 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x00FF, 0x00FF, 0x00FF, 0x00FE, 0x00FE, 0x00FE, 0x00FD, 0x00FD, 0x00FC, 0x00FC, - 0x00FB, 0x00FA, 0x00FA, 0x00F9, 0x00F8, 0x00F8, 0x00F7, 0x00F6, 0x00F5, 0x00F4, 0x00F3, 0x00F2, 0x00F1, 0x00F0, 0x00EF, 0x00EE, - 0x00ED, 0x00EB, 0x00EA, 0x00E9, 0x00E7, 0x00E6, 0x00E5, 0x00E3, 0x00E2, 0x00E0, 0x00DF, 0x00DD, 0x00DC, 0x00DA, 0x00D8, 0x00D7, - 0x00D5, 0x00D3, 0x00D1, 0x00CF, 0x00CE, 0x00CC, 0x00CA, 0x00C8, 0x00C6, 0x00C4, 0x00C2, 0x00C0, 0x00BE, 0x00BC, 0x00B9, 0x00B7, - - 0x00B5, 0x00B3, 0x00B1, 0x00AE, 0x00AC, 0x00AA, 0x00A7, 0x00A5, 0x00A2, 0x00A0, 0x009D, 0x009B, 0x0098, 0x0096, 0x0093, 0x0091, - 0x008E, 0x008C, 0x0089, 0x0086, 0x0084, 0x0081, 0x007E, 0x007B, 0x0079, 0x0076, 0x0073, 0x0070, 0x006D, 0x006B, 0x0068, 0x0065, - 0x0062, 0x005F, 0x005C, 0x0059, 0x0056, 0x0053, 0x0050, 0x004D, 0x004A, 0x0047, 0x0044, 0x0041, 0x003E, 0x003B, 0x0038, 0x0035, - 0x0032, 0x002F, 0x002C, 0x0029, 0x0026, 0x0022, 0x001F, 0x001C, 0x0019, 0x0016, 0x0013, 0x0010, 0x000D, 0x0009, 0x0006, 0x0003, - - 0x0000, 0xFFFD, 0xFFFA, 0xFFF7, 0xFFF3, 0xFFF0, 0xFFED, 0xFFEA, 0xFFE7, 0xFFE4, 0xFFE1, 0xFFDE, 0xFFDA, 0xFFD7, 0xFFD4, 0xFFD1, - 0xFFCE, 0xFFCB, 0xFFC8, 0xFFC5, 0xFFC2, 0xFFBF, 0xFFBC, 0xFFB9, 0xFFB6, 0xFFB3, 0xFFB0, 0xFFAD, 0xFFAA, 0xFFA7, 0xFFA4, 0xFFA1, - 0xFF9E, 0xFF9B, 0xFF98, 0xFF95, 0xFF93, 0xFF90, 0xFF8D, 0xFF8A, 0xFF87, 0xFF85, 0xFF82, 0xFF7F, 0xFF7C, 0xFF7A, 0xFF77, 0xFF74, - 0xFF72, 0xFF6F, 0xFF6D, 0xFF6A, 0xFF68, 0xFF65, 0xFF63, 0xFF60, 0xFF5E, 0xFF5B, 0xFF59, 0xFF56, 0xFF54, 0xFF52, 0xFF4F, 0xFF4D, - - 0xFF4B, 0xFF49, 0xFF47, 0xFF44, 0xFF42, 0xFF40, 0xFF3E, 0xFF3C, 0xFF3A, 0xFF38, 0xFF36, 0xFF34, 0xFF32, 0xFF31, 0xFF2F, 0xFF2D, - 0xFF2B, 0xFF29, 0xFF28, 0xFF26, 0xFF24, 0xFF23, 0xFF21, 0xFF20, 0xFF1E, 0xFF1D, 0xFF1B, 0xFF1A, 0xFF19, 0xFF17, 0xFF16, 0xFF15, - 0xFF13, 0xFF12, 0xFF11, 0xFF10, 0xFF0F, 0xFF0E, 0xFF0D, 0xFF0C, 0xFF0B, 0xFF0A, 0xFF09, 0xFF08, 0xFF08, 0xFF07, 0xFF06, 0xFF06, - 0xFF05, 0xFF04, 0xFF04, 0xFF03, 0xFF03, 0xFF02, 0xFF02, 0xFF02, 0xFF01, 0xFF01, 0xFF01, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, - - 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF01, 0xFF01, 0xFF01, 0xFF02, 0xFF02, 0xFF02, 0xFF03, 0xFF03, 0xFF04, 0xFF04, - 0xFF05, 0xFF06, 0xFF06, 0xFF07, 0xFF08, 0xFF08, 0xFF09, 0xFF0A, 0xFF0B, 0xFF0C, 0xFF0D, 0xFF0E, 0xFF0F, 0xFF10, 0xFF11, 0xFF12, - 0xFF13, 0xFF15, 0xFF16, 0xFF17, 0xFF19, 0xFF1A, 0xFF1B, 0xFF1D, 0xFF1E, 0xFF20, 0xFF21, 0xFF23, 0xFF24, 0xFF26, 0xFF28, 0xFF29, - 0xFF2B, 0xFF2D, 0xFF2F, 0xFF31, 0xFF32, 0xFF34, 0xFF36, 0xFF38, 0xFF3A, 0xFF3C, 0xFF3E, 0xFF40, 0xFF42, 0xFF44, 0xFF47, 0xFF49, - - 0xFF4B, 0xFF4D, 0xFF4F, 0xFF52, 0xFF54, 0xFF56, 0xFF59, 0xFF5B, 0xFF5E, 0xFF60, 0xFF63, 0xFF65, 0xFF68, 0xFF6A, 0xFF6D, 0xFF6F, - 0xFF72, 0xFF74, 0xFF77, 0xFF7A, 0xFF7C, 0xFF7F, 0xFF82, 0xFF85, 0xFF87, 0xFF8A, 0xFF8D, 0xFF90, 0xFF93, 0xFF95, 0xFF98, 0xFF9B, - 0xFF9E, 0xFFA1, 0xFFA4, 0xFFA7, 0xFFAA, 0xFFAD, 0xFFB0, 0xFFB3, 0xFFB6, 0xFFB9, 0xFFBC, 0xFFBF, 0xFFC2, 0xFFC5, 0xFFC8, 0xFFCB, - 0xFFCE, 0xFFD1, 0xFFD4, 0xFFD7, 0xFFDA, 0xFFDE, 0xFFE1, 0xFFE4, 0xFFE7, 0xFFEA, 0xFFED, 0xFFF0, 0xFFF3, 0xFFF7, 0xFFFA, 0xFFFD -}; +#include + +u32 RandomValue = 1; + +u16 PA_AdjustAngle(u16 angle, s16 anglerot, s32 startx, s32 starty, s32 targetx, s32 targety) { + u64 distances[3]; + startx = startx << 8; // Fixed point... + starty = starty << 8; // Fixed point... + targetx = targetx << 8; // Fixed point... + targety = targety << 8; // Fixed point... + u16 tempangle = (angle - anglerot) & 511; + // Calcul des distances en fonction des angles + distances[0] = PA_Distance(startx + PA_Cos(tempangle), starty - PA_Sin(tempangle), targetx, targety); + tempangle += anglerot; + tempangle &= 511; + distances[1] = PA_Distance(startx + PA_Cos(tempangle), starty - PA_Sin(tempangle), targetx, targety); + tempangle += anglerot; + tempangle &= 511; + distances[2] = PA_Distance(startx + PA_Cos(tempangle), starty - PA_Sin(tempangle), targetx, targety); + + // On regarde si l'angle est optimal. Si ce n'est pas le cas, + // on fait tourner toujours dans le meme sens... + if (distances[0] < distances[1]) angle -= anglerot; + else if (distances[2] < distances[1]) angle += anglerot; + + return (angle&511); +} + +const s16 PA_SIN[512] = { + 0x0000, 0x0003, 0x0006, 0x0009, 0x000D, 0x0010, 0x0013, 0x0016, 0x0019, 0x001C, 0x001F, 0x0022, 0x0026, 0x0029, 0x002C, 0x002F, + 0x0032, 0x0035, 0x0038, 0x003B, 0x003E, 0x0041, 0x0044, 0x0047, 0x004A, 0x004D, 0x0050, 0x0053, 0x0056, 0x0059, 0x005C, 0x005F, + 0x0062, 0x0065, 0x0068, 0x006B, 0x006D, 0x0070, 0x0073, 0x0076, 0x0079, 0x007B, 0x007E, 0x0081, 0x0084, 0x0086, 0x0089, 0x008C, + 0x008E, 0x0091, 0x0093, 0x0096, 0x0098, 0x009B, 0x009D, 0x00A0, 0x00A2, 0x00A5, 0x00A7, 0x00AA, 0x00AC, 0x00AE, 0x00B1, 0x00B3, + + 0x00B5, 0x00B7, 0x00B9, 0x00BC, 0x00BE, 0x00C0, 0x00C2, 0x00C4, 0x00C6, 0x00C8, 0x00CA, 0x00CC, 0x00CE, 0x00CF, 0x00D1, 0x00D3, + 0x00D5, 0x00D7, 0x00D8, 0x00DA, 0x00DC, 0x00DD, 0x00DF, 0x00E0, 0x00E2, 0x00E3, 0x00E5, 0x00E6, 0x00E7, 0x00E9, 0x00EA, 0x00EB, + 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F8, 0x00F9, 0x00FA, 0x00FA, + 0x00FB, 0x00FC, 0x00FC, 0x00FD, 0x00FD, 0x00FE, 0x00FE, 0x00FE, 0x00FF, 0x00FF, 0x00FF, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, + + 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x00FF, 0x00FF, 0x00FF, 0x00FE, 0x00FE, 0x00FE, 0x00FD, 0x00FD, 0x00FC, 0x00FC, + 0x00FB, 0x00FA, 0x00FA, 0x00F9, 0x00F8, 0x00F8, 0x00F7, 0x00F6, 0x00F5, 0x00F4, 0x00F3, 0x00F2, 0x00F1, 0x00F0, 0x00EF, 0x00EE, + 0x00ED, 0x00EB, 0x00EA, 0x00E9, 0x00E7, 0x00E6, 0x00E5, 0x00E3, 0x00E2, 0x00E0, 0x00DF, 0x00DD, 0x00DC, 0x00DA, 0x00D8, 0x00D7, + 0x00D5, 0x00D3, 0x00D1, 0x00CF, 0x00CE, 0x00CC, 0x00CA, 0x00C8, 0x00C6, 0x00C4, 0x00C2, 0x00C0, 0x00BE, 0x00BC, 0x00B9, 0x00B7, + + 0x00B5, 0x00B3, 0x00B1, 0x00AE, 0x00AC, 0x00AA, 0x00A7, 0x00A5, 0x00A2, 0x00A0, 0x009D, 0x009B, 0x0098, 0x0096, 0x0093, 0x0091, + 0x008E, 0x008C, 0x0089, 0x0086, 0x0084, 0x0081, 0x007E, 0x007B, 0x0079, 0x0076, 0x0073, 0x0070, 0x006D, 0x006B, 0x0068, 0x0065, + 0x0062, 0x005F, 0x005C, 0x0059, 0x0056, 0x0053, 0x0050, 0x004D, 0x004A, 0x0047, 0x0044, 0x0041, 0x003E, 0x003B, 0x0038, 0x0035, + 0x0032, 0x002F, 0x002C, 0x0029, 0x0026, 0x0022, 0x001F, 0x001C, 0x0019, 0x0016, 0x0013, 0x0010, 0x000D, 0x0009, 0x0006, 0x0003, + + 0x0000, 0xFFFD, 0xFFFA, 0xFFF7, 0xFFF3, 0xFFF0, 0xFFED, 0xFFEA, 0xFFE7, 0xFFE4, 0xFFE1, 0xFFDE, 0xFFDA, 0xFFD7, 0xFFD4, 0xFFD1, + 0xFFCE, 0xFFCB, 0xFFC8, 0xFFC5, 0xFFC2, 0xFFBF, 0xFFBC, 0xFFB9, 0xFFB6, 0xFFB3, 0xFFB0, 0xFFAD, 0xFFAA, 0xFFA7, 0xFFA4, 0xFFA1, + 0xFF9E, 0xFF9B, 0xFF98, 0xFF95, 0xFF93, 0xFF90, 0xFF8D, 0xFF8A, 0xFF87, 0xFF85, 0xFF82, 0xFF7F, 0xFF7C, 0xFF7A, 0xFF77, 0xFF74, + 0xFF72, 0xFF6F, 0xFF6D, 0xFF6A, 0xFF68, 0xFF65, 0xFF63, 0xFF60, 0xFF5E, 0xFF5B, 0xFF59, 0xFF56, 0xFF54, 0xFF52, 0xFF4F, 0xFF4D, + + 0xFF4B, 0xFF49, 0xFF47, 0xFF44, 0xFF42, 0xFF40, 0xFF3E, 0xFF3C, 0xFF3A, 0xFF38, 0xFF36, 0xFF34, 0xFF32, 0xFF31, 0xFF2F, 0xFF2D, + 0xFF2B, 0xFF29, 0xFF28, 0xFF26, 0xFF24, 0xFF23, 0xFF21, 0xFF20, 0xFF1E, 0xFF1D, 0xFF1B, 0xFF1A, 0xFF19, 0xFF17, 0xFF16, 0xFF15, + 0xFF13, 0xFF12, 0xFF11, 0xFF10, 0xFF0F, 0xFF0E, 0xFF0D, 0xFF0C, 0xFF0B, 0xFF0A, 0xFF09, 0xFF08, 0xFF08, 0xFF07, 0xFF06, 0xFF06, + 0xFF05, 0xFF04, 0xFF04, 0xFF03, 0xFF03, 0xFF02, 0xFF02, 0xFF02, 0xFF01, 0xFF01, 0xFF01, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, + + 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF00, 0xFF01, 0xFF01, 0xFF01, 0xFF02, 0xFF02, 0xFF02, 0xFF03, 0xFF03, 0xFF04, 0xFF04, + 0xFF05, 0xFF06, 0xFF06, 0xFF07, 0xFF08, 0xFF08, 0xFF09, 0xFF0A, 0xFF0B, 0xFF0C, 0xFF0D, 0xFF0E, 0xFF0F, 0xFF10, 0xFF11, 0xFF12, + 0xFF13, 0xFF15, 0xFF16, 0xFF17, 0xFF19, 0xFF1A, 0xFF1B, 0xFF1D, 0xFF1E, 0xFF20, 0xFF21, 0xFF23, 0xFF24, 0xFF26, 0xFF28, 0xFF29, + 0xFF2B, 0xFF2D, 0xFF2F, 0xFF31, 0xFF32, 0xFF34, 0xFF36, 0xFF38, 0xFF3A, 0xFF3C, 0xFF3E, 0xFF40, 0xFF42, 0xFF44, 0xFF47, 0xFF49, + + 0xFF4B, 0xFF4D, 0xFF4F, 0xFF52, 0xFF54, 0xFF56, 0xFF59, 0xFF5B, 0xFF5E, 0xFF60, 0xFF63, 0xFF65, 0xFF68, 0xFF6A, 0xFF6D, 0xFF6F, + 0xFF72, 0xFF74, 0xFF77, 0xFF7A, 0xFF7C, 0xFF7F, 0xFF82, 0xFF85, 0xFF87, 0xFF8A, 0xFF8D, 0xFF90, 0xFF93, 0xFF95, 0xFF98, 0xFF9B, + 0xFF9E, 0xFFA1, 0xFFA4, 0xFFA7, 0xFFAA, 0xFFAD, 0xFFB0, 0xFFB3, 0xFFB6, 0xFFB9, 0xFFBC, 0xFFBF, 0xFFC2, 0xFFC5, 0xFFC8, 0xFFCB, + 0xFFCE, 0xFFD1, 0xFFD4, 0xFFD7, 0xFFDA, 0xFFDE, 0xFFE1, 0xFFE4, 0xFFE7, 0xFFEA, 0xFFED, 0xFFF0, 0xFFF3, 0xFFF7, 0xFFFA, 0xFFFD +}; diff --git a/source/arm9/PA_Mode7.c b/source/arm9/PA_Mode7.c index 633f40a..87f310d 100644 --- a/source/arm9/PA_Mode7.c +++ b/source/arm9/PA_Mode7.c @@ -1,156 +1,156 @@ -#include -#include - -u32 DX, DY; -u16 PA, PB, PC, PD; -s32 center_y, center_x; - -u16 PAtemp; // temp value - -u8 PA_currentmode; - -s32 mode7cam_x, mode7cam_y, mode7cam_z, mode7alpha; -s32 mode7cos, mode7sin; // temporaries for cos and sin alpha -s16 mode7_distance; - -// in mode7.c -M7CAM _m7_cam; -int _m7_horizon = M7_TOP; -BGAFF_EX _m7_bgaff_ex[192]; // affine parameters for each line - -/*! \fn void PA_InitMode7(u8 bg_select) - \brief - \~english Initialize Mode 7 for a given background. You MUST be in video mode 1 or 2 - \~french Initialise le Mode 7 pour un fond donné. Vous devez etre en mode 1 ou 2 impérativement ! - \param bg_select - \~english Bg number, 2 in mode 1, 2 or 3 in mode 2 - \~french Numéro du fond. 2 en mode 1, 2 ou 3 en mode 2 -*/ - -void PA_InitMode7(u8 bg_select) { - mode7cam_x = X0; mode7cam_y = Y0; mode7cam_z = Z0; - mode7alpha = 0; - mode7cos = 256; mode7sin = 0; // temporaries for cos and sin alpha - mode7_distance = 160; -//PA_StartInt(INT_HBLANK, hbl_mode7); - irqSet(IRQ_HBLANK, hbl_mode7); - irqEnable(IRQ_HBLANK); -} - - - - -// globals -// DIV: a 160-LUT with 1/(h+1) ; h=[0,160> (16.16 FIXEDs) -// g_cc: sine value for current alpha (24.8 FIXEDs) -// g_ss: cosine value for current alpha (24.8 FIXEDs) -// M7_D: the projection plane distance (=160 in our case) -// cam_x, cam_y, cam_z: camera coordinates (24.8 FIXEDs) - - - -u8 m7_distance = 160; - -u8 PAcount; - -void hbl_mode7(void) { - u8 screen = 0; - u8 bg = 3; - s32 ww, wcc, wss, wxr, wyr; -// ww= (mode7cam_y*DIV[REG_VCOUNT])>>12; // .8*.16 /.12 = 20.12 - s16 vc = REG_VCOUNT; - - if (vc > 192) vc = 0; - - ww = (mode7cam_y << 4) / (vc + 1); // .8*.16 /.12 = 20.12 - wcc = ww * mode7cos >> 5; // .12*.8 /.5 = 17.15 - wss = ww * mode7sin >> 5; // .12*.8 /.5 = 17.15 - // NOTE: when you do P * q0 - // - for x-offset (q0_x): >>7, then *120 - // - for y-offset (q0_y): *160, then >>7 - // Bad things happen if you don't. - // horizontal scale and offset - wxr = 128 * (wcc >> 7); // .8 - wyr = (mode7_distance * wss) >> 7; // .8 - PA_BGXPA(screen, bg) = wcc >> 7; - PA_BGXX(screen, bg) = mode7cam_x - wxr + wyr; - // vertical scale and offset - wxr = 128 * (wss >> 7); // .8 - wyr = (mode7_distance * wcc) >> 7; // .8 - PA_BGXPC(screen, bg) = wss >> 7; - PA_BGXY(screen, bg) = mode7cam_z - wxr - wyr; - // REG_IF = INT_HBLANK; // cleared by isr switchblock -} - - -#define PA_INT_MIN 0 -#define PA_INT_MAX 2147483647 - -void m7_horz_calc(void) { - if (_m7_cam.v.y != 0) { - _m7_horizon = M7_FAR_BG * _m7_cam.w.y - _m7_cam.pos.y; - _m7_horizon = M7_TOP - swiDivide(_m7_horizon << M7_D_SH, M7_FAR_BG * _m7_cam.v.y); -// _m7_horizon= M7_TOP - swiDivide(horz< 0 ? PA_INT_MIN : PA_INT_MAX; -} - - -/* -typedef struct { - s16 pa, pb, pc, pd; s32 dx, dy; -} BGAFF_EX; -*/ -/*#define PA_BGXX(screen, bg) _REG32(0x4000008 + (0x1000 * screen) + (bg << 4)) -#define PA_BGXY(screen, bg) _REG32(0x400000C + (0x1000 * screen) + (bg << 4)) -#define PA_BGXPA(screen, bg) _REG16(0x4000000 + (0x1000 * screen) + (bg << 4)) -#define PA_BGXPB(screen, bg) _REG16(0x4000002 + (0x1000 * screen) + (bg << 4)) -#define PA_BGXPC(screen, bg) _REG16(0x4000004 + (0x1000 * screen) + (bg << 4)) -#define PA_BGXPD(screen, bg) _REG16(0x4000006 + (0x1000 * screen) + (bg << 4)) -*/ -void m7_hbl_flr(void) { - u8 screen = 0; - u8 bg = 3; - u32 vc = REG_VCOUNT; - // Copie les trucs de BGAFF_EX - PA_BGXPA(screen, bg) = _m7_bgaff_ex[vc].pa; - PA_BGXPB(screen, bg) = _m7_bgaff_ex[vc].pb; - PA_BGXPC(screen, bg) = _m7_bgaff_ex[vc].pc; - PA_BGXPD(screen, bg) = _m7_bgaff_ex[vc].pd; - PA_BGXX(screen, bg) = _m7_bgaff_ex[vc].dx; - PA_BGXY(screen, bg) = _m7_bgaff_ex[vc].dy; - //bga_ex_mem[2] = _m7_bgaff_ex[vc]; - // Faire le blending... - //vid_bld_y( _m7_bgaff_ex[vc].pb>>6 ); -} - - - -void m7_aff_calc(void) { - if (_m7_horizon >= 192) - return; - - int ii, ii0 = _m7_horizon >= 0 ? _m7_horizon : 0; - s32 dcx = _m7_cam.v.x, dcy = _m7_cam.v.y, dcz = _m7_cam.v.z; - s32 lam = INT_MAX, cx, cy, cz; - // initial offsets - cx = (_m7_cam.w.x << M7_D_SH) + (ii0 - M7_TOP) * dcx; - cy = (_m7_cam.w.y << M7_D_SH) + (ii0 - M7_TOP) * dcy; - cz = (_m7_cam.w.z << M7_D_SH) + (ii0 - M7_TOP) * dcz; - BGAFF_EX *bga = &_m7_bgaff_ex[ii0]; - - for (ii = ii0; ii < 192; ii++) { - if (cy == 0) lam = INT_MAX; - else lam = swiDivide(_m7_cam.pos.y << 12, cy); // .12 - - // a little hack - bga->pb = lam >> 4; // .8 - // calculate affine parameters - bga->pa = (lam * _m7_cam.u.x) >> 12; - bga->dx = _m7_cam.pos.x + M7_LEFT * bga->pa - (lam * cx >> 12); - bga->pc = (lam * _m7_cam.u.z) >> 12; - bga->dy = _m7_cam.pos.z + M7_LEFT * bga->pc - (lam * cz >> 12); - cx += dcx; cy += dcy; cz += dcz; - bga++; - } -} +#include +#include + +u32 DX, DY; +u16 PA, PB, PC, PD; +s32 center_y, center_x; + +u16 PAtemp; // temp value + +u8 PA_currentmode; + +s32 mode7cam_x, mode7cam_y, mode7cam_z, mode7alpha; +s32 mode7cos, mode7sin; // temporaries for cos and sin alpha +s16 mode7_distance; + +// in mode7.c +M7CAM _m7_cam; +int _m7_horizon = M7_TOP; +BGAFF_EX _m7_bgaff_ex[192]; // affine parameters for each line + +/*! \fn void PA_InitMode7(u8 bg_select) + \brief + \~english Initialize Mode 7 for a given background. You MUST be in video mode 1 or 2 + \~french Initialise le Mode 7 pour un fond donné. Vous devez etre en mode 1 ou 2 impérativement ! + \param bg_select + \~english Bg number, 2 in mode 1, 2 or 3 in mode 2 + \~french Numéro du fond. 2 en mode 1, 2 ou 3 en mode 2 +*/ + +void PA_InitMode7(u8 bg_select) { + mode7cam_x = X0; mode7cam_y = Y0; mode7cam_z = Z0; + mode7alpha = 0; + mode7cos = 256; mode7sin = 0; // temporaries for cos and sin alpha + mode7_distance = 160; +//PA_StartInt(INT_HBLANK, hbl_mode7); + irqSet(IRQ_HBLANK, hbl_mode7); + irqEnable(IRQ_HBLANK); +} + + + + +// globals +// DIV: a 160-LUT with 1/(h+1) ; h=[0,160> (16.16 FIXEDs) +// g_cc: sine value for current alpha (24.8 FIXEDs) +// g_ss: cosine value for current alpha (24.8 FIXEDs) +// M7_D: the projection plane distance (=160 in our case) +// cam_x, cam_y, cam_z: camera coordinates (24.8 FIXEDs) + + + +u8 m7_distance = 160; + +u8 PAcount; + +void hbl_mode7(void) { + u8 screen = 0; + u8 bg = 3; + s32 ww, wcc, wss, wxr, wyr; +// ww= (mode7cam_y*DIV[REG_VCOUNT])>>12; // .8*.16 /.12 = 20.12 + s16 vc = REG_VCOUNT; + + if (vc > 192) vc = 0; + + ww = (mode7cam_y << 4) / (vc + 1); // .8*.16 /.12 = 20.12 + wcc = ww * mode7cos >> 5; // .12*.8 /.5 = 17.15 + wss = ww * mode7sin >> 5; // .12*.8 /.5 = 17.15 + // NOTE: when you do P * q0 + // - for x-offset (q0_x): >>7, then *120 + // - for y-offset (q0_y): *160, then >>7 + // Bad things happen if you don't. + // horizontal scale and offset + wxr = 128 * (wcc >> 7); // .8 + wyr = (mode7_distance * wss) >> 7; // .8 + PA_BGXPA(screen, bg) = wcc >> 7; + PA_BGXX(screen, bg) = mode7cam_x - wxr + wyr; + // vertical scale and offset + wxr = 128 * (wss >> 7); // .8 + wyr = (mode7_distance * wcc) >> 7; // .8 + PA_BGXPC(screen, bg) = wss >> 7; + PA_BGXY(screen, bg) = mode7cam_z - wxr - wyr; + // REG_IF = INT_HBLANK; // cleared by isr switchblock +} + + +#define PA_INT_MIN 0 +#define PA_INT_MAX 2147483647 + +void m7_horz_calc(void) { + if (_m7_cam.v.y != 0) { + _m7_horizon = M7_FAR_BG * _m7_cam.w.y - _m7_cam.pos.y; + _m7_horizon = M7_TOP - swiDivide(_m7_horizon << M7_D_SH, M7_FAR_BG * _m7_cam.v.y); +// _m7_horizon= M7_TOP - swiDivide(horz< 0 ? PA_INT_MIN : PA_INT_MAX; +} + + +/* +typedef struct { + s16 pa, pb, pc, pd; s32 dx, dy; +} BGAFF_EX; +*/ +/*#define PA_BGXX(screen, bg) _REG32(0x4000008 + (0x1000 * screen) + (bg << 4)) +#define PA_BGXY(screen, bg) _REG32(0x400000C + (0x1000 * screen) + (bg << 4)) +#define PA_BGXPA(screen, bg) _REG16(0x4000000 + (0x1000 * screen) + (bg << 4)) +#define PA_BGXPB(screen, bg) _REG16(0x4000002 + (0x1000 * screen) + (bg << 4)) +#define PA_BGXPC(screen, bg) _REG16(0x4000004 + (0x1000 * screen) + (bg << 4)) +#define PA_BGXPD(screen, bg) _REG16(0x4000006 + (0x1000 * screen) + (bg << 4)) +*/ +void m7_hbl_flr(void) { + u8 screen = 0; + u8 bg = 3; + u32 vc = REG_VCOUNT; + // Copie les trucs de BGAFF_EX + PA_BGXPA(screen, bg) = _m7_bgaff_ex[vc].pa; + PA_BGXPB(screen, bg) = _m7_bgaff_ex[vc].pb; + PA_BGXPC(screen, bg) = _m7_bgaff_ex[vc].pc; + PA_BGXPD(screen, bg) = _m7_bgaff_ex[vc].pd; + PA_BGXX(screen, bg) = _m7_bgaff_ex[vc].dx; + PA_BGXY(screen, bg) = _m7_bgaff_ex[vc].dy; + //bga_ex_mem[2] = _m7_bgaff_ex[vc]; + // Faire le blending... + //vid_bld_y( _m7_bgaff_ex[vc].pb>>6 ); +} + + + +void m7_aff_calc(void) { + if (_m7_horizon >= 192) + return; + + int ii, ii0 = _m7_horizon >= 0 ? _m7_horizon : 0; + s32 dcx = _m7_cam.v.x, dcy = _m7_cam.v.y, dcz = _m7_cam.v.z; + s32 lam = INT_MAX, cx, cy, cz; + // initial offsets + cx = (_m7_cam.w.x << M7_D_SH) + (ii0 - M7_TOP) * dcx; + cy = (_m7_cam.w.y << M7_D_SH) + (ii0 - M7_TOP) * dcy; + cz = (_m7_cam.w.z << M7_D_SH) + (ii0 - M7_TOP) * dcz; + BGAFF_EX *bga = &_m7_bgaff_ex[ii0]; + + for (ii = ii0; ii < 192; ii++) { + if (cy == 0) lam = INT_MAX; + else lam = swiDivide(_m7_cam.pos.y << 12, cy); // .12 + + // a little hack + bga->pb = lam >> 4; // .8 + // calculate affine parameters + bga->pa = (lam * _m7_cam.u.x) >> 12; + bga->dx = _m7_cam.pos.x + M7_LEFT * bga->pa - (lam * cx >> 12); + bga->pc = (lam * _m7_cam.u.z) >> 12; + bga->dy = _m7_cam.pos.z + M7_LEFT * bga->pc - (lam * cz >> 12); + cx += dcx; cy += dcy; cz += dcz; + bga++; + } +} diff --git a/source/arm9/PA_Motion.c b/source/arm9/PA_Motion.c index 631b67a..a59f6e5 100644 --- a/source/arm9/PA_Motion.c +++ b/source/arm9/PA_Motion.c @@ -1,89 +1,89 @@ -#include - -extern funcpointer MotionVBL; // VBL function... set to nothing by default -motion_struct Motion; - -// global variables for the sensor parameters -int PA_Xoffset = 2048; // output of X axis at 0 acceleration - this can vary slightly from sensor to sensor -int PA_Yoffset = 2048; // output of Y axis at 0 acceleration - this can vary slightly from sensor to sensor -int PA_Zoffset = 2048; // output of Z axis at 0 acceleration - this can vary slightly from sensor to sensor -int PA_Xsens = 819; // sensitivity of X axis (how many counts the output changes with 1 g) - this can vary slightly from sensor to sensor -int PA_Ysens = 819; // sensitivity of Y axis (how many counts the output changes with 1 g) - this can vary slightly from sensor to sensor -int PA_Zsens = 819; // sensitivity of Z axis (how many counts the output changes with 1 g) - this can vary slightly from sensor to sensor -int PA_Goffset = 1680; // zero rate bias (offset) of the gyro - this can vary slightly from sensor to sensor -int PA_Gsens = 825;// sensitivity of gyro (how many counts the output changes with 1000 degrees/second rotation) - this can vary slightly from sensor to sensor - -void PA_MotionVBL(void); - - - - -u8 pamotiontopad; - -typedef struct { - s32 X, Y, Z; -} pamotiontype; -pamotiontype pamotionold[4]; -u8 pamotioncurrent; - -void PA_MotionVBL(void) { - // Backup - s32 oldx = Motion.X; - s32 oldy = Motion.Y; - s32 oldz = Motion.Z; - s32 oldzrot = Motion.Zrot; - // Read commands - Motion.X = motion_read_x(); // this returns a value between 0 and 4095 - Motion.Y = motion_read_y(); // this returns a value between 0 and 4095 - Motion.Z = motion_read_z(); // this returns a value between 0 and 4095 - Motion.AccelX = motion_acceleration_x(); // this returns a value between 0 and 4095 - Motion.AccelY = motion_acceleration_y(); // this returns a value between 0 and 4095 - Motion.AccelZ = motion_acceleration_z(); // this returns a value between 0 and 4095 - Motion.Zrot = motion_read_gyro(); // this returns a value between 0 and 4095 - Motion.X = ((Motion.X - PA_Xoffset) * 1000 / PA_Xsens) >> 3; // this converts from counts to mg (milli-g) (1000 mg = 1 g) - Motion.Y = ((Motion.Y - PA_Yoffset) * 1000 / PA_Ysens) >> 3; // 1 g is gravitational acceleration - Motion.Z = ((Motion.Z - PA_Zoffset) * 1000 / PA_Zsens) >> 3; - Motion.Zrot = (Motion.Zrot - PA_Goffset) * 1000 / PA_Gsens; // this converts to deg/sec (degrees per second) - Motion.Newpress.Left = (!(oldx > 20)) && (Motion.X > 20); - Motion.Newpress.Right = (!(oldx < -20)) && (Motion.X < -20); - Motion.Newpress.Down = (!(oldy > 20)) && (Motion.Y > 20); - Motion.Newpress.Up = (!(oldy < -20)) && (Motion.Y < -20); - Motion.Released.Left = (oldx > 20) && !(Motion.X > 20); - Motion.Released.Right = (oldx < -20) && !(Motion.X < -20); - Motion.Released.Down = (oldy > 20) && !(Motion.Y > 20); - Motion.Released.Up = (oldy < -20) && !(Motion.Y < -20); - Motion.Held.Left = (Motion.X > 20); - Motion.Held.Right = (Motion.X < -20); - Motion.Held.Down = (Motion.Y > 20); - Motion.Held.Up = (Motion.Y < -20); - Motion.Angle = PA_GetAngle(0, 0, -Motion.X, Motion.Y); - Motion.Force = PA_TrueDistance(0, 0, Motion.X, Motion.Y); - - if (pamotiontopad) { // Map - Pad.Newpress.Left = Motion.Newpress.Left; - Pad.Newpress.Up = Motion.Newpress.Up; - Pad.Newpress.Down = Motion.Newpress.Down; - Pad.Newpress.Right = Motion.Newpress.Right; - Pad.Held.Left = Motion.Held.Left; - Pad.Held.Up = Motion.Held.Up; - Pad.Held.Down = Motion.Held.Down; - Pad.Held.Right = Motion.Held.Right; - Pad.Released.Left = Motion.Released.Left; - Pad.Released.Up = Motion.Released.Up; - Pad.Released.Down = Motion.Released.Down; - Pad.Released.Right = Motion.Released.Right; - } - - // Get Changes... - Motion.Vx = Motion.X - oldx; - Motion.Vy = Motion.Y - oldy; - Motion.Vz = Motion.Z - oldz; - Motion.Vzrot = Motion.Zrot - oldzrot; - pamotioncurrent++; pamotioncurrent &= 3; // limit to 4... - pamotionold[pamotioncurrent].X = Motion.X; - pamotionold[pamotioncurrent].Y = Motion.Y; - pamotionold[pamotioncurrent].Z = Motion.Z; - Motion.X = (pamotionold[0].X + pamotionold[1].X + pamotionold[2].X + pamotionold[3].X) >> 2; // Average value - Motion.Y = (pamotionold[0].Y + pamotionold[1].Y + pamotionold[2].Y + pamotionold[3].Y) >> 2; // Average value - Motion.Z = (pamotionold[0].Z + pamotionold[1].Z + pamotionold[2].Z + pamotionold[3].Z) >> 2; // Average value -} +#include + +extern funcpointer MotionVBL; // VBL function... set to nothing by default +motion_struct Motion; + +// global variables for the sensor parameters +int PA_Xoffset = 2048; // output of X axis at 0 acceleration - this can vary slightly from sensor to sensor +int PA_Yoffset = 2048; // output of Y axis at 0 acceleration - this can vary slightly from sensor to sensor +int PA_Zoffset = 2048; // output of Z axis at 0 acceleration - this can vary slightly from sensor to sensor +int PA_Xsens = 819; // sensitivity of X axis (how many counts the output changes with 1 g) - this can vary slightly from sensor to sensor +int PA_Ysens = 819; // sensitivity of Y axis (how many counts the output changes with 1 g) - this can vary slightly from sensor to sensor +int PA_Zsens = 819; // sensitivity of Z axis (how many counts the output changes with 1 g) - this can vary slightly from sensor to sensor +int PA_Goffset = 1680; // zero rate bias (offset) of the gyro - this can vary slightly from sensor to sensor +int PA_Gsens = 825;// sensitivity of gyro (how many counts the output changes with 1000 degrees/second rotation) - this can vary slightly from sensor to sensor + +void PA_MotionVBL(void); + + + + +u8 pamotiontopad; + +typedef struct { + s32 X, Y, Z; +} pamotiontype; +pamotiontype pamotionold[4]; +u8 pamotioncurrent; + +void PA_MotionVBL(void) { + // Backup + s32 oldx = Motion.X; + s32 oldy = Motion.Y; + s32 oldz = Motion.Z; + s32 oldzrot = Motion.Zrot; + // Read commands + Motion.X = motion_read_x(); // this returns a value between 0 and 4095 + Motion.Y = motion_read_y(); // this returns a value between 0 and 4095 + Motion.Z = motion_read_z(); // this returns a value between 0 and 4095 + Motion.AccelX = motion_acceleration_x(); // this returns a value between 0 and 4095 + Motion.AccelY = motion_acceleration_y(); // this returns a value between 0 and 4095 + Motion.AccelZ = motion_acceleration_z(); // this returns a value between 0 and 4095 + Motion.Zrot = motion_read_gyro(); // this returns a value between 0 and 4095 + Motion.X = ((Motion.X - PA_Xoffset) * 1000 / PA_Xsens) >> 3; // this converts from counts to mg (milli-g) (1000 mg = 1 g) + Motion.Y = ((Motion.Y - PA_Yoffset) * 1000 / PA_Ysens) >> 3; // 1 g is gravitational acceleration + Motion.Z = ((Motion.Z - PA_Zoffset) * 1000 / PA_Zsens) >> 3; + Motion.Zrot = (Motion.Zrot - PA_Goffset) * 1000 / PA_Gsens; // this converts to deg/sec (degrees per second) + Motion.Newpress.Left = (!(oldx > 20)) && (Motion.X > 20); + Motion.Newpress.Right = (!(oldx < -20)) && (Motion.X < -20); + Motion.Newpress.Down = (!(oldy > 20)) && (Motion.Y > 20); + Motion.Newpress.Up = (!(oldy < -20)) && (Motion.Y < -20); + Motion.Released.Left = (oldx > 20) && !(Motion.X > 20); + Motion.Released.Right = (oldx < -20) && !(Motion.X < -20); + Motion.Released.Down = (oldy > 20) && !(Motion.Y > 20); + Motion.Released.Up = (oldy < -20) && !(Motion.Y < -20); + Motion.Held.Left = (Motion.X > 20); + Motion.Held.Right = (Motion.X < -20); + Motion.Held.Down = (Motion.Y > 20); + Motion.Held.Up = (Motion.Y < -20); + Motion.Angle = PA_GetAngle(0, 0, -Motion.X, Motion.Y); + Motion.Force = PA_TrueDistance(0, 0, Motion.X, Motion.Y); + + if (pamotiontopad) { // Map + Pad.Newpress.Left = Motion.Newpress.Left; + Pad.Newpress.Up = Motion.Newpress.Up; + Pad.Newpress.Down = Motion.Newpress.Down; + Pad.Newpress.Right = Motion.Newpress.Right; + Pad.Held.Left = Motion.Held.Left; + Pad.Held.Up = Motion.Held.Up; + Pad.Held.Down = Motion.Held.Down; + Pad.Held.Right = Motion.Held.Right; + Pad.Released.Left = Motion.Released.Left; + Pad.Released.Up = Motion.Released.Up; + Pad.Released.Down = Motion.Released.Down; + Pad.Released.Right = Motion.Released.Right; + } + + // Get Changes... + Motion.Vx = Motion.X - oldx; + Motion.Vy = Motion.Y - oldy; + Motion.Vz = Motion.Z - oldz; + Motion.Vzrot = Motion.Zrot - oldzrot; + pamotioncurrent++; pamotioncurrent &= 3; // limit to 4... + pamotionold[pamotioncurrent].X = Motion.X; + pamotionold[pamotioncurrent].Y = Motion.Y; + pamotionold[pamotioncurrent].Z = Motion.Z; + Motion.X = (pamotionold[0].X + pamotionold[1].X + pamotionold[2].X + pamotionold[3].X) >> 2; // Average value + Motion.Y = (pamotionold[0].Y + pamotionold[1].Y + pamotionold[2].Y + pamotionold[3].Y) >> 2; // Average value + Motion.Z = (pamotionold[0].Z + pamotionold[1].Z + pamotionold[2].Z + pamotionold[3].Z) >> 2; // Average value +} diff --git a/source/arm9/PA_MulDivSqrt.s b/source/arm9/PA_MulDivSqrt.s index 034f540..ae83089 100644 --- a/source/arm9/PA_MulDivSqrt.s +++ b/source/arm9/PA_MulDivSqrt.s @@ -1,161 +1,161 @@ -.arch armv5te - -.arm -.text - -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ Q12 fixed point multiplication function @ -@ Mainly used to support 64-bit multiplications in THUMB code @ -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ int PA_mulf32(int a, int b); - -.align 2 -.global PA_mulf32 -PA_mulf32: @ int PA_mulf32(int a, int b){ - smull r2, r3, r0, r1 @ long long result = a * b; - mov r0, r2, lsr #12 @ result = result >> 12; - orr r0, r3, lsl #20 @ - bx lr @ return (int) result; - @ } - -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ Q12 fixed point division function @ -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ int PA_divf32(int a, int b); - -.align 2 -.global PA_divf32 - -PA_divf32: - @ Check for division by zero - movs r1, r1 - beq .Ldivision_by_zero - - @ Address base - mov r3, #0x04000000 - orr r3, r3, #0x280 - - @ Write denominator - str r1, [r3, #0x18] - - @ Write numerator - mov r1, r0, asr #20 - mov r0, r0, lsl #12 - strd r0, [r3, #0x10] - - @ Signal the hardware - mov r0, #1 - str r0, [r3] - - @ Wait for the division to be completed -.Ldivloop: - ldr r0, [r3] - tst r0, #0x8000 - bne .Ldivloop - - @ Load the result - ldr r0, [r3, #0x20] - - @ Return - bx lr - -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ Q12 fixed point modulo function @ -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ int PA_modf32(int a, int b); - -.align 2 -.global PA_modf32 - -PA_modf32: - @ Check for division by zero - movs r1, r1 - beq .Ldivision_by_zero - - @ Address base - mov r3, #0x04000000 - orr r3, r3, #0x280 - - @ Write numerator - str r0, [r3, #0x10] - - @ Write denominator - str r1, [r3, #0x18] - - @ Signal the hardware - mov r0, #0 - str r0, [r3] - - @ Wait for the modulo to be completed -.Lmodloop: - ldr r0, [r3] - tst r0, #0x8000 - bne .Lmodloop - - @ Load the result - ldr r0, [r3, #0x28] - - @ Return - bx lr - -@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ Q12 square root function @ -@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ int PA_sqrtf32(int a); - -.align 2 -.global PA_sqrtf32 - -PA_sqrtf32: - @ Fix negative values - movs r0, r0 - rsbmi r0, r0, #0 - - @ Address base - mov r3, #0x04000000 - orr r3, r3, #0x2B0 - - @ Write the parameter - mov r1, r0, lsr #20 - mov r0, r0, lsl #12 - strd r0, [r3, #0x08] - - @ Signal the hardware - mov r0, #1 - str r0, [r3] - - @ Wait for the square root to be completed -.Lsqrtloop: - ldr r0, [r3] - tst r0, #0x8000 - bne .Lsqrtloop - - @ Load the result - ldr r0, [r3, #0x04] - - @ Return - bx lr - -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ Crappy division by zero handler @ -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - -.align 2 -.Ldivision_by_zero: - ldr r0, =.Lcondition - ldr r1, =.Lmessage - ldr r2, =.Lfile - mov r3, #35 - b _PA_Assert - -.align 2 -.Lcondition: - .ascii "b != 0\000" - -.align 2 -.Lmessage: - .ascii "Division by zero\000" - -.align 2 -.Lfile: - .asciz __FILE__ +.arch armv5te + +.arm +.text + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Q12 fixed point multiplication function @ +@ Mainly used to support 64-bit multiplications in THUMB code @ +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ int PA_mulf32(int a, int b); + +.align 2 +.global PA_mulf32 +PA_mulf32: @ int PA_mulf32(int a, int b){ + smull r2, r3, r0, r1 @ long long result = a * b; + mov r0, r2, lsr #12 @ result = result >> 12; + orr r0, r3, lsl #20 @ + bx lr @ return (int) result; + @ } + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Q12 fixed point division function @ +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ int PA_divf32(int a, int b); + +.align 2 +.global PA_divf32 + +PA_divf32: + @ Check for division by zero + movs r1, r1 + beq .Ldivision_by_zero + + @ Address base + mov r3, #0x04000000 + orr r3, r3, #0x280 + + @ Write denominator + str r1, [r3, #0x18] + + @ Write numerator + mov r1, r0, asr #20 + mov r0, r0, lsl #12 + strd r0, [r3, #0x10] + + @ Signal the hardware + mov r0, #1 + str r0, [r3] + + @ Wait for the division to be completed +.Ldivloop: + ldr r0, [r3] + tst r0, #0x8000 + bne .Ldivloop + + @ Load the result + ldr r0, [r3, #0x20] + + @ Return + bx lr + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Q12 fixed point modulo function @ +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ int PA_modf32(int a, int b); + +.align 2 +.global PA_modf32 + +PA_modf32: + @ Check for division by zero + movs r1, r1 + beq .Ldivision_by_zero + + @ Address base + mov r3, #0x04000000 + orr r3, r3, #0x280 + + @ Write numerator + str r0, [r3, #0x10] + + @ Write denominator + str r1, [r3, #0x18] + + @ Signal the hardware + mov r0, #0 + str r0, [r3] + + @ Wait for the modulo to be completed +.Lmodloop: + ldr r0, [r3] + tst r0, #0x8000 + bne .Lmodloop + + @ Load the result + ldr r0, [r3, #0x28] + + @ Return + bx lr + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Q12 square root function @ +@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ int PA_sqrtf32(int a); + +.align 2 +.global PA_sqrtf32 + +PA_sqrtf32: + @ Fix negative values + movs r0, r0 + rsbmi r0, r0, #0 + + @ Address base + mov r3, #0x04000000 + orr r3, r3, #0x2B0 + + @ Write the parameter + mov r1, r0, lsr #20 + mov r0, r0, lsl #12 + strd r0, [r3, #0x08] + + @ Signal the hardware + mov r0, #1 + str r0, [r3] + + @ Wait for the square root to be completed +.Lsqrtloop: + ldr r0, [r3] + tst r0, #0x8000 + bne .Lsqrtloop + + @ Load the result + ldr r0, [r3, #0x04] + + @ Return + bx lr + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Crappy division by zero handler @ +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +.align 2 +.Ldivision_by_zero: + ldr r0, =.Lcondition + ldr r1, =.Lmessage + ldr r2, =.Lfile + mov r3, #35 + b _PA_Assert + +.align 2 +.Lcondition: + .ascii "b != 0\000" + +.align 2 +.Lmessage: + .ascii "Division by zero\000" + +.align 2 +.Lfile: + .asciz __FILE__ diff --git a/source/arm9/PA_NewBg.c b/source/arm9/PA_NewBg.c index 52431e3..a64d396 100644 --- a/source/arm9/PA_NewBg.c +++ b/source/arm9/PA_NewBg.c @@ -1,132 +1,132 @@ -#include - -void PA_LoadBackground(u8 screen, u8 bg_select, const PA_BgStruct* bg){ - int tempsize; - - switch(bg->BgType){ - case PA_BgNormal: - PA_StoreEasyBgInfos(screen, bg_select, BG_TILEDBG, bg->width, - bg->height, (void*) bg->BgTiles, bg->BgTiles_size >> 1, - (void*) bg->BgMap, bg->BgMap_size >> 1, (void*) bg->BgPalette); - - PA_LoadBgPal(screen, bg_select, (void*) bg->BgPalette); - - tempsize = PA_GetPAGfxBgSize(bg->width, bg->height); - - PA_DeleteBg(screen, bg_select); - PA_LoadBgTilesEx(screen, bg_select, (void*) bg->BgTiles, bg->BgTiles_size >> 1); - PA_LoadBgMap(screen, bg_select, (void*) bg->BgMap, tempsize); - - PA_InitBg(screen, bg_select, tempsize, 0, 1); - PA_BGScrollXY(screen, bg_select, 0, 0); - break; - - case PA_BgLarge: - PA_StoreEasyBgInfos(screen, bg_select, BG_LARGEMAP, bg->width, - bg->height, (void*) bg->BgTiles, bg->BgTiles_size >> 1, - (void*) bg->BgMap, bg->BgMap_size >> 1, (void*) bg->BgPalette); - - PA_LoadBgPal(screen, bg_select, (void*) bg->BgPalette); - - PA_BgInfo[screen][bg_select].NTiles = bg->BgTiles_size >> 6; - - PA_DeleteBg(screen, bg_select); - PA_LoadBgTilesEx(screen, bg_select, (void*) bg->BgTiles, bg->BgTiles_size >> 1); - PA_LoadBgMap(screen, bg_select, NULL, BG_512X256); - - PA_InitBg(screen, bg_select, BG_512X256, 0, 1); - PA_BGScrollXY(screen, bg_select, 0, 0); - - PA_InitLargeBg(screen, bg_select, bg->width >> 3, bg->height >> 3, (void*) bg->BgMap); - break; - - case PA_BgUnlimited: - PA_StoreEasyBgInfos(screen, bg_select, BG_INFINITEMAP, bg->width, - bg->height, (void*) bg->BgTiles, bg->BgTiles_size >> 1, - (void*) bg->BgMap, bg->BgMap_size >> 1, (void*) bg->BgPalette); - - PA_LoadBgPal(screen, bg_select, (void*) bg->BgPalette); - - PA_BgInfo[screen][bg_select].NTiles = bg->BgTiles_size >> 6; - - PA_DeleteBg(screen, bg_select); - PA_LoadBgTilesEx(screen, bg_select, (void*)NULL, (1008<<5)); - PA_BgInfo[screen][bg_select].Tiles = (void*) bg->BgTiles; - PA_LoadBgMap(screen, bg_select, NULL, BG_512X256); - PA_InitBg(screen, bg_select, BG_512X256, 0, 1); - PA_BGScrollXY(screen, bg_select, 0, 0); - - PA_InitLargeBg(screen, bg_select, bg->width >> 3, bg->height >> 3, (void*) bg->BgMap); - break; - - case PA_BgRot: - PA_Assert(bg_select >= 2, "Invalid background"); - PA_Assert(PA_GetVideoMode(screen) != 0, "Invalid video mode"); - - PA_Load8bitBgPal(screen, (void*) bg->BgPalette); - - tempsize = PA_GetPAGfxRotBgSize(bg->width); - - PA_DeleteBg(screen, bg_select); - PA_LoadBgTilesEx(screen, bg_select, (void*) bg->BgTiles, bg->BgTiles_size >> 1); - PA_LoadRotBgMap(screen, bg_select, (void*) bg->BgMap, tempsize); - - PA_InitBg(screen, bg_select, tempsize, 0, 1); - PA_SetBgRot(screen, bg_select, 0, 0, 0, 0, 0, 256); - break; - } -} - -void PA_LoadText(u8 screen, u8 bg_select, const PA_BgStruct* font){ - PA_Assert(font->BgType == PA_BgNormal, "Invalid font type"); - PAbgtext[screen] = bg_select; - - PA_LoadBgPal(screen, bg_select, (void*) font->BgPalette); - - PA_DeleteBg(screen, bg_select); - PA_LoadBgTilesEx(screen, bg_select, (void*) font->BgTiles, font->BgTiles_size >> 1); - PA_LoadBgMap(screen, bg_select, NULL, BG_256X256); - - PA_InitBg(screen, bg_select, BG_256X256, 0, 1); - PA_BGScrollXY(screen, bg_select, 0, 0); - - PA_textmap[screen] = (u16*) font->BgMap; - PA_textpal[screen] = (u16*) font->BgPalette; - PAtext_pal[screen] = 0; -} - -void PA_LoadKeyboard(u8 bg_select, const PA_BgStruct* keybd){ - PA_Assert(keybd->BgType == PA_BgLarge, "Invalid keyboard type"); - PA_LoadBgPal(keyb_screen, bg_select, (void*) keybd->BgPalette); - - PA_DeleteBg(keyb_screen, bg_select); - PA_LoadBgTilesEx(keyb_screen, bg_select, (void*) keybd->BgTiles, keybd->BgTiles_size >> 1); - PA_LoadBgMap(keyb_screen, bg_select, (void*) keybd->BgMap, BG_256X512); - - PA_InitBg(keyb_screen, bg_select, BG_256X512, 0, 1); - PA_BGScrollXY(keyb_screen, bg_select, 0, 0); - - PA_Keyboard_Struct.Bg = bg_select; - PA_Keyboard_Struct.Type = 0; - PA_Keyboard_Struct.Repeat = 0; - PA_Keyboard_Struct.Custom = 1; - PA_BgInfo[keyb_screen][bg_select].Map = (u32) keybd->BgMap; -} - -void PA_AddBitmapFont(int slot, const PA_BgStruct* font){ - PA_Assert(font->BgType == PA_Font8bit, "Invalid font type"); - - bittext_maps[slot] = (u16*) font->BgMap; - bit8_tiles[slot] = (u8*) font->BgTiles; - pa_bittextdefaultsize[slot] = (u8*) font->FontSizes; - pa_bittextpoliceheight[slot] = font->FontHeight; -} - -void PA_Add16cFont(int slot, const PA_BgStruct* font){ - PA_Assert(font->BgType == PA_Font4bit, "Invalid font type"); - - bittext_maps[slot] = (u16*) font->BgMap; - c16_tiles[slot] = (u32*) font->BgTiles; - pa_bittextdefaultsize[slot] = (u8*) font->FontSizes; - pa_bittextpoliceheight[slot] = font->FontHeight; -} +#include + +void PA_LoadBackground(u8 screen, u8 bg_select, const PA_BgStruct* bg){ + int tempsize; + + switch(bg->BgType){ + case PA_BgNormal: + PA_StoreEasyBgInfos(screen, bg_select, BG_TILEDBG, bg->width, + bg->height, (void*) bg->BgTiles, bg->BgTiles_size >> 1, + (void*) bg->BgMap, bg->BgMap_size >> 1, (void*) bg->BgPalette); + + PA_LoadBgPal(screen, bg_select, (void*) bg->BgPalette); + + tempsize = PA_GetPAGfxBgSize(bg->width, bg->height); + + PA_DeleteBg(screen, bg_select); + PA_LoadBgTilesEx(screen, bg_select, (void*) bg->BgTiles, bg->BgTiles_size >> 1); + PA_LoadBgMap(screen, bg_select, (void*) bg->BgMap, tempsize); + + PA_InitBg(screen, bg_select, tempsize, 0, 1); + PA_BGScrollXY(screen, bg_select, 0, 0); + break; + + case PA_BgLarge: + PA_StoreEasyBgInfos(screen, bg_select, BG_LARGEMAP, bg->width, + bg->height, (void*) bg->BgTiles, bg->BgTiles_size >> 1, + (void*) bg->BgMap, bg->BgMap_size >> 1, (void*) bg->BgPalette); + + PA_LoadBgPal(screen, bg_select, (void*) bg->BgPalette); + + PA_BgInfo[screen][bg_select].NTiles = bg->BgTiles_size >> 6; + + PA_DeleteBg(screen, bg_select); + PA_LoadBgTilesEx(screen, bg_select, (void*) bg->BgTiles, bg->BgTiles_size >> 1); + PA_LoadBgMap(screen, bg_select, NULL, BG_512X256); + + PA_InitBg(screen, bg_select, BG_512X256, 0, 1); + PA_BGScrollXY(screen, bg_select, 0, 0); + + PA_InitLargeBg(screen, bg_select, bg->width >> 3, bg->height >> 3, (void*) bg->BgMap); + break; + + case PA_BgUnlimited: + PA_StoreEasyBgInfos(screen, bg_select, BG_INFINITEMAP, bg->width, + bg->height, (void*) bg->BgTiles, bg->BgTiles_size >> 1, + (void*) bg->BgMap, bg->BgMap_size >> 1, (void*) bg->BgPalette); + + PA_LoadBgPal(screen, bg_select, (void*) bg->BgPalette); + + PA_BgInfo[screen][bg_select].NTiles = bg->BgTiles_size >> 6; + + PA_DeleteBg(screen, bg_select); + PA_LoadBgTilesEx(screen, bg_select, (void*)NULL, (1008<<5)); + PA_BgInfo[screen][bg_select].Tiles = (void*) bg->BgTiles; + PA_LoadBgMap(screen, bg_select, NULL, BG_512X256); + PA_InitBg(screen, bg_select, BG_512X256, 0, 1); + PA_BGScrollXY(screen, bg_select, 0, 0); + + PA_InitLargeBg(screen, bg_select, bg->width >> 3, bg->height >> 3, (void*) bg->BgMap); + break; + + case PA_BgRot: + PA_Assert(bg_select >= 2, "Invalid background"); + PA_Assert(PA_GetVideoMode(screen) != 0, "Invalid video mode"); + + PA_Load8bitBgPal(screen, (void*) bg->BgPalette); + + tempsize = PA_GetPAGfxRotBgSize(bg->width); + + PA_DeleteBg(screen, bg_select); + PA_LoadBgTilesEx(screen, bg_select, (void*) bg->BgTiles, bg->BgTiles_size >> 1); + PA_LoadRotBgMap(screen, bg_select, (void*) bg->BgMap, tempsize); + + PA_InitBg(screen, bg_select, tempsize, 0, 1); + PA_SetBgRot(screen, bg_select, 0, 0, 0, 0, 0, 256); + break; + } +} + +void PA_LoadText(u8 screen, u8 bg_select, const PA_BgStruct* font){ + PA_Assert(font->BgType == PA_BgNormal, "Invalid font type"); + PAbgtext[screen] = bg_select; + + PA_LoadBgPal(screen, bg_select, (void*) font->BgPalette); + + PA_DeleteBg(screen, bg_select); + PA_LoadBgTilesEx(screen, bg_select, (void*) font->BgTiles, font->BgTiles_size >> 1); + PA_LoadBgMap(screen, bg_select, NULL, BG_256X256); + + PA_InitBg(screen, bg_select, BG_256X256, 0, 1); + PA_BGScrollXY(screen, bg_select, 0, 0); + + PA_textmap[screen] = (u16*) font->BgMap; + PA_textpal[screen] = (u16*) font->BgPalette; + PAtext_pal[screen] = 0; +} + +void PA_LoadKeyboard(u8 bg_select, const PA_BgStruct* keybd){ + PA_Assert(keybd->BgType == PA_BgLarge, "Invalid keyboard type"); + PA_LoadBgPal(keyb_screen, bg_select, (void*) keybd->BgPalette); + + PA_DeleteBg(keyb_screen, bg_select); + PA_LoadBgTilesEx(keyb_screen, bg_select, (void*) keybd->BgTiles, keybd->BgTiles_size >> 1); + PA_LoadBgMap(keyb_screen, bg_select, (void*) keybd->BgMap, BG_256X512); + + PA_InitBg(keyb_screen, bg_select, BG_256X512, 0, 1); + PA_BGScrollXY(keyb_screen, bg_select, 0, 0); + + PA_Keyboard_Struct.Bg = bg_select; + PA_Keyboard_Struct.Type = 0; + PA_Keyboard_Struct.Repeat = 0; + PA_Keyboard_Struct.Custom = 1; + PA_BgInfo[keyb_screen][bg_select].Map = (u32) keybd->BgMap; +} + +void PA_AddBitmapFont(int slot, const PA_BgStruct* font){ + PA_Assert(font->BgType == PA_Font8bit, "Invalid font type"); + + bittext_maps[slot] = (u16*) font->BgMap; + bit8_tiles[slot] = (u8*) font->BgTiles; + pa_bittextdefaultsize[slot] = (u8*) font->FontSizes; + pa_bittextpoliceheight[slot] = font->FontHeight; +} + +void PA_Add16cFont(int slot, const PA_BgStruct* font){ + PA_Assert(font->BgType == PA_Font4bit, "Invalid font type"); + + bittext_maps[slot] = (u16*) font->BgMap; + c16_tiles[slot] = (u32*) font->BgTiles; + pa_bittextdefaultsize[slot] = (u8*) font->FontSizes; + pa_bittextpoliceheight[slot] = font->FontHeight; +} diff --git a/source/arm9/PA_Palette.c b/source/arm9/PA_Palette.c index 6337564..4dc8b87 100644 --- a/source/arm9/PA_Palette.c +++ b/source/arm9/PA_Palette.c @@ -1,61 +1,61 @@ -#include - -u8 PA_ExtPal[2][2]; // 0 si pas étendu, 1 sinon - -void PA_InitSpriteExtPal(void) { - // Palettes étendus pour les 256 couleurs... - vramSetBankG(VRAM_G_SPRITE_EXT_PALETTE); - vramSetBankI(VRAM_I_SUB_SPRITE_EXT_PALETTE); - PA_ExtPal[0][0] = 1; - PA_ExtPal[0][1] = 1; - REG_DISPCNT |= DISPLAY_SPR_EXT_PALETTE; - REG_DISPCNT_SUB |= DISPLAY_SPR_EXT_PALETTE; - PA_LoadSpritePal(0, 0, (void*)PAL_SPRITE0); - PA_LoadSpritePal(1, 0, (void*)PAL_SPRITE1); -} - -void PA_LoadSpriteExtPal(u8 screen, u16 palette_number, void* palette) { - if (screen == 0) { - vramSetBankG(VRAM_G_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres - dmaCopy(palette,VRAM_G_EXT_SPR_PALETTE[palette_number],512); - vramSetBankG(VRAM_G_SPRITE_EXT_PALETTE); - } else { - vramSetBankI(VRAM_I_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres - dmaCopy(palette,VRAM_I_EXT_SPR_PALETTE[palette_number],512); - vramSetBankI(VRAM_I_SUB_SPRITE_EXT_PALETTE); - } -} - -void PA_InitBgExtPal(void) { - // Palettes étendus pour les 256 couleurs... - vramSetBankE(VRAM_E_BG_EXT_PALETTE); - vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE); - PA_ExtPal[1][0] = 1; - PA_ExtPal[1][1] = 1; - //DISPLAY_CR |= 1 << 30; - //SUB_DISPLAY_CR |= 1 << 30; - bgExtPaletteEnable(); - bgExtPaletteEnableSub(); - u8 i; - - for (i = 0; i < 4; i++) { // On copie la palette partout - PA_LoadBgExtPal(0, i, (void*)PAL_BG0); - PA_LoadBgExtPal(1, i, (void*)PAL_BG0); - } -} - -void PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette) { - if (screen == 0) { - vramSetBankE(VRAM_E_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres - //DMA_Copy(palette, VRAM_E + (bg_number << 13) + (pal_number << 9), 256, DMA_16NOW); - //New code - dmaCopy(palette,&VRAM_E_EXT_PALETTE[bg_number][pal_number],512); - vramSetBankE(VRAM_E_BG_EXT_PALETTE); - } else { - vramSetBankH(VRAM_H_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres - //DMA_Copy(palette, VRAM_H + (bg_number << 13) + (pal_number << 9), 256, DMA_16NOW); - //new code - dmaCopy(palette,&VRAM_H_EXT_PALETTE[bg_number][pal_number],512); - vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE); - } -} +#include + +u8 PA_ExtPal[2][2]; // 0 si pas étendu, 1 sinon + +void PA_InitSpriteExtPal(void) { + // Palettes étendus pour les 256 couleurs... + vramSetBankG(VRAM_G_SPRITE_EXT_PALETTE); + vramSetBankI(VRAM_I_SUB_SPRITE_EXT_PALETTE); + PA_ExtPal[0][0] = 1; + PA_ExtPal[0][1] = 1; + REG_DISPCNT |= DISPLAY_SPR_EXT_PALETTE; + REG_DISPCNT_SUB |= DISPLAY_SPR_EXT_PALETTE; + PA_LoadSpritePal(0, 0, (void*)PAL_SPRITE0); + PA_LoadSpritePal(1, 0, (void*)PAL_SPRITE1); +} + +void PA_LoadSpriteExtPal(u8 screen, u16 palette_number, void* palette) { + if (screen == 0) { + vramSetBankG(VRAM_G_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres + dmaCopy(palette,VRAM_G_EXT_SPR_PALETTE[palette_number],512); + vramSetBankG(VRAM_G_SPRITE_EXT_PALETTE); + } else { + vramSetBankI(VRAM_I_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres + dmaCopy(palette,VRAM_I_EXT_SPR_PALETTE[palette_number],512); + vramSetBankI(VRAM_I_SUB_SPRITE_EXT_PALETTE); + } +} + +void PA_InitBgExtPal(void) { + // Palettes étendus pour les 256 couleurs... + vramSetBankE(VRAM_E_BG_EXT_PALETTE); + vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE); + PA_ExtPal[1][0] = 1; + PA_ExtPal[1][1] = 1; + //DISPLAY_CR |= 1 << 30; + //SUB_DISPLAY_CR |= 1 << 30; + bgExtPaletteEnable(); + bgExtPaletteEnableSub(); + u8 i; + + for (i = 0; i < 4; i++) { // On copie la palette partout + PA_LoadBgExtPal(0, i, (void*)PAL_BG0); + PA_LoadBgExtPal(1, i, (void*)PAL_BG0); + } +} + +void PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette) { + if (screen == 0) { + vramSetBankE(VRAM_E_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres + //DMA_Copy(palette, VRAM_E + (bg_number << 13) + (pal_number << 9), 256, DMA_16NOW); + //New code + dmaCopy(palette,&VRAM_E_EXT_PALETTE[bg_number][pal_number],512); + vramSetBankE(VRAM_E_BG_EXT_PALETTE); + } else { + vramSetBankH(VRAM_H_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres + //DMA_Copy(palette, VRAM_H + (bg_number << 13) + (pal_number << 9), 256, DMA_16NOW); + //new code + dmaCopy(palette,&VRAM_H_EXT_PALETTE[bg_number][pal_number],512); + vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE); + } +} diff --git a/source/arm9/PA_PaletteEx.c b/source/arm9/PA_PaletteEx.c index 3024df4..febbb9e 100644 --- a/source/arm9/PA_PaletteEx.c +++ b/source/arm9/PA_PaletteEx.c @@ -1,66 +1,66 @@ -#include - -void PA_CreatePalBright(u16 *pal, u16 *newpal, s8 bright) { - u16 i; - s8 r, g, b; - - for (i = 0; i < 256; i++) { - r = pal[i] & 31; PA_AdjustCol(r, bright); - g = (pal[i] >> 5) & 31; PA_AdjustCol(g, bright); - b = (pal[i] >> 10) & 31; PA_AdjustCol(b, bright); - newpal[i] = PA_RGB(r, g, b); - } -} - - -void PA_CreatePalTransition(u16 *pal, u16 *newpal, s8 level, u8 destr, u8 destg, u8 destb) { - u16 i; - s16 r, g, b; - - for (i = 0; i < 256; i++) { - r = ((pal[i] & 31) * (31 - level) + level * destr) >> 5; - g = (((pal[i] >> 5) & 31) * (31 - level) + level * destr) >> 5; - b = (((pal[i] >> 10) & 31) * (31 - level) + level * destr) >> 5; - newpal[i] = PA_RGB(r, g, b); - } -} - -void PA_SetBgPalNCol(u8 screen, u8 bg_number, u8 pal_number, u8 color_number, u16 color) { - u16 *palcolor; - - if (screen == 0) { - vramSetBankE(VRAM_E_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres - palcolor = (u16*)(VRAM_E + (bg_number << 12) + (pal_number << 8)); - palcolor[color_number] = color; - vramSetBankE(VRAM_E_BG_EXT_PALETTE); - } else { - vramSetBankH(VRAM_H_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres - palcolor = (u16*)(VRAM_H + (bg_number << 12) + (pal_number << 8)); - palcolor[color_number] = color; - vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE); - } -} - -void PA_SetSpritePalCol(u8 screen, u8 pal_number, u8 color_number, u16 color) { - u16 *palcolor; - - if (screen == 0) { - vramSetBankG(VRAM_G_LCD); // bank contents can only be changed in LCD mode - palcolor = (u16*)(VRAM_G + (pal_number << 8)); - palcolor[color_number] = color; - vramSetBankG(VRAM_G_SPRITE_EXT_PALETTE); - } else { - vramSetBankI(VRAM_I_LCD); // bank contents can only be changed in LCD mode - palcolor = (u16*)(VRAM_I + (pal_number << 8)); - palcolor[color_number] = color; - vramSetBankI(VRAM_I_SUB_SPRITE_EXT_PALETTE); - } -} - -void PA_3DSetSpritePalCol(u8 pal_number, u8 color_number, u16 color) { - u16 *palcolor; - vramSetBankF(VRAM_F_LCD); - palcolor = (u16*)(VRAM_F + (pal_number << 8)); - palcolor[color_number] = color; - vramSetBankF(VRAM_F_TEX_PALETTE); -} +#include + +void PA_CreatePalBright(u16 *pal, u16 *newpal, s8 bright) { + u16 i; + s8 r, g, b; + + for (i = 0; i < 256; i++) { + r = pal[i] & 31; PA_AdjustCol(r, bright); + g = (pal[i] >> 5) & 31; PA_AdjustCol(g, bright); + b = (pal[i] >> 10) & 31; PA_AdjustCol(b, bright); + newpal[i] = PA_RGB(r, g, b); + } +} + + +void PA_CreatePalTransition(u16 *pal, u16 *newpal, s8 level, u8 destr, u8 destg, u8 destb) { + u16 i; + s16 r, g, b; + + for (i = 0; i < 256; i++) { + r = ((pal[i] & 31) * (31 - level) + level * destr) >> 5; + g = (((pal[i] >> 5) & 31) * (31 - level) + level * destr) >> 5; + b = (((pal[i] >> 10) & 31) * (31 - level) + level * destr) >> 5; + newpal[i] = PA_RGB(r, g, b); + } +} + +void PA_SetBgPalNCol(u8 screen, u8 bg_number, u8 pal_number, u8 color_number, u16 color) { + u16 *palcolor; + + if (screen == 0) { + vramSetBankE(VRAM_E_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres + palcolor = (u16*)(VRAM_E + (bg_number << 12) + (pal_number << 8)); + palcolor[color_number] = color; + vramSetBankE(VRAM_E_BG_EXT_PALETTE); + } else { + vramSetBankH(VRAM_H_LCD); // On passe en mode LCD pour pouvoir ecrire dessus, on reviendre en palette apres + palcolor = (u16*)(VRAM_H + (bg_number << 12) + (pal_number << 8)); + palcolor[color_number] = color; + vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE); + } +} + +void PA_SetSpritePalCol(u8 screen, u8 pal_number, u8 color_number, u16 color) { + u16 *palcolor; + + if (screen == 0) { + vramSetBankG(VRAM_G_LCD); // bank contents can only be changed in LCD mode + palcolor = (u16*)(VRAM_G + (pal_number << 8)); + palcolor[color_number] = color; + vramSetBankG(VRAM_G_SPRITE_EXT_PALETTE); + } else { + vramSetBankI(VRAM_I_LCD); // bank contents can only be changed in LCD mode + palcolor = (u16*)(VRAM_I + (pal_number << 8)); + palcolor[color_number] = color; + vramSetBankI(VRAM_I_SUB_SPRITE_EXT_PALETTE); + } +} + +void PA_3DSetSpritePalCol(u8 pal_number, u8 color_number, u16 color) { + u16 *palcolor; + vramSetBankF(VRAM_F_LCD); + palcolor = (u16*)(VRAM_F + (pal_number << 8)); + palcolor[color_number] = color; + vramSetBankF(VRAM_F_TEX_PALETTE); +} diff --git a/source/arm9/PA_RTC.c b/source/arm9/PA_RTC.c index 316f25f..a0c2dd0 100644 --- a/source/arm9/PA_RTC.c +++ b/source/arm9/PA_RTC.c @@ -1,37 +1,37 @@ -#include - -infos PA_UserInfo; -RTC PA_RTC; - -void PA_UpdateUserInfo(){ - int i; - PA_UserInfo.Color = PersonalData->theme; - PA_UserInfo.BdayMonth = PersonalData->birthMonth; - PA_UserInfo.BdayDay = PersonalData->birthDay; - PA_UserInfo.AlarmHour = PersonalData->alarmHour; - PA_UserInfo.AlarmMinute = PersonalData->alarmMinute; - PA_UserInfo.NameLength = PersonalData->nameLen; - - for (i = 0; i < PA_UserInfo.NameLength; i ++) - PA_UserInfo.Name[i] = PersonalData->name[i]; - - PA_UserInfo.Name[i] = 0; // To mark the end - PA_UserInfo.MessageLength = PersonalData->messageLen; - - for (i = 0; i < PA_UserInfo.MessageLength; i++) - PA_UserInfo.Message[i] = PersonalData->message[i]; - - PA_UserInfo.Message[i] = 0; // To mark the end - PA_UserInfo.Language = PersonalData->language; -} - -void PA_UpdateRTC(){ - time_t unixTime = time(NULL); - struct tm* RTCV = gmtime((const time_t *) & unixTime); - PA_RTC.Seconds = RTCV->tm_sec; - PA_RTC.Minutes = RTCV->tm_min; - PA_RTC.Hour = RTCV->tm_hour; - PA_RTC.Day = RTCV->tm_mday; - PA_RTC.Month = RTCV->tm_mon + 1; - PA_RTC.Year = 1900 + RTCV->tm_year; -} +#include + +infos PA_UserInfo; +RTC PA_RTC; + +void PA_UpdateUserInfo(){ + int i; + PA_UserInfo.Color = PersonalData->theme; + PA_UserInfo.BdayMonth = PersonalData->birthMonth; + PA_UserInfo.BdayDay = PersonalData->birthDay; + PA_UserInfo.AlarmHour = PersonalData->alarmHour; + PA_UserInfo.AlarmMinute = PersonalData->alarmMinute; + PA_UserInfo.NameLength = PersonalData->nameLen; + + for (i = 0; i < PA_UserInfo.NameLength; i ++) + PA_UserInfo.Name[i] = PersonalData->name[i]; + + PA_UserInfo.Name[i] = 0; // To mark the end + PA_UserInfo.MessageLength = PersonalData->messageLen; + + for (i = 0; i < PA_UserInfo.MessageLength; i++) + PA_UserInfo.Message[i] = PersonalData->message[i]; + + PA_UserInfo.Message[i] = 0; // To mark the end + PA_UserInfo.Language = PersonalData->language; +} + +void PA_UpdateRTC(){ + time_t unixTime = time(NULL); + struct tm* RTCV = gmtime((const time_t *) & unixTime); + PA_RTC.Seconds = RTCV->tm_sec; + PA_RTC.Minutes = RTCV->tm_min; + PA_RTC.Hour = RTCV->tm_hour; + PA_RTC.Day = RTCV->tm_mday; + PA_RTC.Month = RTCV->tm_mon + 1; + PA_RTC.Year = 1900 + RTCV->tm_year; +} diff --git a/source/arm9/PA_Reco.c b/source/arm9/PA_Reco.c index bf067ee..33504f0 100644 --- a/source/arm9/PA_Reco.c +++ b/source/arm9/PA_Reco.c @@ -1,233 +1,233 @@ -#include - -PA_StylusPosition PA_StylusPos[20000]; - -PA_RecoValues PA_Reco; - -char PA_RecoShape[16]; - -u8 PA_UseGraffiti = true; - -u8 PA_CustomReco = 0; // number of custom shapes -PA_FormType PA_CustomShape[200]; - -PA_RecoInfos PA_RecoInfo; - -PA_FormType PA_Graffiti[PA_RECOTESTS] = { - {' ', "AAAAAAAAAAAAAAA"}, - {'a', "FGGGGGFB;:;;;;;"}, - {'b', "JJJJJIGC>:8=<62"}, - {'c', "01234689;<>?@BC"}, - {'d', "=995KJIFB?=;853"}, - {'e', "1236;>@136;=?@A"}, - {'f', "121111399998779"}, - {'g', "235689;=@CFIJEA"}, - {'h', "8999999;HFEA><:"}, - {'i', "999999999999999"}, - {'j', "999999998653100"}, - {'k', "654320NIDCA?==="}, - {'l', "999999988;853"}, - {'q', "4679?>>;73100"}, - {'t', "AAAA@@@;8999999"}, - {'u', "899:;<>ACEGHHIH"}, - {'v', ";;:::::?FGGHHGF"}, - {'w', "::;=BA<<@CDEFGH"}, - {'x', ";;;;;;;;;;;;;;;"}, - {'y', ">;=AFF899974OIF"}, - {'z', ">A@@>843348?@AA"}, - {PA_BACKSPACE, "000000000000000"}, - {PA_ENTER, "555555555555555"}, -// {'?', "FCA@><8655799::"}, - {'.', "LLLLLLLLLLLLLLL"} -}; - - - -static void PA_AddStylusPos(u8 x, u8 y) { - if (!((x == PA_StylusPos[PA_Reco.nvalues-1].x) && (y == PA_StylusPos[PA_Reco.nvalues-1].y))) { - PA_StylusPos[PA_Reco.nvalues].x = x; - PA_StylusPos[PA_Reco.nvalues].y = y; - PA_Reco.nvalues++; - } -} - - -void PA_StylusLine(u8 x1, u8 y1, u8 x2, u8 y2) { - int i, dx, dy, sdx, sdy, dxabs, dyabs, x, y, px, py; - dx = x2 - x1; /* the horizontal distance of the line */ - dy = y2 - y1; /* the vertical distance of the line */ - dxabs = dx; - sdx = 1; - - if (dx < 0) { - dxabs = -dx; - sdx = -1; - } - - dyabs = dy; - sdy = 1; - - if (dy < 0) { - dyabs = -dy; - sdy = -1; - } - - x = dyabs >> 1; - y = dxabs >> 1; - px = x1; - py = y1; - PA_AddStylusPos(px, py); - - if (dxabs >= dyabs) { - for (i = 0; i < dxabs; i++) { - y += dyabs; - - if (y >= dxabs) { - y -= dxabs; - py += sdy; - } - - px += sdx; - PA_AddStylusPos(px, py); - } - } else { - for (i = 0; i < dyabs; i++) { - x += dxabs; - - if (x >= dyabs) { - x -= dyabs; - px += sdx; - } - - py += sdy; - PA_AddStylusPos(px, py); - } - } -} - - -#define PA_ShapeAddPoint(i, value){\ - points[i] = PA_StylusPos[value];\ - if (points[i].x < PA_RecoInfo.minX) PA_RecoInfo.minX = points[i].x;\ - else if (points[i].x > PA_RecoInfo.maxX) PA_RecoInfo.maxX = points[i].x;\ - if (points[i].y < PA_RecoInfo.minY) PA_RecoInfo.minY = points[i].y;\ - else if (points[i].y > PA_RecoInfo.maxY) PA_RecoInfo.maxY = points[i].y; } - - - - -char PA_AnalyzeShape(void) { - s32 i; -// for (i = 0; i < 32; i++) PA_OutputSimpleText(1, 0, i, " "); - PA_StylusPosition points[17]; - - for (i = 0; i < 16; i++) { - PA_ShapeAddPoint(i, (PA_Reco.nvalues*i) >> 4) - } - - PA_ShapeAddPoint(16, PA_Reco.nvalues - 1) - //points[16] = PA_StylusPos[PA_Reco.nvalues-1]; - PA_RecoInfo.endX = PA_StylusPos[PA_Reco.nvalues-1].x; // last values - PA_RecoInfo.endY = PA_StylusPos[PA_Reco.nvalues-1].y; // last values - PA_RecoInfo.Length = PA_Reco.nvalues; // Total length - PA_RecoInfo.Angle = PA_GetAngle(points[0].x, points[0].y, points[16].x, points[16].y); - -//Better values - if (PA_RecoInfo.minX > 1) PA_RecoInfo.minX -= 2; - - if (PA_RecoInfo.maxX < 254) PA_RecoInfo.maxX += 2; - - if (PA_RecoInfo.minY > 1) PA_RecoInfo.minY -= 2; - - if (PA_RecoInfo.maxY < 190) PA_RecoInfo.maxY += 2; - - u16 angles[15]; - - for (i = 0; i < 15; i++) angles[i] = PA_GetAngle(points[i+2].x, points[i+2].y, points[i].x, points[i].y); - - for (i = 0; i < 15; i++) PA_RecoShape[i] = '0' + (((angles[i] + 16) & 511) >> 4); - - PA_RecoShape[15] = 0; - //PA_OutputText(1, 2, 23, PA_RecoShape); - u8 letter = 0; // 0 par défaut - s32 diff = 65000; // Diff max par défaut - u8 j; - - if (PA_UseGraffiti) { - for (j = 0; j < PA_RECOTESTS; j++) { - s32 tempvalue = 0; - s32 tempdiff = 0; - - for (i = 0; i < 15; i++) { - tempvalue = (PA_RecoShape[i] - PA_Graffiti[j].code[i]) & 31; - tempvalue -= (tempvalue >> 4) << 5; // normalise - - if (tempvalue < 0) tempvalue = -tempvalue; - - tempdiff += tempvalue; // value - } - - if (tempdiff < diff) { // Nouvelle lettre ! - diff = tempdiff; - letter = PA_Graffiti[j].letter; - } - } - } - - if (PA_CustomReco > 0) { - for (j = 0; j < PA_CustomReco; j++) { - s32 tempvalue = 0; - s32 tempdiff = 0; - - for (i = 0; i < 15; i++) { - tempvalue = (PA_RecoShape[i] - PA_CustomShape[j].code[i]) & 31; - tempvalue -= (tempvalue >> 4) << 5; // normalise - - if (tempvalue < 0) tempvalue = -tempvalue; - - tempdiff += tempvalue; // value - } - - if (tempdiff < diff) { // Nouvelle lettre ! - diff = tempdiff; - letter = PA_CustomShape[j].letter; - } - } - } - - PA_RecoInfo.Difference = diff; // Difference to perfect shape - PA_RecoInfo.Shape = letter; - return letter; -} - - - -char PA_CheckLetter(void) { - if (Stylus.Newpress) { - PA_Reco.nvalues = 0; // Start over again - PA_Reco.oldn = 0; - PA_Reco.veryold = 0; - PA_RecoInfo.startX = PA_StylusPos[PA_Reco.nvalues].x = Stylus.X; // start values - PA_RecoInfo.startY = PA_StylusPos[PA_Reco.nvalues].y = Stylus.Y; - PA_RecoInfo.minX = PA_RecoInfo.maxX = PA_RecoInfo.startX; - PA_RecoInfo.minY = PA_RecoInfo.maxY = PA_RecoInfo.startY; - PA_Reco.nvalues++; - } else if (Stylus.Held) { - PA_StylusLine(PA_StylusPos[PA_Reco.nvalues-1].x, PA_StylusPos[PA_Reco.nvalues-1].y, Stylus.X, Stylus.Y); - } - - if (Stylus.Released) { // Start analyzing... - PA_Reco.nvalues = PA_Reco.veryold; - return PA_AnalyzeShape(); - } - - PA_Reco.veryold = PA_Reco.oldn; - PA_Reco.oldn = PA_Reco.nvalues; - return 0; -} +#include + +PA_StylusPosition PA_StylusPos[20000]; + +PA_RecoValues PA_Reco; + +char PA_RecoShape[16]; + +u8 PA_UseGraffiti = true; + +u8 PA_CustomReco = 0; // number of custom shapes +PA_FormType PA_CustomShape[200]; + +PA_RecoInfos PA_RecoInfo; + +PA_FormType PA_Graffiti[PA_RECOTESTS] = { + {' ', "AAAAAAAAAAAAAAA"}, + {'a', "FGGGGGFB;:;;;;;"}, + {'b', "JJJJJIGC>:8=<62"}, + {'c', "01234689;<>?@BC"}, + {'d', "=995KJIFB?=;853"}, + {'e', "1236;>@136;=?@A"}, + {'f', "121111399998779"}, + {'g', "235689;=@CFIJEA"}, + {'h', "8999999;HFEA><:"}, + {'i', "999999999999999"}, + {'j', "999999998653100"}, + {'k', "654320NIDCA?==="}, + {'l', "999999988;853"}, + {'q', "4679?>>;73100"}, + {'t', "AAAA@@@;8999999"}, + {'u', "899:;<>ACEGHHIH"}, + {'v', ";;:::::?FGGHHGF"}, + {'w', "::;=BA<<@CDEFGH"}, + {'x', ";;;;;;;;;;;;;;;"}, + {'y', ">;=AFF899974OIF"}, + {'z', ">A@@>843348?@AA"}, + {PA_BACKSPACE, "000000000000000"}, + {PA_ENTER, "555555555555555"}, +// {'?', "FCA@><8655799::"}, + {'.', "LLLLLLLLLLLLLLL"} +}; + + + +static void PA_AddStylusPos(u8 x, u8 y) { + if (!((x == PA_StylusPos[PA_Reco.nvalues-1].x) && (y == PA_StylusPos[PA_Reco.nvalues-1].y))) { + PA_StylusPos[PA_Reco.nvalues].x = x; + PA_StylusPos[PA_Reco.nvalues].y = y; + PA_Reco.nvalues++; + } +} + + +void PA_StylusLine(u8 x1, u8 y1, u8 x2, u8 y2) { + int i, dx, dy, sdx, sdy, dxabs, dyabs, x, y, px, py; + dx = x2 - x1; /* the horizontal distance of the line */ + dy = y2 - y1; /* the vertical distance of the line */ + dxabs = dx; + sdx = 1; + + if (dx < 0) { + dxabs = -dx; + sdx = -1; + } + + dyabs = dy; + sdy = 1; + + if (dy < 0) { + dyabs = -dy; + sdy = -1; + } + + x = dyabs >> 1; + y = dxabs >> 1; + px = x1; + py = y1; + PA_AddStylusPos(px, py); + + if (dxabs >= dyabs) { + for (i = 0; i < dxabs; i++) { + y += dyabs; + + if (y >= dxabs) { + y -= dxabs; + py += sdy; + } + + px += sdx; + PA_AddStylusPos(px, py); + } + } else { + for (i = 0; i < dyabs; i++) { + x += dxabs; + + if (x >= dyabs) { + x -= dyabs; + px += sdx; + } + + py += sdy; + PA_AddStylusPos(px, py); + } + } +} + + +#define PA_ShapeAddPoint(i, value){\ + points[i] = PA_StylusPos[value];\ + if (points[i].x < PA_RecoInfo.minX) PA_RecoInfo.minX = points[i].x;\ + else if (points[i].x > PA_RecoInfo.maxX) PA_RecoInfo.maxX = points[i].x;\ + if (points[i].y < PA_RecoInfo.minY) PA_RecoInfo.minY = points[i].y;\ + else if (points[i].y > PA_RecoInfo.maxY) PA_RecoInfo.maxY = points[i].y; } + + + + +char PA_AnalyzeShape(void) { + s32 i; +// for (i = 0; i < 32; i++) PA_OutputSimpleText(1, 0, i, " "); + PA_StylusPosition points[17]; + + for (i = 0; i < 16; i++) { + PA_ShapeAddPoint(i, (PA_Reco.nvalues*i) >> 4) + } + + PA_ShapeAddPoint(16, PA_Reco.nvalues - 1) + //points[16] = PA_StylusPos[PA_Reco.nvalues-1]; + PA_RecoInfo.endX = PA_StylusPos[PA_Reco.nvalues-1].x; // last values + PA_RecoInfo.endY = PA_StylusPos[PA_Reco.nvalues-1].y; // last values + PA_RecoInfo.Length = PA_Reco.nvalues; // Total length + PA_RecoInfo.Angle = PA_GetAngle(points[0].x, points[0].y, points[16].x, points[16].y); + +//Better values + if (PA_RecoInfo.minX > 1) PA_RecoInfo.minX -= 2; + + if (PA_RecoInfo.maxX < 254) PA_RecoInfo.maxX += 2; + + if (PA_RecoInfo.minY > 1) PA_RecoInfo.minY -= 2; + + if (PA_RecoInfo.maxY < 190) PA_RecoInfo.maxY += 2; + + u16 angles[15]; + + for (i = 0; i < 15; i++) angles[i] = PA_GetAngle(points[i+2].x, points[i+2].y, points[i].x, points[i].y); + + for (i = 0; i < 15; i++) PA_RecoShape[i] = '0' + (((angles[i] + 16) & 511) >> 4); + + PA_RecoShape[15] = 0; + //PA_OutputText(1, 2, 23, PA_RecoShape); + u8 letter = 0; // 0 par défaut + s32 diff = 65000; // Diff max par défaut + u8 j; + + if (PA_UseGraffiti) { + for (j = 0; j < PA_RECOTESTS; j++) { + s32 tempvalue = 0; + s32 tempdiff = 0; + + for (i = 0; i < 15; i++) { + tempvalue = (PA_RecoShape[i] - PA_Graffiti[j].code[i]) & 31; + tempvalue -= (tempvalue >> 4) << 5; // normalise + + if (tempvalue < 0) tempvalue = -tempvalue; + + tempdiff += tempvalue; // value + } + + if (tempdiff < diff) { // Nouvelle lettre ! + diff = tempdiff; + letter = PA_Graffiti[j].letter; + } + } + } + + if (PA_CustomReco > 0) { + for (j = 0; j < PA_CustomReco; j++) { + s32 tempvalue = 0; + s32 tempdiff = 0; + + for (i = 0; i < 15; i++) { + tempvalue = (PA_RecoShape[i] - PA_CustomShape[j].code[i]) & 31; + tempvalue -= (tempvalue >> 4) << 5; // normalise + + if (tempvalue < 0) tempvalue = -tempvalue; + + tempdiff += tempvalue; // value + } + + if (tempdiff < diff) { // Nouvelle lettre ! + diff = tempdiff; + letter = PA_CustomShape[j].letter; + } + } + } + + PA_RecoInfo.Difference = diff; // Difference to perfect shape + PA_RecoInfo.Shape = letter; + return letter; +} + + + +char PA_CheckLetter(void) { + if (Stylus.Newpress) { + PA_Reco.nvalues = 0; // Start over again + PA_Reco.oldn = 0; + PA_Reco.veryold = 0; + PA_RecoInfo.startX = PA_StylusPos[PA_Reco.nvalues].x = Stylus.X; // start values + PA_RecoInfo.startY = PA_StylusPos[PA_Reco.nvalues].y = Stylus.Y; + PA_RecoInfo.minX = PA_RecoInfo.maxX = PA_RecoInfo.startX; + PA_RecoInfo.minY = PA_RecoInfo.maxY = PA_RecoInfo.startY; + PA_Reco.nvalues++; + } else if (Stylus.Held) { + PA_StylusLine(PA_StylusPos[PA_Reco.nvalues-1].x, PA_StylusPos[PA_Reco.nvalues-1].y, Stylus.X, Stylus.Y); + } + + if (Stylus.Released) { // Start analyzing... + PA_Reco.nvalues = PA_Reco.veryold; + return PA_AnalyzeShape(); + } + + PA_Reco.veryold = PA_Reco.oldn; + PA_Reco.oldn = PA_Reco.nvalues; + return 0; +} diff --git a/source/arm9/PA_Sound.c b/source/arm9/PA_Sound.c index 3e3a35c..9eb6b41 100644 --- a/source/arm9/PA_Sound.c +++ b/source/arm9/PA_Sound.c @@ -1,37 +1,37 @@ -#define PA_NO_DEPRECATION // we need access to the legacy PA_IPC structure -#include - -void PA_PlayPSG(u8 chan, u8 vol, u8 pan, u32 freq, u8 duty) { - PA_FifoMsg msg; - msg.type = PA_MSG_PSG; - msg.PSGMsg.freq = freq << 1; // a bug that fixes a bug. - msg.PSGMsg.chan = (chan & 7) | 8; // clip it to a valid PSG channel - msg.PSGMsg.vol = vol & 0x7F; - msg.PSGMsg.pan = pan & 0x7F; - msg.PSGMsg.duty = duty & 7; - PA_SendFifoMsg(msg); -} - -void PA_PlaySoundEx2(u8 PA_Channel, const void* data, s32 length, u8 volume, int freq, s16 format, bool repeat, int repeatPoint) { - // Flush the data - DC_FlushRange(data, length); - PA_IPC.Sound[PA_Channel].Busy = 1; // now busy - // keep this in for compatibility with some functions - // Sound commands - //PA_IPC.Sound[PA_Channel].Command |= (1< + +void PA_PlayPSG(u8 chan, u8 vol, u8 pan, u32 freq, u8 duty) { + PA_FifoMsg msg; + msg.type = PA_MSG_PSG; + msg.PSGMsg.freq = freq << 1; // a bug that fixes a bug. + msg.PSGMsg.chan = (chan & 7) | 8; // clip it to a valid PSG channel + msg.PSGMsg.vol = vol & 0x7F; + msg.PSGMsg.pan = pan & 0x7F; + msg.PSGMsg.duty = duty & 7; + PA_SendFifoMsg(msg); +} + +void PA_PlaySoundEx2(u8 PA_Channel, const void* data, s32 length, u8 volume, int freq, s16 format, bool repeat, int repeatPoint) { + // Flush the data + DC_FlushRange(data, length); + PA_IPC.Sound[PA_Channel].Busy = 1; // now busy + // keep this in for compatibility with some functions + // Sound commands + //PA_IPC.Sound[PA_Channel].Command |= (1< - -////////////////////////////////////////////////////////////////////// -// Système de sprites -////////////////////////////////////////////////////////////////////// - -u16 n_free_mem[2]; // nombre d'emplacements libres -u8 used_mem[2][1024]; // Note la quantité de mémoire utilisée en chaque point de la mémoire pour pouvoir effacer les gfx... -u8 obj_per_gfx[2][1024]; // Nombre de sprites utilisant un gfx donné... -mem_usage free_mem[2][1024]; -u8 pa_obj_created[2][128]; -u16 FirstGfx[2] = {0, 0}; - - -s16 nspriteanims = 0; // Number of animated sprites currently... -spriteanim spriteanims[2][128]; // Init the array on PAlib init... - - - -const PA_sizes PA_size[3][4] = {{{8, 8}, {16, 16}, {32, 32}, {64, 64}}, {{16, 8}, {32, 8}, {32, 16}, {64, 32}}, {{8, 16}, {8, 32}, {16, 32}, {32, 64}}}; - - -// Utilisé pour déterminer la taille en mémoire en fonction de la taille du sprite -const u16 PA_obj_sizes[4][3] = { - {64, 128, 128}, - {256, 256, 256}, - {1024, 512, 512}, - {4096, 2048, 2048} -}; - -obj_inf PA_obj[2][128] __attribute__((aligned(4))); // Les 128 premiers pour l'écran du haut, et encore 128 pour l'écran du bas... - - -s16 DualSpriteX[128]; // memorize 128 pixel positions for dual sprites - -u16 *PA_SpriteAnimP[2][1024]; // Pointer towards the sprite's graphics, allows animation - - - - -u8 PA_SpriteExtPrio = 0; -u8 PA_SpritePrio[2][128]; // Set the sprite priorities... - - -s8 PA_next[2][128]; -s8 PA_first[2][256]; // Sprite at given priority... - - -void PA_InitSpriteExtPrio(u8 SpritePrio) { - PA_SpriteExtPrio = SpritePrio; - u8 i, n; - - if (SpritePrio == 1) { - for (i = 0; i < 2; i++) { - for (n = 0; n < 128; n++) { - PA_SpritePrio[i][n] = 0; - } - } - } -} - - -void PA_ResetSpriteSysScreen(u8 screen) { - u8 n; - s16 i; - n_free_mem[screen] = 1; - free_mem[screen][0].mem_block = 0; free_mem[screen][0].free = 1024; - - for (i = 0; i < 1024; i++) { - used_mem[screen][i] = 0; - obj_per_gfx[screen][i] = 0; - } - - for (n = 0; n < 128; n++) { - PA_obj[screen][n].atr0 = 192; - PA_obj[screen][n].atr1 = 256; - PA_obj[screen][n].atr2 = 0; - PA_obj[screen][n].atr3 = 0; - } - - for (n = 0; n < 32; n++) { - PA_SetRotset(screen, n, 0, 256, 256); // Pas de zoom ou de rotation par défaut - } - - FirstGfx[screen] = 0; - - for (n = 0; n < 128; n++) { - nspriteanims -= spriteanims[screen][n].play; // remove sprites from sprite to animate list - spriteanims[screen][n].play = 0; - pa_obj_created[screen][n]=0; - } - - if (screen == 0) PA_MoveSpriteType = 0; -} - -void PA_ResetSpriteSys(void) { - PA_ResetSpriteSysScreen(0); - PA_ResetSpriteSysScreen(1); - nspriteanims = 0; // No animations... - PA_InitSpriteExtPrio(0);// normal priority system by default -} - -u16 PA_CreateGfx(u8 screen, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode) { - u16 mem_size = PA_obj_sizes[obj_size][obj_shape] >> (8 - color_mode); - //if (color_mode == 2) mem_size = PA_16bit_sizes[obj_size][obj_shape] >> 6; - - if (mem_size == 0) mem_size++; // Peut faire 0 si 8x8... - - u8 exit = 0; - u16 n_mem = 0; - u16 i, truenumber; - - for (i = 0; (i < n_free_mem[screen]) & !exit; i++) { - if (mem_size <= free_mem[screen][i].free) { - n_mem = i; - exit = 1; - } - } - - if (exit == 0) { - PA_Error( - "\n" - " Sorry, but there's not enough\n" - " VRAM to load all your sprites!\n" - " Load less sprites or use\n" - " PA_CloneSprite or PA_CreateGfx\n" - " and PA_CreateSpriteFromGfx to\n" - " optimize the space used.\n" - " Alternatively you can use 16c\n" - " sprites.\n" - "\n" - " Desolé, mais là il n'y a plus\n" - " assez de VRAM pour charger les\n" - " sprites ! Charge moins de\n" - " sprites, ou alors sers-toi de\n" - " PA_CloneSprite ou PA_CreateGfx\n" - " et PA_CreateSpriteFromGfx pour\n" - " optimiser la place nécessaire.\n" - " Tu peux aussi utiliser des 16c\n" - " sprites.\n" - ); - - for (;;) swiWaitForVBlank(); - } - - i = free_mem[screen][n_mem].mem_block; // On met la valeur de coté pour la renvoyer... - truenumber = i + FirstGfx[screen]; - DMA_Copy(obj_data, (void*)(SPRITE_GFX1 + (0x200000 * screen) + (truenumber << NUMBER_DECAL)), (mem_size << MEM_DECAL), DMA_32NOW); - used_mem[screen][i] = mem_size; // Nombre de blocks - obj_per_gfx[screen][i] = 0; // Nombre d'objets sur ce gfx... - free_mem[screen][n_mem].free -= mem_size; - - if (free_mem[screen][n_mem].free > 0) free_mem[screen][n_mem].mem_block += mem_size; // S'il reste un bout libre, on garde... - else {// On doit tout décaler d'un cran... vers la gauche - for (i = n_mem; i < n_free_mem[screen]; i++) {// On recopie la liste plus loin... - free_mem[screen][i] = free_mem[screen][i + 1]; - } - - --n_free_mem[screen]; - } - - PA_SpriteAnimP[screen][truenumber] = (u16*)obj_data; // mémorise la source de l'image... - return truenumber; -} - - -void PA_DeleteSprite(u8 screen, u8 obj_number) { - //check if sprite is created first - if(pa_obj_created[screen][obj_number]){ - - u16 obj_gfx = PA_GetSpriteGfx(screen, obj_number); - - // If there are multiple sprites using the graphics, then save the graphics - if (obj_per_gfx[screen][obj_gfx] > 0) { - obj_per_gfx[screen][obj_gfx]--; - //if this is the last sprite using the graphics, then delete the graphics - if (obj_per_gfx[screen][obj_gfx] == 0){ - //stop animation - PA_StopSpriteAnim (screen,obj_number); - PA_SetSpriteAnimFrame (screen,obj_number,0); - //delete the graphics - PA_DeleteGfx(screen, obj_gfx); - } - } - - PA_obj[screen][obj_number].atr0 = 192; - PA_obj[screen][obj_number].atr1 = 256; - PA_obj[screen][obj_number].atr2 = 0; - PA_obj[screen][obj_number].atr3 = 0; - } -} - - - -void PA_DeleteGfx(u8 screen, u16 obj_gfx) { - u16 i; - u16 j; - u8 exit = 0; - s8 decal = 0; // Décalage que l'on aura à faire pour classer le tableau... - obj_gfx -= FirstGfx[screen]; - obj_per_gfx[screen][obj_gfx] = 0; - - // Gestion dynamique de la mémoire... - for (i = 0; ((i < n_free_mem[screen]) & !exit); i++) { // On regarde les différents emplacements mémoire pour ajouter le morceau libre dans le tas... - if (obj_gfx < free_mem[screen][i].mem_block) { // Si on a un trou qui précède le premier trou dispo, on va devoir tout décaler...peut-etre ! - exit = 1; // On va pourvoir sortir, après avir ordonné le tableau... - decal = 1; - - if ((obj_gfx > 0) & (free_mem[screen][i - 1].mem_block + free_mem[screen][i - 1].free == obj_gfx)) { // On a 2 cases côtes à côtes, donc pas besoin de décaler, on ajouter la mem dispo... - free_mem[screen][i-1].free += used_mem[screen][obj_gfx]; - obj_gfx = free_mem[screen][i-1].mem_block; - used_mem[screen][obj_gfx] = free_mem[screen][i-1].free; - decal = 0; - } - - if (obj_gfx + used_mem[screen][obj_gfx] == free_mem[screen][i].mem_block) { // Si le bloc d'après suit parfaitement le bloc qu'on vient d'ajouter... - -- decal; - free_mem[screen][i].mem_block = obj_gfx; - free_mem[screen][i].free += used_mem[screen][obj_gfx]; - } - - // Si le décalage est de 0, on touche à rien - if (decal == -1) { // On doit décaler vers la gauche... les données sont déjà dans le tableau - for (j = i - 1; j < n_free_mem[screen]; j++) {// On recopie la liste plus loin... - free_mem[screen][j] = free_mem[screen][j + 1]; - } - - -- n_free_mem[screen]; - } else if (decal == 1) { // On doit tout décaler pour faire rentrer la case vide... - ++n_free_mem[screen]; - - for (j = n_free_mem[screen]; j > i; j--) {// On recopie la liste plus loin... - free_mem[screen][j] = free_mem[screen][j - 1]; - } - - free_mem[screen][i].mem_block = obj_gfx; - free_mem[screen][i].free = used_mem[screen][obj_gfx]; - } - } - } - - // Effacage de la mémoire - dmaFillWords(0, (void*)(SPRITE_GFX1 + (0x200000 * screen) + (obj_gfx << NUMBER_DECAL)), (used_mem[screen][obj_gfx] << MEM_DECAL)*2); - used_mem[screen][obj_gfx] = 0; -} - -void PA_InitSpriteDraw(u8 screen, u8 sprite) { - spriteanims[screen][sprite].lx = PA_GetSpriteLx(screen, sprite); - spriteanims[screen][sprite].ly = PA_GetSpriteLy(screen, sprite); - spriteanims[screen][sprite].colors = PA_GetSpriteColors(screen, sprite); - spriteanims[screen][sprite].gfx = (u16*)(SPRITE_GFX1 + (0x200000 * screen) + (PA_GetSpriteGfx(screen, sprite) << 7)); -} - -void PA_UpdateOAM(void) { - int i; - s32 value = 0; - s32 value2 = 512; - - DC_FlushRange(PA_obj, 4*2*128*2); - - if (!PA_SpriteExtPrio) - DMA_CopyEx(0, PA_obj, OAM, 512, DMA_32NOW); // DMA0 Copy - else { // Use the extended priorities - value += 3; - value2 += 3; - - for (i = 0; i < 128; i++) { // copy rotsets - OAM[value] = PA_obj[0][i].atr3; - OAM[value2] = PA_obj[1][i].atr3; - value += 4; - value2 += 4; - } - - value = 0; - int sprite; - - for (i = 0; i < 256; i += 2) { - PA_first[0][i] = PA_first[1][i] = -1; - PA_first[0][i+1] = PA_first[1][i+1] = -1; - } - - for (i = 127; i > -1; i--) { // sort - PA_next[0][i] = PA_first[0][PA_SpritePrio[0][i]]; - PA_first[0][PA_SpritePrio[0][i]] = i; - PA_next[1][i] = PA_first[1][PA_SpritePrio[1][i]]; - PA_first[1][PA_SpritePrio[1][i]] = i; - } - - int screen; - - for (screen = 0; screen < 2; screen++) { - for (i = 0; i < 256; i++) { // copy - sprite = PA_first[screen][i]; - - while (sprite != -1) { - OAM[value] = PA_obj[screen][sprite].atr0; - OAM[value + 1] = PA_obj[screen][sprite].atr1; - OAM[value + 2] = PA_obj[screen][sprite].atr2; - value += 4; - sprite = PA_next[screen][sprite]; - } - } - } - } -} - -static inline void PA_UpdateMoveSprite(void) { - PA_MovedSprite.Time++; - - if ((PA_MovedSprite.Time > 2) || Stylus.Released) { - PA_MovedSprite.Moving = 0; - PA_MovedSprite.Time = 0; - } -} - -VoidFn VBLSpriteAnims = PA_Nothing; - -void PA_UpdateSpriteVBL(void) { - PA_UpdateMoveSprite(); // Met à jour les infos sur les déplacements de sprites - PA_UpdateOAM(); // Updates the Object on screen - VBLSpriteAnims(); -} +#include + +////////////////////////////////////////////////////////////////////// +// Système de sprites +////////////////////////////////////////////////////////////////////// + +u16 n_free_mem[2]; // nombre d'emplacements libres +u8 used_mem[2][1024]; // Note la quantité de mémoire utilisée en chaque point de la mémoire pour pouvoir effacer les gfx... +u8 obj_per_gfx[2][1024]; // Nombre de sprites utilisant un gfx donné... +mem_usage free_mem[2][1024]; +u8 pa_obj_created[2][128]; +u16 FirstGfx[2] = {0, 0}; + + +s16 nspriteanims = 0; // Number of animated sprites currently... +spriteanim spriteanims[2][128]; // Init the array on PAlib init... + + + +const PA_sizes PA_size[3][4] = {{{8, 8}, {16, 16}, {32, 32}, {64, 64}}, {{16, 8}, {32, 8}, {32, 16}, {64, 32}}, {{8, 16}, {8, 32}, {16, 32}, {32, 64}}}; + + +// Utilisé pour déterminer la taille en mémoire en fonction de la taille du sprite +const u16 PA_obj_sizes[4][3] = { + {64, 128, 128}, + {256, 256, 256}, + {1024, 512, 512}, + {4096, 2048, 2048} +}; + +obj_inf PA_obj[2][128] __attribute__((aligned(4))); // Les 128 premiers pour l'écran du haut, et encore 128 pour l'écran du bas... + + +s16 DualSpriteX[128]; // memorize 128 pixel positions for dual sprites + +u16 *PA_SpriteAnimP[2][1024]; // Pointer towards the sprite's graphics, allows animation + + + + +u8 PA_SpriteExtPrio = 0; +u8 PA_SpritePrio[2][128]; // Set the sprite priorities... + + +s8 PA_next[2][128]; +s8 PA_first[2][256]; // Sprite at given priority... + + +void PA_InitSpriteExtPrio(u8 SpritePrio) { + PA_SpriteExtPrio = SpritePrio; + u8 i, n; + + if (SpritePrio == 1) { + for (i = 0; i < 2; i++) { + for (n = 0; n < 128; n++) { + PA_SpritePrio[i][n] = 0; + } + } + } +} + + +void PA_ResetSpriteSysScreen(u8 screen) { + u8 n; + s16 i; + n_free_mem[screen] = 1; + free_mem[screen][0].mem_block = 0; free_mem[screen][0].free = 1024; + + for (i = 0; i < 1024; i++) { + used_mem[screen][i] = 0; + obj_per_gfx[screen][i] = 0; + } + + for (n = 0; n < 128; n++) { + PA_obj[screen][n].atr0 = 192; + PA_obj[screen][n].atr1 = 256; + PA_obj[screen][n].atr2 = 0; + PA_obj[screen][n].atr3 = 0; + } + + for (n = 0; n < 32; n++) { + PA_SetRotset(screen, n, 0, 256, 256); // Pas de zoom ou de rotation par défaut + } + + FirstGfx[screen] = 0; + + for (n = 0; n < 128; n++) { + nspriteanims -= spriteanims[screen][n].play; // remove sprites from sprite to animate list + spriteanims[screen][n].play = 0; + pa_obj_created[screen][n]=0; + } + + if (screen == 0) PA_MoveSpriteType = 0; +} + +void PA_ResetSpriteSys(void) { + PA_ResetSpriteSysScreen(0); + PA_ResetSpriteSysScreen(1); + nspriteanims = 0; // No animations... + PA_InitSpriteExtPrio(0);// normal priority system by default +} + +u16 PA_CreateGfx(u8 screen, void* obj_data, u8 obj_shape, u8 obj_size, u8 color_mode) { + u16 mem_size = PA_obj_sizes[obj_size][obj_shape] >> (8 - color_mode); + //if (color_mode == 2) mem_size = PA_16bit_sizes[obj_size][obj_shape] >> 6; + + if (mem_size == 0) mem_size++; // Peut faire 0 si 8x8... + + u8 exit = 0; + u16 n_mem = 0; + u16 i, truenumber; + + for (i = 0; (i < n_free_mem[screen]) & !exit; i++) { + if (mem_size <= free_mem[screen][i].free) { + n_mem = i; + exit = 1; + } + } + + if (exit == 0) { + PA_Error( + "\n" + " Sorry, but there's not enough\n" + " VRAM to load all your sprites!\n" + " Load less sprites or use\n" + " PA_CloneSprite or PA_CreateGfx\n" + " and PA_CreateSpriteFromGfx to\n" + " optimize the space used.\n" + " Alternatively you can use 16c\n" + " sprites.\n" + "\n" + " Desolé, mais là il n'y a plus\n" + " assez de VRAM pour charger les\n" + " sprites ! Charge moins de\n" + " sprites, ou alors sers-toi de\n" + " PA_CloneSprite ou PA_CreateGfx\n" + " et PA_CreateSpriteFromGfx pour\n" + " optimiser la place nécessaire.\n" + " Tu peux aussi utiliser des 16c\n" + " sprites.\n" + ); + + for (;;) swiWaitForVBlank(); + } + + i = free_mem[screen][n_mem].mem_block; // On met la valeur de coté pour la renvoyer... + truenumber = i + FirstGfx[screen]; + DMA_Copy(obj_data, (void*)(SPRITE_GFX1 + (0x200000 * screen) + (truenumber << NUMBER_DECAL)), (mem_size << MEM_DECAL), DMA_32NOW); + used_mem[screen][i] = mem_size; // Nombre de blocks + obj_per_gfx[screen][i] = 0; // Nombre d'objets sur ce gfx... + free_mem[screen][n_mem].free -= mem_size; + + if (free_mem[screen][n_mem].free > 0) free_mem[screen][n_mem].mem_block += mem_size; // S'il reste un bout libre, on garde... + else {// On doit tout décaler d'un cran... vers la gauche + for (i = n_mem; i < n_free_mem[screen]; i++) {// On recopie la liste plus loin... + free_mem[screen][i] = free_mem[screen][i + 1]; + } + + --n_free_mem[screen]; + } + + PA_SpriteAnimP[screen][truenumber] = (u16*)obj_data; // mémorise la source de l'image... + return truenumber; +} + + +void PA_DeleteSprite(u8 screen, u8 obj_number) { + //check if sprite is created first + if(pa_obj_created[screen][obj_number]){ + + u16 obj_gfx = PA_GetSpriteGfx(screen, obj_number); + + // If there are multiple sprites using the graphics, then save the graphics + if (obj_per_gfx[screen][obj_gfx] > 0) { + obj_per_gfx[screen][obj_gfx]--; + //if this is the last sprite using the graphics, then delete the graphics + if (obj_per_gfx[screen][obj_gfx] == 0){ + //stop animation + PA_StopSpriteAnim (screen,obj_number); + PA_SetSpriteAnimFrame (screen,obj_number,0); + //delete the graphics + PA_DeleteGfx(screen, obj_gfx); + } + } + + PA_obj[screen][obj_number].atr0 = 192; + PA_obj[screen][obj_number].atr1 = 256; + PA_obj[screen][obj_number].atr2 = 0; + PA_obj[screen][obj_number].atr3 = 0; + } +} + + + +void PA_DeleteGfx(u8 screen, u16 obj_gfx) { + u16 i; + u16 j; + u8 exit = 0; + s8 decal = 0; // Décalage que l'on aura à faire pour classer le tableau... + obj_gfx -= FirstGfx[screen]; + obj_per_gfx[screen][obj_gfx] = 0; + + // Gestion dynamique de la mémoire... + for (i = 0; ((i < n_free_mem[screen]) & !exit); i++) { // On regarde les différents emplacements mémoire pour ajouter le morceau libre dans le tas... + if (obj_gfx < free_mem[screen][i].mem_block) { // Si on a un trou qui précède le premier trou dispo, on va devoir tout décaler...peut-etre ! + exit = 1; // On va pourvoir sortir, après avir ordonné le tableau... + decal = 1; + + if ((obj_gfx > 0) & (free_mem[screen][i - 1].mem_block + free_mem[screen][i - 1].free == obj_gfx)) { // On a 2 cases côtes à côtes, donc pas besoin de décaler, on ajouter la mem dispo... + free_mem[screen][i-1].free += used_mem[screen][obj_gfx]; + obj_gfx = free_mem[screen][i-1].mem_block; + used_mem[screen][obj_gfx] = free_mem[screen][i-1].free; + decal = 0; + } + + if (obj_gfx + used_mem[screen][obj_gfx] == free_mem[screen][i].mem_block) { // Si le bloc d'après suit parfaitement le bloc qu'on vient d'ajouter... + -- decal; + free_mem[screen][i].mem_block = obj_gfx; + free_mem[screen][i].free += used_mem[screen][obj_gfx]; + } + + // Si le décalage est de 0, on touche à rien + if (decal == -1) { // On doit décaler vers la gauche... les données sont déjà dans le tableau + for (j = i - 1; j < n_free_mem[screen]; j++) {// On recopie la liste plus loin... + free_mem[screen][j] = free_mem[screen][j + 1]; + } + + -- n_free_mem[screen]; + } else if (decal == 1) { // On doit tout décaler pour faire rentrer la case vide... + ++n_free_mem[screen]; + + for (j = n_free_mem[screen]; j > i; j--) {// On recopie la liste plus loin... + free_mem[screen][j] = free_mem[screen][j - 1]; + } + + free_mem[screen][i].mem_block = obj_gfx; + free_mem[screen][i].free = used_mem[screen][obj_gfx]; + } + } + } + + // Effacage de la mémoire + dmaFillWords(0, (void*)(SPRITE_GFX1 + (0x200000 * screen) + (obj_gfx << NUMBER_DECAL)), (used_mem[screen][obj_gfx] << MEM_DECAL)*2); + used_mem[screen][obj_gfx] = 0; +} + +void PA_InitSpriteDraw(u8 screen, u8 sprite) { + spriteanims[screen][sprite].lx = PA_GetSpriteLx(screen, sprite); + spriteanims[screen][sprite].ly = PA_GetSpriteLy(screen, sprite); + spriteanims[screen][sprite].colors = PA_GetSpriteColors(screen, sprite); + spriteanims[screen][sprite].gfx = (u16*)(SPRITE_GFX1 + (0x200000 * screen) + (PA_GetSpriteGfx(screen, sprite) << 7)); +} + +void PA_UpdateOAM(void) { + int i; + s32 value = 0; + s32 value2 = 512; + + DC_FlushRange(PA_obj, 4*2*128*2); + + if (!PA_SpriteExtPrio) + DMA_CopyEx(0, PA_obj, OAM, 512, DMA_32NOW); // DMA0 Copy + else { // Use the extended priorities + value += 3; + value2 += 3; + + for (i = 0; i < 128; i++) { // copy rotsets + OAM[value] = PA_obj[0][i].atr3; + OAM[value2] = PA_obj[1][i].atr3; + value += 4; + value2 += 4; + } + + value = 0; + int sprite; + + for (i = 0; i < 256; i += 2) { + PA_first[0][i] = PA_first[1][i] = -1; + PA_first[0][i+1] = PA_first[1][i+1] = -1; + } + + for (i = 127; i > -1; i--) { // sort + PA_next[0][i] = PA_first[0][PA_SpritePrio[0][i]]; + PA_first[0][PA_SpritePrio[0][i]] = i; + PA_next[1][i] = PA_first[1][PA_SpritePrio[1][i]]; + PA_first[1][PA_SpritePrio[1][i]] = i; + } + + int screen; + + for (screen = 0; screen < 2; screen++) { + for (i = 0; i < 256; i++) { // copy + sprite = PA_first[screen][i]; + + while (sprite != -1) { + OAM[value] = PA_obj[screen][sprite].atr0; + OAM[value + 1] = PA_obj[screen][sprite].atr1; + OAM[value + 2] = PA_obj[screen][sprite].atr2; + value += 4; + sprite = PA_next[screen][sprite]; + } + } + } + } +} + +static inline void PA_UpdateMoveSprite(void) { + PA_MovedSprite.Time++; + + if ((PA_MovedSprite.Time > 2) || Stylus.Released) { + PA_MovedSprite.Moving = 0; + PA_MovedSprite.Time = 0; + } +} + +VoidFn VBLSpriteAnims = PA_Nothing; + +void PA_UpdateSpriteVBL(void) { + PA_UpdateMoveSprite(); // Met à jour les infos sur les déplacements de sprites + PA_UpdateOAM(); // Updates the Object on screen + VBLSpriteAnims(); +} diff --git a/source/arm9/PA_SpriteAnim.c b/source/arm9/PA_SpriteAnim.c index 492f5fc..f26745f 100644 --- a/source/arm9/PA_SpriteAnim.c +++ b/source/arm9/PA_SpriteAnim.c @@ -1,77 +1,77 @@ -#include - -void PA_UpdateSpriteAnims(void); - -extern VoidFn VBLSpriteAnims; - -void PA_StartSpriteAnimEx(u8 screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles) { - // Activate animations - VBLSpriteAnims = PA_UpdateSpriteAnims; - spriteanims[screen][sprite].lx = PA_GetSpriteLx(screen, sprite); - spriteanims[screen][sprite].ly = PA_GetSpriteLy(screen, sprite); - spriteanims[screen][sprite].colors = PA_GetSpriteColors(screen, sprite); - spriteanims[screen][sprite].currentframe = spriteanims[screen][sprite].firstframe = firstframe; - spriteanims[screen][sprite].lastframe = lastframe; - spriteanims[screen][sprite].speed = speed; - spriteanims[screen][sprite].time = 0; - spriteanims[screen][sprite].type = type; - spriteanims[screen][sprite].ncycles = ncycles; - spriteanims[screen][sprite].framechange = 1; // normal change to start - - if (!spriteanims[screen][sprite].play) { // Counts number of sprites playing... - nspriteanims += 1; - } - - PA_SetSpriteAnimEx(screen, sprite, spriteanims[screen][sprite].lx, spriteanims[screen][sprite].ly, spriteanims[screen][sprite].colors, firstframe); - spriteanims[screen][sprite].play = 1; // playing... - //PA_OutputText(1, 0, nanim+12, "%d : %d, %d ", sprite, PA_GetSpriteX(0, sprite), PA_GetSpriteY(0, sprite)); - //nanim++; -} - -void PA_UpdateSpriteAnims(void) { - u16 anims = nspriteanims; - u8 currentsprite = 0; - u8 screen = 0; - - while ((anims > 0) && (currentsprite < 128)) { - for (screen = 0; screen < 2; screen++) { - if (spriteanims[screen][currentsprite].play) { - //++nanim; - spriteanims[screen][currentsprite].time += spriteanims[screen][currentsprite].speed; - - if (spriteanims[screen][currentsprite].time >= 60) { - while (spriteanims[screen][currentsprite].time >= 60) { - spriteanims[screen][currentsprite].time -= 60; - spriteanims[screen][currentsprite].currentframe += spriteanims[screen][currentsprite].framechange; - - if (((spriteanims[screen][currentsprite].framechange > 0) && (spriteanims[screen][currentsprite].currentframe > spriteanims[screen][currentsprite].lastframe)) || ((spriteanims[screen][currentsprite].framechange < 0) && (spriteanims[screen][currentsprite].currentframe < spriteanims[screen][currentsprite].firstframe))) { - if (spriteanims[screen][currentsprite].type == ANIM_LOOP) { // Loop - spriteanims[screen][currentsprite].currentframe = spriteanims[screen][currentsprite].firstframe; - } else { // Don't loop, go back -> switch speed and first/last frames - spriteanims[screen][currentsprite].framechange = -spriteanims[screen][currentsprite].framechange; - - if (spriteanims[screen][currentsprite].ncycles == 1)// It was the last one - spriteanims[screen][currentsprite].currentframe += spriteanims[screen][currentsprite].framechange; - //spriteanims[screen][currentsprite].framechange; // stop on the correct animation - else spriteanims[screen][currentsprite].currentframe += spriteanims[screen][currentsprite].framechange << 1; // continue going back and forth - } - - // In all cases : - spriteanims[screen][currentsprite].ncycles--; // 1 less to do - - if (spriteanims[screen][currentsprite].ncycles == 0) { - PA_StopSpriteAnim(screen, currentsprite); - } else if (spriteanims[screen][currentsprite].ncycles < 0) spriteanims[screen][currentsprite].ncycles = -1; // Inifinite - } - } - - PA_SetSpriteAnimEx(screen, currentsprite, spriteanims[screen][currentsprite].lx, spriteanims[screen][currentsprite].ly, spriteanims[screen][currentsprite].colors, spriteanims[screen][currentsprite].currentframe); - } - - anims--; // Une de faite ! - } - } - - currentsprite++; // next sprite... - } -} +#include + +void PA_UpdateSpriteAnims(void); + +extern VoidFn VBLSpriteAnims; + +void PA_StartSpriteAnimEx(u8 screen, u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles) { + // Activate animations + VBLSpriteAnims = PA_UpdateSpriteAnims; + spriteanims[screen][sprite].lx = PA_GetSpriteLx(screen, sprite); + spriteanims[screen][sprite].ly = PA_GetSpriteLy(screen, sprite); + spriteanims[screen][sprite].colors = PA_GetSpriteColors(screen, sprite); + spriteanims[screen][sprite].currentframe = spriteanims[screen][sprite].firstframe = firstframe; + spriteanims[screen][sprite].lastframe = lastframe; + spriteanims[screen][sprite].speed = speed; + spriteanims[screen][sprite].time = 0; + spriteanims[screen][sprite].type = type; + spriteanims[screen][sprite].ncycles = ncycles; + spriteanims[screen][sprite].framechange = 1; // normal change to start + + if (!spriteanims[screen][sprite].play) { // Counts number of sprites playing... + nspriteanims += 1; + } + + PA_SetSpriteAnimEx(screen, sprite, spriteanims[screen][sprite].lx, spriteanims[screen][sprite].ly, spriteanims[screen][sprite].colors, firstframe); + spriteanims[screen][sprite].play = 1; // playing... + //PA_OutputText(1, 0, nanim+12, "%d : %d, %d ", sprite, PA_GetSpriteX(0, sprite), PA_GetSpriteY(0, sprite)); + //nanim++; +} + +void PA_UpdateSpriteAnims(void) { + u16 anims = nspriteanims; + u8 currentsprite = 0; + u8 screen = 0; + + while ((anims > 0) && (currentsprite < 128)) { + for (screen = 0; screen < 2; screen++) { + if (spriteanims[screen][currentsprite].play) { + //++nanim; + spriteanims[screen][currentsprite].time += spriteanims[screen][currentsprite].speed; + + if (spriteanims[screen][currentsprite].time >= 60) { + while (spriteanims[screen][currentsprite].time >= 60) { + spriteanims[screen][currentsprite].time -= 60; + spriteanims[screen][currentsprite].currentframe += spriteanims[screen][currentsprite].framechange; + + if (((spriteanims[screen][currentsprite].framechange > 0) && (spriteanims[screen][currentsprite].currentframe > spriteanims[screen][currentsprite].lastframe)) || ((spriteanims[screen][currentsprite].framechange < 0) && (spriteanims[screen][currentsprite].currentframe < spriteanims[screen][currentsprite].firstframe))) { + if (spriteanims[screen][currentsprite].type == ANIM_LOOP) { // Loop + spriteanims[screen][currentsprite].currentframe = spriteanims[screen][currentsprite].firstframe; + } else { // Don't loop, go back -> switch speed and first/last frames + spriteanims[screen][currentsprite].framechange = -spriteanims[screen][currentsprite].framechange; + + if (spriteanims[screen][currentsprite].ncycles == 1)// It was the last one + spriteanims[screen][currentsprite].currentframe += spriteanims[screen][currentsprite].framechange; + //spriteanims[screen][currentsprite].framechange; // stop on the correct animation + else spriteanims[screen][currentsprite].currentframe += spriteanims[screen][currentsprite].framechange << 1; // continue going back and forth + } + + // In all cases : + spriteanims[screen][currentsprite].ncycles--; // 1 less to do + + if (spriteanims[screen][currentsprite].ncycles == 0) { + PA_StopSpriteAnim(screen, currentsprite); + } else if (spriteanims[screen][currentsprite].ncycles < 0) spriteanims[screen][currentsprite].ncycles = -1; // Inifinite + } + } + + PA_SetSpriteAnimEx(screen, currentsprite, spriteanims[screen][currentsprite].lx, spriteanims[screen][currentsprite].ly, spriteanims[screen][currentsprite].colors, spriteanims[screen][currentsprite].currentframe); + } + + anims--; // Une de faite ! + } + } + + currentsprite++; // next sprite... + } +} diff --git a/source/arm9/PA_SpriteStylus.c b/source/arm9/PA_SpriteStylus.c index 8ce5560..5e4ca42 100644 --- a/source/arm9/PA_SpriteStylus.c +++ b/source/arm9/PA_SpriteStylus.c @@ -1,79 +1,79 @@ -#include "PA9.h" - -u8 PA_MoveSpriteEx(u8 screen, u8 sprite, u8 lx, u8 ly) { - u8 truelx = (PA_GetSpriteLx(screen, sprite) >> 1); - u8 truely = (PA_GetSpriteLy(screen, sprite) >> 1); - s16 x = PA_GetSpriteX(screen, sprite) + truelx; - s16 y = PA_GetSpriteY(screen, sprite) + truely; - lx = lx >> 1; - ly = ly >> 1; - - if (x >= 458) x -= 511; // normalize the X coordinate... - - if (y >= 220) y -= 256; // normalize the X coordinate... - - if (Stylus.Released) { - PA_MovedSprite.Moving = 0; - } else { - if (Stylus.Held & !PA_MovedSprite.Moving) { // Si nouvelle pression, on regarde si on touche ou pas le truc - PA_MovedSprite.NextVx = 0; - PA_MovedSprite.NextVx = 0; - - if ((PA_MoveSpriteType == 0) && (Stylus.X > x - lx) && (Stylus.X < x + lx) && (Stylus.Y > y - ly) && (Stylus.Y < y + ly)) { // Square collision - PA_MovedSprite.Moving = 1; - PA_MovedSprite.Sprite = sprite; - } else if (PA_MoveSpriteType && (PA_Distance(Stylus.X, Stylus.Y, x, y) < lx*ly)) { // Distance collision - PA_MovedSprite.Moving = 1; - PA_MovedSprite.Sprite = sprite; - } - } - - if (PA_MovedSprite.Moving && (PA_MovedSprite.Sprite == sprite)) { // Si on peut le déplacer... - PA_MovedSprite.Vx = PA_MovedSprite.NextVx; - PA_MovedSprite.Vy = PA_MovedSprite.NextVy; - PA_MovedSprite.NextVx = Stylus.X - PA_MovedSprite.X; - PA_MovedSprite.NextVy = Stylus.Y - PA_MovedSprite.Y; - PA_MovedSprite.X = Stylus.X; - PA_MovedSprite.Y = Stylus.Y; - PA_SetSpriteXY(screen, sprite, Stylus.X - truelx, Stylus.Y - truely); - PA_MovedSprite.Time = 0; //Si on passe 2 vbl sans le bouger, on changera de cible - return(1); // On a bougé... - } - } - - return(0); -} - -u8 PA_MoveSpritePix(u8 sprite) { - if (Stylus.Released) { - PA_MovedSprite.Moving = 0; - } else { - if (Stylus.Held & !PA_MovedSprite.Moving) { // Si nouvelle pression, on regarde si on touche ou pas le truc - PA_MovedSprite.NextVx = 0; - PA_MovedSprite.NextVx = 0; - - if ((PA_MoveSpriteType == 0) && PA_SpriteTouchedPix(sprite)) { //New sprite moving ! - PA_MovedSprite.Moving = 1; - PA_MovedSprite.Sprite = sprite; - PA_MovedSprite.X = PA_GetSpriteX(PA_Screen, sprite); - PA_MovedSprite.Y = PA_GetSpriteY(PA_Screen, sprite); - - if (PA_MovedSprite.X >= 458) PA_MovedSprite.X -= 511; // normalize the X coordinate... - - if (PA_MovedSprite.Y >= 220) PA_MovedSprite.Y -= 256; // normalize the y coordinate... - } - } else if ((!Stylus.Newpress) && PA_MovedSprite.Moving && (PA_MovedSprite.Sprite == sprite)) { // Si on peut le déplacer... - PA_MovedSprite.Vx = PA_MovedSprite.NextVx; - PA_MovedSprite.Vy = PA_MovedSprite.NextVy; - PA_MovedSprite.NextVx = Stylus.Vx; - PA_MovedSprite.NextVy = Stylus.Vy; - PA_MovedSprite.X += Stylus.Vx; - PA_MovedSprite.Y += Stylus.Vy; - PA_SetSpriteXY(PA_Screen, sprite, PA_MovedSprite.X, PA_MovedSprite.Y); - PA_MovedSprite.Time = 0; //Si on passe 2 vbl sans le bouger, on changera de cible - return(1); // On a bougé... - } - } - - return(0); -} +#include "PA9.h" + +u8 PA_MoveSpriteEx(u8 screen, u8 sprite, u8 lx, u8 ly) { + u8 truelx = (PA_GetSpriteLx(screen, sprite) >> 1); + u8 truely = (PA_GetSpriteLy(screen, sprite) >> 1); + s16 x = PA_GetSpriteX(screen, sprite) + truelx; + s16 y = PA_GetSpriteY(screen, sprite) + truely; + lx = lx >> 1; + ly = ly >> 1; + + if (x >= 458) x -= 511; // normalize the X coordinate... + + if (y >= 220) y -= 256; // normalize the X coordinate... + + if (Stylus.Released) { + PA_MovedSprite.Moving = 0; + } else { + if (Stylus.Held & !PA_MovedSprite.Moving) { // Si nouvelle pression, on regarde si on touche ou pas le truc + PA_MovedSprite.NextVx = 0; + PA_MovedSprite.NextVx = 0; + + if ((PA_MoveSpriteType == 0) && (Stylus.X > x - lx) && (Stylus.X < x + lx) && (Stylus.Y > y - ly) && (Stylus.Y < y + ly)) { // Square collision + PA_MovedSprite.Moving = 1; + PA_MovedSprite.Sprite = sprite; + } else if (PA_MoveSpriteType && (PA_Distance(Stylus.X, Stylus.Y, x, y) < lx*ly)) { // Distance collision + PA_MovedSprite.Moving = 1; + PA_MovedSprite.Sprite = sprite; + } + } + + if (PA_MovedSprite.Moving && (PA_MovedSprite.Sprite == sprite)) { // Si on peut le déplacer... + PA_MovedSprite.Vx = PA_MovedSprite.NextVx; + PA_MovedSprite.Vy = PA_MovedSprite.NextVy; + PA_MovedSprite.NextVx = Stylus.X - PA_MovedSprite.X; + PA_MovedSprite.NextVy = Stylus.Y - PA_MovedSprite.Y; + PA_MovedSprite.X = Stylus.X; + PA_MovedSprite.Y = Stylus.Y; + PA_SetSpriteXY(screen, sprite, Stylus.X - truelx, Stylus.Y - truely); + PA_MovedSprite.Time = 0; //Si on passe 2 vbl sans le bouger, on changera de cible + return(1); // On a bougé... + } + } + + return(0); +} + +u8 PA_MoveSpritePix(u8 sprite) { + if (Stylus.Released) { + PA_MovedSprite.Moving = 0; + } else { + if (Stylus.Held & !PA_MovedSprite.Moving) { // Si nouvelle pression, on regarde si on touche ou pas le truc + PA_MovedSprite.NextVx = 0; + PA_MovedSprite.NextVx = 0; + + if ((PA_MoveSpriteType == 0) && PA_SpriteTouchedPix(sprite)) { //New sprite moving ! + PA_MovedSprite.Moving = 1; + PA_MovedSprite.Sprite = sprite; + PA_MovedSprite.X = PA_GetSpriteX(PA_Screen, sprite); + PA_MovedSprite.Y = PA_GetSpriteY(PA_Screen, sprite); + + if (PA_MovedSprite.X >= 458) PA_MovedSprite.X -= 511; // normalize the X coordinate... + + if (PA_MovedSprite.Y >= 220) PA_MovedSprite.Y -= 256; // normalize the y coordinate... + } + } else if ((!Stylus.Newpress) && PA_MovedSprite.Moving && (PA_MovedSprite.Sprite == sprite)) { // Si on peut le déplacer... + PA_MovedSprite.Vx = PA_MovedSprite.NextVx; + PA_MovedSprite.Vy = PA_MovedSprite.NextVy; + PA_MovedSprite.NextVx = Stylus.Vx; + PA_MovedSprite.NextVy = Stylus.Vy; + PA_MovedSprite.X += Stylus.Vx; + PA_MovedSprite.Y += Stylus.Vy; + PA_SetSpriteXY(PA_Screen, sprite, PA_MovedSprite.X, PA_MovedSprite.Y); + PA_MovedSprite.Time = 0; //Si on passe 2 vbl sans le bouger, on changera de cible + return(1); // On a bougé... + } + } + + return(0); +} diff --git a/source/arm9/PA_Stuff.c b/source/arm9/PA_Stuff.c index 3453257..10475c8 100644 --- a/source/arm9/PA_Stuff.c +++ b/source/arm9/PA_Stuff.c @@ -1,60 +1,60 @@ -#include -#include -#include - -void PA_SetVideoMode(u8 screen, u8 mode) { - // NEW version - if (screen) { - REG_DISPCNT_SUB &= ~7; // clear mode flags - REG_DISPCNT_SUB |= mode; // set mode - } else { - REG_DISPCNT &= ~7; // clear mode flags - REG_DISPCNT |= mode; // set mode - } -} - -bool PA_Locate(char *start, char *target, bool isDir, int depth, char *result) { - DIR *dir; - dir = opendir(start); - char temp[256]; - struct dirent *pent; - struct stat statbuf; - - if (dir) { - while ((pent=readdir(dir))!=NULL) { - stat(pent->d_name,&statbuf); - - if(strcmp(".", pent->d_name) == 0 || strcmp("..", pent->d_name) == 0) - continue; - - if ((S_ISDIR(statbuf.st_mode) && isDir) || (!S_ISDIR(statbuf.st_mode) && !isDir)) { - if(strcasecmp(target, pent->d_name) == 0) { - strcpy(result, start); - if (start[strlen(start)-1] != '/') - strcat(result, "/"); - strcat(result, pent->d_name); - if (isDir) - strcat(result, "/"); - closedir(dir); - return true; - } - } - - if (S_ISDIR(statbuf.st_mode) && depth > 1) { - strcpy(temp, start); - if (start[strlen(start)-1] != '/') - strcat(temp, "/"); - strcat(temp, pent->d_name); - strcat(temp, "/"); - - if (PA_Locate(temp, target, isDir, depth-1, result)) { - closedir(dir); - return true; - } - } - } - } - - closedir(dir); - return false; -} +#include +#include +#include + +void PA_SetVideoMode(u8 screen, u8 mode) { + // NEW version + if (screen) { + REG_DISPCNT_SUB &= ~7; // clear mode flags + REG_DISPCNT_SUB |= mode; // set mode + } else { + REG_DISPCNT &= ~7; // clear mode flags + REG_DISPCNT |= mode; // set mode + } +} + +bool PA_Locate(char *start, char *target, bool isDir, int depth, char *result) { + DIR *dir; + dir = opendir(start); + char temp[256]; + struct dirent *pent; + struct stat statbuf; + + if (dir) { + while ((pent=readdir(dir))!=NULL) { + stat(pent->d_name,&statbuf); + + if(strcmp(".", pent->d_name) == 0 || strcmp("..", pent->d_name) == 0) + continue; + + if ((S_ISDIR(statbuf.st_mode) && isDir) || (!S_ISDIR(statbuf.st_mode) && !isDir)) { + if(strcasecmp(target, pent->d_name) == 0) { + strcpy(result, start); + if (start[strlen(start)-1] != '/') + strcat(result, "/"); + strcat(result, pent->d_name); + if (isDir) + strcat(result, "/"); + closedir(dir); + return true; + } + } + + if (S_ISDIR(statbuf.st_mode) && depth > 1) { + strcpy(temp, start); + if (start[strlen(start)-1] != '/') + strcat(temp, "/"); + strcat(temp, pent->d_name); + strcat(temp, "/"); + + if (PA_Locate(temp, target, isDir, depth-1, result)) { + closedir(dir); + return true; + } + } + } + } + + closedir(dir); + return false; +} diff --git a/source/arm9/PA_Text.c b/source/arm9/PA_Text.c index 33579ee..3324c95 100644 --- a/source/arm9/PA_Text.c +++ b/source/arm9/PA_Text.c @@ -1,252 +1,252 @@ -#include - -#include "TiledFont/all_gfx.h" // Include the text! - -u8 PAbgtext[2]; -u16 textcol[2]; - -u16 *PA_textmap[2]; //Pointeur vers la map et les tiles... -u8 *PA_texttiles[2]; -u16 *PA_textpal[2]; // Palette ! - -u32 pa_printx[2]; -u32 pa_printy[2]; -s16 pa_printscroll[2]; - -s8 PA_font[2] = {}; // 0 pour normal, 1 pour d�grad�, -1 pour custom - -u16 PAtext_pal[2] = {0, 0}; // text colors... - -textborders PA_TextBox[2]; - -void PA_CreateTextPal(u8 screen, u8 pal_number, u16 r, u16 g, u16 b) { - u16 baser, baseg, baseb; - int i; - - for (i = 1; i < 7; i++) { // Just do the first colors... - baser = 1 + (PA_textpal[screen][i] & 31) * r; - baseg = 1 + ((PA_textpal[screen][i] >> 5) & 31) * g; - baseb = 1 + ((PA_textpal[screen][i] >> 10) & 31) * b; - PA_SetBgPalNCol(screen, PAbgtext[screen], pal_number, i, PA_RGB((baser >> 5), (baseg >> 5), (baseb >> 5))); - } -} - -void PA_LoadDefaultText(u8 screen, u8 bg_select) { -//#ifndef TEXT_ALLCHARACTERS - PA_LoadText(screen, bg_select, &PA_TiledFont); - PA_SetTextTileCol(screen, 0); -/*#endif -#ifdef TEXT_ALLCHARACTERS - PA_InitCustomText(screen, bg_select, PA_text2); - PA_SetTextTileCol(screen, 0); -#endif*/ - PA_CreateTextPal(screen, 0, 31, 31, 31); - PA_CreateTextPal(screen, 1, 31, 0, 0); - PA_CreateTextPal(screen, 2, 0, 31, 0); - PA_CreateTextPal(screen, 3, 0, 0, 31); - PA_CreateTextPal(screen, 4, 31, 0, 31); - PA_CreateTextPal(screen, 5, 0, 31, 31); - PA_CreateTextPal(screen, 6, 31, 31, 0); - PA_CreateTextPal(screen, 7, 25, 25, 25); - PA_CreateTextPal(screen, 8, 20, 20, 20); - PA_CreateTextPal(screen, 9, 0, 0, 0); - pa_printx[screen] = 0; - pa_printy[screen] = 0; - pa_printscroll[screen] = 0; -} - -u16 PA_OutputSimpleText(u8 screen, u16 x, u16 y, const char *text) { - int j, i = 0; - u16 textcount = 0; // compte le nombre de lettres... - BG_PALETTE[255 + (screen * 512)] = textcol[screen]; // On remet la couleur au cas o� on ait charg� du texte par-dessus... - - for (j = 0; text[j]; j++) { - while (text[j] == '\n') { - y++; - j++; - i = j; - } - - PA_SetTileLetter(screen, x + j - i, y, text[j]); - ++textcount; - } - - return textcount; -} - -void PA_OutputText(u8 screen, u16 x, u16 y, const char* text, ...) { - int j, i, k = 0; - u16 textcount = 0; // compte le nombre de lettres... - u8 PAtext[32]; // tableau o� l'on copie les nombres et tout... - u8 *PAextext; // Extra text - s32 PAtextnumber; - double tempdouble = 0; - va_list varg; /* Variable identifiant le prochain param�tre. */ - va_start(varg, text); - u8 textcolor = PAtext_pal[screen]; - - for (j = 0; text[j]; j++) { - if (text[j] == '%') { - if (text[j+1] == 'c') { // change color ! - PA_SetTextTileCol(screen, text[j+2] - '0'); - j += 2; - } else if (text[j+1] == 's') { // S'il y a %s, c'est une chaine de caract�res... - PAextext = (u8*)va_arg(varg, const u8 *); // Pointeur vers la chaine de charact�res... - - for (i = 0; PAextext[i]; i++) { - while (PAextext[i] == '\n') { - y++; - i++; - ++textcount; - k = i; - } - - PA_SetTileLetter(screen, x + textcount - k, y, PAextext[i]); - ++textcount; - } - - j += 1; - } else if ((text[j+1] == 'x')) { - u32 test = va_arg(varg, u32); - u8 temp; - u8 started = 0; - - for (i = 0; i < 32; i += 4) { - temp = (test >> (28 - i)) & 15; - - if (started || temp) { - if (temp >= 10) PA_SetTileLetter(screen, x + textcount, y, 'A' + (temp - 10)); - else PA_SetTileLetter(screen, x + textcount, y, '0' + (temp)); - - textcount++; - started = 1; - } - } - - j++; - } else if ((text[j+1] == 'd') || (text[j+1] == 'f')) { - double test = 0; - - if (text[j+1] == 'd') { - PAtextnumber = va_arg(varg, s32); - test = PAtextnumber; - } else { // On ne prend que la partie enti�re pour l'instant, on garde le reste pour plus tard :p - tempdouble = va_arg(varg, double); - test = tempdouble; - PAtextnumber = (s32)tempdouble ; - tempdouble -= PAtextnumber; - } - - s8 neg = 0; // Si negatif, passe � 1... - - if (test < 0) { - PAtextnumber = -PAtextnumber; - //tempdouble = -tempdouble; - neg = 1; - } - - for (i = 0; PAtextnumber || (!PAtextnumber && !i); i++) { // tant que le nombre ne vaut pas 0 mais que i est positif, on continu � la convertir... - PAtext[i] = '0' + (PAtextnumber % 10); - PAtextnumber = PAtextnumber / 10; // Nombre de d�part... - } - - if (neg) { - PAtext[i] = '-'; - ++i; - } - - for (i--; i > -1; i--) { - PA_SetTileLetter(screen, x + textcount, y, PAtext[i]); - ++ textcount; - } - - j += 1; - - if (text[j] == 'f') { // Il reste donc la virgule � traiter... - PA_SetTileLetter(screen, x + textcount, y, '.'); - ++ textcount; - i = text[j+1] - 48; // Nombre de chiffres apr�s la virgule... - PAtext[1] = 0; // Permet de stopper si c'est vba... - - if (tempdouble < 0) tempdouble = -tempdouble; - - while ((i-- > 0)) { // Pas plus de 6 chiffres apr�s la virgule... - tempdouble *= 10; - //if ( - PAtextnumber = (s32)tempdouble; - tempdouble -= PAtextnumber; - PAtext[0] = '0' + PAtextnumber; - PA_SetTileLetter(screen, x + textcount, y, PAtext[0]); - ++ textcount; - } - - j += 1; - } - } else if ((text[j+3] == 'd') && (text[j+1] != ' ') && (text[j+2] != ' ')) { // C'est plus loin, donc on a genre %02d... - PAtextnumber = va_arg(varg, s32); - s8 neg = 0; // Si negatif, passe � 1... - u8 amettre = text[j+1]; // Nombre � mettre pour remplir - s8 nfois = text[j+2] - '0'; // Nombre de caract�res � mettre - - if (PAtextnumber < 0) { - PAtextnumber = -PAtextnumber; - neg = 1; - } - - for (i = 0; PAtextnumber || (!PAtextnumber && !i); i++) { // tant que le nombre ne vaut pas 0 mais que i est positif, on continu � la convertir... - PAtext[i] = 48 + (PAtextnumber % 10); - PAtextnumber = PAtextnumber / 10; // Nombre de d�part... - nfois--; // Un nombre de moins � mettre... - } - - while (nfois > 0) { // On compl�te de 0 est tout... - PA_SetTileLetter(screen, x + textcount, y, amettre); - ++textcount; - --nfois; - } - - if (neg) { - PAtext[i] = '-'; - ++i; - } - - for (i--; i > -1; i--) { - PA_SetTileLetter(screen, x + textcount, y, PAtext[i]); - ++ textcount; - } - - j += 3; - } else { // Sinon c'est juste - PA_SetTileLetter(screen, x + textcount, y, text[j]); - ++textcount; - } - } else if (text[j] == '\n') { - textcount = 0; - ++y; - } else if ((text[j] == '/') && (text[j+1] == 'n')) { - textcount = 0; - ++y; - j++; - } else { - PA_SetTileLetter(screen, x + textcount, y, text[j]); - ++textcount; - } - } - - va_end(varg); /* Terminaison. */ - PA_SetTextTileCol(screen, textcolor); // put back the old color -} - - -void PA_ClearTextBg(u8 screen) { - int i, j; - - for (i = 0; i < 32; i++) - for (j = 0; j < 32; j++) - PA_SetMapTileAll(screen, PAbgtext[screen], i, j, 0); - - pa_printx[screen] = 0; - pa_printy[screen] = 0; - pa_printscroll[screen] = 0; - PA_BGScrollY(screen, PAbgtext[screen], 0); -} +#include + +#include "TiledFont/all_gfx.h" // Include the text! + +u8 PAbgtext[2]; +u16 textcol[2]; + +u16 *PA_textmap[2]; //Pointeur vers la map et les tiles... +u8 *PA_texttiles[2]; +u16 *PA_textpal[2]; // Palette ! + +u32 pa_printx[2]; +u32 pa_printy[2]; +s16 pa_printscroll[2]; + +s8 PA_font[2] = {}; // 0 pour normal, 1 pour d�grad�, -1 pour custom + +u16 PAtext_pal[2] = {0, 0}; // text colors... + +textborders PA_TextBox[2]; + +void PA_CreateTextPal(u8 screen, u8 pal_number, u16 r, u16 g, u16 b) { + u16 baser, baseg, baseb; + int i; + + for (i = 1; i < 7; i++) { // Just do the first colors... + baser = 1 + (PA_textpal[screen][i] & 31) * r; + baseg = 1 + ((PA_textpal[screen][i] >> 5) & 31) * g; + baseb = 1 + ((PA_textpal[screen][i] >> 10) & 31) * b; + PA_SetBgPalNCol(screen, PAbgtext[screen], pal_number, i, PA_RGB((baser >> 5), (baseg >> 5), (baseb >> 5))); + } +} + +void PA_LoadDefaultText(u8 screen, u8 bg_select) { +//#ifndef TEXT_ALLCHARACTERS + PA_LoadText(screen, bg_select, &PA_TiledFont); + PA_SetTextTileCol(screen, 0); +/*#endif +#ifdef TEXT_ALLCHARACTERS + PA_InitCustomText(screen, bg_select, PA_text2); + PA_SetTextTileCol(screen, 0); +#endif*/ + PA_CreateTextPal(screen, 0, 31, 31, 31); + PA_CreateTextPal(screen, 1, 31, 0, 0); + PA_CreateTextPal(screen, 2, 0, 31, 0); + PA_CreateTextPal(screen, 3, 0, 0, 31); + PA_CreateTextPal(screen, 4, 31, 0, 31); + PA_CreateTextPal(screen, 5, 0, 31, 31); + PA_CreateTextPal(screen, 6, 31, 31, 0); + PA_CreateTextPal(screen, 7, 25, 25, 25); + PA_CreateTextPal(screen, 8, 20, 20, 20); + PA_CreateTextPal(screen, 9, 0, 0, 0); + pa_printx[screen] = 0; + pa_printy[screen] = 0; + pa_printscroll[screen] = 0; +} + +u16 PA_OutputSimpleText(u8 screen, u16 x, u16 y, const char *text) { + int j, i = 0; + u16 textcount = 0; // compte le nombre de lettres... + BG_PALETTE[255 + (screen * 512)] = textcol[screen]; // On remet la couleur au cas o� on ait charg� du texte par-dessus... + + for (j = 0; text[j]; j++) { + while (text[j] == '\n') { + y++; + j++; + i = j; + } + + PA_SetTileLetter(screen, x + j - i, y, text[j]); + ++textcount; + } + + return textcount; +} + +void PA_OutputText(u8 screen, u16 x, u16 y, const char* text, ...) { + int j, i, k = 0; + u16 textcount = 0; // compte le nombre de lettres... + u8 PAtext[32]; // tableau o� l'on copie les nombres et tout... + u8 *PAextext; // Extra text + s32 PAtextnumber; + double tempdouble = 0; + va_list varg; /* Variable identifiant le prochain param�tre. */ + va_start(varg, text); + u8 textcolor = PAtext_pal[screen]; + + for (j = 0; text[j]; j++) { + if (text[j] == '%') { + if (text[j+1] == 'c') { // change color ! + PA_SetTextTileCol(screen, text[j+2] - '0'); + j += 2; + } else if (text[j+1] == 's') { // S'il y a %s, c'est une chaine de caract�res... + PAextext = (u8*)va_arg(varg, const u8 *); // Pointeur vers la chaine de charact�res... + + for (i = 0; PAextext[i]; i++) { + while (PAextext[i] == '\n') { + y++; + i++; + ++textcount; + k = i; + } + + PA_SetTileLetter(screen, x + textcount - k, y, PAextext[i]); + ++textcount; + } + + j += 1; + } else if ((text[j+1] == 'x')) { + u32 test = va_arg(varg, u32); + u8 temp; + u8 started = 0; + + for (i = 0; i < 32; i += 4) { + temp = (test >> (28 - i)) & 15; + + if (started || temp) { + if (temp >= 10) PA_SetTileLetter(screen, x + textcount, y, 'A' + (temp - 10)); + else PA_SetTileLetter(screen, x + textcount, y, '0' + (temp)); + + textcount++; + started = 1; + } + } + + j++; + } else if ((text[j+1] == 'd') || (text[j+1] == 'f')) { + double test = 0; + + if (text[j+1] == 'd') { + PAtextnumber = va_arg(varg, s32); + test = PAtextnumber; + } else { // On ne prend que la partie enti�re pour l'instant, on garde le reste pour plus tard :p + tempdouble = va_arg(varg, double); + test = tempdouble; + PAtextnumber = (s32)tempdouble ; + tempdouble -= PAtextnumber; + } + + s8 neg = 0; // Si negatif, passe � 1... + + if (test < 0) { + PAtextnumber = -PAtextnumber; + //tempdouble = -tempdouble; + neg = 1; + } + + for (i = 0; PAtextnumber || (!PAtextnumber && !i); i++) { // tant que le nombre ne vaut pas 0 mais que i est positif, on continu � la convertir... + PAtext[i] = '0' + (PAtextnumber % 10); + PAtextnumber = PAtextnumber / 10; // Nombre de d�part... + } + + if (neg) { + PAtext[i] = '-'; + ++i; + } + + for (i--; i > -1; i--) { + PA_SetTileLetter(screen, x + textcount, y, PAtext[i]); + ++ textcount; + } + + j += 1; + + if (text[j] == 'f') { // Il reste donc la virgule � traiter... + PA_SetTileLetter(screen, x + textcount, y, '.'); + ++ textcount; + i = text[j+1] - 48; // Nombre de chiffres apr�s la virgule... + PAtext[1] = 0; // Permet de stopper si c'est vba... + + if (tempdouble < 0) tempdouble = -tempdouble; + + while ((i-- > 0)) { // Pas plus de 6 chiffres apr�s la virgule... + tempdouble *= 10; + //if ( + PAtextnumber = (s32)tempdouble; + tempdouble -= PAtextnumber; + PAtext[0] = '0' + PAtextnumber; + PA_SetTileLetter(screen, x + textcount, y, PAtext[0]); + ++ textcount; + } + + j += 1; + } + } else if ((text[j+3] == 'd') && (text[j+1] != ' ') && (text[j+2] != ' ')) { // C'est plus loin, donc on a genre %02d... + PAtextnumber = va_arg(varg, s32); + s8 neg = 0; // Si negatif, passe � 1... + u8 amettre = text[j+1]; // Nombre � mettre pour remplir + s8 nfois = text[j+2] - '0'; // Nombre de caract�res � mettre + + if (PAtextnumber < 0) { + PAtextnumber = -PAtextnumber; + neg = 1; + } + + for (i = 0; PAtextnumber || (!PAtextnumber && !i); i++) { // tant que le nombre ne vaut pas 0 mais que i est positif, on continu � la convertir... + PAtext[i] = 48 + (PAtextnumber % 10); + PAtextnumber = PAtextnumber / 10; // Nombre de d�part... + nfois--; // Un nombre de moins � mettre... + } + + while (nfois > 0) { // On compl�te de 0 est tout... + PA_SetTileLetter(screen, x + textcount, y, amettre); + ++textcount; + --nfois; + } + + if (neg) { + PAtext[i] = '-'; + ++i; + } + + for (i--; i > -1; i--) { + PA_SetTileLetter(screen, x + textcount, y, PAtext[i]); + ++ textcount; + } + + j += 3; + } else { // Sinon c'est juste + PA_SetTileLetter(screen, x + textcount, y, text[j]); + ++textcount; + } + } else if (text[j] == '\n') { + textcount = 0; + ++y; + } else if ((text[j] == '/') && (text[j+1] == 'n')) { + textcount = 0; + ++y; + j++; + } else { + PA_SetTileLetter(screen, x + textcount, y, text[j]); + ++textcount; + } + } + + va_end(varg); /* Terminaison. */ + PA_SetTextTileCol(screen, textcolor); // put back the old color +} + + +void PA_ClearTextBg(u8 screen) { + int i, j; + + for (i = 0; i < 32; i++) + for (j = 0; j < 32; j++) + PA_SetMapTileAll(screen, PAbgtext[screen], i, j, 0); + + pa_printx[screen] = 0; + pa_printy[screen] = 0; + pa_printscroll[screen] = 0; + PA_BGScrollY(screen, PAbgtext[screen], 0); +} diff --git a/source/arm9/PA_Text16bit.c b/source/arm9/PA_Text16bit.c index 682d779..d56e759 100644 --- a/source/arm9/PA_Text16bit.c +++ b/source/arm9/PA_Text16bit.c @@ -1,176 +1,176 @@ -#include - -//#include "16c/all_gfx.h" - -void Letter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color); -void TranspLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color); -void NoLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color); -void RotLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color); -void RotLetter216bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color); - -letterfp16bit letters16bit[5] = {(letterfp16bit)&Letter16bit, (letterfp16bit)&TranspLetter16bit, (letterfp16bit)&NoLetter16bit, (letterfp16bit)&RotLetter16bit, (letterfp16bit)&RotLetter216bit}; - -static inline void PA_16bitDrawTile(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u16 color) { - u16 i, j; - - for (j = 0; j < ly; j++) { - for (i = 0; i < lx; i++) { - PA_Put16bitPixel(screen, x + i, y + j, data[i+(j<<3)]*color); - } - } -} - -static inline void PA_16bitDrawTileTransp(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u16 color) { - u16 i, j; - - for (j = 0; j < ly; j++) { - for (i = 0; i < lx; i++) { - if (data[i+(j<<3)]) PA_Put16bitPixel(screen, x + i, y + j, data[i+(j<<3)]*color); - } - } -} - -static inline void PA_16bitDrawTileRot(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u16 color) { - u16 i, j; - s16 temp = x; - x = 255 - y; - y = temp; - - for (j = 0; j < ly; j++) { - for (i = 0; i < lx; i++) { - PA_Put16bitPixel(screen, x - j, y + i, data[i+(j<<3)]*color); - } - } -} - -static inline void PA_16bitDrawTileRot2(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u16 color) { - u16 i, j; - s16 temp = 192 - x; - x = y; - y = temp; - - for (j = 0; j < ly; j++) { - for (i = 0; i < lx; i++) { - PA_Put16bitPixel(screen, x + j, y - i, data[i+(j<<3)]*color); - } - } -} - -void NoLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color) { -} - -void RotLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color) { - u8 lx = pa_bittextdefaultsize[size][(u8)letter]; - u8 ly = pa_bittextpoliceheight[size]; - u8 *data; - - if (ly > 8) { - ly--; - u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_16bitDrawTileRot(screen, x, y, 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_16bitDrawTileRot(screen, x, y + 8, 8, ly - 8, data, color); - firstpos ++; - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_16bitDrawTileRot(screen, x + 8, y, lx - 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_16bitDrawTileRot(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); - } else { - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); - PA_16bitDrawTileRot(screen, x, y, lx, ly, data, color); - } -} - -void RotLetter216bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color) { - u8 lx = pa_bittextdefaultsize[size][(u8)letter]; - u8 ly = pa_bittextpoliceheight[size]; - u8 *data; - - if (ly > 8) { - ly--; - u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_16bitDrawTileRot2(screen, x, y, 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_16bitDrawTileRot2(screen, x, y + 8, 8, ly - 8, data, color); - firstpos ++; - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_16bitDrawTileRot2(screen, x + 8, y, lx - 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_16bitDrawTileRot2(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); - } else { - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); - PA_16bitDrawTileRot2(screen, x, y, lx, ly, data, color); - } -} - -void Letter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color) { - u8 lx = pa_bittextdefaultsize[size][(u8)letter]; - u8 ly = pa_bittextpoliceheight[size]; - u8 *data; - - if (ly > 8) { - u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_16bitDrawTile(screen, x, y, 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_16bitDrawTile(screen, x, y + 8, 8, ly - 8, data, color); - firstpos ++; - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_16bitDrawTile(screen, x + 8, y, lx - 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_16bitDrawTile(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); - } else { - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); - PA_16bitDrawTile(screen, x, y, lx, ly, data, color); - } -} - -void TranspLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color) { - u8 lx = pa_bittextdefaultsize[size][(u8)letter]; - u8 ly = pa_bittextpoliceheight[size]; - u8 *data; - - if (ly > 8) { - u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_16bitDrawTileTransp(screen, x, y, 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_16bitDrawTileTransp(screen, x, y + 8, 8, ly - 8, data, color); - firstpos ++; - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_16bitDrawTileTransp(screen, x + 8, y, lx - 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_16bitDrawTileTransp(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); - } else { - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); - PA_16bitDrawTileTransp(screen, x, y, lx, ly, data, color); - } -} - -void pa_16bitTextDecompress(u8 size) { - s16 i; - - if ((size < 5) && (((void*)bittext_tiles_blank[size]) == ((void*)bit8_tiles[size]))) { // Using default font and still compressed - u32 tilesize = pa_bittextsizes[size] << 3; - bit8_tiles[size] = (u8*)malloc(tilesize); - - for (i = 0; i < tilesize; i++) { - bit8_tiles[size][i] = (bittext_tiles_blank[size][i>>3] >> (i & 7)) & 1; - } - } -} - -s16 PA_16bitText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u16 color, u8 size, u8 transp, s32 limit) { - s32 i; - pa_16bitTextDecompress(size); - PA_DoLetterPos(basex, basey, maxx, maxy, text, color, size, limit); - - if (limit > PA_LetterPos.NLetters) limit = PA_LetterPos.NLetters; // Plus short que prévu - - for (i = 0; i < limit; i++) letters16bit[transp](PA_LetterPos.Letter[i].Size, screen, PA_LetterPos.Letter[i].X, PA_LetterPos.Letter[i].Y, - PA_LetterPos.Letter[i].Letter, PA_LetterPos.Letter[i].Color); - - return limit; -} +#include + +//#include "16c/all_gfx.h" + +void Letter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color); +void TranspLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color); +void NoLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color); +void RotLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color); +void RotLetter216bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color); + +letterfp16bit letters16bit[5] = {(letterfp16bit)&Letter16bit, (letterfp16bit)&TranspLetter16bit, (letterfp16bit)&NoLetter16bit, (letterfp16bit)&RotLetter16bit, (letterfp16bit)&RotLetter216bit}; + +static inline void PA_16bitDrawTile(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u16 color) { + u16 i, j; + + for (j = 0; j < ly; j++) { + for (i = 0; i < lx; i++) { + PA_Put16bitPixel(screen, x + i, y + j, data[i+(j<<3)]*color); + } + } +} + +static inline void PA_16bitDrawTileTransp(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u16 color) { + u16 i, j; + + for (j = 0; j < ly; j++) { + for (i = 0; i < lx; i++) { + if (data[i+(j<<3)]) PA_Put16bitPixel(screen, x + i, y + j, data[i+(j<<3)]*color); + } + } +} + +static inline void PA_16bitDrawTileRot(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u16 color) { + u16 i, j; + s16 temp = x; + x = 255 - y; + y = temp; + + for (j = 0; j < ly; j++) { + for (i = 0; i < lx; i++) { + PA_Put16bitPixel(screen, x - j, y + i, data[i+(j<<3)]*color); + } + } +} + +static inline void PA_16bitDrawTileRot2(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u16 color) { + u16 i, j; + s16 temp = 192 - x; + x = y; + y = temp; + + for (j = 0; j < ly; j++) { + for (i = 0; i < lx; i++) { + PA_Put16bitPixel(screen, x + j, y - i, data[i+(j<<3)]*color); + } + } +} + +void NoLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color) { +} + +void RotLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color) { + u8 lx = pa_bittextdefaultsize[size][(u8)letter]; + u8 ly = pa_bittextpoliceheight[size]; + u8 *data; + + if (ly > 8) { + ly--; + u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_16bitDrawTileRot(screen, x, y, 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_16bitDrawTileRot(screen, x, y + 8, 8, ly - 8, data, color); + firstpos ++; + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_16bitDrawTileRot(screen, x + 8, y, lx - 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_16bitDrawTileRot(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); + } else { + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); + PA_16bitDrawTileRot(screen, x, y, lx, ly, data, color); + } +} + +void RotLetter216bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color) { + u8 lx = pa_bittextdefaultsize[size][(u8)letter]; + u8 ly = pa_bittextpoliceheight[size]; + u8 *data; + + if (ly > 8) { + ly--; + u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_16bitDrawTileRot2(screen, x, y, 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_16bitDrawTileRot2(screen, x, y + 8, 8, ly - 8, data, color); + firstpos ++; + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_16bitDrawTileRot2(screen, x + 8, y, lx - 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_16bitDrawTileRot2(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); + } else { + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); + PA_16bitDrawTileRot2(screen, x, y, lx, ly, data, color); + } +} + +void Letter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color) { + u8 lx = pa_bittextdefaultsize[size][(u8)letter]; + u8 ly = pa_bittextpoliceheight[size]; + u8 *data; + + if (ly > 8) { + u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_16bitDrawTile(screen, x, y, 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_16bitDrawTile(screen, x, y + 8, 8, ly - 8, data, color); + firstpos ++; + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_16bitDrawTile(screen, x + 8, y, lx - 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_16bitDrawTile(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); + } else { + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); + PA_16bitDrawTile(screen, x, y, lx, ly, data, color); + } +} + +void TranspLetter16bit(u8 size, u8 screen, u16 x, u16 y, char letter, u16 color) { + u8 lx = pa_bittextdefaultsize[size][(u8)letter]; + u8 ly = pa_bittextpoliceheight[size]; + u8 *data; + + if (ly > 8) { + u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_16bitDrawTileTransp(screen, x, y, 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_16bitDrawTileTransp(screen, x, y + 8, 8, ly - 8, data, color); + firstpos ++; + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_16bitDrawTileTransp(screen, x + 8, y, lx - 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_16bitDrawTileTransp(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); + } else { + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); + PA_16bitDrawTileTransp(screen, x, y, lx, ly, data, color); + } +} + +void pa_16bitTextDecompress(u8 size) { + s16 i; + + if ((size < 5) && (((void*)bittext_tiles_blank[size]) == ((void*)bit8_tiles[size]))) { // Using default font and still compressed + u32 tilesize = pa_bittextsizes[size] << 3; + bit8_tiles[size] = (u8*)malloc(tilesize); + + for (i = 0; i < tilesize; i++) { + bit8_tiles[size][i] = (bittext_tiles_blank[size][i>>3] >> (i & 7)) & 1; + } + } +} + +s16 PA_16bitText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u16 color, u8 size, u8 transp, s32 limit) { + s32 i; + pa_16bitTextDecompress(size); + PA_DoLetterPos(basex, basey, maxx, maxy, text, color, size, limit); + + if (limit > PA_LetterPos.NLetters) limit = PA_LetterPos.NLetters; // Plus short que prévu + + for (i = 0; i < limit; i++) letters16bit[transp](PA_LetterPos.Letter[i].Size, screen, PA_LetterPos.Letter[i].X, PA_LetterPos.Letter[i].Y, + PA_LetterPos.Letter[i].Letter, PA_LetterPos.Letter[i].Color); + + return limit; +} diff --git a/source/arm9/PA_Text8bit.c b/source/arm9/PA_Text8bit.c index 902d868..fd2c031 100644 --- a/source/arm9/PA_Text8bit.c +++ b/source/arm9/PA_Text8bit.c @@ -1,203 +1,203 @@ -#include - -#include "PA_BmpFont0_Tiles_bin.h" -#include "PA_BmpFont1_Tiles_bin.h" -#include "PA_BmpFont2_Tiles_bin.h" -#include "PA_BmpFont3_Tiles_bin.h" -#include "PA_BmpFont4_Tiles_bin.h" - -u8* bit8_tiles[10] = { - // This list can be modified by the user - (u8 *)PA_BmpFont0_Tiles_bin, - (u8 *)PA_BmpFont1_Tiles_bin, - (u8 *)PA_BmpFont2_Tiles_bin, - (u8 *)PA_BmpFont3_Tiles_bin, - (u8 *)PA_BmpFont4_Tiles_bin -}; - -void Letter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color); -void TranspLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color); -void NoLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color); -void RotLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color); -void RotLetter2(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color); - -letterfp letters[5] = {(letterfp)&Letter, (letterfp)&TranspLetter, (letterfp)&NoLetter, (letterfp)&RotLetter, (letterfp)&RotLetter2}; - -static inline void PA_8bitDrawTile(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u8 color) { - u16 i, j; - - for (j = 0; j < ly; j++) { - for (i = 0; i < lx; i++) { - PA_Put8bitPixel(screen, x + i, y + j, data[i+(j<<3)]*color); - } - } -} - -static inline void PA_8bitDrawTileTransp(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u8 color) { - u16 i, j; - - for (j = 0; j < ly; j++) { - for (i = 0; i < lx; i++) { - u8 decal = (((x + i) & 1) << 3); - u16 pixel = (data[i+(j<<3)] * color) << decal; - - if (pixel) { - PA_DrawBg[screen][((y+j) <<7) + ((x+i)>>1)] &= 255 << (8 - decal); - PA_DrawBg[screen][((y+j) <<7) + ((x+i)>>1)] |= pixel; - } - } - } -} - -static inline void PA_8bitDrawTileRot(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u8 color) { - u16 i, j; - s16 temp = x; - x = 255 - y; - y = temp; - - for (j = 0; j < ly; j++) { - for (i = 0; i < lx; i++) { - PA_Put8bitPixel(screen, x - j, y + i, data[i+(j<<3)]*color); - } - } -} - -static inline void PA_8bitDrawTileRot2(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u8 color) { - u16 i, j; - s16 temp = 192 - x; - x = y; - y = temp; - - for (j = 0; j < ly; j++) { - for (i = 0; i < lx; i++) { - PA_Put8bitPixel(screen, x + j, y - i, data[i+(j<<3)]*color); - } - } -} - -void NoLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color) { -} - -void RotLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color) { - u8 lx = pa_bittextdefaultsize[size][(u8)letter]; - u8 ly = pa_bittextpoliceheight[size]; - u8 *data; - - if (ly > 8) { - ly--; - u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_8bitDrawTileRot(screen, x, y, 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_8bitDrawTileRot(screen, x, y + 8, 8, ly - 8, data, color); - firstpos ++; - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_8bitDrawTileRot(screen, x + 8, y, lx - 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_8bitDrawTileRot(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); - } else { - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); - PA_8bitDrawTileRot(screen, x, y, lx, ly, data, color); - } -} - -void RotLetter2(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color) { - u8 lx = pa_bittextdefaultsize[size][(u8)letter]; - u8 ly = pa_bittextpoliceheight[size]; - u8 *data; - - if (ly > 8) { - ly--; - u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_8bitDrawTileRot2(screen, x, y, 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_8bitDrawTileRot2(screen, x, y + 8, 8, ly - 8, data, color); - firstpos ++; - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_8bitDrawTileRot2(screen, x + 8, y, lx - 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_8bitDrawTileRot2(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); - } else { - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); - PA_8bitDrawTileRot2(screen, x, y, lx, ly, data, color); - } -} - -void Letter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color) { - u8 lx = pa_bittextdefaultsize[size][(u8)letter]; - u8 ly = pa_bittextpoliceheight[size]; - u8 *data; - - if (ly > 8) { - u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_8bitDrawTile(screen, x, y, 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_8bitDrawTile(screen, x, y + 8, 8, ly - 8, data, color); - firstpos ++; - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_8bitDrawTile(screen, x + 8, y, lx - 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_8bitDrawTile(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); - } else { - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); - PA_8bitDrawTile(screen, x, y, lx, ly, data, color); - } -} - -void TranspLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color) { - u8 lx = pa_bittextdefaultsize[size][(u8)letter]; - u8 ly = pa_bittextpoliceheight[size]; - u8 *data; - - if (ly > 8) { - u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_8bitDrawTileTransp(screen, x, y, 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_8bitDrawTileTransp(screen, x, y + 8, 8, ly - 8, data, color); - firstpos ++; - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); - PA_8bitDrawTileTransp(screen, x + 8, y, lx - 8, 8, data, color); - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); - PA_8bitDrawTileTransp(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); - } else { - data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); - PA_8bitDrawTileTransp(screen, x, y, lx, ly, data, color); - } -} - -void pa_8bitTextDecompress(u8 size) { - s16 i; - - if ((size < 5) && (((void*)bittext_tiles_blank[size]) == ((void*)bit8_tiles[size]))) { // Using default font and still compressed - u32 tilesize = pa_bittextsizes[size] << 3; - bit8_tiles[size] = (u8*)malloc(tilesize); - - for (i = 0; i < tilesize; i++) { - bit8_tiles[size][i] = (bittext_tiles_blank[size][i>>3] >> (i & 7)) & 1; - } - } -} - -s16 PA_8bitText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp, s32 limit) { - s32 i; - pa_8bitTextDecompress(size); - PA_DoLetterPos(basex, basey, maxx, maxy, text, color, size, limit); - - if (limit > PA_LetterPos.NLetters) limit = PA_LetterPos.NLetters; // Plus short que prévu - - for (i = 0; i < limit; i++) letters[transp](PA_LetterPos.Letter[i].Size, screen, PA_LetterPos.Letter[i].X, PA_LetterPos.Letter[i].Y, - PA_LetterPos.Letter[i].Letter, PA_LetterPos.Letter[i].Color); - - return limit; -} - -s16 PA_CenterSmartText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp) { - u8 align = textinfo.align; - textinfo.align = ALIGN_CENTER; - u16 temp = PA_8bitText(screen, basex, basey, maxx, maxy, text, color, size, transp, 100000); - textinfo.align = align; - return temp; -} +#include + +#include "PA_BmpFont0_Tiles_bin.h" +#include "PA_BmpFont1_Tiles_bin.h" +#include "PA_BmpFont2_Tiles_bin.h" +#include "PA_BmpFont3_Tiles_bin.h" +#include "PA_BmpFont4_Tiles_bin.h" + +u8* bit8_tiles[10] = { + // This list can be modified by the user + (u8 *)PA_BmpFont0_Tiles_bin, + (u8 *)PA_BmpFont1_Tiles_bin, + (u8 *)PA_BmpFont2_Tiles_bin, + (u8 *)PA_BmpFont3_Tiles_bin, + (u8 *)PA_BmpFont4_Tiles_bin +}; + +void Letter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color); +void TranspLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color); +void NoLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color); +void RotLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color); +void RotLetter2(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color); + +letterfp letters[5] = {(letterfp)&Letter, (letterfp)&TranspLetter, (letterfp)&NoLetter, (letterfp)&RotLetter, (letterfp)&RotLetter2}; + +static inline void PA_8bitDrawTile(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u8 color) { + u16 i, j; + + for (j = 0; j < ly; j++) { + for (i = 0; i < lx; i++) { + PA_Put8bitPixel(screen, x + i, y + j, data[i+(j<<3)]*color); + } + } +} + +static inline void PA_8bitDrawTileTransp(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u8 color) { + u16 i, j; + + for (j = 0; j < ly; j++) { + for (i = 0; i < lx; i++) { + u8 decal = (((x + i) & 1) << 3); + u16 pixel = (data[i+(j<<3)] * color) << decal; + + if (pixel) { + PA_DrawBg[screen][((y+j) <<7) + ((x+i)>>1)] &= 255 << (8 - decal); + PA_DrawBg[screen][((y+j) <<7) + ((x+i)>>1)] |= pixel; + } + } + } +} + +static inline void PA_8bitDrawTileRot(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u8 color) { + u16 i, j; + s16 temp = x; + x = 255 - y; + y = temp; + + for (j = 0; j < ly; j++) { + for (i = 0; i < lx; i++) { + PA_Put8bitPixel(screen, x - j, y + i, data[i+(j<<3)]*color); + } + } +} + +static inline void PA_8bitDrawTileRot2(u8 screen, u16 x, u16 y, s8 lx, s8 ly, u8 *data, u8 color) { + u16 i, j; + s16 temp = 192 - x; + x = y; + y = temp; + + for (j = 0; j < ly; j++) { + for (i = 0; i < lx; i++) { + PA_Put8bitPixel(screen, x + j, y - i, data[i+(j<<3)]*color); + } + } +} + +void NoLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color) { +} + +void RotLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color) { + u8 lx = pa_bittextdefaultsize[size][(u8)letter]; + u8 ly = pa_bittextpoliceheight[size]; + u8 *data; + + if (ly > 8) { + ly--; + u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_8bitDrawTileRot(screen, x, y, 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_8bitDrawTileRot(screen, x, y + 8, 8, ly - 8, data, color); + firstpos ++; + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_8bitDrawTileRot(screen, x + 8, y, lx - 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_8bitDrawTileRot(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); + } else { + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); + PA_8bitDrawTileRot(screen, x, y, lx, ly, data, color); + } +} + +void RotLetter2(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color) { + u8 lx = pa_bittextdefaultsize[size][(u8)letter]; + u8 ly = pa_bittextpoliceheight[size]; + u8 *data; + + if (ly > 8) { + ly--; + u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_8bitDrawTileRot2(screen, x, y, 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_8bitDrawTileRot2(screen, x, y + 8, 8, ly - 8, data, color); + firstpos ++; + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_8bitDrawTileRot2(screen, x + 8, y, lx - 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_8bitDrawTileRot2(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); + } else { + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); + PA_8bitDrawTileRot2(screen, x, y, lx, ly, data, color); + } +} + +void Letter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color) { + u8 lx = pa_bittextdefaultsize[size][(u8)letter]; + u8 ly = pa_bittextpoliceheight[size]; + u8 *data; + + if (ly > 8) { + u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_8bitDrawTile(screen, x, y, 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_8bitDrawTile(screen, x, y + 8, 8, ly - 8, data, color); + firstpos ++; + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_8bitDrawTile(screen, x + 8, y, lx - 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_8bitDrawTile(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); + } else { + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); + PA_8bitDrawTile(screen, x, y, lx, ly, data, color); + } +} + +void TranspLetter(u8 size, u8 screen, u16 x, u16 y, char letter, u8 color) { + u8 lx = pa_bittextdefaultsize[size][(u8)letter]; + u8 ly = pa_bittextpoliceheight[size]; + u8 *data; + + if (ly > 8) { + u16 firstpos = ((letter & 31) << 1) + ((letter >> 5) << 7); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_8bitDrawTileTransp(screen, x, y, 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_8bitDrawTileTransp(screen, x, y + 8, 8, ly - 8, data, color); + firstpos ++; + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos] << 6)); + PA_8bitDrawTileTransp(screen, x + 8, y, lx - 8, 8, data, color); + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][firstpos+64] << 6)); + PA_8bitDrawTileTransp(screen, x + 8, y + 8, lx - 8, ly - 8, data, color); + } else { + data = (u8*)(bit8_tiles[size] + (bittext_maps[size][(u8)letter] << 6)); + PA_8bitDrawTileTransp(screen, x, y, lx, ly, data, color); + } +} + +void pa_8bitTextDecompress(u8 size) { + s16 i; + + if ((size < 5) && (((void*)bittext_tiles_blank[size]) == ((void*)bit8_tiles[size]))) { // Using default font and still compressed + u32 tilesize = pa_bittextsizes[size] << 3; + bit8_tiles[size] = (u8*)malloc(tilesize); + + for (i = 0; i < tilesize; i++) { + bit8_tiles[size][i] = (bittext_tiles_blank[size][i>>3] >> (i & 7)) & 1; + } + } +} + +s16 PA_8bitText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp, s32 limit) { + s32 i; + pa_8bitTextDecompress(size); + PA_DoLetterPos(basex, basey, maxx, maxy, text, color, size, limit); + + if (limit > PA_LetterPos.NLetters) limit = PA_LetterPos.NLetters; // Plus short que prévu + + for (i = 0; i < limit; i++) letters[transp](PA_LetterPos.Letter[i].Size, screen, PA_LetterPos.Letter[i].X, PA_LetterPos.Letter[i].Y, + PA_LetterPos.Letter[i].Letter, PA_LetterPos.Letter[i].Color); + + return limit; +} + +s16 PA_CenterSmartText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u8 color, u8 size, u8 transp) { + u8 align = textinfo.align; + textinfo.align = ALIGN_CENTER; + u16 temp = PA_8bitText(screen, basex, basey, maxx, maxy, text, color, size, transp, 100000); + textinfo.align = align; + return temp; +} diff --git a/source/arm9/PA_TextBits.c b/source/arm9/PA_TextBits.c index 31d7936..3f4f678 100644 --- a/source/arm9/PA_TextBits.c +++ b/source/arm9/PA_TextBits.c @@ -1,162 +1,162 @@ -#include "PA_TextBits.h" - -#include "PA_BmpFont0_Tiles_bin.h" -#include "PA_BmpFont1_Tiles_bin.h" -#include "PA_BmpFont2_Tiles_bin.h" -#include "PA_BmpFont3_Tiles_bin.h" -#include "PA_BmpFont4_Tiles_bin.h" - -#include "PA_BmpFont0_Map_bin.h" -#include "PA_BmpFont1_Map_bin.h" -#include "PA_BmpFont2_Map_bin.h" -#include "PA_BmpFont3_Map_bin.h" -#include "PA_BmpFont4_Map_bin.h" - -#include "PA_BmpFont0_Sizes_bin.h" -#include "PA_BmpFont1_Sizes_bin.h" -#include "PA_BmpFont2_Sizes_bin.h" -#include "PA_BmpFont3_Sizes_bin.h" -#include "PA_BmpFont4_Sizes_bin.h" - -const u16 *bittext_maps[10] = { - (const u16 *)PA_BmpFont0_Map_bin, - (const u16 *)PA_BmpFont1_Map_bin, - (const u16 *)PA_BmpFont2_Map_bin, - (const u16 *)PA_BmpFont3_Map_bin, - (const u16 *)PA_BmpFont4_Map_bin -}; - -const u8 *bittext_tiles_blank[10] = { - PA_BmpFont0_Tiles_bin, - PA_BmpFont1_Tiles_bin, - PA_BmpFont2_Tiles_bin, - PA_BmpFont3_Tiles_bin, - PA_BmpFont4_Tiles_bin -}; - -const u8 *pa_bittextdefaultsize[10] = { - PA_BmpFont0_Sizes_bin, - PA_BmpFont1_Sizes_bin, - PA_BmpFont2_Sizes_bin, - PA_BmpFont3_Sizes_bin, - PA_BmpFont4_Sizes_bin -}; - -// Will be filled later -u16 pa_bittextsizes[5]; -u8 pa_bittextpoliceheight[10]; - -LetterPos PA_LetterPos; -textinfo_type textinfo = {1, 0, ALIGN_LEFT, 0}; - -static inline void PA_AddLetterPos(s16 Letter, s16 x, s16 y, u8 size, u16 color) { - PA_LetterPos.Letter[PA_LetterPos.NLetters].Letter = Letter; - PA_LetterPos.Letter[PA_LetterPos.NLetters].X = x; - PA_LetterPos.Letter[PA_LetterPos.NLetters].Y = y; - PA_LetterPos.Letter[PA_LetterPos.NLetters].Size = size; - PA_LetterPos.Letter[PA_LetterPos.NLetters].Color = color; - PA_LetterPos.NLetters++; -} - -void PA_DoAlign(u16 start, s16 x, s16 maxx, u8 justify) { - s16 i; - s16 width = (maxx + 1) - x; - - if (textinfo.align == ALIGN_RIGHT) { // Cas simple, on rajoute la diff�rence de largeur � toutes les lettres... - width++; - - for (i = start; i < PA_LetterPos.NLetters; i++) PA_LetterPos.Letter[i].X += width; - } else if (textinfo.align == ALIGN_CENTER) { // Cas simple, on rajoute la moiti� de la largeur � toutes les lettres... - width = (width + 1) >> 1; - - for (i = start; i < PA_LetterPos.NLetters; i++) PA_LetterPos.Letter[i].X += width; - } else if (justify && (textinfo.align == ALIGN_JUSTIFY)) { // Cas relou ^^ - //u8 nletters = PA_LetterPos.NLetters-start; // Nombre de lettres - u8 justify = 0; // D�callage � faire au d�but... - u8 spaces = 0; - u8 change = 0; - u8 quickadd = 0; - u8 nletters = PA_LetterPos.NLetters - 1 - start; - - if (nletters < width) { // Less letters than the width to add, add 1 pixel/letter... - quickadd = 1; - width -= nletters; - } - - // Compter le nombre d'espaces - for (i = start; i < PA_LetterPos.NLetters - 1; i++) if (PA_LetterPos.Letter[i].Letter == ' ') spaces++; - - for (i = start; i < PA_LetterPos.NLetters; i++) { - justify += quickadd; - PA_LetterPos.Letter[i].X += justify; - - if ((PA_LetterPos.Letter[i].Letter == ' ') && width) { - change = (width + (spaces >> 1)) / spaces; - justify += change; - width -= change; // Moins � corriger par la suite... - spaces--; - } - } - } -} - -void PA_DoLetterPos(s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u16 color, u8 size, s32 limit) { - s16 x = basex; s16 y = basey; - s16 letterstart; - u8 lx, letter = ' '; - s16 i; - PA_LetterPos.NLetters = 0; - letterstart = 0; - - if ((textinfo.align == ALIGN_JUSTIFY) || (textinfo.align == ALIGN_LEFT)) limit += 100; // Pour bien caler la ligne - - for (i = 0; (i < limit + 100) && (text[i]); i++) { - letter = text[i]; - lx = pa_bittextdefaultsize[size][letter] + textinfo.letterspacing; - - if ((letter == '\n') || ((x + lx > maxx) && (letter != ' '))) { // retour ligne, ou on d�passe... - - if (letter == '\n')PA_AddLetterPos(letter, x, y, size, color); // Retour ligne � mettre dans le tableau - else if (letter == ' ') PA_AddLetterPos(letter, x, y, size, color); // Si espace, on met � la suite - else { - // Sinon, on revient en arri�re pour pas couper un mot ! - while (text[i-1] != ' ') { - i--; x -= pa_bittextdefaultsize[size][(u8)text[i]] + textinfo.letterspacing; PA_LetterPos.NLetters--; - } // Retirer les lettres et la largeur - - letter = text[i]; - lx = pa_bittextdefaultsize[size][letter] + textinfo.letterspacing; - x--; // Moins de largeur - } - - if (y + pa_bittextpoliceheight[size] * 2 > maxy) { - break; // EXIT ! - } - - // Calculer diff�rence de largeur... - if (text[i-1] == ' ') x -= pa_bittextdefaultsize[size][(u8)(' ')]; // Retirer la largeur de l'espace - - // Retour ligne ! Voir si besoin d'aligne le texte d'un c�t� ou de l'autre, centrer, etc... - PA_DoAlign(letterstart, x, maxx, (letter != '\n')); // Autorise le justify que si pas '\'n - x = basex; - y += pa_bittextpoliceheight[size] + textinfo.linespacing; - letterstart = PA_LetterPos.NLetters; // Premi�re lettre de cette ligne ! - - if (letter > 32) { - PA_AddLetterPos(letter, x, y, size, color); - x += lx; - } - } else { - PA_AddLetterPos(letter, x, y, size, color); - x += lx; - } - } - - if (text[i-1] == ' ') x -= pa_bittextdefaultsize[size][(u8)(' ')]; // Retirer la largeur de l'espace - - PA_DoAlign(letterstart, x, maxx, (letter != '\n') && (text[i] != '\0')); - // End Position - PA_LetterPos.Letter[PA_LetterPos.NLetters].X = x; - PA_LetterPos.Letter[PA_LetterPos.NLetters].Y = y; -} - +#include "PA_TextBits.h" + +#include "PA_BmpFont0_Tiles_bin.h" +#include "PA_BmpFont1_Tiles_bin.h" +#include "PA_BmpFont2_Tiles_bin.h" +#include "PA_BmpFont3_Tiles_bin.h" +#include "PA_BmpFont4_Tiles_bin.h" + +#include "PA_BmpFont0_Map_bin.h" +#include "PA_BmpFont1_Map_bin.h" +#include "PA_BmpFont2_Map_bin.h" +#include "PA_BmpFont3_Map_bin.h" +#include "PA_BmpFont4_Map_bin.h" + +#include "PA_BmpFont0_Sizes_bin.h" +#include "PA_BmpFont1_Sizes_bin.h" +#include "PA_BmpFont2_Sizes_bin.h" +#include "PA_BmpFont3_Sizes_bin.h" +#include "PA_BmpFont4_Sizes_bin.h" + +const u16 *bittext_maps[10] = { + (const u16 *)PA_BmpFont0_Map_bin, + (const u16 *)PA_BmpFont1_Map_bin, + (const u16 *)PA_BmpFont2_Map_bin, + (const u16 *)PA_BmpFont3_Map_bin, + (const u16 *)PA_BmpFont4_Map_bin +}; + +const u8 *bittext_tiles_blank[10] = { + PA_BmpFont0_Tiles_bin, + PA_BmpFont1_Tiles_bin, + PA_BmpFont2_Tiles_bin, + PA_BmpFont3_Tiles_bin, + PA_BmpFont4_Tiles_bin +}; + +const u8 *pa_bittextdefaultsize[10] = { + PA_BmpFont0_Sizes_bin, + PA_BmpFont1_Sizes_bin, + PA_BmpFont2_Sizes_bin, + PA_BmpFont3_Sizes_bin, + PA_BmpFont4_Sizes_bin +}; + +// Will be filled later +u16 pa_bittextsizes[5]; +u8 pa_bittextpoliceheight[10]; + +LetterPos PA_LetterPos; +textinfo_type textinfo = {1, 0, ALIGN_LEFT, 0}; + +static inline void PA_AddLetterPos(s16 Letter, s16 x, s16 y, u8 size, u16 color) { + PA_LetterPos.Letter[PA_LetterPos.NLetters].Letter = Letter; + PA_LetterPos.Letter[PA_LetterPos.NLetters].X = x; + PA_LetterPos.Letter[PA_LetterPos.NLetters].Y = y; + PA_LetterPos.Letter[PA_LetterPos.NLetters].Size = size; + PA_LetterPos.Letter[PA_LetterPos.NLetters].Color = color; + PA_LetterPos.NLetters++; +} + +void PA_DoAlign(u16 start, s16 x, s16 maxx, u8 justify) { + s16 i; + s16 width = (maxx + 1) - x; + + if (textinfo.align == ALIGN_RIGHT) { // Cas simple, on rajoute la diff�rence de largeur � toutes les lettres... + width++; + + for (i = start; i < PA_LetterPos.NLetters; i++) PA_LetterPos.Letter[i].X += width; + } else if (textinfo.align == ALIGN_CENTER) { // Cas simple, on rajoute la moiti� de la largeur � toutes les lettres... + width = (width + 1) >> 1; + + for (i = start; i < PA_LetterPos.NLetters; i++) PA_LetterPos.Letter[i].X += width; + } else if (justify && (textinfo.align == ALIGN_JUSTIFY)) { // Cas relou ^^ + //u8 nletters = PA_LetterPos.NLetters-start; // Nombre de lettres + u8 justify = 0; // D�callage � faire au d�but... + u8 spaces = 0; + u8 change = 0; + u8 quickadd = 0; + u8 nletters = PA_LetterPos.NLetters - 1 - start; + + if (nletters < width) { // Less letters than the width to add, add 1 pixel/letter... + quickadd = 1; + width -= nletters; + } + + // Compter le nombre d'espaces + for (i = start; i < PA_LetterPos.NLetters - 1; i++) if (PA_LetterPos.Letter[i].Letter == ' ') spaces++; + + for (i = start; i < PA_LetterPos.NLetters; i++) { + justify += quickadd; + PA_LetterPos.Letter[i].X += justify; + + if ((PA_LetterPos.Letter[i].Letter == ' ') && width) { + change = (width + (spaces >> 1)) / spaces; + justify += change; + width -= change; // Moins � corriger par la suite... + spaces--; + } + } + } +} + +void PA_DoLetterPos(s16 basex, s16 basey, s16 maxx, s16 maxy, const char* text, u16 color, u8 size, s32 limit) { + s16 x = basex; s16 y = basey; + s16 letterstart; + u8 lx, letter = ' '; + s16 i; + PA_LetterPos.NLetters = 0; + letterstart = 0; + + if ((textinfo.align == ALIGN_JUSTIFY) || (textinfo.align == ALIGN_LEFT)) limit += 100; // Pour bien caler la ligne + + for (i = 0; (i < limit + 100) && (text[i]); i++) { + letter = text[i]; + lx = pa_bittextdefaultsize[size][letter] + textinfo.letterspacing; + + if ((letter == '\n') || ((x + lx > maxx) && (letter != ' '))) { // retour ligne, ou on d�passe... + + if (letter == '\n')PA_AddLetterPos(letter, x, y, size, color); // Retour ligne � mettre dans le tableau + else if (letter == ' ') PA_AddLetterPos(letter, x, y, size, color); // Si espace, on met � la suite + else { + // Sinon, on revient en arri�re pour pas couper un mot ! + while (text[i-1] != ' ') { + i--; x -= pa_bittextdefaultsize[size][(u8)text[i]] + textinfo.letterspacing; PA_LetterPos.NLetters--; + } // Retirer les lettres et la largeur + + letter = text[i]; + lx = pa_bittextdefaultsize[size][letter] + textinfo.letterspacing; + x--; // Moins de largeur + } + + if (y + pa_bittextpoliceheight[size] * 2 > maxy) { + break; // EXIT ! + } + + // Calculer diff�rence de largeur... + if (text[i-1] == ' ') x -= pa_bittextdefaultsize[size][(u8)(' ')]; // Retirer la largeur de l'espace + + // Retour ligne ! Voir si besoin d'aligne le texte d'un c�t� ou de l'autre, centrer, etc... + PA_DoAlign(letterstart, x, maxx, (letter != '\n')); // Autorise le justify que si pas '\'n + x = basex; + y += pa_bittextpoliceheight[size] + textinfo.linespacing; + letterstart = PA_LetterPos.NLetters; // Premi�re lettre de cette ligne ! + + if (letter > 32) { + PA_AddLetterPos(letter, x, y, size, color); + x += lx; + } + } else { + PA_AddLetterPos(letter, x, y, size, color); + x += lx; + } + } + + if (text[i-1] == ' ') x -= pa_bittextdefaultsize[size][(u8)(' ')]; // Retirer la largeur de l'espace + + PA_DoAlign(letterstart, x, maxx, (letter != '\n') && (text[i] != '\0')); + // End Position + PA_LetterPos.Letter[PA_LetterPos.NLetters].X = x; + PA_LetterPos.Letter[PA_LetterPos.NLetters].Y = y; +} + diff --git a/source/arm9/PA_TextPrint.c b/source/arm9/PA_TextPrint.c index b053c3c..70d37af 100644 --- a/source/arm9/PA_TextPrint.c +++ b/source/arm9/PA_TextPrint.c @@ -1,160 +1,160 @@ -#include - -void PA_PrintYPlus(u8 screen) { - u8 i; - - for (i = pa_printx[screen]; i < 32; i++) PA_SetTileLetter(screen, pa_printx[screen], pa_printy[screen]&31, ' '); // Erase - - pa_printy[screen]++; - pa_printx[screen] = 0; - - if (pa_printy[screen] > 24) { - pa_printscroll[screen] += 8; - PA_BGScrollY(screen, PAbgtext[screen], pa_printscroll[screen]); - } -} - -void PA_Print(u8 screen, const char* text, ...) { - s16 j, i; - u8 PAtext[32]; // tableau où l'on copie les nombres et tout... - u8 *PAextext; // Extra text - s32 PAtextnumber; - double tempdouble = 0; - //BG_PALETTE[255 + (screen * 512)] = textcol[screen]; // On remet la couleur au cas où on ait chargé du texte par-dessus... - va_list varg; /* Variable identifiant le prochain paramètre. */ - va_start(varg, text); - u8 textcolor = PAtext_pal[screen]; - - for (j = 0; text[j]; j++) { - if (text[j] == '%') { - if (text[j+1] == 'c') { // change color ! - PA_SetTextTileCol(screen, text[j+2] - '0'); - j += 2; - } else if (text[j+1] == 's') { // S'il y a %s, c'est une chaine de caractères... - PAextext = (u8*)va_arg(varg, const u8 *); // Pointeur vers la chaine de charactères... - - for (i = 0; PAextext[i]; i++) { - PA_PrintLetter(screen, PAextext[i]); - } - - j += 1; - } else if ((text[j+1] == 'x')) { - u32 test = va_arg(varg, u32); - u8 temp; - u8 started = 0; - - for (i = 0; i < 32; i += 4) { - temp = (test >> (28 - i)) & 15; - - if (started || temp) { - if (temp >= 10) PA_PrintLetter(screen, 'A' + (temp - 10)); - else PA_PrintLetter(screen, '0' + (temp)); - - started = 1; - } - } - - j++; - } else if ((text[j+1] == 'd') || (text[j+1] == 'f')) { - double test = 0; - - if (text[j+1] == 'd') { - PAtextnumber = va_arg(varg, s32); - test = PAtextnumber; - } else { // On ne prend que la partie entière pour l'instant, on garde le reste pour plus tard :p - tempdouble = va_arg(varg, double); - test = tempdouble; - PAtextnumber = (s32)tempdouble ; - tempdouble -= PAtextnumber; - } - - s8 neg = 0; // Si negatif, passe à 1... - - if (test < 0) { - PAtextnumber = -PAtextnumber; - //tempdouble = -tempdouble; - neg = 1; - } - - for (i = 0; PAtextnumber || (!PAtextnumber && !i); i++) { // tant que le nombre ne vaut pas 0 mais que i est positif, on continu à la convertir... - PAtext[i] = '0' + (PAtextnumber % 10); - PAtextnumber = PAtextnumber / 10; // Nombre de départ... - } - - if (neg) { - PAtext[i] = '-'; - ++i; - } - - for (i--; i > -1; i--) { - PA_PrintLetter(screen, PAtext[i]); - } - - j += 1; - - if (text[j] == 'f') { // Il reste donc la virgule à traiter... - PA_PrintLetter(screen, '.'); - i = text[j+1] - 48; // Nombre de chiffres après la virgule... - PAtext[1] = 0; // Permet de stopper si c'est vba... - - if (tempdouble < 0) tempdouble = -tempdouble; - - while ((i-- > 0)) { // Pas plus de 6 chiffres après la virgule... - tempdouble *= 10; - //if ( - PAtextnumber = (s32)tempdouble; - tempdouble -= PAtextnumber; - PAtext[0] = '0' + PAtextnumber; - PA_PrintLetter(screen, PAtext[0]); - } - - j += 1; - } - } else if ((text[j+3] == 'd') && (text[j+1] != ' ') && (text[j+2] != ' ')) { // C'est plus loin, donc on a genre %02d... - PAtextnumber = va_arg(varg, s32); - s8 neg = 0; // Si negatif, passe à 1... - u8 amettre = text[j+1]; // Nombre à mettre pour remplir - s8 nfois = text[j+2] - '0'; // Nombre de caractères à mettre - - if (PAtextnumber < 0) { - PAtextnumber = -PAtextnumber; - neg = 1; - } - - for (i = 0; PAtextnumber || (!PAtextnumber && !i); i++) { // tant que le nombre ne vaut pas 0 mais que i est positif, on continu à la convertir... - PAtext[i] = 48 + (PAtextnumber % 10); - PAtextnumber = PAtextnumber / 10; // Nombre de départ... - nfois--; // Un nombre de moins à mettre... - } - - while (nfois > 0) { // On complète de 0 est tout... - PA_PrintLetter(screen, amettre); - --nfois; - } - - if (neg) { - PAtext[i] = '-'; - ++i; - } - - for (i--; i > -1; i--) { - PA_PrintLetter(screen, PAtext[i]); - } - - j += 3; - } else { // Sinon c'est juste - PA_PrintLetter(screen, text[j]); - } - } else if (text[j] == '\n') { - PA_PrintYPlus(screen); - } else if ((text[j] == '/') && (text[j+1] == 'n')) { - PA_PrintYPlus(screen); - j++; - } else { - PA_PrintLetter(screen, text[j]); - } - } - - va_end(varg); /* Terminaison. */ - PA_SetTextTileCol(screen, textcolor); // put back the old color -} +#include + +void PA_PrintYPlus(u8 screen) { + u8 i; + + for (i = pa_printx[screen]; i < 32; i++) PA_SetTileLetter(screen, pa_printx[screen], pa_printy[screen]&31, ' '); // Erase + + pa_printy[screen]++; + pa_printx[screen] = 0; + + if (pa_printy[screen] > 24) { + pa_printscroll[screen] += 8; + PA_BGScrollY(screen, PAbgtext[screen], pa_printscroll[screen]); + } +} + +void PA_Print(u8 screen, const char* text, ...) { + s16 j, i; + u8 PAtext[32]; // tableau où l'on copie les nombres et tout... + u8 *PAextext; // Extra text + s32 PAtextnumber; + double tempdouble = 0; + //BG_PALETTE[255 + (screen * 512)] = textcol[screen]; // On remet la couleur au cas où on ait chargé du texte par-dessus... + va_list varg; /* Variable identifiant le prochain paramètre. */ + va_start(varg, text); + u8 textcolor = PAtext_pal[screen]; + + for (j = 0; text[j]; j++) { + if (text[j] == '%') { + if (text[j+1] == 'c') { // change color ! + PA_SetTextTileCol(screen, text[j+2] - '0'); + j += 2; + } else if (text[j+1] == 's') { // S'il y a %s, c'est une chaine de caractères... + PAextext = (u8*)va_arg(varg, const u8 *); // Pointeur vers la chaine de charactères... + + for (i = 0; PAextext[i]; i++) { + PA_PrintLetter(screen, PAextext[i]); + } + + j += 1; + } else if ((text[j+1] == 'x')) { + u32 test = va_arg(varg, u32); + u8 temp; + u8 started = 0; + + for (i = 0; i < 32; i += 4) { + temp = (test >> (28 - i)) & 15; + + if (started || temp) { + if (temp >= 10) PA_PrintLetter(screen, 'A' + (temp - 10)); + else PA_PrintLetter(screen, '0' + (temp)); + + started = 1; + } + } + + j++; + } else if ((text[j+1] == 'd') || (text[j+1] == 'f')) { + double test = 0; + + if (text[j+1] == 'd') { + PAtextnumber = va_arg(varg, s32); + test = PAtextnumber; + } else { // On ne prend que la partie entière pour l'instant, on garde le reste pour plus tard :p + tempdouble = va_arg(varg, double); + test = tempdouble; + PAtextnumber = (s32)tempdouble ; + tempdouble -= PAtextnumber; + } + + s8 neg = 0; // Si negatif, passe à 1... + + if (test < 0) { + PAtextnumber = -PAtextnumber; + //tempdouble = -tempdouble; + neg = 1; + } + + for (i = 0; PAtextnumber || (!PAtextnumber && !i); i++) { // tant que le nombre ne vaut pas 0 mais que i est positif, on continu à la convertir... + PAtext[i] = '0' + (PAtextnumber % 10); + PAtextnumber = PAtextnumber / 10; // Nombre de départ... + } + + if (neg) { + PAtext[i] = '-'; + ++i; + } + + for (i--; i > -1; i--) { + PA_PrintLetter(screen, PAtext[i]); + } + + j += 1; + + if (text[j] == 'f') { // Il reste donc la virgule à traiter... + PA_PrintLetter(screen, '.'); + i = text[j+1] - 48; // Nombre de chiffres après la virgule... + PAtext[1] = 0; // Permet de stopper si c'est vba... + + if (tempdouble < 0) tempdouble = -tempdouble; + + while ((i-- > 0)) { // Pas plus de 6 chiffres après la virgule... + tempdouble *= 10; + //if ( + PAtextnumber = (s32)tempdouble; + tempdouble -= PAtextnumber; + PAtext[0] = '0' + PAtextnumber; + PA_PrintLetter(screen, PAtext[0]); + } + + j += 1; + } + } else if ((text[j+3] == 'd') && (text[j+1] != ' ') && (text[j+2] != ' ')) { // C'est plus loin, donc on a genre %02d... + PAtextnumber = va_arg(varg, s32); + s8 neg = 0; // Si negatif, passe à 1... + u8 amettre = text[j+1]; // Nombre à mettre pour remplir + s8 nfois = text[j+2] - '0'; // Nombre de caractères à mettre + + if (PAtextnumber < 0) { + PAtextnumber = -PAtextnumber; + neg = 1; + } + + for (i = 0; PAtextnumber || (!PAtextnumber && !i); i++) { // tant que le nombre ne vaut pas 0 mais que i est positif, on continu à la convertir... + PAtext[i] = 48 + (PAtextnumber % 10); + PAtextnumber = PAtextnumber / 10; // Nombre de départ... + nfois--; // Un nombre de moins à mettre... + } + + while (nfois > 0) { // On complète de 0 est tout... + PA_PrintLetter(screen, amettre); + --nfois; + } + + if (neg) { + PAtext[i] = '-'; + ++i; + } + + for (i--; i > -1; i--) { + PA_PrintLetter(screen, PAtext[i]); + } + + j += 3; + } else { // Sinon c'est juste + PA_PrintLetter(screen, text[j]); + } + } else if (text[j] == '\n') { + PA_PrintYPlus(screen); + } else if ((text[j] == '/') && (text[j+1] == 'n')) { + PA_PrintYPlus(screen); + j++; + } else { + PA_PrintLetter(screen, text[j]); + } + } + + va_end(varg); /* Terminaison. */ + PA_SetTextTileCol(screen, textcolor); // put back the old color +} diff --git a/source/arm9/PA_TextSpecial.c b/source/arm9/PA_TextSpecial.c index 1e30e59..bdb32a2 100644 --- a/source/arm9/PA_TextSpecial.c +++ b/source/arm9/PA_TextSpecial.c @@ -1,243 +1,243 @@ -#include - -void PA_EraseTextBox(u8 screen) { - s16 i, j; - - for (j = PA_TextBox[screen].y1 + 1; j < PA_TextBox[screen].y2; j++) - for (i = PA_TextBox[screen].x1 + 1; i < PA_TextBox[screen].x2; i++) - PA_SetTileLetter(screen, i, j, ' '); -} - -void PA_InitTextBorders(u8 screen, u8 x1, u8 y1, u8 x2, u8 y2) { - // Fill the text border info - PA_TextBox[screen].x1 = x1; - PA_TextBox[screen].x2 = x2; - PA_TextBox[screen].y1 = y1; - PA_TextBox[screen].y2 = y2; - // Init the text with border and all... - PA_SetMapTileEx(screen, PAbgtext[screen], x1, y1, 1, 0, 0, 0); // Top left corner - PA_SetMapTileEx(screen, PAbgtext[screen], x2, y1, 1, 1, 0, 0); // Top right corner flipped - PA_SetMapTileEx(screen, PAbgtext[screen], x1, y2, 1, 0, 1, 0); // Bottom left corner vflip - PA_SetMapTileEx(screen, PAbgtext[screen], x2, y2, 1, 1, 1, 0); // Bottom right corner vflip+hflip - s16 i, j; // Fill in the borders... - - for (i = x1 + 1; i < x2; i++) { - PA_SetMapTileEx(screen, PAbgtext[screen], i, y1, 2, 0, 0, 0); - PA_SetMapTileEx(screen, PAbgtext[screen], i, y2, 2, 0, 1, 0); - } - - for (j = y1 + 1; j < y2; j++) { - PA_SetMapTileEx(screen, PAbgtext[screen], x1, j, 3, 0, 0, 0); - PA_SetMapTileEx(screen, PAbgtext[screen], x2, j, 3, 1, 0, 0); - } - - PA_EraseTextBox(screen); -} - -u32 PA_BoxTextNoWrap(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit) { - u16 x = basex; - u16 y = basey; - u16 j; - u16 textcount = 0; // compte le nombre de lettres... - u8 loop = 1; // On continue... - BG_PALETTE[255 + (screen * 512)] = textcol[screen]; // On remet la couleur au cas o� on ait charg� du texte par-dessus... - - for (j = 0; text[j] && loop && (j < limit); j++) { - if (text[j] == '\n') { - x = basex; - y++; - - if (y > maxy) loop = 0; - } - //else if (text[j] == '\r') - else { - PA_SetTileLetter(screen, x, y, text[j]); - x++; - - if (x > maxx) { - x = basex; - y++; - - if (y > maxy) loop = 0; - } - } - - ++textcount; - } - - return textcount; -} - -u32 PA_BoxText(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit) { - s16 i, j; - s16 x, y; - x = basex; - y = basey; - u16 ylimit = maxy; - s16 length = 0; - s16 wordx = 0; // Longueur de mot - s16 wordletter = 0; - u8 textcolor = PAtext_pal[screen]; // save the screen color - // u8 goon = 1; - u8 temp = 1; - - for (i = 0; (text[i] && (y <= maxy) && (i < limit) && temp); i++) { - if (text[i] == '%') { - if (text[i+1] == 'c') { // change color ! - PA_SetTextTileCol(screen, text[i+2] - '0'); - i += 2; - limit += 3; // Don't count it in the limit - length -= 3; // Don't count them in the length - //PA_OutputText(0, 0, 0, "%d ", length); - } - } else if (text[i] == '\n') { - while (x < maxx) { // On efface tout ce qui suit - PA_SetTileLetter(screen, x, y, ' '); - x++; - } - - if (text[i+1] == ' ') { - i++; // On vire s'il y a un espace - limit++; - length--; - } - - x = basex; - y ++; - } else { - wordletter = 1; - wordx = 0; - - //PA_OutputText(0, 0, 0, "%d ", temp); - while (!((text[i+wordletter] <= 32) || ((text[i+wordletter] == '%') && (text[i+wordletter+1] == 'c')))) { // >= 32, donc si 0, '\n', on ' ' :) - wordx++; - wordletter++; - } - - //if (text[i+wordletter] == 0) loop = 0; - - if (x + wordx > maxx) { // On d�passe en X... - while (x < maxx) { // On efface tout ce qui suit - PA_SetTileLetter(screen, x, y, ' '); - x++; - } - - x = basex; - y ++; - - if (text[i] != ' ') { // On vire s'il y a un espace - if (y <= ylimit) { // Si on n'a pas d�pass�... - for (j = i; (j < (i + wordletter)) && (j < limit) && (text[j] != 0); j++) { - PA_SetTileLetter(screen, x, y, text[j]); - /*goon = goon && text[j]; - if (goon == 0) temp = 0; - PA_OutputText(0, x*4, y*4, "%d ", goon);*/ - x++; - i++; - } - - i--; - //i+=wordletter-1; - } // Sinon ca va s'arreter - else i--; // On n'a pas affich� la derniere lettre... - } - } else { // Si pas de passage � la ligne auto - s32 jmax = (i + wordletter); - - if (text[(i + wordletter-1)] < 32) jmax--; // On ne dessinera pas ce caract�re - - for (j = i; (j < jmax) && (j < limit) && (text[j] != 0); j++) { - PA_SetTileLetter(screen, x, y, text[j]); - /*goon = goon && text[j]; - if (goon == 0) temp = 0; - PA_OutputText(0, x*4, y*4, "%d ", goon); */ - x++; - i++; - } - - i--; - } - } - } - - length += i; - PA_SetTextTileCol(screen, textcolor); - return length; -} - -char *selectchar(const char *text, int begin, int end) { - char *text2 = (char*)malloc(sizeof(char) * (end - begin)); - int i; - - for (i = begin; i < end; i++)text2[i-begin] = text[i]; - - text2[i-begin+1] = '\0'; - return text2; -} -//defilement -void PA_OutputTextSpecial0(u8 screen, int x1, int y, const char *text) { - int i, k, x2 = strlen(text) + x1 + 1; - - for (i = x2; i > x1; i--) { - PA_OutputSimpleText(screen, i, y, selectchar(text, 0, x2 - x1 - 1)); - - for (k = 0; k < 30; k++)PA_WaitForVBL(); - - PA_OutputSimpleText(screen, i + strlen(selectchar(text, 0, x2 - x1 - 1)) - 1, y, " "); - } -} -//separation -void PA_OutputTextSpecial1(u8 screen, int x1, int y, const char *text) { - int i, k, x2 = strlen(text) + x1 + 1; - - for (i = x2; i > x1; i--) { - PA_OutputSimpleText(screen, i + strlen(selectchar(text, 0, i - x1 - 1)), y, " "); - PA_OutputSimpleText(screen, i, y, selectchar(text, 0, i - x1 - 1)); - - for (k = 0; k < 30; k++)PA_WaitForVBL(); - } -} -//etirement -void PA_OutputTextSpecial2(u8 screen, int x1, int y, const char *text) { - int i, k, x2 = strlen(text) + x1; - - for (i = x2; i > x1; i--) { - PA_OutputSimpleText(screen, i, y, selectchar(text, 0, i - x1)); - - for (k = 0; k < 30; k++)PA_WaitForVBL(); - } -} -//etirement + suppression de la fin -void PA_OutputTextSpecial3(u8 screen, int x1, int y, const char *text) { - int i, k, x2 = strlen(text) + x1 + 1; - - for (i = x2; i > x1; i--) { - PA_OutputSimpleText(screen, x2 + strlen(selectchar(text, 0, i - x1 - 1)) + 1, y, " "); - PA_OutputSimpleText(screen, i, y, selectchar(text, 0, i - x1 - 1)); - - for (k = 0; k < 30; k++)PA_WaitForVBL(); - } -} -//etirement + separation -void PA_OutputTextSpecial4(u8 screen, int x1, int y, const char *text) { - int i, k, x2 = strlen(text) + x1 + 1; - - for (i = x2; i > x1; i--) { - PA_OutputSimpleText(screen, i + strlen(selectchar(text, 0, i - x1)), y, " "); - PA_OutputSimpleText(screen, i, y, selectchar(text, 0, i - x1 - 1)); - - for (k = 0; k < 30; k++)PA_WaitForVBL(); - } -} -//defilement + suppression -void PA_OutputTextSpecial5(u8 screen, int x1, int y, const char *text) { - int i, k, x2 = strlen(text) + x1 + 1; - - for (i = x2; i > x1; i--) { - PA_OutputSimpleText(screen, i, y, selectchar(text, 0, i - x1 - 1)); - - for (k = 0; k < 30; k++)PA_WaitForVBL(); - - PA_OutputSimpleText(screen, i + strlen(selectchar(text, 0, i - x1 - 1)) - 2, y, " "); - } -} +#include + +void PA_EraseTextBox(u8 screen) { + s16 i, j; + + for (j = PA_TextBox[screen].y1 + 1; j < PA_TextBox[screen].y2; j++) + for (i = PA_TextBox[screen].x1 + 1; i < PA_TextBox[screen].x2; i++) + PA_SetTileLetter(screen, i, j, ' '); +} + +void PA_InitTextBorders(u8 screen, u8 x1, u8 y1, u8 x2, u8 y2) { + // Fill the text border info + PA_TextBox[screen].x1 = x1; + PA_TextBox[screen].x2 = x2; + PA_TextBox[screen].y1 = y1; + PA_TextBox[screen].y2 = y2; + // Init the text with border and all... + PA_SetMapTileEx(screen, PAbgtext[screen], x1, y1, 1, 0, 0, 0); // Top left corner + PA_SetMapTileEx(screen, PAbgtext[screen], x2, y1, 1, 1, 0, 0); // Top right corner flipped + PA_SetMapTileEx(screen, PAbgtext[screen], x1, y2, 1, 0, 1, 0); // Bottom left corner vflip + PA_SetMapTileEx(screen, PAbgtext[screen], x2, y2, 1, 1, 1, 0); // Bottom right corner vflip+hflip + s16 i, j; // Fill in the borders... + + for (i = x1 + 1; i < x2; i++) { + PA_SetMapTileEx(screen, PAbgtext[screen], i, y1, 2, 0, 0, 0); + PA_SetMapTileEx(screen, PAbgtext[screen], i, y2, 2, 0, 1, 0); + } + + for (j = y1 + 1; j < y2; j++) { + PA_SetMapTileEx(screen, PAbgtext[screen], x1, j, 3, 0, 0, 0); + PA_SetMapTileEx(screen, PAbgtext[screen], x2, j, 3, 1, 0, 0); + } + + PA_EraseTextBox(screen); +} + +u32 PA_BoxTextNoWrap(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit) { + u16 x = basex; + u16 y = basey; + u16 j; + u16 textcount = 0; // compte le nombre de lettres... + u8 loop = 1; // On continue... + BG_PALETTE[255 + (screen * 512)] = textcol[screen]; // On remet la couleur au cas o� on ait charg� du texte par-dessus... + + for (j = 0; text[j] && loop && (j < limit); j++) { + if (text[j] == '\n') { + x = basex; + y++; + + if (y > maxy) loop = 0; + } + //else if (text[j] == '\r') + else { + PA_SetTileLetter(screen, x, y, text[j]); + x++; + + if (x > maxx) { + x = basex; + y++; + + if (y > maxy) loop = 0; + } + } + + ++textcount; + } + + return textcount; +} + +u32 PA_BoxText(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit) { + s16 i, j; + s16 x, y; + x = basex; + y = basey; + u16 ylimit = maxy; + s16 length = 0; + s16 wordx = 0; // Longueur de mot + s16 wordletter = 0; + u8 textcolor = PAtext_pal[screen]; // save the screen color + // u8 goon = 1; + u8 temp = 1; + + for (i = 0; (text[i] && (y <= maxy) && (i < limit) && temp); i++) { + if (text[i] == '%') { + if (text[i+1] == 'c') { // change color ! + PA_SetTextTileCol(screen, text[i+2] - '0'); + i += 2; + limit += 3; // Don't count it in the limit + length -= 3; // Don't count them in the length + //PA_OutputText(0, 0, 0, "%d ", length); + } + } else if (text[i] == '\n') { + while (x < maxx) { // On efface tout ce qui suit + PA_SetTileLetter(screen, x, y, ' '); + x++; + } + + if (text[i+1] == ' ') { + i++; // On vire s'il y a un espace + limit++; + length--; + } + + x = basex; + y ++; + } else { + wordletter = 1; + wordx = 0; + + //PA_OutputText(0, 0, 0, "%d ", temp); + while (!((text[i+wordletter] <= 32) || ((text[i+wordletter] == '%') && (text[i+wordletter+1] == 'c')))) { // >= 32, donc si 0, '\n', on ' ' :) + wordx++; + wordletter++; + } + + //if (text[i+wordletter] == 0) loop = 0; + + if (x + wordx > maxx) { // On d�passe en X... + while (x < maxx) { // On efface tout ce qui suit + PA_SetTileLetter(screen, x, y, ' '); + x++; + } + + x = basex; + y ++; + + if (text[i] != ' ') { // On vire s'il y a un espace + if (y <= ylimit) { // Si on n'a pas d�pass�... + for (j = i; (j < (i + wordletter)) && (j < limit) && (text[j] != 0); j++) { + PA_SetTileLetter(screen, x, y, text[j]); + /*goon = goon && text[j]; + if (goon == 0) temp = 0; + PA_OutputText(0, x*4, y*4, "%d ", goon);*/ + x++; + i++; + } + + i--; + //i+=wordletter-1; + } // Sinon ca va s'arreter + else i--; // On n'a pas affich� la derniere lettre... + } + } else { // Si pas de passage � la ligne auto + s32 jmax = (i + wordletter); + + if (text[(i + wordletter-1)] < 32) jmax--; // On ne dessinera pas ce caract�re + + for (j = i; (j < jmax) && (j < limit) && (text[j] != 0); j++) { + PA_SetTileLetter(screen, x, y, text[j]); + /*goon = goon && text[j]; + if (goon == 0) temp = 0; + PA_OutputText(0, x*4, y*4, "%d ", goon); */ + x++; + i++; + } + + i--; + } + } + } + + length += i; + PA_SetTextTileCol(screen, textcolor); + return length; +} + +char *selectchar(const char *text, int begin, int end) { + char *text2 = (char*)malloc(sizeof(char) * (end - begin)); + int i; + + for (i = begin; i < end; i++)text2[i-begin] = text[i]; + + text2[i-begin+1] = '\0'; + return text2; +} +//defilement +void PA_OutputTextSpecial0(u8 screen, int x1, int y, const char *text) { + int i, k, x2 = strlen(text) + x1 + 1; + + for (i = x2; i > x1; i--) { + PA_OutputSimpleText(screen, i, y, selectchar(text, 0, x2 - x1 - 1)); + + for (k = 0; k < 30; k++)PA_WaitForVBL(); + + PA_OutputSimpleText(screen, i + strlen(selectchar(text, 0, x2 - x1 - 1)) - 1, y, " "); + } +} +//separation +void PA_OutputTextSpecial1(u8 screen, int x1, int y, const char *text) { + int i, k, x2 = strlen(text) + x1 + 1; + + for (i = x2; i > x1; i--) { + PA_OutputSimpleText(screen, i + strlen(selectchar(text, 0, i - x1 - 1)), y, " "); + PA_OutputSimpleText(screen, i, y, selectchar(text, 0, i - x1 - 1)); + + for (k = 0; k < 30; k++)PA_WaitForVBL(); + } +} +//etirement +void PA_OutputTextSpecial2(u8 screen, int x1, int y, const char *text) { + int i, k, x2 = strlen(text) + x1; + + for (i = x2; i > x1; i--) { + PA_OutputSimpleText(screen, i, y, selectchar(text, 0, i - x1)); + + for (k = 0; k < 30; k++)PA_WaitForVBL(); + } +} +//etirement + suppression de la fin +void PA_OutputTextSpecial3(u8 screen, int x1, int y, const char *text) { + int i, k, x2 = strlen(text) + x1 + 1; + + for (i = x2; i > x1; i--) { + PA_OutputSimpleText(screen, x2 + strlen(selectchar(text, 0, i - x1 - 1)) + 1, y, " "); + PA_OutputSimpleText(screen, i, y, selectchar(text, 0, i - x1 - 1)); + + for (k = 0; k < 30; k++)PA_WaitForVBL(); + } +} +//etirement + separation +void PA_OutputTextSpecial4(u8 screen, int x1, int y, const char *text) { + int i, k, x2 = strlen(text) + x1 + 1; + + for (i = x2; i > x1; i--) { + PA_OutputSimpleText(screen, i + strlen(selectchar(text, 0, i - x1)), y, " "); + PA_OutputSimpleText(screen, i, y, selectchar(text, 0, i - x1 - 1)); + + for (k = 0; k < 30; k++)PA_WaitForVBL(); + } +} +//defilement + suppression +void PA_OutputTextSpecial5(u8 screen, int x1, int y, const char *text) { + int i, k, x2 = strlen(text) + x1 + 1; + + for (i = x2; i > x1; i--) { + PA_OutputSimpleText(screen, i, y, selectchar(text, 0, i - x1 - 1)); + + for (k = 0; k < 30; k++)PA_WaitForVBL(); + + PA_OutputSimpleText(screen, i + strlen(selectchar(text, 0, i - x1 - 1)) - 2, y, " "); + } +} diff --git a/source/arm9/PA_Timer.c b/source/arm9/PA_Timer.c index 802a479..6538336 100644 --- a/source/arm9/PA_Timer.c +++ b/source/arm9/PA_Timer.c @@ -1,78 +1,78 @@ -#include "PA_Timer.h" - -#define TICK ((TIMER1_DATA>>5) + (TIMER2_DATA<<11)) -struct tTimeMgr gTime; - -void StartTime(u8 bNew){ - struct tTimer* pTimer = &(gTime.rBank[0]); - pTimer->bRunning = true; - - if(!bNew){ - pTimer->nRefTick -= TICK - pTimer->nRefTick; - return; - } - - pTimer->nRefTick = 0; - TIMER1_DATA = 0; - TIMER2_DATA = 0; - TIMER1_CR = TIMER_DIV_1024 | TIMER_ENABLE; - TIMER2_CR = TIMER_CASCADE | TIMER_ENABLE; - gTime.nCount = 1; -} - -void PauseTime(){ - struct tTimer * pTimer = &(gTime.rBank[0]); -// ASSERT(pTimer != NULL); - pTimer->bRunning = false; -} - -u8 NewTimer(u8 bStarted){ - struct tTimer * pTimer = NULL; -// ASSERT(gTime.nCount < TIME_MGR_CAPACITY-1); - pTimer = &(gTime.rBank[gTime.nCount]); -// ASSERT(pTimer != NULL); - pTimer->bRunning = bStarted; - pTimer->nRefTick = 0; - - if (bStarted) - pTimer->nRefTick = TICK; - - return gTime.nCount++; -} - -void StartTimer(u8 nTimerId){ - struct tTimer * pTimer = &(gTime.rBank[nTimerId]); -// ASSERT(pTimer != NULL); - pTimer->bRunning = true; - pTimer->nRefTick = TICK - pTimer->nRefTick; -} - -u32 Tick(u8 nTimerId){ - struct tTimer * pTimer = &(gTime.rBank[nTimerId]); -// ASSERT(pTimer != NULL); - - if (pTimer->bRunning == true) - return TICK - pTimer->nRefTick; - - return pTimer->nRefTick; -} - -void PauseTimer(u8 nTimerId){ - struct tTimer* pTimer = &(gTime.rBank[nTimerId]); -// ASSERT(pTimer != NULL); - pTimer->nPauseTick = TICK; - pTimer->bRunning = false; -} - -void UnpauseTimer(u8 nTimerId){ - struct tTimer* pTimer = &(gTime.rBank[nTimerId]); -// ASSERT(pTimer != NULL); - pTimer->nRefTick += TICK - pTimer->nPauseTick; - pTimer->bRunning = true; -} - -void ResetTimer(u8 nTimerId){ - struct tTimer * pTimer = &(gTime.rBank[nTimerId]); -// ASSERT(pTimer != NULL); - pTimer->nRefTick = TICK; -} +#include "PA_Timer.h" + +#define TICK ((TIMER1_DATA>>5) + (TIMER2_DATA<<11)) +struct tTimeMgr gTime; + +void StartTime(u8 bNew){ + struct tTimer* pTimer = &(gTime.rBank[0]); + pTimer->bRunning = true; + + if(!bNew){ + pTimer->nRefTick -= TICK - pTimer->nRefTick; + return; + } + + pTimer->nRefTick = 0; + TIMER1_DATA = 0; + TIMER2_DATA = 0; + TIMER1_CR = TIMER_DIV_1024 | TIMER_ENABLE; + TIMER2_CR = TIMER_CASCADE | TIMER_ENABLE; + gTime.nCount = 1; +} + +void PauseTime(){ + struct tTimer * pTimer = &(gTime.rBank[0]); +// ASSERT(pTimer != NULL); + pTimer->bRunning = false; +} + +u8 NewTimer(u8 bStarted){ + struct tTimer * pTimer = NULL; +// ASSERT(gTime.nCount < TIME_MGR_CAPACITY-1); + pTimer = &(gTime.rBank[gTime.nCount]); +// ASSERT(pTimer != NULL); + pTimer->bRunning = bStarted; + pTimer->nRefTick = 0; + + if (bStarted) + pTimer->nRefTick = TICK; + + return gTime.nCount++; +} + +void StartTimer(u8 nTimerId){ + struct tTimer * pTimer = &(gTime.rBank[nTimerId]); +// ASSERT(pTimer != NULL); + pTimer->bRunning = true; + pTimer->nRefTick = TICK - pTimer->nRefTick; +} + +u32 Tick(u8 nTimerId){ + struct tTimer * pTimer = &(gTime.rBank[nTimerId]); +// ASSERT(pTimer != NULL); + + if (pTimer->bRunning == true) + return TICK - pTimer->nRefTick; + + return pTimer->nRefTick; +} + +void PauseTimer(u8 nTimerId){ + struct tTimer* pTimer = &(gTime.rBank[nTimerId]); +// ASSERT(pTimer != NULL); + pTimer->nPauseTick = TICK; + pTimer->bRunning = false; +} + +void UnpauseTimer(u8 nTimerId){ + struct tTimer* pTimer = &(gTime.rBank[nTimerId]); +// ASSERT(pTimer != NULL); + pTimer->nRefTick += TICK - pTimer->nPauseTick; + pTimer->bRunning = true; +} + +void ResetTimer(u8 nTimerId){ + struct tTimer * pTimer = &(gTime.rBank[nTimerId]); +// ASSERT(pTimer != NULL); + pTimer->nRefTick = TICK; +} diff --git a/source/arm9/PA_Wifi.c b/source/arm9/PA_Wifi.c index 4db6e91..76bcd7d 100644 --- a/source/arm9/PA_Wifi.c +++ b/source/arm9/PA_Wifi.c @@ -1,238 +1,238 @@ -#include - -#include - -#include -#include -#include -#include - -#ifdef FD_SETSIZE -#undef FD_SETSIZE -#endif -#include -#include -#include - -#define IS_DIGIT_OR_DOT(c) (isdigit(c)||((c)=='.')) -#define IS_INETADDR(s) (IS_DIGIT_OR_DOT(s[0])&&IS_DIGIT_OR_DOT(s[1])&&IS_DIGIT_OR_DOT(s[2])&&IS_DIGIT_OR_DOT(s[3])&&IS_DIGIT_OR_DOT(s[4])&&IS_DIGIT_OR_DOT(s[5])&&IS_DIGIT_OR_DOT(s[6])) - -bool PA_ConnectWifiWFC() { - int wifiStatus = ASSOCSTATUS_DISCONNECTED; - Wifi_AutoConnect(); // request connect - - while (wifiStatus != ASSOCSTATUS_ASSOCIATED) { - wifiStatus = Wifi_AssocStatus(); // check status - - if (wifiStatus == ASSOCSTATUS_CANNOTCONNECT) return false; - } - - return true; -} - -unsigned long makelong(unsigned char data1, unsigned char data2, unsigned char data3, unsigned char data4) { - return (data4 << 24) | (data3 << 16) | (data2 << 8) | data1; -} - -unsigned long PA_chartoip(char *message) { - int i, j; - unsigned char data[4]; - int debut = 0; - - for (j = 0; j < 4; j++) { - char buffer[256]; - - for (i = debut; message[i] != '.' && message[i] != '\0'; i++) { - buffer[i-debut] = message[i]; - } - - buffer[i-debut] = '\0'; - debut = i + 1; - data[j] = atoi(buffer); - } - - return makelong(data[0], data[1], data[2], data[3]); -} - -int PA_InitSocket(int* sock, char *host, int port, int mode) { - unsigned long ip; - struct sockaddr_in servaddr; - *sock = socket(AF_INET, SOCK_STREAM, 0); - - if (IS_INETADDR(host)) - ip = PA_chartoip(host); - else - ip = *(unsigned long *)gethostbyname(host)->h_addr_list[0]; - - servaddr.sin_family = AF_INET; - servaddr.sin_port = htons(port); - servaddr.sin_addr.s_addr = ip; - - if (mode == PA_NORMAL_TCP) { - if (connect(*sock, (struct sockaddr *) &servaddr, sizeof(servaddr)) == 0) - return 1; - } else if (mode == PA_NONBLOCKING_TCP) { - if (connect(*sock, (struct sockaddr *) &servaddr, sizeof(servaddr)) == 0) { - int i = 1; - ioctl(*sock, FIONBIO, &i); - return 1; - } - } - - return 0; -} - -int PA_InitServer(int* sock, int port, int mode, int num_connect) { - int i; - struct sockaddr_in servaddr; - *sock = socket(AF_INET, SOCK_STREAM, 0); - servaddr.sin_family = AF_INET; - servaddr.sin_port = htons(port); - servaddr.sin_addr.s_addr = 0; - - if (mode == PA_NORMAL_TCP) { - bind(*sock, (struct sockaddr *)&servaddr, sizeof(servaddr)); - listen(*sock, num_connect); - return 1; - } else if (mode == PA_NONBLOCKING_TCP) { - bind(*sock, (struct sockaddr *)&servaddr, sizeof(servaddr)); - i = 1; - ioctl(*sock, FIONBIO, &i); - listen(*sock, num_connect); - return 1; - } - - return 0; -} - -int search_word(char *mot1, char *mot2, int depart) { - int i, j, erreur = 1; - - for (i = depart; i < strlen(mot1); i++) { - if (mot1[i] == mot2[0]) { - erreur = 0; - - for (j = 0; j < strlen(mot2); j++) - if (mot2[j] != mot1[i+j]) - erreur = 1; - - if (erreur == 0) - return i; - } - } - - return -1; -} - -int get_HTTP_serveur(char *buffer, char *buffer2) { - int i, depart = 0; - - if (search_word(buffer2, "http://", 0) != -1) - depart += 7; - - for (i = depart; buffer2[i] != '\0' && buffer2[i] != '/' && buffer2[i] != '\\'; i++) { - buffer[i-depart] = buffer2[i]; - } - - buffer[i-depart] = '\0'; - return i; -} - -// LeaderBoard functions -// I had to put it in here because it gave me some weird errors bcus of redefinitions - -int pa_transferScore(char *buffer, char *adress); -int pa_httpServer(char *buffer, char *buffer2); -int pa_wordSearch(char *mot1, char *mot2, int depart); - -//Ideally - you shouldn't need to change any of this code. -bool PA_SubmitScore(char *response, char *gamekey, char *playername, int score, char *level, u8 responsetype) { - bool returnval = true; - - if (PA_ConnectWifiWFC()) { - PA_WaitForVBL(); - char url[256]; - sprintf(url, "http://leaderboard.palib.info/submitscore.php?gamekey=%s&playername=%s&levelname=%s&score=%d&responsetype=%d&end", gamekey, playername, level, score, responsetype); - pa_transferScore(response, url); - } else { - returnval = false; - } - - PA_WaitForVBL(); - Wifi_DisconnectAP(); - PA_WaitForVBL(); - Wifi_DisableWifi(); - return returnval; -} - -//modified version of: int PA_GetHTTP(char *buffer, char *adress); -int pa_transferScore(char *buffer, char *adress) { - int sock; - char serveur[256]; - char buffer3[256]; - int pos = pa_httpServer(serveur, adress); - PA_InitSocket(&sock, serveur, 80, PA_NONBLOCKING_TCP); - char buffer2[256]; - sprintf(buffer2, "GET %s HTTP/1.0\r\nhost: %s\r\nAccept: */*\r\n\r\n", adress + pos, serveur); - send(sock, buffer2, 256, 0); - strcpy(buffer, ""); - - while (pa_wordSearch(buffer3, "\r\n\r\n", 0) == -1) { - if (Pad.Newpress.Start) break; - - memset(buffer3, 0, sizeof(buffer3)); - recv(sock, buffer3, 256, 0); - } - - int poshtml = pa_wordSearch(buffer3, "\r\n\r\n", 0) + 4; - strcat(buffer, buffer3 + poshtml); - - while (1) { //wordSearch(buffer,"-----",0) == -1) - if (Pad.Newpress.Start) break; - - memset(buffer3, 0, sizeof(buffer3)); - - if (recv(sock, buffer3, 256, 0) < 1) break; - - strcat(buffer, buffer3); - } - - if (sock) closesocket(sock); - - return 1; -} - -//modified version of: int get_HTTP_serveurx(char *buffer, char *buffer2); -int pa_httpServer(char *buffer, char *buffer2) { - int i, depart = 0; - - if (pa_wordSearch(buffer2, "http://", 0) != -1) - depart += 7; - - for (i = depart; buffer2[i] != '\0' && buffer2[i] != '/' && buffer2[i] != '\\'; i++) { - buffer[i-depart] = buffer2[i]; - } - - buffer[i-depart] = '\0'; - return i; -} - -//modified version of: int search_word(char *mot1, char *mot2, int depart); -int pa_wordSearch(char *mot1, char *mot2, int depart) { - int i, j, erreur = 1; - - for (i = depart; i < strlen(mot1); i++) { - if (mot1[i] == mot2[0]) { - erreur = 0; - - for (j = 0; j < strlen(mot2); j++) - if (mot2[j] != mot1[i+j]) - erreur = 1; - - if (erreur == 0) - return i; - } - } - - return -1; -} +#include + +#include + +#include +#include +#include +#include + +#ifdef FD_SETSIZE +#undef FD_SETSIZE +#endif +#include +#include +#include + +#define IS_DIGIT_OR_DOT(c) (isdigit(c)||((c)=='.')) +#define IS_INETADDR(s) (IS_DIGIT_OR_DOT(s[0])&&IS_DIGIT_OR_DOT(s[1])&&IS_DIGIT_OR_DOT(s[2])&&IS_DIGIT_OR_DOT(s[3])&&IS_DIGIT_OR_DOT(s[4])&&IS_DIGIT_OR_DOT(s[5])&&IS_DIGIT_OR_DOT(s[6])) + +bool PA_ConnectWifiWFC() { + int wifiStatus = ASSOCSTATUS_DISCONNECTED; + Wifi_AutoConnect(); // request connect + + while (wifiStatus != ASSOCSTATUS_ASSOCIATED) { + wifiStatus = Wifi_AssocStatus(); // check status + + if (wifiStatus == ASSOCSTATUS_CANNOTCONNECT) return false; + } + + return true; +} + +unsigned long makelong(unsigned char data1, unsigned char data2, unsigned char data3, unsigned char data4) { + return (data4 << 24) | (data3 << 16) | (data2 << 8) | data1; +} + +unsigned long PA_chartoip(char *message) { + int i, j; + unsigned char data[4]; + int debut = 0; + + for (j = 0; j < 4; j++) { + char buffer[256]; + + for (i = debut; message[i] != '.' && message[i] != '\0'; i++) { + buffer[i-debut] = message[i]; + } + + buffer[i-debut] = '\0'; + debut = i + 1; + data[j] = atoi(buffer); + } + + return makelong(data[0], data[1], data[2], data[3]); +} + +int PA_InitSocket(int* sock, char *host, int port, int mode) { + unsigned long ip; + struct sockaddr_in servaddr; + *sock = socket(AF_INET, SOCK_STREAM, 0); + + if (IS_INETADDR(host)) + ip = PA_chartoip(host); + else + ip = *(unsigned long *)gethostbyname(host)->h_addr_list[0]; + + servaddr.sin_family = AF_INET; + servaddr.sin_port = htons(port); + servaddr.sin_addr.s_addr = ip; + + if (mode == PA_NORMAL_TCP) { + if (connect(*sock, (struct sockaddr *) &servaddr, sizeof(servaddr)) == 0) + return 1; + } else if (mode == PA_NONBLOCKING_TCP) { + if (connect(*sock, (struct sockaddr *) &servaddr, sizeof(servaddr)) == 0) { + int i = 1; + ioctl(*sock, FIONBIO, &i); + return 1; + } + } + + return 0; +} + +int PA_InitServer(int* sock, int port, int mode, int num_connect) { + int i; + struct sockaddr_in servaddr; + *sock = socket(AF_INET, SOCK_STREAM, 0); + servaddr.sin_family = AF_INET; + servaddr.sin_port = htons(port); + servaddr.sin_addr.s_addr = 0; + + if (mode == PA_NORMAL_TCP) { + bind(*sock, (struct sockaddr *)&servaddr, sizeof(servaddr)); + listen(*sock, num_connect); + return 1; + } else if (mode == PA_NONBLOCKING_TCP) { + bind(*sock, (struct sockaddr *)&servaddr, sizeof(servaddr)); + i = 1; + ioctl(*sock, FIONBIO, &i); + listen(*sock, num_connect); + return 1; + } + + return 0; +} + +int search_word(char *mot1, char *mot2, int depart) { + int i, j, erreur = 1; + + for (i = depart; i < strlen(mot1); i++) { + if (mot1[i] == mot2[0]) { + erreur = 0; + + for (j = 0; j < strlen(mot2); j++) + if (mot2[j] != mot1[i+j]) + erreur = 1; + + if (erreur == 0) + return i; + } + } + + return -1; +} + +int get_HTTP_serveur(char *buffer, char *buffer2) { + int i, depart = 0; + + if (search_word(buffer2, "http://", 0) != -1) + depart += 7; + + for (i = depart; buffer2[i] != '\0' && buffer2[i] != '/' && buffer2[i] != '\\'; i++) { + buffer[i-depart] = buffer2[i]; + } + + buffer[i-depart] = '\0'; + return i; +} + +// LeaderBoard functions +// I had to put it in here because it gave me some weird errors bcus of redefinitions + +int pa_transferScore(char *buffer, char *adress); +int pa_httpServer(char *buffer, char *buffer2); +int pa_wordSearch(char *mot1, char *mot2, int depart); + +//Ideally - you shouldn't need to change any of this code. +bool PA_SubmitScore(char *response, char *gamekey, char *playername, int score, char *level, u8 responsetype) { + bool returnval = true; + + if (PA_ConnectWifiWFC()) { + PA_WaitForVBL(); + char url[256]; + sprintf(url, "http://leaderboard.palib.info/submitscore.php?gamekey=%s&playername=%s&levelname=%s&score=%d&responsetype=%d&end", gamekey, playername, level, score, responsetype); + pa_transferScore(response, url); + } else { + returnval = false; + } + + PA_WaitForVBL(); + Wifi_DisconnectAP(); + PA_WaitForVBL(); + Wifi_DisableWifi(); + return returnval; +} + +//modified version of: int PA_GetHTTP(char *buffer, char *adress); +int pa_transferScore(char *buffer, char *adress) { + int sock; + char serveur[256]; + char buffer3[256]; + int pos = pa_httpServer(serveur, adress); + PA_InitSocket(&sock, serveur, 80, PA_NONBLOCKING_TCP); + char buffer2[256]; + sprintf(buffer2, "GET %s HTTP/1.0\r\nhost: %s\r\nAccept: */*\r\n\r\n", adress + pos, serveur); + send(sock, buffer2, 256, 0); + strcpy(buffer, ""); + + while (pa_wordSearch(buffer3, "\r\n\r\n", 0) == -1) { + if (Pad.Newpress.Start) break; + + memset(buffer3, 0, sizeof(buffer3)); + recv(sock, buffer3, 256, 0); + } + + int poshtml = pa_wordSearch(buffer3, "\r\n\r\n", 0) + 4; + strcat(buffer, buffer3 + poshtml); + + while (1) { //wordSearch(buffer,"-----",0) == -1) + if (Pad.Newpress.Start) break; + + memset(buffer3, 0, sizeof(buffer3)); + + if (recv(sock, buffer3, 256, 0) < 1) break; + + strcat(buffer, buffer3); + } + + if (sock) closesocket(sock); + + return 1; +} + +//modified version of: int get_HTTP_serveurx(char *buffer, char *buffer2); +int pa_httpServer(char *buffer, char *buffer2) { + int i, depart = 0; + + if (pa_wordSearch(buffer2, "http://", 0) != -1) + depart += 7; + + for (i = depart; buffer2[i] != '\0' && buffer2[i] != '/' && buffer2[i] != '\\'; i++) { + buffer[i-depart] = buffer2[i]; + } + + buffer[i-depart] = '\0'; + return i; +} + +//modified version of: int search_word(char *mot1, char *mot2, int depart); +int pa_wordSearch(char *mot1, char *mot2, int depart) { + int i, j, erreur = 1; + + for (i = depart; i < strlen(mot1); i++) { + if (mot1[i] == mot2[0]) { + erreur = 0; + + for (j = 0; j < strlen(mot2); j++) + if (mot2[j] != mot1[i+j]) + erreur = 1; + + if (erreur == 0) + return i; + } + } + + return -1; +} diff --git a/source/arm9/TiledFont/all_gfx.h b/source/arm9/TiledFont/all_gfx.h index 80e3e1c..1bb4eaf 100644 --- a/source/arm9/TiledFont/all_gfx.h +++ b/source/arm9/TiledFont/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#define _GFX_ALIGN __attribute__((aligned (4))) - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct PA_TiledFont; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#define _GFX_ALIGN __attribute__((aligned (4))) + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct PA_TiledFont; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/source/arm9/TiledFont/bin/PA_TiledFont.c b/source/arm9/TiledFont/bin/PA_TiledFont.c index b098183..1cb7f18 100644 --- a/source/arm9/TiledFont/bin/PA_TiledFont.c +++ b/source/arm9/TiledFont/bin/PA_TiledFont.c @@ -1,17 +1,17 @@ -#include - -#include "PA_TiledFont_Tiles_bin.h" -#include "PA_TiledFont_Map_bin.h" -#include "PA_TiledFont_Pal_bin.h" - -const PA_BgStruct PA_TiledFont = { - PA_BgNormal, - 256, 192, - - PA_TiledFont_Tiles_bin, - PA_TiledFont_Map_bin, - {PA_TiledFont_Pal_bin}, - - 13248, - {1536} -}; +#include + +#include "PA_TiledFont_Tiles_bin.h" +#include "PA_TiledFont_Map_bin.h" +#include "PA_TiledFont_Pal_bin.h" + +const PA_BgStruct PA_TiledFont = { + PA_BgNormal, + 256, 192, + + PA_TiledFont_Tiles_bin, + PA_TiledFont_Map_bin, + {PA_TiledFont_Pal_bin}, + + 13248, + {1536} +}; diff --git a/source/arm9/TransBg/all_gfx.h b/source/arm9/TransBg/all_gfx.h index 98e7a6c..9c8959e 100644 --- a/source/arm9/TransBg/all_gfx.h +++ b/source/arm9/TransBg/all_gfx.h @@ -1,20 +1,20 @@ -// Graphics converted using PAGfx by Mollusk. - -#pragma once - -#include - -#define _GFX_ALIGN __attribute__((aligned (4))) - -#ifdef __cplusplus -extern "C"{ -#endif - -// Backgrounds: -extern const PA_BgStruct PA_TransBg; - -// Palettes: - -#ifdef __cplusplus -} -#endif +// Graphics converted using PAGfx by Mollusk. + +#pragma once + +#include + +#define _GFX_ALIGN __attribute__((aligned (4))) + +#ifdef __cplusplus +extern "C"{ +#endif + +// Backgrounds: +extern const PA_BgStruct PA_TransBg; + +// Palettes: + +#ifdef __cplusplus +} +#endif diff --git a/source/arm9/TransBg/bin/PA_TransBg.c b/source/arm9/TransBg/bin/PA_TransBg.c index 79233a5..9124620 100644 --- a/source/arm9/TransBg/bin/PA_TransBg.c +++ b/source/arm9/TransBg/bin/PA_TransBg.c @@ -1,17 +1,17 @@ -#include - -#include "PA_TransBg_Tiles_bin.h" -#include "PA_TransBg_Map_bin.h" -#include "PA_TransBg_Pal_bin.h" - -const PA_BgStruct PA_TransBg = { - PA_BgNormal, - 256, 192, - - PA_TransBg_Tiles_bin, - PA_TransBg_Map_bin, - {PA_TransBg_Pal_bin}, - - 3584, - {1536} -}; +#include + +#include "PA_TransBg_Tiles_bin.h" +#include "PA_TransBg_Map_bin.h" +#include "PA_TransBg_Pal_bin.h" + +const PA_BgStruct PA_TransBg = { + PA_BgNormal, + 256, 192, + + PA_TransBg_Tiles_bin, + PA_TransBg_Map_bin, + {PA_TransBg_Pal_bin}, + + 3584, + {1536} +}; diff --git a/source/arm9/as_lib9.c b/source/arm9/as_lib9.c index ad5c09e..62eaa44 100644 --- a/source/arm9/as_lib9.c +++ b/source/arm9/as_lib9.c @@ -1,469 +1,469 @@ -/* - - Advanced Sound Library (ASlib) - ------------------------------ - - file : sound9.c - author : Lasorsa Yohan (Noda) - description : ARM7 sound functions - - history : - - 29/11/2007 - v1.0 - = Original release - - 07/02/2008 - v1.1 - - = corrected arm7/arm9 initialization (fix M3S/R4 problems) - = fixed stereo detection problem (thanks to ThomasS) - = corrected panning when surround is not activated - -*/ - -#include -#include -#include - -#include "as_lib9.h" - -// variable for the mp3 file stream -static MP3FILE *mp3file = NULL; -static u8* mp3filebuffer = NULL; -static bool as_mp3mode_enabled = false; - -// default settings for sounds -u8 as_default_format; -s32 as_default_rate; -u8 as_default_delay; - - -// initialize ASlib -bool AS_Init(u8 mode) -{ - int i, nb_chan = 16; - - as_mp3mode_enabled = false; - - // initialize default settings - as_default_format = AS_PCM_8BIT; - as_default_rate = 16384; // this is a good rate - as_default_delay = AS_SURROUND; - - // wait for the ARM7 to be ready - while( !(IPC_Sound->chan[0].cmd & SNDCMD_ARM7READY) ) - swiWaitForVBlank(); - - // initialize channels - for(i = 0; i < 16; i++) { - IPC_Sound->chan[i].busy = false; - IPC_Sound->chan[i].reserved = false; - IPC_Sound->chan[i].volume = 0; - IPC_Sound->chan[i].pan = 64; - IPC_Sound->chan[i].cmd = SNDCMD_NONE; - } - - // use only 8 channels - if(mode & AS_MODE_8CH) { - - nb_chan = 8; - for(i = 8; i < 16; i++) - IPC_Sound->chan[i].reserved = true; - } - - // use surround - if(mode & AS_MODE_SURROUND) { - - IPC_Sound->surround = true; - for(i = nb_chan / 2; i < nb_chan; i++) - IPC_Sound->chan[i].reserved = true; - - } else { - IPC_Sound->surround = false; - } - - IPC_Sound->num_chan = nb_chan / 2; - - // use mp3 - if(mode & AS_MODE_MP3) { - - // allocate ram for the ARM7 mp3 decoder - size_t alloc_ram_size = (size_t)IPC_Sound->mp3.alloc_ram; - IPC_Sound->mp3.alloc_ram = calloc(1, alloc_ram_size); - if(IPC_Sound->mp3.alloc_ram == NULL) - return false; - DC_FlushRange(IPC_Sound->mp3.alloc_ram, alloc_ram_size); - IPC_Sound->mp3.cmd = MP3CMD_ARM9ALLOCDONE; - - // initialize mp3 structure - IPC_Sound->mp3.mixbuffer = calloc(1, AS_AUDIOBUFFER_SIZE * 2); - if(IPC_Sound->mp3.mixbuffer == NULL) - return false; - DC_FlushRange(IPC_Sound->mp3.mixbuffer, AS_AUDIOBUFFER_SIZE * 2); - - IPC_Sound->mp3.buffersize = AS_AUDIOBUFFER_SIZE / 2; - IPC_Sound->mp3.channelL = 0; - IPC_Sound->mp3.prevtimer = 0; - IPC_Sound->mp3.soundcursor = 0; - IPC_Sound->mp3.numsamples = 0; - IPC_Sound->mp3.delay = AS_SURROUND; - IPC_Sound->mp3.cmd |= MP3CMD_INIT; - IPC_Sound->mp3.state = MP3ST_STOPPED; - - IPC_Sound->chan[0].reserved = true; - - if(IPC_Sound->surround) { - IPC_Sound->mp3.channelR = nb_chan / 2; - IPC_Sound->chan[nb_chan / 2].reserved = true; - } else { - IPC_Sound->mp3.channelR = 1; - IPC_Sound->chan[1].reserved = true; - } - - IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan = 64; - - // Allow othe MP3 functions to work - as_mp3mode_enabled = true; - - AS_SetMP3Volume(127); - - // wait for the mp3 engine to be initialized - while(IPC_Sound->mp3.cmd & MP3CMD_INIT) - swiWaitForVBlank(); - } - - AS_SetMasterVolume(127); - - return true; -} - -// play a sound using the priority system -// return the sound channel allocated or -1 if the sound was skipped -int AS_SoundPlay(SoundInfo sound) -{ - int i, free_ch = -1, minp_ch = -1; - - // search a free channel - for(i = 0; i < 16; i++) { - if(!(IPC_Sound->chan[i].reserved || IPC_Sound->chan[i].busy)) - free_ch = i; - } - - // if a free channel was found - if(free_ch != -1) { - - // play the sound - AS_SoundDirectPlay(free_ch, sound); - return free_ch; - - } else { - - // find the channel with the least priority - for(i = 0; i < 16; i++) { - if(!IPC_Sound->chan[i].reserved) { - if(minp_ch == -1) - minp_ch = i; - else if(IPC_Sound->chan[i].snd.priority < IPC_Sound->chan[minp_ch].snd.priority) - minp_ch = i; - } - } - - // if the priority of the found channel is <= the one of the sound - if( IPC_Sound->chan[minp_ch].snd.priority <= sound.priority) { - - // play the sound - AS_SoundDirectPlay(minp_ch, sound); - return minp_ch; - - } else { - - // skip the sound - return -1; - } - } -} - -// set the panning of a sound (0=left, 64=center, 127=right) -void AS_SetSoundPan(u8 chan, u8 pan) -{ - IPC_Sound->chan[chan].snd.pan = pan; - - if(IPC_Sound->surround) { - - int difference = ((pan - 64) >> AS_PANNING_SHIFT) * IPC_Sound->chan[chan].snd.volume / AS_VOL_NORMALIZE; - - IPC_Sound->chan[chan].pan = 0; - IPC_Sound->chan[chan].volume = IPC_Sound->chan[chan].snd.volume + difference; - - if(IPC_Sound->chan[chan].volume < 0) - IPC_Sound->chan[chan].volume = 0; - - IPC_Sound->chan[chan].cmd |= SNDCMD_SETVOLUME; - IPC_Sound->chan[chan].cmd |= SNDCMD_SETPAN; - - IPC_Sound->chan[chan + IPC_Sound->num_chan].pan = 127; - IPC_Sound->chan[chan + IPC_Sound->num_chan].volume = IPC_Sound->chan[chan].snd.volume - difference; - - if(IPC_Sound->chan[chan + IPC_Sound->num_chan].volume < 0) - IPC_Sound->chan[chan + IPC_Sound->num_chan].volume = 0; - - IPC_Sound->chan[chan + IPC_Sound->num_chan].cmd |= SNDCMD_SETVOLUME; - IPC_Sound->chan[chan + IPC_Sound->num_chan].cmd |= SNDCMD_SETPAN; - - } else { - - IPC_Sound->chan[chan].cmd |= SNDCMD_SETPAN; - IPC_Sound->chan[chan].pan = pan; - - } -} - -// set the volume of a sound (0..127) -void AS_SetSoundVolume(u8 chan, u8 volume) -{ - if(IPC_Sound->surround) { - IPC_Sound->chan[chan].snd.volume = volume * AS_BASE_VOLUME / 127; - AS_SetSoundPan(chan, IPC_Sound->chan[chan].snd.pan); - } else { - IPC_Sound->chan[chan].volume = volume; - IPC_Sound->chan[chan].cmd |= SNDCMD_SETVOLUME; - } -} - -// set the sound sample rate -void AS_SetSoundRate(u8 chan, u32 rate) -{ - IPC_Sound->chan[chan].snd.rate = rate; - IPC_Sound->chan[chan].cmd |= SNDCMD_SETRATE; - - if(IPC_Sound->surround) { - IPC_Sound->chan[chan + IPC_Sound->num_chan].snd.rate = rate; - IPC_Sound->chan[chan + IPC_Sound->num_chan].cmd |= SNDCMD_SETRATE; - } -} - -static inline void _AS_CopyToSoundIPC(SoundInfoAlign* out, SoundInfo* in){ - out->data = in->data; - out->size = in->size; - out->rate = in->rate; - out->format = in->format; - out->volume = in->volume; - out->pan = in->pan; - out->loop = in->loop; - out->priority = in->priority; - out->delay = in->delay; -} - -// play a sound directly using the given channel -void AS_SoundDirectPlay(u8 chan, SoundInfo sound) -{ - _AS_CopyToSoundIPC(&IPC_Sound->chan[chan].snd, &sound); - //IPC_Sound->chan[chan].snd = sound; - IPC_Sound->chan[chan].busy = true; - IPC_Sound->chan[chan].cmd = SNDCMD_PLAY; - IPC_Sound->chan[chan].volume = sound.volume; - - if(IPC_Sound->surround) { - _AS_CopyToSoundIPC(&IPC_Sound->chan[chan + IPC_Sound->num_chan].snd, &sound); - //IPC_Sound->chan[chan + IPC_Sound->num_chan].snd = sound; - IPC_Sound->chan[chan + IPC_Sound->num_chan].busy = true; - IPC_Sound->chan[chan + IPC_Sound->num_chan].cmd = SNDCMD_DELAY; - - // set the correct surround volume & pan - AS_SetSoundVolume(chan, sound.volume); - } else { - IPC_Sound->chan[chan].pan = sound.pan; - } -} - -// fill the given buffer with the required amount of mp3 data -bool AS_MP3FillBuffer(u8 *buffer, u32 bytes) -{ - if(!as_mp3mode_enabled) - return false; - - if(mp3file == NULL) - return false; - - u32 read = FILE_READ(buffer, 1, bytes, mp3file); - if (read == bytes) { - // Exit if we have read enough bytes. Note that fread() can't return a - // number bigger than the requested number of bytes, only the same or - // lower. - DC_FlushRange(buffer, bytes); - return true; - } - - // If we haven't read enough bytes, it may be that we have reached the end - // of the file or there has been a read error. - if (!feof(mp3file)) { - // If the end of the file hasn't been reached, there has been a read - // error. - IPC_Sound->mp3.cmd = MP3CMD_STOP; - return false; - } - - // If the song doesn't have to loop, fill the left of the buffer with zeroes - if (!IPC_Sound->mp3.loop) { - memset(buffer + read, 0, bytes - read); - DC_FlushRange(buffer, bytes); - return true; - } - - // The song is looping. Go back to the start of the file - int ret = FILE_SEEK(mp3file, 0, SEEK_SET); - if(ret != 0) { - IPC_Sound->mp3.cmd = MP3CMD_STOP; - return false; - } - - // Read the remaining bytes from the start of the file - u32 bytesleft = bytes - read; - read = FILE_READ(buffer + read, 1, bytesleft, mp3file); - if(read != bytesleft) { - IPC_Sound->mp3.cmd = MP3CMD_STOP; - return false; - } - - DC_FlushRange(buffer, bytes); - - return true; -} - -// play an mp3 directly from memory -void AS_MP3DirectPlay(u8 *mp3_data, u32 size) -{ - if(!as_mp3mode_enabled) - return; - - if(IPC_Sound->mp3.state & (MP3ST_PLAYING | MP3ST_PAUSED)) - return; - - IPC_Sound->mp3.mp3buffer = mp3_data; - IPC_Sound->mp3.mp3filesize = size; - IPC_Sound->mp3.stream = false; - IPC_Sound->mp3.cmd = MP3CMD_PLAY; -} - -// play an mp3 stream -bool AS_MP3StreamPlay(const char *path) -{ - if(!as_mp3mode_enabled) - return false; - - if(IPC_Sound->mp3.state & (MP3ST_PLAYING | MP3ST_PAUSED)) - return false; - - if (mp3file) { - FILE_CLOSE(mp3file); - mp3file = NULL; - } - - mp3file = FILE_OPEN(path); - - if(mp3file == NULL) - return false; - - // allocate the file buffer the first time - if(!mp3filebuffer) { - mp3filebuffer = calloc(1, AS_FILEBUFFER_SIZE * 2); // 2 buffers, to swap - if(!mp3filebuffer) - goto error; - - IPC_Sound->mp3.mp3buffer = mp3filebuffer; - IPC_Sound->mp3.mp3buffersize = AS_FILEBUFFER_SIZE; - } - - // get the file size - int ret = FILE_SEEK(mp3file, 0, SEEK_END); - if(ret != 0) - goto error; - - IPC_Sound->mp3.mp3filesize = FILE_TELL(mp3file); - - // fill the file buffer - ret = FILE_SEEK(mp3file, 0, SEEK_SET); - if(ret != 0) - goto error; - - // For the initial read, fill the two halves of the buffer - if (AS_MP3FillBuffer(mp3filebuffer, AS_FILEBUFFER_SIZE * 2) == false) - goto error; - - // start playing - IPC_Sound->mp3.stream = true; - IPC_Sound->mp3.cmd = MP3CMD_PLAY; - - return true; - -error: - FILE_CLOSE(mp3file); - mp3file = NULL; - - return false; -} - -// stop an mp3 -void AS_MP3Stop() -{ - if(!as_mp3mode_enabled) - return; - - // Always send the command, but only close the file if we're streaming MP3 - // from the filesystem. - IPC_Sound->mp3.cmd = MP3CMD_STOP; - - if(mp3file != NULL) { - FILE_CLOSE(mp3file); - mp3file = NULL; - } -} - -// set the mp3 panning (0=left, 64=center, 127=right) -void AS_SetMP3Pan(u8 pan) -{ - if(!as_mp3mode_enabled) - return; - - int difference = ((pan - 64) >> AS_PANNING_SHIFT) * IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.volume / AS_VOL_NORMALIZE; - - IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan = pan; - IPC_Sound->chan[IPC_Sound->mp3.channelL].pan = 0; - IPC_Sound->chan[IPC_Sound->mp3.channelL].volume = IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.volume - difference; - - if(IPC_Sound->chan[IPC_Sound->mp3.channelL].volume < 0) - IPC_Sound->chan[IPC_Sound->mp3.channelL].volume = 0; - - IPC_Sound->chan[IPC_Sound->mp3.channelL].cmd |= SNDCMD_SETVOLUME; - IPC_Sound->chan[IPC_Sound->mp3.channelL].cmd |= SNDCMD_SETPAN; - - IPC_Sound->chan[IPC_Sound->mp3.channelR].pan = 127; - IPC_Sound->chan[IPC_Sound->mp3.channelR].volume = IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.volume + difference; - - if(IPC_Sound->chan[IPC_Sound->mp3.channelR].volume < 0) - IPC_Sound->chan[IPC_Sound->mp3.channelR].volume = 0; - - IPC_Sound->chan[IPC_Sound->mp3.channelR].cmd |= SNDCMD_SETVOLUME; - IPC_Sound->chan[IPC_Sound->mp3.channelR].cmd |= SNDCMD_SETPAN; - -} - -// regenerate buffers for mp3 stream, must be called each VBlank (only needed if mp3 is used) -void AS_SoundVBL() -{ - if(!as_mp3mode_enabled) - return; - - // refill mp3 file buffer if needed - if(IPC_Sound->mp3.needdata) { - - // Reading from the filesystem may cause a yield from this thread, so - // interrupts need to be enabled for the yield to ever end. - REG_IME= 1; - - // Fill only half of the buffer - if(AS_MP3FillBuffer(IPC_Sound->mp3.mp3buffer + AS_FILEBUFFER_SIZE, AS_FILEBUFFER_SIZE)) - IPC_Sound->mp3.needdata = false; - else - IPC_Sound->mp3.cmd = MP3CMD_STOP; - } -} +/* + + Advanced Sound Library (ASlib) + ------------------------------ + + file : sound9.c + author : Lasorsa Yohan (Noda) + description : ARM7 sound functions + + history : + + 29/11/2007 - v1.0 + = Original release + + 07/02/2008 - v1.1 + + = corrected arm7/arm9 initialization (fix M3S/R4 problems) + = fixed stereo detection problem (thanks to ThomasS) + = corrected panning when surround is not activated + +*/ + +#include +#include +#include + +#include "as_lib9.h" + +// variable for the mp3 file stream +static MP3FILE *mp3file = NULL; +static u8* mp3filebuffer = NULL; +static bool as_mp3mode_enabled = false; + +// default settings for sounds +u8 as_default_format; +s32 as_default_rate; +u8 as_default_delay; + + +// initialize ASlib +bool AS_Init(u8 mode) +{ + int i, nb_chan = 16; + + as_mp3mode_enabled = false; + + // initialize default settings + as_default_format = AS_PCM_8BIT; + as_default_rate = 16384; // this is a good rate + as_default_delay = AS_SURROUND; + + // wait for the ARM7 to be ready + while( !(IPC_Sound->chan[0].cmd & SNDCMD_ARM7READY) ) + swiWaitForVBlank(); + + // initialize channels + for(i = 0; i < 16; i++) { + IPC_Sound->chan[i].busy = false; + IPC_Sound->chan[i].reserved = false; + IPC_Sound->chan[i].volume = 0; + IPC_Sound->chan[i].pan = 64; + IPC_Sound->chan[i].cmd = SNDCMD_NONE; + } + + // use only 8 channels + if(mode & AS_MODE_8CH) { + + nb_chan = 8; + for(i = 8; i < 16; i++) + IPC_Sound->chan[i].reserved = true; + } + + // use surround + if(mode & AS_MODE_SURROUND) { + + IPC_Sound->surround = true; + for(i = nb_chan / 2; i < nb_chan; i++) + IPC_Sound->chan[i].reserved = true; + + } else { + IPC_Sound->surround = false; + } + + IPC_Sound->num_chan = nb_chan / 2; + + // use mp3 + if(mode & AS_MODE_MP3) { + + // allocate ram for the ARM7 mp3 decoder + size_t alloc_ram_size = (size_t)IPC_Sound->mp3.alloc_ram; + IPC_Sound->mp3.alloc_ram = calloc(1, alloc_ram_size); + if(IPC_Sound->mp3.alloc_ram == NULL) + return false; + DC_FlushRange(IPC_Sound->mp3.alloc_ram, alloc_ram_size); + IPC_Sound->mp3.cmd = MP3CMD_ARM9ALLOCDONE; + + // initialize mp3 structure + IPC_Sound->mp3.mixbuffer = calloc(1, AS_AUDIOBUFFER_SIZE * 2); + if(IPC_Sound->mp3.mixbuffer == NULL) + return false; + DC_FlushRange(IPC_Sound->mp3.mixbuffer, AS_AUDIOBUFFER_SIZE * 2); + + IPC_Sound->mp3.buffersize = AS_AUDIOBUFFER_SIZE / 2; + IPC_Sound->mp3.channelL = 0; + IPC_Sound->mp3.prevtimer = 0; + IPC_Sound->mp3.soundcursor = 0; + IPC_Sound->mp3.numsamples = 0; + IPC_Sound->mp3.delay = AS_SURROUND; + IPC_Sound->mp3.cmd |= MP3CMD_INIT; + IPC_Sound->mp3.state = MP3ST_STOPPED; + + IPC_Sound->chan[0].reserved = true; + + if(IPC_Sound->surround) { + IPC_Sound->mp3.channelR = nb_chan / 2; + IPC_Sound->chan[nb_chan / 2].reserved = true; + } else { + IPC_Sound->mp3.channelR = 1; + IPC_Sound->chan[1].reserved = true; + } + + IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan = 64; + + // Allow othe MP3 functions to work + as_mp3mode_enabled = true; + + AS_SetMP3Volume(127); + + // wait for the mp3 engine to be initialized + while(IPC_Sound->mp3.cmd & MP3CMD_INIT) + swiWaitForVBlank(); + } + + AS_SetMasterVolume(127); + + return true; +} + +// play a sound using the priority system +// return the sound channel allocated or -1 if the sound was skipped +int AS_SoundPlay(SoundInfo sound) +{ + int i, free_ch = -1, minp_ch = -1; + + // search a free channel + for(i = 0; i < 16; i++) { + if(!(IPC_Sound->chan[i].reserved || IPC_Sound->chan[i].busy)) + free_ch = i; + } + + // if a free channel was found + if(free_ch != -1) { + + // play the sound + AS_SoundDirectPlay(free_ch, sound); + return free_ch; + + } else { + + // find the channel with the least priority + for(i = 0; i < 16; i++) { + if(!IPC_Sound->chan[i].reserved) { + if(minp_ch == -1) + minp_ch = i; + else if(IPC_Sound->chan[i].snd.priority < IPC_Sound->chan[minp_ch].snd.priority) + minp_ch = i; + } + } + + // if the priority of the found channel is <= the one of the sound + if( IPC_Sound->chan[minp_ch].snd.priority <= sound.priority) { + + // play the sound + AS_SoundDirectPlay(minp_ch, sound); + return minp_ch; + + } else { + + // skip the sound + return -1; + } + } +} + +// set the panning of a sound (0=left, 64=center, 127=right) +void AS_SetSoundPan(u8 chan, u8 pan) +{ + IPC_Sound->chan[chan].snd.pan = pan; + + if(IPC_Sound->surround) { + + int difference = ((pan - 64) >> AS_PANNING_SHIFT) * IPC_Sound->chan[chan].snd.volume / AS_VOL_NORMALIZE; + + IPC_Sound->chan[chan].pan = 0; + IPC_Sound->chan[chan].volume = IPC_Sound->chan[chan].snd.volume + difference; + + if(IPC_Sound->chan[chan].volume < 0) + IPC_Sound->chan[chan].volume = 0; + + IPC_Sound->chan[chan].cmd |= SNDCMD_SETVOLUME; + IPC_Sound->chan[chan].cmd |= SNDCMD_SETPAN; + + IPC_Sound->chan[chan + IPC_Sound->num_chan].pan = 127; + IPC_Sound->chan[chan + IPC_Sound->num_chan].volume = IPC_Sound->chan[chan].snd.volume - difference; + + if(IPC_Sound->chan[chan + IPC_Sound->num_chan].volume < 0) + IPC_Sound->chan[chan + IPC_Sound->num_chan].volume = 0; + + IPC_Sound->chan[chan + IPC_Sound->num_chan].cmd |= SNDCMD_SETVOLUME; + IPC_Sound->chan[chan + IPC_Sound->num_chan].cmd |= SNDCMD_SETPAN; + + } else { + + IPC_Sound->chan[chan].cmd |= SNDCMD_SETPAN; + IPC_Sound->chan[chan].pan = pan; + + } +} + +// set the volume of a sound (0..127) +void AS_SetSoundVolume(u8 chan, u8 volume) +{ + if(IPC_Sound->surround) { + IPC_Sound->chan[chan].snd.volume = volume * AS_BASE_VOLUME / 127; + AS_SetSoundPan(chan, IPC_Sound->chan[chan].snd.pan); + } else { + IPC_Sound->chan[chan].volume = volume; + IPC_Sound->chan[chan].cmd |= SNDCMD_SETVOLUME; + } +} + +// set the sound sample rate +void AS_SetSoundRate(u8 chan, u32 rate) +{ + IPC_Sound->chan[chan].snd.rate = rate; + IPC_Sound->chan[chan].cmd |= SNDCMD_SETRATE; + + if(IPC_Sound->surround) { + IPC_Sound->chan[chan + IPC_Sound->num_chan].snd.rate = rate; + IPC_Sound->chan[chan + IPC_Sound->num_chan].cmd |= SNDCMD_SETRATE; + } +} + +static inline void _AS_CopyToSoundIPC(SoundInfoAlign* out, SoundInfo* in){ + out->data = in->data; + out->size = in->size; + out->rate = in->rate; + out->format = in->format; + out->volume = in->volume; + out->pan = in->pan; + out->loop = in->loop; + out->priority = in->priority; + out->delay = in->delay; +} + +// play a sound directly using the given channel +void AS_SoundDirectPlay(u8 chan, SoundInfo sound) +{ + _AS_CopyToSoundIPC(&IPC_Sound->chan[chan].snd, &sound); + //IPC_Sound->chan[chan].snd = sound; + IPC_Sound->chan[chan].busy = true; + IPC_Sound->chan[chan].cmd = SNDCMD_PLAY; + IPC_Sound->chan[chan].volume = sound.volume; + + if(IPC_Sound->surround) { + _AS_CopyToSoundIPC(&IPC_Sound->chan[chan + IPC_Sound->num_chan].snd, &sound); + //IPC_Sound->chan[chan + IPC_Sound->num_chan].snd = sound; + IPC_Sound->chan[chan + IPC_Sound->num_chan].busy = true; + IPC_Sound->chan[chan + IPC_Sound->num_chan].cmd = SNDCMD_DELAY; + + // set the correct surround volume & pan + AS_SetSoundVolume(chan, sound.volume); + } else { + IPC_Sound->chan[chan].pan = sound.pan; + } +} + +// fill the given buffer with the required amount of mp3 data +bool AS_MP3FillBuffer(u8 *buffer, u32 bytes) +{ + if(!as_mp3mode_enabled) + return false; + + if(mp3file == NULL) + return false; + + u32 read = FILE_READ(buffer, 1, bytes, mp3file); + if (read == bytes) { + // Exit if we have read enough bytes. Note that fread() can't return a + // number bigger than the requested number of bytes, only the same or + // lower. + DC_FlushRange(buffer, bytes); + return true; + } + + // If we haven't read enough bytes, it may be that we have reached the end + // of the file or there has been a read error. + if (!feof(mp3file)) { + // If the end of the file hasn't been reached, there has been a read + // error. + IPC_Sound->mp3.cmd = MP3CMD_STOP; + return false; + } + + // If the song doesn't have to loop, fill the left of the buffer with zeroes + if (!IPC_Sound->mp3.loop) { + memset(buffer + read, 0, bytes - read); + DC_FlushRange(buffer, bytes); + return true; + } + + // The song is looping. Go back to the start of the file + int ret = FILE_SEEK(mp3file, 0, SEEK_SET); + if(ret != 0) { + IPC_Sound->mp3.cmd = MP3CMD_STOP; + return false; + } + + // Read the remaining bytes from the start of the file + u32 bytesleft = bytes - read; + read = FILE_READ(buffer + read, 1, bytesleft, mp3file); + if(read != bytesleft) { + IPC_Sound->mp3.cmd = MP3CMD_STOP; + return false; + } + + DC_FlushRange(buffer, bytes); + + return true; +} + +// play an mp3 directly from memory +void AS_MP3DirectPlay(u8 *mp3_data, u32 size) +{ + if(!as_mp3mode_enabled) + return; + + if(IPC_Sound->mp3.state & (MP3ST_PLAYING | MP3ST_PAUSED)) + return; + + IPC_Sound->mp3.mp3buffer = mp3_data; + IPC_Sound->mp3.mp3filesize = size; + IPC_Sound->mp3.stream = false; + IPC_Sound->mp3.cmd = MP3CMD_PLAY; +} + +// play an mp3 stream +bool AS_MP3StreamPlay(const char *path) +{ + if(!as_mp3mode_enabled) + return false; + + if(IPC_Sound->mp3.state & (MP3ST_PLAYING | MP3ST_PAUSED)) + return false; + + if (mp3file) { + FILE_CLOSE(mp3file); + mp3file = NULL; + } + + mp3file = FILE_OPEN(path); + + if(mp3file == NULL) + return false; + + // allocate the file buffer the first time + if(!mp3filebuffer) { + mp3filebuffer = calloc(1, AS_FILEBUFFER_SIZE * 2); // 2 buffers, to swap + if(!mp3filebuffer) + goto error; + + IPC_Sound->mp3.mp3buffer = mp3filebuffer; + IPC_Sound->mp3.mp3buffersize = AS_FILEBUFFER_SIZE; + } + + // get the file size + int ret = FILE_SEEK(mp3file, 0, SEEK_END); + if(ret != 0) + goto error; + + IPC_Sound->mp3.mp3filesize = FILE_TELL(mp3file); + + // fill the file buffer + ret = FILE_SEEK(mp3file, 0, SEEK_SET); + if(ret != 0) + goto error; + + // For the initial read, fill the two halves of the buffer + if (AS_MP3FillBuffer(mp3filebuffer, AS_FILEBUFFER_SIZE * 2) == false) + goto error; + + // start playing + IPC_Sound->mp3.stream = true; + IPC_Sound->mp3.cmd = MP3CMD_PLAY; + + return true; + +error: + FILE_CLOSE(mp3file); + mp3file = NULL; + + return false; +} + +// stop an mp3 +void AS_MP3Stop() +{ + if(!as_mp3mode_enabled) + return; + + // Always send the command, but only close the file if we're streaming MP3 + // from the filesystem. + IPC_Sound->mp3.cmd = MP3CMD_STOP; + + if(mp3file != NULL) { + FILE_CLOSE(mp3file); + mp3file = NULL; + } +} + +// set the mp3 panning (0=left, 64=center, 127=right) +void AS_SetMP3Pan(u8 pan) +{ + if(!as_mp3mode_enabled) + return; + + int difference = ((pan - 64) >> AS_PANNING_SHIFT) * IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.volume / AS_VOL_NORMALIZE; + + IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.pan = pan; + IPC_Sound->chan[IPC_Sound->mp3.channelL].pan = 0; + IPC_Sound->chan[IPC_Sound->mp3.channelL].volume = IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.volume - difference; + + if(IPC_Sound->chan[IPC_Sound->mp3.channelL].volume < 0) + IPC_Sound->chan[IPC_Sound->mp3.channelL].volume = 0; + + IPC_Sound->chan[IPC_Sound->mp3.channelL].cmd |= SNDCMD_SETVOLUME; + IPC_Sound->chan[IPC_Sound->mp3.channelL].cmd |= SNDCMD_SETPAN; + + IPC_Sound->chan[IPC_Sound->mp3.channelR].pan = 127; + IPC_Sound->chan[IPC_Sound->mp3.channelR].volume = IPC_Sound->chan[IPC_Sound->mp3.channelL].snd.volume + difference; + + if(IPC_Sound->chan[IPC_Sound->mp3.channelR].volume < 0) + IPC_Sound->chan[IPC_Sound->mp3.channelR].volume = 0; + + IPC_Sound->chan[IPC_Sound->mp3.channelR].cmd |= SNDCMD_SETVOLUME; + IPC_Sound->chan[IPC_Sound->mp3.channelR].cmd |= SNDCMD_SETPAN; + +} + +// regenerate buffers for mp3 stream, must be called each VBlank (only needed if mp3 is used) +void AS_SoundVBL() +{ + if(!as_mp3mode_enabled) + return; + + // refill mp3 file buffer if needed + if(IPC_Sound->mp3.needdata) { + + // Reading from the filesystem may cause a yield from this thread, so + // interrupts need to be enabled for the yield to ever end. + REG_IME= 1; + + // Fill only half of the buffer + if(AS_MP3FillBuffer(IPC_Sound->mp3.mp3buffer + AS_FILEBUFFER_SIZE, AS_FILEBUFFER_SIZE)) + IPC_Sound->mp3.needdata = false; + else + IPC_Sound->mp3.cmd = MP3CMD_STOP; + } +} diff --git a/source/arm9/cpp/PA_Wrappers.cpp b/source/arm9/cpp/PA_Wrappers.cpp index fad9624..2375136 100644 --- a/source/arm9/cpp/PA_Wrappers.cpp +++ b/source/arm9/cpp/PA_Wrappers.cpp @@ -1 +1 @@ -#include +#include diff --git a/source/arm9/jpeg.c b/source/arm9/jpeg.c index e00c4a4..35372bd 100644 --- a/source/arm9/jpeg.c +++ b/source/arm9/jpeg.c @@ -1,1105 +1,1105 @@ -#include - -/* Setup the IWRAM-loading definitions if this has been enabled. There are - * three sections of this; the register definitions, the IWRAM end - * determination, and the DMA copying functions. Register definitions are the - * same as anywhere else, only with a JPEG_IWRAM prefix. The IWRAM end - * determination uses a generated variable that DevKit Advance's linker script - * creates. Because of this, other linker scripts might not work with this - * code. Finally, the DMA copying uses DMA 3. - * - * Functions that are to be copied to IWRAM must obey certain restrictions. - * They cannot refer to external constant data. They must be declared static. - * They must have a JPEG_FUNCTION_END(NAME) macro after them; see how it is - * used in the code ahead for an example. Finally, you should avoid external - * references altogether because of how it limits your flexibility. Instead, - * pass necessary variable and function pointers in the arguments. - */ - -#if JPEG_USE_IWRAM - /* The source address pointer for DMA 3. */ - #define JPEG_IWRAM_REG_DM3SAD (*(volatile unsigned int *) 0x40000D4) - - /* The destination address pointer for DMA 3. */ - #define JPEG_IWRAM_REG_DM3DAD (*(volatile unsigned int *) 0x40000D8) - - /* The number of words or halfwords to transfer for DMA 3. */ - #define JPEG_IWRAM_REG_DM3CNT_L (*(volatile unsigned short *) 0x40000DC) - - /* DMA 3 control register. */ - #define JPEG_IWRAM_REG_DM3CNT_H (*(volatile unsigned short *) 0x40000DE) - - /* The address of this is the end of the .bss (uninitialized variables) - * segment, which DevKit Advance's linker script puts last. - */ - extern char __bss_end; - - /* Retrieve the pointer to the first free byte in the IWRAM segment. */ - #define JPEG_IWRAM_USED_END (&__bss_end) - - /* This creates a simple stub function that can be used with JPEG_FUNCTION_SIZE - * to determine the size of a function in bytes. If the function will be - * IWRAM-loaded, this macro must be executed immediately after the - * function with the name of the function in the NAME parameter, and the - * function must be declared static. - */ - #define JPEG_FUNCTION_END(NAME) static void NAME##End () { } - - /* Retrieve the size in bytes of a function that has a JPEG_FUNCTION_END - * ballast. - */ - #define JPEG_FUNCTION_SIZE(NAME) ((int) ((char *) &NAME##End - (char *) &NAME) & ~3) - - /* Start a loading function by defining the necessary variables. */ - #define JPEG_IWRAM_LoadStart() char *iwramEnd = (char *) JPEG_IWRAM_USED_END - - /* Load the value named JPEG_NAME into the pointer named NAME, - * adjusting the read pointer. This copies SIZE bytes through DMA 3. - */ - #define JPEG_IWRAM_LoadValue(NAME, SIZE) \ - *(void **) &NAME = iwramEnd; \ - while (JPEG_IWRAM_REG_DM3CNT_H & (1 << 15)) { } \ - JPEG_Assert (iwramEnd + (SIZE) < (char *) &iwramEnd); \ - JPEG_IWRAM_REG_DM3SAD = (unsigned int) &JPEG_##NAME; \ - JPEG_IWRAM_REG_DM3DAD = (unsigned int) iwramEnd; \ - JPEG_IWRAM_REG_DM3CNT_L = (SIZE + 3) >> 2; \ - JPEG_IWRAM_REG_DM3CNT_H = (1 << 10) | (1 << 15); \ - iwramEnd += (SIZE & ~3) - - #define JPEG_IWRAM_LoadFunction(NAME) JPEG_IWRAM_LoadValue (NAME, JPEG_FUNCTION_SIZE (JPEG_##NAME)) - #define JPEG_IWRAM_LoadData(NAME) JPEG_IWRAM_LoadValue (NAME, sizeof (JPEG_##NAME)) - - /* Finish loading the IWRAM by waiting for the DMA transfers to finish and - * making an assertion check that makes sure (with fairly good but not - * perfect assurance) that we haven't written over the stack. - */ - #define JPEG_IWRAM_LoadDone() \ - do { } while (JPEG_IWRAM_REG_DM3CNT_H & (1 << 15)) - -#else - /* This stub does absolutely nothing. */ - #define JPEG_FUNCTION_END(NAME) -#endif /* JPEG_USE_IWRAM */ - - - -/* Converts left-to-right coefficient indices into zig-zagged indices. */ -const unsigned char JPEG_ToZigZag [JPEG_DCTSIZE2] = -{ - 0, 1, 8, 16, 9, 2, 3, 10, - 17, 24, 32, 25, 18, 11, 4, 5, - 12, 19, 26, 33, 40, 48, 41, 34, - 27, 20, 13, 6, 7, 14, 21, 28, - 35, 42, 49, 56, 57, 50, 43, 36, - 29, 22, 15, 23, 30, 37, 44, 51, - 58, 59, 52, 45, 38, 31, 39, 46, - 53, 60, 61, 54, 47, 55, 62, 63, -}; - -/* These macros are so that we can generate the AA&N multipliers at - * compile-time, allowing configuration control of fixed point precision. - */ -#define JPEG_AAN_0 1.0 -#define JPEG_AAN_1 1.387039845 -#define JPEG_AAN_2 1.306562965 -#define JPEG_AAN_3 1.175875602 -#define JPEG_AAN_4 1.0 -#define JPEG_AAN_5 0.785694958 -#define JPEG_AAN_6 0.541196100 -#define JPEG_AAN_7 0.275899379 - -#define JPEG_AAN_LINE(B) \ - JPEG_FTOFIX (JPEG_AAN_0 * JPEG_AAN_##B), \ - JPEG_FTOFIX (JPEG_AAN_1 * JPEG_AAN_##B), \ - JPEG_FTOFIX (JPEG_AAN_2 * JPEG_AAN_##B), \ - JPEG_FTOFIX (JPEG_AAN_3 * JPEG_AAN_##B), \ - JPEG_FTOFIX (JPEG_AAN_4 * JPEG_AAN_##B), \ - JPEG_FTOFIX (JPEG_AAN_5 * JPEG_AAN_##B), \ - JPEG_FTOFIX (JPEG_AAN_6 * JPEG_AAN_##B), \ - JPEG_FTOFIX (JPEG_AAN_7 * JPEG_AAN_##B) - -/* The AA&N scaling factors. These should be multiplied against quantization - * coefficients to determine their real value. - */ -const JPEG_FIXED_TYPE JPEG_AANScaleFactor [JPEG_DCTSIZE2] = -{ - JPEG_AAN_LINE (0), - JPEG_AAN_LINE (1), - JPEG_AAN_LINE (2), - JPEG_AAN_LINE (3), - JPEG_AAN_LINE (4), - JPEG_AAN_LINE (5), - JPEG_AAN_LINE (6), - JPEG_AAN_LINE (7), -}; - -int jpeg_width = 256; - -/* This converts values in the range [-32 .. 32] to [0 .. 32] by clamping - * values outside of that range. To use it, add 32 to your input. - */ -const unsigned char JPEG_ComponentRange [32 * 3] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 -}; - -/* Compute the columns half of the IDCT. */ -void JPEG_IDCT_Columns (JPEG_FIXED_TYPE *zz) -{ - JPEG_FIXED_TYPE tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmp10, tmp11; - JPEG_FIXED_TYPE *ez = zz + JPEG_DCTSIZE; - - /* The first column will always have a non-zero coefficient, the DC. */ - goto skipFirstCheckb; - - for ( ; zz < ez; zz ++) - { - /* A column containing only zeroes will output only zeroes. Since we - * output in-place, we don't need to do anything in that case. - */ - if (!zz [0 * JPEG_DCTSIZE] && !zz [1 * JPEG_DCTSIZE] - && !zz [2 * JPEG_DCTSIZE] && !zz [3 * JPEG_DCTSIZE] - && !zz [4 * JPEG_DCTSIZE] && !zz [5 * JPEG_DCTSIZE] - && !zz [6 * JPEG_DCTSIZE] && !zz [7 * JPEG_DCTSIZE]) - continue; - - skipFirstCheckb: - tmp0 = zz [0 * JPEG_DCTSIZE]; - tmp1 = zz [2 * JPEG_DCTSIZE]; - tmp2 = zz [4 * JPEG_DCTSIZE]; - tmp3 = zz [6 * JPEG_DCTSIZE]; - - tmp6 = tmp1 + tmp3; - tmp7 = JPEG_FIXMUL (tmp1 - tmp3, JPEG_FTOFIX (1.414213562)) - tmp6; - tmp1 = tmp0 - tmp2 + tmp7; - tmp0 = tmp0 + tmp2 + tmp6; - - tmp3 = tmp0 - (tmp6 << 1); - tmp2 = tmp1 - (tmp7 << 1); - - tmp4 = zz [1 * JPEG_DCTSIZE]; - tmp5 = zz [3 * JPEG_DCTSIZE]; - tmp6 = zz [5 * JPEG_DCTSIZE]; - tmp7 = zz [7 * JPEG_DCTSIZE]; - - tmp10 = tmp4 - tmp7; - - tmp8 = tmp6 + tmp5; - tmp9 = tmp4 + tmp7; - tmp7 = tmp9 + tmp8; - tmp11 = JPEG_FIXMUL (tmp9 - tmp8, JPEG_FTOFIX (1.414213562)); - - tmp8 = tmp6 - tmp5; - tmp9 = JPEG_FIXMUL (tmp8 + tmp10, JPEG_FTOFIX (1.847759065)); - - tmp6 = JPEG_FIXMUL (JPEG_FTOFIX (-2.613125930), tmp8) + tmp9 - tmp7; - tmp5 = tmp11 - tmp6; - tmp4 = JPEG_FIXMUL (JPEG_FTOFIX (1.082392200), tmp10) - tmp9 + tmp5; - - zz [0 * JPEG_DCTSIZE] = tmp0 + tmp7; - zz [1 * JPEG_DCTSIZE] = tmp1 + tmp6; - zz [2 * JPEG_DCTSIZE] = tmp2 + tmp5; - zz [3 * JPEG_DCTSIZE] = tmp3 - tmp4; - zz [4 * JPEG_DCTSIZE] = tmp3 + tmp4; - zz [5 * JPEG_DCTSIZE] = tmp2 - tmp5; - zz [6 * JPEG_DCTSIZE] = tmp1 - tmp6; - zz [7 * JPEG_DCTSIZE] = tmp0 - tmp7; - } -} -JPEG_FUNCTION_END (JPEG_IDCT_Columns) - -/* Compute the rows half of the IDCT, loading the component information into - * chunk as values in the range -64 to 64, although it can go somewhat outside - * of that range. chunkStride is the number of bytes in a row in chunk. - */ - -void JPEG_IDCT_Rows (const JPEG_FIXED_TYPE *zz, signed char *chunk, int chunkStride) -{ - JPEG_FIXED_TYPE tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13; - JPEG_FIXED_TYPE tmp4, tmp5, tmp6, tmp7, z5, z10, z11, z12, z13; - int row; - - for (row = 0; row < JPEG_DCTSIZE; row ++, zz += JPEG_DCTSIZE, chunk += chunkStride) - { - tmp10 = zz [0] + zz [4]; - tmp11 = zz [0] - zz [4]; - - tmp13 = zz [2] + zz [6]; - tmp12 = JPEG_FIXMUL (zz [2] - zz [6], JPEG_FTOFIX (1.414213562)) - tmp13; - - tmp0 = tmp10 + tmp13; - tmp3 = tmp10 - tmp13; - tmp1 = tmp11 + tmp12; - tmp2 = tmp11 - tmp12; - - z13 = zz [5] + zz [3]; - z10 = zz [5] - zz [3]; - z11 = zz [1] + zz [7]; - z12 = zz [1] - zz [7]; - - tmp7 = z11 + z13; - tmp11 = JPEG_FIXMUL (z11 - z13, JPEG_FTOFIX (1.414213562)); - - z5 = JPEG_FIXMUL (z10 + z12, JPEG_FTOFIX (1.847759065)); - tmp10 = JPEG_FIXMUL (JPEG_FTOFIX (1.082392200), z12) - z5; - tmp12 = JPEG_FIXMUL (JPEG_FTOFIX (-2.613125930), z10) + z5; - - tmp6 = tmp12 - tmp7; - tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; - - /* This shifts by an extra bit to remove the need for clamping at - * this point. Thus the normative samples are in the range -64 to 63. - * This requires a later bit-shift, but that comes for free with the ARM - * instruction set, and has an acceptable, likely imperceptible, loss - * of quality. - */ - - chunk [0] = JPEG_FIXTOI (tmp0 + tmp7) >> 4; - chunk [1] = JPEG_FIXTOI (tmp1 + tmp6) >> 4; - chunk [2] = JPEG_FIXTOI (tmp2 + tmp5) >> 4; - chunk [3] = JPEG_FIXTOI (tmp3 - tmp4) >> 4; - chunk [4] = JPEG_FIXTOI (tmp3 + tmp4) >> 4; - chunk [5] = JPEG_FIXTOI (tmp2 - tmp5) >> 4; - chunk [6] = JPEG_FIXTOI (tmp1 - tmp6) >> 4; - chunk [7] = JPEG_FIXTOI (tmp0 - tmp7) >> 4; - } -} -JPEG_FUNCTION_END (JPEG_IDCT_Rows) - -/* This function comes from jpeglib. I feel all right about that since it comes from AA&N anyway. */ -void JPEG_IDCT (JPEG_FIXED_TYPE *zz, signed char *chunk, int chunkStride) -{ - JPEG_IDCT_Columns (zz); - JPEG_IDCT_Rows (zz, chunk, chunkStride); -} - -/* Compute a signed value. COUNT is the number of bits to read, and OUT is - * where to store the result. - */ - -#define JPEG_Value(COUNT, OUT) \ - do { \ - unsigned int value = JPEG_BITS_GET (COUNT); \ - \ - if (value < (unsigned int) (1 << ((unsigned int) (COUNT - 1)))) \ - value += (-1 << COUNT) + 1; \ - (OUT) = value; \ - } while (0) - -/* Decode the coefficients from the input stream and do dequantization at the - * same time. dcLast is the previous block's DC value and is updated. zz is - * the output coefficients and will be all ready for an IDCT. quant is the - * quantization table to use, dcTable and acTable are the Huffman tables for - * the DC and AC coefficients respectively, dataBase, bitsLeftBase, and - * bitsDataBase are for input stream state, and toZigZag is a pointer to - * JPEG_ToZigZag or to its IWRAM copy. - */ - -void JPEG_DecodeCoefficients ( - JPEG_FIXED_TYPE *dcLast, JPEG_FIXED_TYPE *zz, JPEG_FIXED_TYPE *quant, - JPEG_HuffmanTable *dcTable, JPEG_HuffmanTable *acTable, - const unsigned char **dataBase, unsigned int *bitsLeftBase, - unsigned long int *bitsDataBase, const unsigned char *toZigZag) -{ - unsigned bits_left = *bitsLeftBase, bits_data = *bitsDataBase; /* Input stream state. */ - const unsigned char *data = *dataBase; /* Input stream state. */ - int r, s, diff; /* Various temporary data variables. */ - int index = 1; /* The current zig-zagged index. */ - - /* Clear all coefficients to zero. */ - { - JPEG_FIXED_TYPE *ez = zz + JPEG_DCTSIZE2; - do *-- ez = 0; - while (ez > zz); - } - - /* Read the DC coefficient. */ - JPEG_BITS_CHECK (); - JPEG_HuffmanTable_Decode (dcTable, s); - JPEG_Value (s, diff); - - /* Store the DC coefficient. */ - *dcLast += diff; - zz [toZigZag [0]] = *dcLast * quant [0]; - - while (1) - { - /* Read a bits/run-length value. */ - JPEG_BITS_CHECK (); - JPEG_HuffmanTable_Decode (acTable, s); - r = s >> 4; - s &= 15; - - /* If there is a value at this cell +r, then read it. */ - if (s) - { - index += r; - JPEG_Value (s, r); - zz [toZigZag [index]] = r * quant [index]; - if (index == JPEG_DCTSIZE2 - 1) - break; - index ++; - } - /* Otherwise we skip 16 cells or finish up. */ - else - { - if (r != 15) - break; - index += 16; - } - } - - /* Restore state for the caller. */ - *bitsDataBase = bits_data; - *bitsLeftBase = bits_left; - *dataBase = data; -} -JPEG_FUNCTION_END (JPEG_DecodeCoefficients) - -/* Convert a chunk of YCbCr data to the output format. YBlock, CbBlock, - * and CrBlock are the pointers to the relevant chunks; each sample is - * between -64 and 64, although out-of-range values are possible. - * nHorzFactor and nVertFactor, where n is Y, Cb, and Cr, hold the - * multipliers for each coordinate. Shift right by horzMax and vertMax to - * get the actual point to sample data from. M211 is true if the - * component factors satisfy a 2:1:1 relationship; this leads to a much - * faster conversion if JPEG_FASTER_M211 is enabled. - * out and outStride are the output pointers and the number of samples - * in an output row. Finally, ComponentRange is a pointer to the - * JPEG_ComponentRange array. - */ - - - -void JPEG_ConvertBlock ( - signed char *YBlock, signed char *CbBlock, signed char *CrBlock, - int YHorzFactor, int YVertFactor, int CbHorzFactor, int CbVertFactor, int CrHorzFactor, int CrVertFactor, int horzMax, int vertMax, - char M211, volatile JPEG_OUTPUT_TYPE *out, int outStride, const unsigned char *ComponentRange) -{ - int px, py; - - /* Since we need to offset all indices into this anyway, we might as well do it once only. */ - ComponentRange += 32; - -/* Do the faster 2:1:1 code if JPEG_FASTER_M211 is set and the image scan satisfies that relationship. */ -#if JPEG_FASTER_M211 - if (M211) - { - /* Nothing complex here. Because of its nature, we can do Cb and Cr - * conversion only once for every four pixels. This optimization is - * done implicitly, using GCC's optimizer for gleaning the actual - * advantage. - */ - - for (py = 0; py < 2 * JPEG_DCTSIZE; py += 2) - { - volatile JPEG_OUTPUT_TYPE *row = &out [outStride * py]; - volatile JPEG_OUTPUT_TYPE *rowEnd = row + JPEG_DCTSIZE * 2; - - for ( ; row < rowEnd; row += 2, YBlock += 2, CbBlock ++, CrBlock ++) - { - int Cb = *CbBlock, Cr = *CrBlock; - JPEG_Convert (row [0], YBlock [0], Cb, Cr); - JPEG_Convert (row [1], YBlock [1], Cb, Cr); - JPEG_Convert (row [jpeg_width], YBlock [2 * JPEG_DCTSIZE + 0], Cb, Cr); // 240 - JPEG_Convert (row [jpeg_width+1], YBlock [2 * JPEG_DCTSIZE + 1], Cb, Cr); // 241 - } - - YBlock += JPEG_DCTSIZE * 2; - } - } -#else - if (0) { } -#endif /* JPEG_FASTER_M211 */ - -/* Otherwise we fall back on generic code, if JPEG_HANDLE_ANY_FACTORS is set. - * If it is not, then this function does nothing at all! - */ -#if JPEG_HANDLE_ANY_FACTORS - else for (py = 0; py < vertMax; py ++) - { - signed char *YScan = YBlock + (py * YVertFactor >> 8) * (horzMax * YHorzFactor >> 8); - signed char *CbScan = CbBlock + (py * CbVertFactor >> 8) * (horzMax * CbHorzFactor >> 8); - signed char *CrScan = CrBlock + (py * CrVertFactor >> 8) * (horzMax * CrHorzFactor >> 8); - - volatile JPEG_OUTPUT_TYPE *row = &out [outStride * py]; - - for (px = 0; px < horzMax; px ++, row ++) - { - int Y = YScan [px * YHorzFactor >> 8]; - int Cb = CbScan [px * CbHorzFactor >> 8]; - int Cr = CrScan [px * CrHorzFactor >> 8]; - - JPEG_Convert (*row, Y, Cb, Cr); - } - } -#endif /* JPEG_HANDLE_ANY_FACTORS */ - - /* Make sure all variables are referenced. */ - (void) YHorzFactor; (void) YVertFactor; (void) CbHorzFactor; - (void) CbVertFactor; (void) CrHorzFactor; (void) CrVertFactor; - (void) horzMax; (void) vertMax; (void) px; (void) py; - (void) YBlock; (void) CbBlock; (void) CrBlock; - (void) M211; (void) out; (void) outStride; -} -JPEG_FUNCTION_END (JPEG_ConvertBlock) - - -/* Decode a Huffman table and initialize its data. This expects to be called - * after the DHT marker and the type/slot pair. - */ -int JPEG_HuffmanTable_Read (JPEG_HuffmanTable *huffmanTable, const unsigned char **dataBase) -{ - const unsigned char *data = *dataBase; - const unsigned char *bits; - int huffcode [256]; - unsigned char huffsize [256]; - int total = 0; - int c; - - bits = data; - for (c = 0; c < 16; c ++) - total += *data ++; - huffmanTable->huffval = data; - data += total; - - /*void GenerateSizeTable ()*/ - { - int k = 0, i = 1, j = 1; - - do - { - while (j ++ <= bits [i - 1]) - huffsize [k ++] = i; - i ++; - j = 1; - } - while (i <= 16); - - huffsize [k] = 0; - } - - /*void GenerateCodeTable ()*/ - { - int k = 0, code = 0, si = huffsize [0]; - - while (1) - { - do huffcode [k ++] = code ++; - while (huffsize [k] == si); - - if (huffsize [k] == 0) - break; - - do code <<= 1, si ++; - while (huffsize [k] != si); - } - } - - /*void DecoderTables ()*/ - { - int i = 0, j = 0; - - while (1) - { - if (i >= 16) - break; - if (bits [i] == 0) - huffmanTable->maxcode [i] = -1; - else - { - huffmanTable->valptr [i] = &huffmanTable->huffval [j - huffcode [j]]; - j += bits [i]; - huffmanTable->maxcode [i] = huffcode [j - 1]; - } - i ++; - } - } - - /*void GenerateLookahead ()*/ - { - int l, i, p, c, ctr; - - for (c = 0; c < 256; c ++) - huffmanTable->look_nbits [c] = 0; - - p = 0; - for (l = 1; l <= 8; l ++) - { - for (i = 1; i <= bits [l - 1]; i ++, p ++) - { - int lookbits = huffcode [p] << (8 - l); - - for (ctr = 1 << (8 - l); ctr > 0; ctr --) - { - huffmanTable->look_nbits [lookbits] = l; - huffmanTable->look_sym [lookbits] = huffmanTable->huffval [p]; - lookbits ++; - } - } - } - } - - *dataBase = data; - return 1; -} - -/* Skip past a Huffman table section. This expects to be called after reading - * the DHT marker and the type/slot pair. - */ -int JPEG_HuffmanTable_Skip (const unsigned char **dataBase) -{ - const unsigned char *data = *dataBase; - int c, total = 16; - - for (c = 0; c < 16; c ++) - total += *data ++; - *dataBase += total; - return 1; -} - -/* Takes information discovered in JPEG_Decoder_ReadHeaders and loads the - * image. This is a public function; see gba-jpeg.h for more information on it. - */ -int JPEG_Decoder_ReadImage (JPEG_Decoder *decoder, const unsigned char **dataBase, volatile JPEG_OUTPUT_TYPE *out, int outWidth, int outHeight) -{ - JPEG_FrameHeader *frame = &decoder->frame; /* Pointer to the image's frame. */ - JPEG_ScanHeader *scan = &decoder->scan; /* Pointer to the image's scan. */ - int YHorzFactor = 0, YVertFactor = 0; /* Scaling factors for the Y component. */ - int CbHorzFactor = 1, CbVertFactor = 1; /* Scaling factors for the Cb component. The default is important because it is used for greyscale images. */ - int CrHorzFactor = 1, CrVertFactor = 1; /* Scaling factors for the Cr component. The default is important because it is used for greyscale images. */ - int horzMax = 0, vertMax = 0; /* The maximum horizontal and vertical scaling factors for the components. */ - JPEG_FrameHeader_Component *frameComponents [JPEG_MAXIMUM_COMPONENTS]; /* Pointers translating scan header components to frame header components. */ - JPEG_FrameHeader_Component *item, *itemEnd = frame->componentList + frame->componentCount; /* The frame header's components for loops. */ - JPEG_FIXED_TYPE dcLast [JPEG_MAXIMUM_COMPONENTS]; /* The last DC coefficient computed. This is initialized to zeroes at the start and after a restart interval. */ - int c, bx, by, cx, cy; /* Various loop parameters. */ - int horzShift = 0; /* The right shift to use after multiplying by nHorzFactor to get the actual sample. */ - int vertShift = 0; /* The right shift to use after multiplying by nVertFactor to get the actual sample. */ - char M211 = 0; /* Whether this scan satisfies the 2:1:1 relationship, which leads to faster code. */ - const unsigned char *data = *dataBase; /* The input data pointer; this must be right at the start of scan data. */ - - signed char blockBase [JPEG_DCTSIZE2 * JPEG_MAXIMUM_SCAN_COMPONENT_FACTORS]; /* Blocks that have been read and are alloted to YBlock, CbBlock, and CrBlock based on their scaling factors. */ - signed char *YBlock; /* Y component temporary block that holds samples for the MCU currently being decompressed. */ - signed char *CbBlock; /* Cb component temporary block that holds samples for the MCU currently being decompressed. */ - signed char *CrBlock; /* Cr component temporary block that holds samples for the MCU currently being decompressed. */ - - JPEG_HuffmanTable acTableList [2]; /* The decompressed AC Huffman tables. JPEG Baseline allows only two AC Huffman tables in a scan. */ - int acTableUse [2] = { -1, -1 }; /* The indices of the decompressed AC Huffman tables, or -1 if this table hasn't been used. */ - JPEG_HuffmanTable dcTableList [2]; /* The decompressed DC Huffman tables. JPEG Baseline allows only two DC Huffman tables in a scan. */ - int dcTableUse [2] = { -1, -1 }; /* The indices of the decompressed DC Huffman tables, or -1 if this table hasn't been used. */ - int restartInterval = decoder->restartInterval; /* Number of blocks until the next restart. */ - - /* Pointer to JPEG_ConvertBlock, which might be moved to IWRAM. */ - void (*ConvertBlock) (signed char *, signed char *, signed char *, - int, int, int, int, int, int, int, int, char, - volatile JPEG_OUTPUT_TYPE *, int, const unsigned char *) - = &JPEG_ConvertBlock; - - /* Pointer to JPEG_IDCT_Columns, which might be moved to IWRAM. */ - void (*IDCT_Columns) (JPEG_FIXED_TYPE *) = &JPEG_IDCT_Columns; - - /* Pointer to JPEG_IDCT_Rows, which might be moved to IWRAM. */ - void (*IDCT_Rows) (const JPEG_FIXED_TYPE *, signed char *, int) = &JPEG_IDCT_Rows; - - /* Pointer to JPEG_DecodeCoefficients, which might be moved to IWRAM. */ - void (*DecodeCoefficients) (JPEG_FIXED_TYPE *, JPEG_FIXED_TYPE *, JPEG_FIXED_TYPE *, JPEG_HuffmanTable *, - JPEG_HuffmanTable *, const unsigned char **, unsigned int *, - unsigned long int *, const unsigned char *) = &JPEG_DecodeCoefficients; - - const unsigned char *ToZigZag = JPEG_ToZigZag; /* Pointer to JPEG_ToZigZag, which might be moved to IWRAM. */ - const unsigned char *ComponentRange = JPEG_ComponentRange; /* Pointer to JPEG_ComponentRange, which might be moved to IWRAM. */ - - /* Start decoding bits. */ - JPEG_BITS_START (); - - /* The sum of all factors in the scan; this cannot be greater than 10 in JPEG Baseline. */ - int factorSum = 0; - -/* Load the essential functions and data into IWRAM if this has been set. */ -#if JPEG_USE_IWRAM - JPEG_IWRAM_LoadStart (); /* Define variables. */ - JPEG_IWRAM_LoadFunction (ConvertBlock); - JPEG_IWRAM_LoadFunction (DecodeCoefficients); - JPEG_IWRAM_LoadFunction (IDCT_Columns); - JPEG_IWRAM_LoadFunction (IDCT_Rows); - JPEG_IWRAM_LoadData (ToZigZag); - JPEG_IWRAM_LoadData (ComponentRange); - JPEG_IWRAM_LoadDone (); /* Finished; run down DMA and check that we haven't overwritten the stack. */ -#endif /* JPEG_USE_IWRAM */ - - /* Find the maximum factors and the factors for each component. */ - for (item = frame->componentList; item < itemEnd; item ++) - { - /* Find the opposing scan header component. */ - for (c = 0; ; c ++) - { - JPEG_ScanHeader_Component *sc; - - JPEG_Assert (c < scan->componentCount); - sc = &scan->componentList [c]; - if (sc->selector != item->selector) - continue; - - /* Decompress the DC table if necessary. */ - if (sc->dcTable != dcTableUse [0] && sc->dcTable != dcTableUse [1]) - { - const unsigned char *tablePointer = decoder->dcTables [sc->dcTable]; - - if (dcTableUse [0] == -1) - dcTableUse [0] = sc->dcTable, JPEG_HuffmanTable_Read (&dcTableList [0], &tablePointer); - else if (dcTableUse [1] == -1) - dcTableUse [1] = sc->dcTable, JPEG_HuffmanTable_Read (&dcTableList [1], &tablePointer); - else - JPEG_Assert (0); - } - - /* Decompress the AC table if necessary. */ - if (sc->acTable != acTableUse [0] && sc->acTable != acTableUse [1]) - { - const unsigned char *tablePointer = decoder->acTables [sc->acTable]; - - if (acTableUse [0] == -1) - acTableUse [0] = sc->acTable, JPEG_HuffmanTable_Read (&acTableList [0], &tablePointer); - else if (acTableUse [1] == -1) - acTableUse [1] = sc->acTable, JPEG_HuffmanTable_Read (&acTableList [1], &tablePointer); - else - JPEG_Assert (0); - } - - frameComponents [c] = item; - break; - } - - /* Add the sum for a later assertion test. */ - factorSum += item->horzFactor * item->vertFactor; - - /* Adjust the maximum horizontal and vertical scaling factors as necessary. */ - if (item->horzFactor > horzMax) - horzMax = item->horzFactor; - if (item->vertFactor > vertMax) - vertMax = item->vertFactor; - - /* Update the relevant component scaling factors if necessary. */ - if (item->selector == 1) - { - YHorzFactor = item->horzFactor; - YVertFactor = item->vertFactor; - } - else if (item->selector == 2) - { - CbHorzFactor = item->horzFactor; - CbVertFactor = item->vertFactor; - } - else if (item->selector == 3) - { - CrHorzFactor = item->horzFactor; - CrVertFactor = item->vertFactor; - } - } - - /* Ensure that we have enough memory for these factors. */ - JPEG_Assert (factorSum < JPEG_MAXIMUM_SCAN_COMPONENT_FACTORS); - - /* Split up blockBase according to the components. */ - YBlock = blockBase; - CbBlock = YBlock + YHorzFactor * YVertFactor * JPEG_DCTSIZE2; - CrBlock = CbBlock + CbHorzFactor * CbVertFactor * JPEG_DCTSIZE2; - - /* Compute the right shift to be done after multiplying against the scaling factor. */ - if (horzMax == 1) horzShift = 8; - else if (horzMax == 2) horzShift = 7; - else if (horzMax == 4) horzShift = 6; - - /* Compute the right shift to be done after multiplying against the scaling factor. */ - if (vertMax == 1) vertShift = 8; - else if (vertMax == 2) vertShift = 7; - else if (vertMax == 4) vertShift = 6; - - /* Adjust the scaling factors for our parameters. */ - YHorzFactor <<= horzShift; - YVertFactor <<= vertShift; - CbHorzFactor <<= horzShift; - CbVertFactor <<= vertShift; - CrHorzFactor <<= horzShift; - CrVertFactor <<= vertShift; - - /* Clear the Cb channel for potential grayscale. */ - { - signed char *e = CbBlock + JPEG_DCTSIZE2; - - do *-- e = 0; - while (e > CbBlock); - } - - /* Clear the Cr channel for potential grayscale. */ - { - signed char *e = CrBlock + JPEG_DCTSIZE2; - - do *-- e = 0; - while (e > CrBlock); - } - -/* Compute whether this satisfies the sped up 2:1:1 relationship. */ -#if JPEG_FASTER_M211 - if (YHorzFactor == 256 && YVertFactor == 256 && CbHorzFactor == 128 && CbVertFactor == 128 && CrHorzFactor == 128 && CrVertFactor == 128) - M211 = 1; -#endif /* JPEG_FASTER_M211 */ - - /* Clear the DC parameters. */ - for (c = 0; c < JPEG_MAXIMUM_COMPONENTS; c ++) - dcLast [c] = 0; - - /* Now run over each MCU horizontally, then vertically. */ - for (by = 0; by < frame->height; by += vertMax * JPEG_DCTSIZE) - { - for (bx = 0; bx < frame->width; bx += horzMax * JPEG_DCTSIZE) - { - /* Read the components for the MCU. */ - for (c = 0; c < scan->componentCount; c ++) - { - JPEG_ScanHeader_Component *sc = &scan->componentList [c]; - JPEG_FrameHeader_Component *fc = frameComponents [c]; - JPEG_HuffmanTable *dcTable, *acTable; - JPEG_FIXED_TYPE *quant = decoder->quantTables [fc->quantTable]; - int stride = fc->horzFactor * JPEG_DCTSIZE; - signed char *chunk = 0; - - dcTable = &dcTableList [sc->dcTable == dcTableUse [1] ? 1 : 0]; - acTable = &acTableList [sc->acTable == acTableUse [1] ? 1 : 0]; - - /* Compute the output chunk. */ - if (fc->selector == 1) - chunk = YBlock; - else if (fc->selector == 2) - chunk = CbBlock; - else if (fc->selector == 3) - chunk = CrBlock; - - for (cy = 0; cy < fc->vertFactor * JPEG_DCTSIZE; cy += JPEG_DCTSIZE) - { - for (cx = 0; cx < fc->horzFactor * JPEG_DCTSIZE; cx += JPEG_DCTSIZE) - { - int start = cx + cy * stride; - JPEG_FIXED_TYPE zz [JPEG_DCTSIZE2]; - - /* Decode coefficients. */ - DecodeCoefficients (&dcLast [c], zz, quant, dcTable, acTable, &data, &bits_left, &bits_data, ToZigZag); - - /* Perform an IDCT if this component will contribute to the image. */ - if (chunk) - { - IDCT_Columns (zz); - IDCT_Rows (zz, chunk + start, stride); - } - } - } - } - - /* Check that our block will be in-range; this should actually use clamping. */ - if (bx + horzMax * JPEG_DCTSIZE > outWidth || by + vertMax * JPEG_DCTSIZE > outHeight) - continue; - - /* Convert our block from YCbCr to the output. */ - ConvertBlock (YBlock, CbBlock, CrBlock, - YHorzFactor, YVertFactor, CbHorzFactor, CbVertFactor, CrHorzFactor, CrVertFactor, - horzMax * JPEG_DCTSIZE, vertMax * JPEG_DCTSIZE, M211, out + bx + by * outWidth, outWidth, ComponentRange); - - /* Handle the restart interval. */ - if (decoder->restartInterval && --restartInterval == 0) - { - restartInterval = decoder->restartInterval; - JPEG_BITS_REWIND (); - if (((data [0] << 8) | data [1]) == JPEG_Marker_EOI) - goto finish; - JPEG_Assert (data [0] == 0xFF && (data [1] >= 0xD0 && data [1] <= 0xD7)); - for (c = 0; c < JPEG_MAXIMUM_COMPONENTS; c ++) - dcLast [c] = 0; - data += 2; - } - } - } - -finish: - /* Make sure we read an EOI marker. */ - JPEG_BITS_REWIND (); - JPEG_Assert (((data [0] << 8) | data [1]) == JPEG_Marker_EOI); - data += 2; - - /* Clear up and return success. */ - *dataBase = data; - return 1; -} - -/* Read an JPEG_Marker_SOFn marker into frame. This expects to start - * processing immediately after the marker. - */ -int JPEG_FrameHeader_Read (JPEG_FrameHeader *frame, const unsigned char **dataBase, JPEG_Marker marker) -{ - const unsigned char *data = *dataBase; - unsigned short length = (data [0] << 8) | data [1]; - int index; - - (void) length; - JPEG_Assert (length >= 8); - data += 2; /* Skip the length. */ - frame->marker = marker; - frame->encoding = (marker >= 0xFFC0 && marker <= 0xFFC7) ? 0 : 1; - frame->differential = !(marker >= 0xFFC0 && marker <= 0xFFC3 && marker >= 0xFFC8 && marker <= 0xFFCB); - - frame->precision = *data ++; - frame->height = (data [0] << 8) | data [1]; data += 2; - frame->width = (data [0] << 8) | data [1]; data += 2; - jpeg_width = frame->width; - frame->componentCount = *data ++; - - JPEG_Assert (frame->precision == 8); - JPEG_Assert (frame->componentCount <= JPEG_MAXIMUM_COMPONENTS); - JPEG_Assert (length == 8 + 3 * frame->componentCount); - - /* Read the frame components. */ - for (index = 0; index < frame->componentCount; index ++) - { - JPEG_FrameHeader_Component *c = &frame->componentList [index]; - unsigned char pair; - - c->selector = *data ++; - pair = *data ++; - c->horzFactor = pair >> 4; - c->vertFactor = pair & 15; - c->quantTable = *data ++; - - JPEG_Assert (c->horzFactor == 1 || c->horzFactor == 2 || c->horzFactor == 4); - JPEG_Assert (c->vertFactor == 1 || c->vertFactor == 2 || c->vertFactor == 4); - JPEG_Assert (c->quantTable <= 3); - } - - *dataBase = data; - return 1; -} - -/* Read a JPEG_Marker_SOS marker into scan. This expects to start processing - * immediately after the marker. - */ -int JPEG_ScanHeader_Read (JPEG_ScanHeader *scan, const unsigned char **dataBase) -{ - const unsigned char *data = *dataBase; - unsigned short length = (data [0] << 8) | data [1]; - JPEG_ScanHeader_Component *c, *cEnd; - unsigned char pair; - - (void) length; - JPEG_Assert (length >= 6); - data += 2; /* Skip the length. */ - scan->componentCount = *data ++; - - JPEG_Assert (scan->componentCount <= JPEG_MAXIMUM_COMPONENTS); - JPEG_Assert (length == 6 + 2 * scan->componentCount); - - /* Read the scan components. */ - for (c = scan->componentList, cEnd = c + scan->componentCount; c < cEnd; c ++) - { - c->selector = *data ++; - pair = *data ++; - c->dcTable = pair >> 4; - c->acTable = pair & 15; - - JPEG_Assert (c->dcTable < 4); - JPEG_Assert (c->acTable < 4); - } - - /* Read the spectral and approximation footers, which are used for - * progressive. - */ - - scan->spectralStart = *data ++; - scan->spectralEnd = *data ++; - JPEG_Assert (scan->spectralStart <= 63); - JPEG_Assert (scan->spectralEnd <= 63); - pair = *data ++; - scan->successiveApproximationBitPositionHigh = pair >> 4; - scan->successiveApproximationBitPositionLow = pair & 15; - JPEG_Assert (scan->successiveApproximationBitPositionHigh <= 13); - JPEG_Assert (scan->successiveApproximationBitPositionLow <= 15); - - *dataBase = data; - return 1; -} - -/* Read all headers from the very start of the JFIF stream to right after the - * SOS marker. - */ - -int JPEG_Decoder_ReadHeaders (JPEG_Decoder *decoder, const unsigned char **dataBase) -{ - const unsigned char *data = *dataBase; - JPEG_Marker marker; - int c; - - /* Initialize state and assure that this is a JFIF file. */ - decoder->restartInterval = 0; - JPEG_Assert (((data [0] << 8) | data [1]) == JPEG_Marker_SOI); - data += 2; - - /* Start reading every marker as it comes in. */ - while (1) - { - marker = (JPEG_Marker) ((data [0] << 8) | data [1]); - data += 2; - - switch (marker) - { - /* This block is just skipped over. */ - case JPEG_Marker_APP0: - case JPEG_Marker_APP1: - case JPEG_Marker_APP2: - case JPEG_Marker_APP3: - case JPEG_Marker_APP4: - case JPEG_Marker_APP5: - case JPEG_Marker_APP6: - case JPEG_Marker_APP7: - case JPEG_Marker_APP8: - case JPEG_Marker_APP9: - case JPEG_Marker_APP10: - case JPEG_Marker_APP11: - case JPEG_Marker_APP12: - case JPEG_Marker_APP13: - case JPEG_Marker_APP14: - case JPEG_Marker_APP15: - case JPEG_Marker_COM: - data += (data [0] << 8) | data [1]; - break; - - case JPEG_Marker_DHT: /* Define Huffman table. We just skip it for later decompression. */ - { - unsigned short length = (data [0] << 8) | data [1]; - const unsigned char *end = data + length; - - JPEG_Assert (length >= 2); - data += 2; - while (data < end) - { - unsigned char pair, type, slot; - - pair = *data ++; - type = pair >> 4; - slot = pair & 15; - - JPEG_Assert (type == 0 || type == 1); - JPEG_Assert (slot <= 15); - - if (type == 0) - decoder->dcTables [slot] = data; - else - decoder->acTables [slot] = data; - - if (!JPEG_HuffmanTable_Skip (&data)) - return 0; - } - - JPEG_Assert (data == end); - break; - } - - case JPEG_Marker_DQT: /* Define quantization table. */ - { - unsigned short length = (data [0] << 8) | data [1]; - const unsigned char *end = data + length; - int col, row; - JPEG_FIXED_TYPE *s; - - JPEG_Assert (length >= 2); - data += 2; - - while (data < end) - { - int pair, slot; - - pair = *data ++; - slot = pair & 15; - - JPEG_Assert (precision == 0); /* Only allow 8-bit. */ - JPEG_Assert (slot < 4); /* Ensure the slot is in-range. */ - JPEG_Assert (data + 64 <= end); /* Ensure it's the right size. */ - - s = decoder->quantTables [slot]; - - for (c = 0; c < JPEG_DCTSIZE2; c ++) - s [c] = JPEG_ITOFIX (*data ++); - - /* Multiply against the AAN factors. */ - for (row = 0; row < JPEG_DCTSIZE; row ++) - for (col = 0; col < JPEG_DCTSIZE; col ++) - { - JPEG_FIXED_TYPE *item = &s [col + row * JPEG_DCTSIZE]; - - *item = JPEG_FIXMUL (*item, JPEG_AANScaleFactor [JPEG_ToZigZag [row * JPEG_DCTSIZE + col]]); - } - } - - JPEG_Assert (data == end); /* Ensure we've finished it. */ - break; - } - - case JPEG_Marker_DRI: /* Define restart interval. */ - JPEG_Assert (((data [0] << 8) | data [1]) == 4); /* Check the length. */ - decoder->restartInterval = (data [2] << 8) | data [3]; - data += 4; - break; - - case JPEG_Marker_SOF0: /* Start of Frame: Baseline Sequential Huffman. */ - if (!JPEG_FrameHeader_Read (&decoder->frame, &data, marker)) - return 0; - break; - - case JPEG_Marker_SOS: /* Start of scan, immediately followed by the image. */ - if (!JPEG_ScanHeader_Read (&decoder->scan, &data)) - return 0; - *dataBase = data; - return 1; - - default: /* No known marker of this type. */ - JPEG_Assert (0); - break; - } - } -} - -/* Perform the two steps necessary to decompress a JPEG image. - * Nothing fancy about it. - */ -int JPEG_DecompressImage (const unsigned char *data, volatile JPEG_OUTPUT_TYPE *out, int outWidth, int outHeight) -{ - JPEG_Decoder decoder; - - if (!JPEG_Decoder_ReadHeaders (&decoder, &data)) - return 0; - if (!JPEG_Decoder_ReadImage (&decoder, &data, out, outWidth, outHeight)) - return 0; - - return 1; -} - -/* Return whether this code is a JPEG file. Unfortunately it will incorrectly - * match variants such as JPEG 2000 and JPEG-LS. A better function would - * skip known markers until it reaches an unknown marker or a handled - * SOFn. - */ - -int JPEG_Match (const unsigned char *data, int length) -{ - if (length == 0) return 0; - if (data [0] != 0xFF) return 0; - if (length == 1) return 1; - if (data [1] != 0xD8) return 0; - if (length == 2) return 1; - return 1; - if (data [2] != 0xFF) return 0; - if (length == 3) return 1; - if (data [3] < 0xC0 || data [3] > 0xCF) return 0; - if (data [3] == 0xC0) return 1; - return 0; -} +#include + +/* Setup the IWRAM-loading definitions if this has been enabled. There are + * three sections of this; the register definitions, the IWRAM end + * determination, and the DMA copying functions. Register definitions are the + * same as anywhere else, only with a JPEG_IWRAM prefix. The IWRAM end + * determination uses a generated variable that DevKit Advance's linker script + * creates. Because of this, other linker scripts might not work with this + * code. Finally, the DMA copying uses DMA 3. + * + * Functions that are to be copied to IWRAM must obey certain restrictions. + * They cannot refer to external constant data. They must be declared static. + * They must have a JPEG_FUNCTION_END(NAME) macro after them; see how it is + * used in the code ahead for an example. Finally, you should avoid external + * references altogether because of how it limits your flexibility. Instead, + * pass necessary variable and function pointers in the arguments. + */ + +#if JPEG_USE_IWRAM + /* The source address pointer for DMA 3. */ + #define JPEG_IWRAM_REG_DM3SAD (*(volatile unsigned int *) 0x40000D4) + + /* The destination address pointer for DMA 3. */ + #define JPEG_IWRAM_REG_DM3DAD (*(volatile unsigned int *) 0x40000D8) + + /* The number of words or halfwords to transfer for DMA 3. */ + #define JPEG_IWRAM_REG_DM3CNT_L (*(volatile unsigned short *) 0x40000DC) + + /* DMA 3 control register. */ + #define JPEG_IWRAM_REG_DM3CNT_H (*(volatile unsigned short *) 0x40000DE) + + /* The address of this is the end of the .bss (uninitialized variables) + * segment, which DevKit Advance's linker script puts last. + */ + extern char __bss_end; + + /* Retrieve the pointer to the first free byte in the IWRAM segment. */ + #define JPEG_IWRAM_USED_END (&__bss_end) + + /* This creates a simple stub function that can be used with JPEG_FUNCTION_SIZE + * to determine the size of a function in bytes. If the function will be + * IWRAM-loaded, this macro must be executed immediately after the + * function with the name of the function in the NAME parameter, and the + * function must be declared static. + */ + #define JPEG_FUNCTION_END(NAME) static void NAME##End () { } + + /* Retrieve the size in bytes of a function that has a JPEG_FUNCTION_END + * ballast. + */ + #define JPEG_FUNCTION_SIZE(NAME) ((int) ((char *) &NAME##End - (char *) &NAME) & ~3) + + /* Start a loading function by defining the necessary variables. */ + #define JPEG_IWRAM_LoadStart() char *iwramEnd = (char *) JPEG_IWRAM_USED_END + + /* Load the value named JPEG_NAME into the pointer named NAME, + * adjusting the read pointer. This copies SIZE bytes through DMA 3. + */ + #define JPEG_IWRAM_LoadValue(NAME, SIZE) \ + *(void **) &NAME = iwramEnd; \ + while (JPEG_IWRAM_REG_DM3CNT_H & (1 << 15)) { } \ + JPEG_Assert (iwramEnd + (SIZE) < (char *) &iwramEnd); \ + JPEG_IWRAM_REG_DM3SAD = (unsigned int) &JPEG_##NAME; \ + JPEG_IWRAM_REG_DM3DAD = (unsigned int) iwramEnd; \ + JPEG_IWRAM_REG_DM3CNT_L = (SIZE + 3) >> 2; \ + JPEG_IWRAM_REG_DM3CNT_H = (1 << 10) | (1 << 15); \ + iwramEnd += (SIZE & ~3) + + #define JPEG_IWRAM_LoadFunction(NAME) JPEG_IWRAM_LoadValue (NAME, JPEG_FUNCTION_SIZE (JPEG_##NAME)) + #define JPEG_IWRAM_LoadData(NAME) JPEG_IWRAM_LoadValue (NAME, sizeof (JPEG_##NAME)) + + /* Finish loading the IWRAM by waiting for the DMA transfers to finish and + * making an assertion check that makes sure (with fairly good but not + * perfect assurance) that we haven't written over the stack. + */ + #define JPEG_IWRAM_LoadDone() \ + do { } while (JPEG_IWRAM_REG_DM3CNT_H & (1 << 15)) + +#else + /* This stub does absolutely nothing. */ + #define JPEG_FUNCTION_END(NAME) +#endif /* JPEG_USE_IWRAM */ + + + +/* Converts left-to-right coefficient indices into zig-zagged indices. */ +const unsigned char JPEG_ToZigZag [JPEG_DCTSIZE2] = +{ + 0, 1, 8, 16, 9, 2, 3, 10, + 17, 24, 32, 25, 18, 11, 4, 5, + 12, 19, 26, 33, 40, 48, 41, 34, + 27, 20, 13, 6, 7, 14, 21, 28, + 35, 42, 49, 56, 57, 50, 43, 36, + 29, 22, 15, 23, 30, 37, 44, 51, + 58, 59, 52, 45, 38, 31, 39, 46, + 53, 60, 61, 54, 47, 55, 62, 63, +}; + +/* These macros are so that we can generate the AA&N multipliers at + * compile-time, allowing configuration control of fixed point precision. + */ +#define JPEG_AAN_0 1.0 +#define JPEG_AAN_1 1.387039845 +#define JPEG_AAN_2 1.306562965 +#define JPEG_AAN_3 1.175875602 +#define JPEG_AAN_4 1.0 +#define JPEG_AAN_5 0.785694958 +#define JPEG_AAN_6 0.541196100 +#define JPEG_AAN_7 0.275899379 + +#define JPEG_AAN_LINE(B) \ + JPEG_FTOFIX (JPEG_AAN_0 * JPEG_AAN_##B), \ + JPEG_FTOFIX (JPEG_AAN_1 * JPEG_AAN_##B), \ + JPEG_FTOFIX (JPEG_AAN_2 * JPEG_AAN_##B), \ + JPEG_FTOFIX (JPEG_AAN_3 * JPEG_AAN_##B), \ + JPEG_FTOFIX (JPEG_AAN_4 * JPEG_AAN_##B), \ + JPEG_FTOFIX (JPEG_AAN_5 * JPEG_AAN_##B), \ + JPEG_FTOFIX (JPEG_AAN_6 * JPEG_AAN_##B), \ + JPEG_FTOFIX (JPEG_AAN_7 * JPEG_AAN_##B) + +/* The AA&N scaling factors. These should be multiplied against quantization + * coefficients to determine their real value. + */ +const JPEG_FIXED_TYPE JPEG_AANScaleFactor [JPEG_DCTSIZE2] = +{ + JPEG_AAN_LINE (0), + JPEG_AAN_LINE (1), + JPEG_AAN_LINE (2), + JPEG_AAN_LINE (3), + JPEG_AAN_LINE (4), + JPEG_AAN_LINE (5), + JPEG_AAN_LINE (6), + JPEG_AAN_LINE (7), +}; + +int jpeg_width = 256; + +/* This converts values in the range [-32 .. 32] to [0 .. 32] by clamping + * values outside of that range. To use it, add 32 to your input. + */ +const unsigned char JPEG_ComponentRange [32 * 3] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 +}; + +/* Compute the columns half of the IDCT. */ +void JPEG_IDCT_Columns (JPEG_FIXED_TYPE *zz) +{ + JPEG_FIXED_TYPE tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmp10, tmp11; + JPEG_FIXED_TYPE *ez = zz + JPEG_DCTSIZE; + + /* The first column will always have a non-zero coefficient, the DC. */ + goto skipFirstCheckb; + + for ( ; zz < ez; zz ++) + { + /* A column containing only zeroes will output only zeroes. Since we + * output in-place, we don't need to do anything in that case. + */ + if (!zz [0 * JPEG_DCTSIZE] && !zz [1 * JPEG_DCTSIZE] + && !zz [2 * JPEG_DCTSIZE] && !zz [3 * JPEG_DCTSIZE] + && !zz [4 * JPEG_DCTSIZE] && !zz [5 * JPEG_DCTSIZE] + && !zz [6 * JPEG_DCTSIZE] && !zz [7 * JPEG_DCTSIZE]) + continue; + + skipFirstCheckb: + tmp0 = zz [0 * JPEG_DCTSIZE]; + tmp1 = zz [2 * JPEG_DCTSIZE]; + tmp2 = zz [4 * JPEG_DCTSIZE]; + tmp3 = zz [6 * JPEG_DCTSIZE]; + + tmp6 = tmp1 + tmp3; + tmp7 = JPEG_FIXMUL (tmp1 - tmp3, JPEG_FTOFIX (1.414213562)) - tmp6; + tmp1 = tmp0 - tmp2 + tmp7; + tmp0 = tmp0 + tmp2 + tmp6; + + tmp3 = tmp0 - (tmp6 << 1); + tmp2 = tmp1 - (tmp7 << 1); + + tmp4 = zz [1 * JPEG_DCTSIZE]; + tmp5 = zz [3 * JPEG_DCTSIZE]; + tmp6 = zz [5 * JPEG_DCTSIZE]; + tmp7 = zz [7 * JPEG_DCTSIZE]; + + tmp10 = tmp4 - tmp7; + + tmp8 = tmp6 + tmp5; + tmp9 = tmp4 + tmp7; + tmp7 = tmp9 + tmp8; + tmp11 = JPEG_FIXMUL (tmp9 - tmp8, JPEG_FTOFIX (1.414213562)); + + tmp8 = tmp6 - tmp5; + tmp9 = JPEG_FIXMUL (tmp8 + tmp10, JPEG_FTOFIX (1.847759065)); + + tmp6 = JPEG_FIXMUL (JPEG_FTOFIX (-2.613125930), tmp8) + tmp9 - tmp7; + tmp5 = tmp11 - tmp6; + tmp4 = JPEG_FIXMUL (JPEG_FTOFIX (1.082392200), tmp10) - tmp9 + tmp5; + + zz [0 * JPEG_DCTSIZE] = tmp0 + tmp7; + zz [1 * JPEG_DCTSIZE] = tmp1 + tmp6; + zz [2 * JPEG_DCTSIZE] = tmp2 + tmp5; + zz [3 * JPEG_DCTSIZE] = tmp3 - tmp4; + zz [4 * JPEG_DCTSIZE] = tmp3 + tmp4; + zz [5 * JPEG_DCTSIZE] = tmp2 - tmp5; + zz [6 * JPEG_DCTSIZE] = tmp1 - tmp6; + zz [7 * JPEG_DCTSIZE] = tmp0 - tmp7; + } +} +JPEG_FUNCTION_END (JPEG_IDCT_Columns) + +/* Compute the rows half of the IDCT, loading the component information into + * chunk as values in the range -64 to 64, although it can go somewhat outside + * of that range. chunkStride is the number of bytes in a row in chunk. + */ + +void JPEG_IDCT_Rows (const JPEG_FIXED_TYPE *zz, signed char *chunk, int chunkStride) +{ + JPEG_FIXED_TYPE tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13; + JPEG_FIXED_TYPE tmp4, tmp5, tmp6, tmp7, z5, z10, z11, z12, z13; + int row; + + for (row = 0; row < JPEG_DCTSIZE; row ++, zz += JPEG_DCTSIZE, chunk += chunkStride) + { + tmp10 = zz [0] + zz [4]; + tmp11 = zz [0] - zz [4]; + + tmp13 = zz [2] + zz [6]; + tmp12 = JPEG_FIXMUL (zz [2] - zz [6], JPEG_FTOFIX (1.414213562)) - tmp13; + + tmp0 = tmp10 + tmp13; + tmp3 = tmp10 - tmp13; + tmp1 = tmp11 + tmp12; + tmp2 = tmp11 - tmp12; + + z13 = zz [5] + zz [3]; + z10 = zz [5] - zz [3]; + z11 = zz [1] + zz [7]; + z12 = zz [1] - zz [7]; + + tmp7 = z11 + z13; + tmp11 = JPEG_FIXMUL (z11 - z13, JPEG_FTOFIX (1.414213562)); + + z5 = JPEG_FIXMUL (z10 + z12, JPEG_FTOFIX (1.847759065)); + tmp10 = JPEG_FIXMUL (JPEG_FTOFIX (1.082392200), z12) - z5; + tmp12 = JPEG_FIXMUL (JPEG_FTOFIX (-2.613125930), z10) + z5; + + tmp6 = tmp12 - tmp7; + tmp5 = tmp11 - tmp6; + tmp4 = tmp10 + tmp5; + + /* This shifts by an extra bit to remove the need for clamping at + * this point. Thus the normative samples are in the range -64 to 63. + * This requires a later bit-shift, but that comes for free with the ARM + * instruction set, and has an acceptable, likely imperceptible, loss + * of quality. + */ + + chunk [0] = JPEG_FIXTOI (tmp0 + tmp7) >> 4; + chunk [1] = JPEG_FIXTOI (tmp1 + tmp6) >> 4; + chunk [2] = JPEG_FIXTOI (tmp2 + tmp5) >> 4; + chunk [3] = JPEG_FIXTOI (tmp3 - tmp4) >> 4; + chunk [4] = JPEG_FIXTOI (tmp3 + tmp4) >> 4; + chunk [5] = JPEG_FIXTOI (tmp2 - tmp5) >> 4; + chunk [6] = JPEG_FIXTOI (tmp1 - tmp6) >> 4; + chunk [7] = JPEG_FIXTOI (tmp0 - tmp7) >> 4; + } +} +JPEG_FUNCTION_END (JPEG_IDCT_Rows) + +/* This function comes from jpeglib. I feel all right about that since it comes from AA&N anyway. */ +void JPEG_IDCT (JPEG_FIXED_TYPE *zz, signed char *chunk, int chunkStride) +{ + JPEG_IDCT_Columns (zz); + JPEG_IDCT_Rows (zz, chunk, chunkStride); +} + +/* Compute a signed value. COUNT is the number of bits to read, and OUT is + * where to store the result. + */ + +#define JPEG_Value(COUNT, OUT) \ + do { \ + unsigned int value = JPEG_BITS_GET (COUNT); \ + \ + if (value < (unsigned int) (1 << ((unsigned int) (COUNT - 1)))) \ + value += (-1 << COUNT) + 1; \ + (OUT) = value; \ + } while (0) + +/* Decode the coefficients from the input stream and do dequantization at the + * same time. dcLast is the previous block's DC value and is updated. zz is + * the output coefficients and will be all ready for an IDCT. quant is the + * quantization table to use, dcTable and acTable are the Huffman tables for + * the DC and AC coefficients respectively, dataBase, bitsLeftBase, and + * bitsDataBase are for input stream state, and toZigZag is a pointer to + * JPEG_ToZigZag or to its IWRAM copy. + */ + +void JPEG_DecodeCoefficients ( + JPEG_FIXED_TYPE *dcLast, JPEG_FIXED_TYPE *zz, JPEG_FIXED_TYPE *quant, + JPEG_HuffmanTable *dcTable, JPEG_HuffmanTable *acTable, + const unsigned char **dataBase, unsigned int *bitsLeftBase, + unsigned long int *bitsDataBase, const unsigned char *toZigZag) +{ + unsigned bits_left = *bitsLeftBase, bits_data = *bitsDataBase; /* Input stream state. */ + const unsigned char *data = *dataBase; /* Input stream state. */ + int r, s, diff; /* Various temporary data variables. */ + int index = 1; /* The current zig-zagged index. */ + + /* Clear all coefficients to zero. */ + { + JPEG_FIXED_TYPE *ez = zz + JPEG_DCTSIZE2; + do *-- ez = 0; + while (ez > zz); + } + + /* Read the DC coefficient. */ + JPEG_BITS_CHECK (); + JPEG_HuffmanTable_Decode (dcTable, s); + JPEG_Value (s, diff); + + /* Store the DC coefficient. */ + *dcLast += diff; + zz [toZigZag [0]] = *dcLast * quant [0]; + + while (1) + { + /* Read a bits/run-length value. */ + JPEG_BITS_CHECK (); + JPEG_HuffmanTable_Decode (acTable, s); + r = s >> 4; + s &= 15; + + /* If there is a value at this cell +r, then read it. */ + if (s) + { + index += r; + JPEG_Value (s, r); + zz [toZigZag [index]] = r * quant [index]; + if (index == JPEG_DCTSIZE2 - 1) + break; + index ++; + } + /* Otherwise we skip 16 cells or finish up. */ + else + { + if (r != 15) + break; + index += 16; + } + } + + /* Restore state for the caller. */ + *bitsDataBase = bits_data; + *bitsLeftBase = bits_left; + *dataBase = data; +} +JPEG_FUNCTION_END (JPEG_DecodeCoefficients) + +/* Convert a chunk of YCbCr data to the output format. YBlock, CbBlock, + * and CrBlock are the pointers to the relevant chunks; each sample is + * between -64 and 64, although out-of-range values are possible. + * nHorzFactor and nVertFactor, where n is Y, Cb, and Cr, hold the + * multipliers for each coordinate. Shift right by horzMax and vertMax to + * get the actual point to sample data from. M211 is true if the + * component factors satisfy a 2:1:1 relationship; this leads to a much + * faster conversion if JPEG_FASTER_M211 is enabled. + * out and outStride are the output pointers and the number of samples + * in an output row. Finally, ComponentRange is a pointer to the + * JPEG_ComponentRange array. + */ + + + +void JPEG_ConvertBlock ( + signed char *YBlock, signed char *CbBlock, signed char *CrBlock, + int YHorzFactor, int YVertFactor, int CbHorzFactor, int CbVertFactor, int CrHorzFactor, int CrVertFactor, int horzMax, int vertMax, + char M211, volatile JPEG_OUTPUT_TYPE *out, int outStride, const unsigned char *ComponentRange) +{ + int px, py; + + /* Since we need to offset all indices into this anyway, we might as well do it once only. */ + ComponentRange += 32; + +/* Do the faster 2:1:1 code if JPEG_FASTER_M211 is set and the image scan satisfies that relationship. */ +#if JPEG_FASTER_M211 + if (M211) + { + /* Nothing complex here. Because of its nature, we can do Cb and Cr + * conversion only once for every four pixels. This optimization is + * done implicitly, using GCC's optimizer for gleaning the actual + * advantage. + */ + + for (py = 0; py < 2 * JPEG_DCTSIZE; py += 2) + { + volatile JPEG_OUTPUT_TYPE *row = &out [outStride * py]; + volatile JPEG_OUTPUT_TYPE *rowEnd = row + JPEG_DCTSIZE * 2; + + for ( ; row < rowEnd; row += 2, YBlock += 2, CbBlock ++, CrBlock ++) + { + int Cb = *CbBlock, Cr = *CrBlock; + JPEG_Convert (row [0], YBlock [0], Cb, Cr); + JPEG_Convert (row [1], YBlock [1], Cb, Cr); + JPEG_Convert (row [jpeg_width], YBlock [2 * JPEG_DCTSIZE + 0], Cb, Cr); // 240 + JPEG_Convert (row [jpeg_width+1], YBlock [2 * JPEG_DCTSIZE + 1], Cb, Cr); // 241 + } + + YBlock += JPEG_DCTSIZE * 2; + } + } +#else + if (0) { } +#endif /* JPEG_FASTER_M211 */ + +/* Otherwise we fall back on generic code, if JPEG_HANDLE_ANY_FACTORS is set. + * If it is not, then this function does nothing at all! + */ +#if JPEG_HANDLE_ANY_FACTORS + else for (py = 0; py < vertMax; py ++) + { + signed char *YScan = YBlock + (py * YVertFactor >> 8) * (horzMax * YHorzFactor >> 8); + signed char *CbScan = CbBlock + (py * CbVertFactor >> 8) * (horzMax * CbHorzFactor >> 8); + signed char *CrScan = CrBlock + (py * CrVertFactor >> 8) * (horzMax * CrHorzFactor >> 8); + + volatile JPEG_OUTPUT_TYPE *row = &out [outStride * py]; + + for (px = 0; px < horzMax; px ++, row ++) + { + int Y = YScan [px * YHorzFactor >> 8]; + int Cb = CbScan [px * CbHorzFactor >> 8]; + int Cr = CrScan [px * CrHorzFactor >> 8]; + + JPEG_Convert (*row, Y, Cb, Cr); + } + } +#endif /* JPEG_HANDLE_ANY_FACTORS */ + + /* Make sure all variables are referenced. */ + (void) YHorzFactor; (void) YVertFactor; (void) CbHorzFactor; + (void) CbVertFactor; (void) CrHorzFactor; (void) CrVertFactor; + (void) horzMax; (void) vertMax; (void) px; (void) py; + (void) YBlock; (void) CbBlock; (void) CrBlock; + (void) M211; (void) out; (void) outStride; +} +JPEG_FUNCTION_END (JPEG_ConvertBlock) + + +/* Decode a Huffman table and initialize its data. This expects to be called + * after the DHT marker and the type/slot pair. + */ +int JPEG_HuffmanTable_Read (JPEG_HuffmanTable *huffmanTable, const unsigned char **dataBase) +{ + const unsigned char *data = *dataBase; + const unsigned char *bits; + int huffcode [256]; + unsigned char huffsize [256]; + int total = 0; + int c; + + bits = data; + for (c = 0; c < 16; c ++) + total += *data ++; + huffmanTable->huffval = data; + data += total; + + /*void GenerateSizeTable ()*/ + { + int k = 0, i = 1, j = 1; + + do + { + while (j ++ <= bits [i - 1]) + huffsize [k ++] = i; + i ++; + j = 1; + } + while (i <= 16); + + huffsize [k] = 0; + } + + /*void GenerateCodeTable ()*/ + { + int k = 0, code = 0, si = huffsize [0]; + + while (1) + { + do huffcode [k ++] = code ++; + while (huffsize [k] == si); + + if (huffsize [k] == 0) + break; + + do code <<= 1, si ++; + while (huffsize [k] != si); + } + } + + /*void DecoderTables ()*/ + { + int i = 0, j = 0; + + while (1) + { + if (i >= 16) + break; + if (bits [i] == 0) + huffmanTable->maxcode [i] = -1; + else + { + huffmanTable->valptr [i] = &huffmanTable->huffval [j - huffcode [j]]; + j += bits [i]; + huffmanTable->maxcode [i] = huffcode [j - 1]; + } + i ++; + } + } + + /*void GenerateLookahead ()*/ + { + int l, i, p, c, ctr; + + for (c = 0; c < 256; c ++) + huffmanTable->look_nbits [c] = 0; + + p = 0; + for (l = 1; l <= 8; l ++) + { + for (i = 1; i <= bits [l - 1]; i ++, p ++) + { + int lookbits = huffcode [p] << (8 - l); + + for (ctr = 1 << (8 - l); ctr > 0; ctr --) + { + huffmanTable->look_nbits [lookbits] = l; + huffmanTable->look_sym [lookbits] = huffmanTable->huffval [p]; + lookbits ++; + } + } + } + } + + *dataBase = data; + return 1; +} + +/* Skip past a Huffman table section. This expects to be called after reading + * the DHT marker and the type/slot pair. + */ +int JPEG_HuffmanTable_Skip (const unsigned char **dataBase) +{ + const unsigned char *data = *dataBase; + int c, total = 16; + + for (c = 0; c < 16; c ++) + total += *data ++; + *dataBase += total; + return 1; +} + +/* Takes information discovered in JPEG_Decoder_ReadHeaders and loads the + * image. This is a public function; see gba-jpeg.h for more information on it. + */ +int JPEG_Decoder_ReadImage (JPEG_Decoder *decoder, const unsigned char **dataBase, volatile JPEG_OUTPUT_TYPE *out, int outWidth, int outHeight) +{ + JPEG_FrameHeader *frame = &decoder->frame; /* Pointer to the image's frame. */ + JPEG_ScanHeader *scan = &decoder->scan; /* Pointer to the image's scan. */ + int YHorzFactor = 0, YVertFactor = 0; /* Scaling factors for the Y component. */ + int CbHorzFactor = 1, CbVertFactor = 1; /* Scaling factors for the Cb component. The default is important because it is used for greyscale images. */ + int CrHorzFactor = 1, CrVertFactor = 1; /* Scaling factors for the Cr component. The default is important because it is used for greyscale images. */ + int horzMax = 0, vertMax = 0; /* The maximum horizontal and vertical scaling factors for the components. */ + JPEG_FrameHeader_Component *frameComponents [JPEG_MAXIMUM_COMPONENTS]; /* Pointers translating scan header components to frame header components. */ + JPEG_FrameHeader_Component *item, *itemEnd = frame->componentList + frame->componentCount; /* The frame header's components for loops. */ + JPEG_FIXED_TYPE dcLast [JPEG_MAXIMUM_COMPONENTS]; /* The last DC coefficient computed. This is initialized to zeroes at the start and after a restart interval. */ + int c, bx, by, cx, cy; /* Various loop parameters. */ + int horzShift = 0; /* The right shift to use after multiplying by nHorzFactor to get the actual sample. */ + int vertShift = 0; /* The right shift to use after multiplying by nVertFactor to get the actual sample. */ + char M211 = 0; /* Whether this scan satisfies the 2:1:1 relationship, which leads to faster code. */ + const unsigned char *data = *dataBase; /* The input data pointer; this must be right at the start of scan data. */ + + signed char blockBase [JPEG_DCTSIZE2 * JPEG_MAXIMUM_SCAN_COMPONENT_FACTORS]; /* Blocks that have been read and are alloted to YBlock, CbBlock, and CrBlock based on their scaling factors. */ + signed char *YBlock; /* Y component temporary block that holds samples for the MCU currently being decompressed. */ + signed char *CbBlock; /* Cb component temporary block that holds samples for the MCU currently being decompressed. */ + signed char *CrBlock; /* Cr component temporary block that holds samples for the MCU currently being decompressed. */ + + JPEG_HuffmanTable acTableList [2]; /* The decompressed AC Huffman tables. JPEG Baseline allows only two AC Huffman tables in a scan. */ + int acTableUse [2] = { -1, -1 }; /* The indices of the decompressed AC Huffman tables, or -1 if this table hasn't been used. */ + JPEG_HuffmanTable dcTableList [2]; /* The decompressed DC Huffman tables. JPEG Baseline allows only two DC Huffman tables in a scan. */ + int dcTableUse [2] = { -1, -1 }; /* The indices of the decompressed DC Huffman tables, or -1 if this table hasn't been used. */ + int restartInterval = decoder->restartInterval; /* Number of blocks until the next restart. */ + + /* Pointer to JPEG_ConvertBlock, which might be moved to IWRAM. */ + void (*ConvertBlock) (signed char *, signed char *, signed char *, + int, int, int, int, int, int, int, int, char, + volatile JPEG_OUTPUT_TYPE *, int, const unsigned char *) + = &JPEG_ConvertBlock; + + /* Pointer to JPEG_IDCT_Columns, which might be moved to IWRAM. */ + void (*IDCT_Columns) (JPEG_FIXED_TYPE *) = &JPEG_IDCT_Columns; + + /* Pointer to JPEG_IDCT_Rows, which might be moved to IWRAM. */ + void (*IDCT_Rows) (const JPEG_FIXED_TYPE *, signed char *, int) = &JPEG_IDCT_Rows; + + /* Pointer to JPEG_DecodeCoefficients, which might be moved to IWRAM. */ + void (*DecodeCoefficients) (JPEG_FIXED_TYPE *, JPEG_FIXED_TYPE *, JPEG_FIXED_TYPE *, JPEG_HuffmanTable *, + JPEG_HuffmanTable *, const unsigned char **, unsigned int *, + unsigned long int *, const unsigned char *) = &JPEG_DecodeCoefficients; + + const unsigned char *ToZigZag = JPEG_ToZigZag; /* Pointer to JPEG_ToZigZag, which might be moved to IWRAM. */ + const unsigned char *ComponentRange = JPEG_ComponentRange; /* Pointer to JPEG_ComponentRange, which might be moved to IWRAM. */ + + /* Start decoding bits. */ + JPEG_BITS_START (); + + /* The sum of all factors in the scan; this cannot be greater than 10 in JPEG Baseline. */ + int factorSum = 0; + +/* Load the essential functions and data into IWRAM if this has been set. */ +#if JPEG_USE_IWRAM + JPEG_IWRAM_LoadStart (); /* Define variables. */ + JPEG_IWRAM_LoadFunction (ConvertBlock); + JPEG_IWRAM_LoadFunction (DecodeCoefficients); + JPEG_IWRAM_LoadFunction (IDCT_Columns); + JPEG_IWRAM_LoadFunction (IDCT_Rows); + JPEG_IWRAM_LoadData (ToZigZag); + JPEG_IWRAM_LoadData (ComponentRange); + JPEG_IWRAM_LoadDone (); /* Finished; run down DMA and check that we haven't overwritten the stack. */ +#endif /* JPEG_USE_IWRAM */ + + /* Find the maximum factors and the factors for each component. */ + for (item = frame->componentList; item < itemEnd; item ++) + { + /* Find the opposing scan header component. */ + for (c = 0; ; c ++) + { + JPEG_ScanHeader_Component *sc; + + JPEG_Assert (c < scan->componentCount); + sc = &scan->componentList [c]; + if (sc->selector != item->selector) + continue; + + /* Decompress the DC table if necessary. */ + if (sc->dcTable != dcTableUse [0] && sc->dcTable != dcTableUse [1]) + { + const unsigned char *tablePointer = decoder->dcTables [sc->dcTable]; + + if (dcTableUse [0] == -1) + dcTableUse [0] = sc->dcTable, JPEG_HuffmanTable_Read (&dcTableList [0], &tablePointer); + else if (dcTableUse [1] == -1) + dcTableUse [1] = sc->dcTable, JPEG_HuffmanTable_Read (&dcTableList [1], &tablePointer); + else + JPEG_Assert (0); + } + + /* Decompress the AC table if necessary. */ + if (sc->acTable != acTableUse [0] && sc->acTable != acTableUse [1]) + { + const unsigned char *tablePointer = decoder->acTables [sc->acTable]; + + if (acTableUse [0] == -1) + acTableUse [0] = sc->acTable, JPEG_HuffmanTable_Read (&acTableList [0], &tablePointer); + else if (acTableUse [1] == -1) + acTableUse [1] = sc->acTable, JPEG_HuffmanTable_Read (&acTableList [1], &tablePointer); + else + JPEG_Assert (0); + } + + frameComponents [c] = item; + break; + } + + /* Add the sum for a later assertion test. */ + factorSum += item->horzFactor * item->vertFactor; + + /* Adjust the maximum horizontal and vertical scaling factors as necessary. */ + if (item->horzFactor > horzMax) + horzMax = item->horzFactor; + if (item->vertFactor > vertMax) + vertMax = item->vertFactor; + + /* Update the relevant component scaling factors if necessary. */ + if (item->selector == 1) + { + YHorzFactor = item->horzFactor; + YVertFactor = item->vertFactor; + } + else if (item->selector == 2) + { + CbHorzFactor = item->horzFactor; + CbVertFactor = item->vertFactor; + } + else if (item->selector == 3) + { + CrHorzFactor = item->horzFactor; + CrVertFactor = item->vertFactor; + } + } + + /* Ensure that we have enough memory for these factors. */ + JPEG_Assert (factorSum < JPEG_MAXIMUM_SCAN_COMPONENT_FACTORS); + + /* Split up blockBase according to the components. */ + YBlock = blockBase; + CbBlock = YBlock + YHorzFactor * YVertFactor * JPEG_DCTSIZE2; + CrBlock = CbBlock + CbHorzFactor * CbVertFactor * JPEG_DCTSIZE2; + + /* Compute the right shift to be done after multiplying against the scaling factor. */ + if (horzMax == 1) horzShift = 8; + else if (horzMax == 2) horzShift = 7; + else if (horzMax == 4) horzShift = 6; + + /* Compute the right shift to be done after multiplying against the scaling factor. */ + if (vertMax == 1) vertShift = 8; + else if (vertMax == 2) vertShift = 7; + else if (vertMax == 4) vertShift = 6; + + /* Adjust the scaling factors for our parameters. */ + YHorzFactor <<= horzShift; + YVertFactor <<= vertShift; + CbHorzFactor <<= horzShift; + CbVertFactor <<= vertShift; + CrHorzFactor <<= horzShift; + CrVertFactor <<= vertShift; + + /* Clear the Cb channel for potential grayscale. */ + { + signed char *e = CbBlock + JPEG_DCTSIZE2; + + do *-- e = 0; + while (e > CbBlock); + } + + /* Clear the Cr channel for potential grayscale. */ + { + signed char *e = CrBlock + JPEG_DCTSIZE2; + + do *-- e = 0; + while (e > CrBlock); + } + +/* Compute whether this satisfies the sped up 2:1:1 relationship. */ +#if JPEG_FASTER_M211 + if (YHorzFactor == 256 && YVertFactor == 256 && CbHorzFactor == 128 && CbVertFactor == 128 && CrHorzFactor == 128 && CrVertFactor == 128) + M211 = 1; +#endif /* JPEG_FASTER_M211 */ + + /* Clear the DC parameters. */ + for (c = 0; c < JPEG_MAXIMUM_COMPONENTS; c ++) + dcLast [c] = 0; + + /* Now run over each MCU horizontally, then vertically. */ + for (by = 0; by < frame->height; by += vertMax * JPEG_DCTSIZE) + { + for (bx = 0; bx < frame->width; bx += horzMax * JPEG_DCTSIZE) + { + /* Read the components for the MCU. */ + for (c = 0; c < scan->componentCount; c ++) + { + JPEG_ScanHeader_Component *sc = &scan->componentList [c]; + JPEG_FrameHeader_Component *fc = frameComponents [c]; + JPEG_HuffmanTable *dcTable, *acTable; + JPEG_FIXED_TYPE *quant = decoder->quantTables [fc->quantTable]; + int stride = fc->horzFactor * JPEG_DCTSIZE; + signed char *chunk = 0; + + dcTable = &dcTableList [sc->dcTable == dcTableUse [1] ? 1 : 0]; + acTable = &acTableList [sc->acTable == acTableUse [1] ? 1 : 0]; + + /* Compute the output chunk. */ + if (fc->selector == 1) + chunk = YBlock; + else if (fc->selector == 2) + chunk = CbBlock; + else if (fc->selector == 3) + chunk = CrBlock; + + for (cy = 0; cy < fc->vertFactor * JPEG_DCTSIZE; cy += JPEG_DCTSIZE) + { + for (cx = 0; cx < fc->horzFactor * JPEG_DCTSIZE; cx += JPEG_DCTSIZE) + { + int start = cx + cy * stride; + JPEG_FIXED_TYPE zz [JPEG_DCTSIZE2]; + + /* Decode coefficients. */ + DecodeCoefficients (&dcLast [c], zz, quant, dcTable, acTable, &data, &bits_left, &bits_data, ToZigZag); + + /* Perform an IDCT if this component will contribute to the image. */ + if (chunk) + { + IDCT_Columns (zz); + IDCT_Rows (zz, chunk + start, stride); + } + } + } + } + + /* Check that our block will be in-range; this should actually use clamping. */ + if (bx + horzMax * JPEG_DCTSIZE > outWidth || by + vertMax * JPEG_DCTSIZE > outHeight) + continue; + + /* Convert our block from YCbCr to the output. */ + ConvertBlock (YBlock, CbBlock, CrBlock, + YHorzFactor, YVertFactor, CbHorzFactor, CbVertFactor, CrHorzFactor, CrVertFactor, + horzMax * JPEG_DCTSIZE, vertMax * JPEG_DCTSIZE, M211, out + bx + by * outWidth, outWidth, ComponentRange); + + /* Handle the restart interval. */ + if (decoder->restartInterval && --restartInterval == 0) + { + restartInterval = decoder->restartInterval; + JPEG_BITS_REWIND (); + if (((data [0] << 8) | data [1]) == JPEG_Marker_EOI) + goto finish; + JPEG_Assert (data [0] == 0xFF && (data [1] >= 0xD0 && data [1] <= 0xD7)); + for (c = 0; c < JPEG_MAXIMUM_COMPONENTS; c ++) + dcLast [c] = 0; + data += 2; + } + } + } + +finish: + /* Make sure we read an EOI marker. */ + JPEG_BITS_REWIND (); + JPEG_Assert (((data [0] << 8) | data [1]) == JPEG_Marker_EOI); + data += 2; + + /* Clear up and return success. */ + *dataBase = data; + return 1; +} + +/* Read an JPEG_Marker_SOFn marker into frame. This expects to start + * processing immediately after the marker. + */ +int JPEG_FrameHeader_Read (JPEG_FrameHeader *frame, const unsigned char **dataBase, JPEG_Marker marker) +{ + const unsigned char *data = *dataBase; + unsigned short length = (data [0] << 8) | data [1]; + int index; + + (void) length; + JPEG_Assert (length >= 8); + data += 2; /* Skip the length. */ + frame->marker = marker; + frame->encoding = (marker >= 0xFFC0 && marker <= 0xFFC7) ? 0 : 1; + frame->differential = !(marker >= 0xFFC0 && marker <= 0xFFC3 && marker >= 0xFFC8 && marker <= 0xFFCB); + + frame->precision = *data ++; + frame->height = (data [0] << 8) | data [1]; data += 2; + frame->width = (data [0] << 8) | data [1]; data += 2; + jpeg_width = frame->width; + frame->componentCount = *data ++; + + JPEG_Assert (frame->precision == 8); + JPEG_Assert (frame->componentCount <= JPEG_MAXIMUM_COMPONENTS); + JPEG_Assert (length == 8 + 3 * frame->componentCount); + + /* Read the frame components. */ + for (index = 0; index < frame->componentCount; index ++) + { + JPEG_FrameHeader_Component *c = &frame->componentList [index]; + unsigned char pair; + + c->selector = *data ++; + pair = *data ++; + c->horzFactor = pair >> 4; + c->vertFactor = pair & 15; + c->quantTable = *data ++; + + JPEG_Assert (c->horzFactor == 1 || c->horzFactor == 2 || c->horzFactor == 4); + JPEG_Assert (c->vertFactor == 1 || c->vertFactor == 2 || c->vertFactor == 4); + JPEG_Assert (c->quantTable <= 3); + } + + *dataBase = data; + return 1; +} + +/* Read a JPEG_Marker_SOS marker into scan. This expects to start processing + * immediately after the marker. + */ +int JPEG_ScanHeader_Read (JPEG_ScanHeader *scan, const unsigned char **dataBase) +{ + const unsigned char *data = *dataBase; + unsigned short length = (data [0] << 8) | data [1]; + JPEG_ScanHeader_Component *c, *cEnd; + unsigned char pair; + + (void) length; + JPEG_Assert (length >= 6); + data += 2; /* Skip the length. */ + scan->componentCount = *data ++; + + JPEG_Assert (scan->componentCount <= JPEG_MAXIMUM_COMPONENTS); + JPEG_Assert (length == 6 + 2 * scan->componentCount); + + /* Read the scan components. */ + for (c = scan->componentList, cEnd = c + scan->componentCount; c < cEnd; c ++) + { + c->selector = *data ++; + pair = *data ++; + c->dcTable = pair >> 4; + c->acTable = pair & 15; + + JPEG_Assert (c->dcTable < 4); + JPEG_Assert (c->acTable < 4); + } + + /* Read the spectral and approximation footers, which are used for + * progressive. + */ + + scan->spectralStart = *data ++; + scan->spectralEnd = *data ++; + JPEG_Assert (scan->spectralStart <= 63); + JPEG_Assert (scan->spectralEnd <= 63); + pair = *data ++; + scan->successiveApproximationBitPositionHigh = pair >> 4; + scan->successiveApproximationBitPositionLow = pair & 15; + JPEG_Assert (scan->successiveApproximationBitPositionHigh <= 13); + JPEG_Assert (scan->successiveApproximationBitPositionLow <= 15); + + *dataBase = data; + return 1; +} + +/* Read all headers from the very start of the JFIF stream to right after the + * SOS marker. + */ + +int JPEG_Decoder_ReadHeaders (JPEG_Decoder *decoder, const unsigned char **dataBase) +{ + const unsigned char *data = *dataBase; + JPEG_Marker marker; + int c; + + /* Initialize state and assure that this is a JFIF file. */ + decoder->restartInterval = 0; + JPEG_Assert (((data [0] << 8) | data [1]) == JPEG_Marker_SOI); + data += 2; + + /* Start reading every marker as it comes in. */ + while (1) + { + marker = (JPEG_Marker) ((data [0] << 8) | data [1]); + data += 2; + + switch (marker) + { + /* This block is just skipped over. */ + case JPEG_Marker_APP0: + case JPEG_Marker_APP1: + case JPEG_Marker_APP2: + case JPEG_Marker_APP3: + case JPEG_Marker_APP4: + case JPEG_Marker_APP5: + case JPEG_Marker_APP6: + case JPEG_Marker_APP7: + case JPEG_Marker_APP8: + case JPEG_Marker_APP9: + case JPEG_Marker_APP10: + case JPEG_Marker_APP11: + case JPEG_Marker_APP12: + case JPEG_Marker_APP13: + case JPEG_Marker_APP14: + case JPEG_Marker_APP15: + case JPEG_Marker_COM: + data += (data [0] << 8) | data [1]; + break; + + case JPEG_Marker_DHT: /* Define Huffman table. We just skip it for later decompression. */ + { + unsigned short length = (data [0] << 8) | data [1]; + const unsigned char *end = data + length; + + JPEG_Assert (length >= 2); + data += 2; + while (data < end) + { + unsigned char pair, type, slot; + + pair = *data ++; + type = pair >> 4; + slot = pair & 15; + + JPEG_Assert (type == 0 || type == 1); + JPEG_Assert (slot <= 15); + + if (type == 0) + decoder->dcTables [slot] = data; + else + decoder->acTables [slot] = data; + + if (!JPEG_HuffmanTable_Skip (&data)) + return 0; + } + + JPEG_Assert (data == end); + break; + } + + case JPEG_Marker_DQT: /* Define quantization table. */ + { + unsigned short length = (data [0] << 8) | data [1]; + const unsigned char *end = data + length; + int col, row; + JPEG_FIXED_TYPE *s; + + JPEG_Assert (length >= 2); + data += 2; + + while (data < end) + { + int pair, slot; + + pair = *data ++; + slot = pair & 15; + + JPEG_Assert (precision == 0); /* Only allow 8-bit. */ + JPEG_Assert (slot < 4); /* Ensure the slot is in-range. */ + JPEG_Assert (data + 64 <= end); /* Ensure it's the right size. */ + + s = decoder->quantTables [slot]; + + for (c = 0; c < JPEG_DCTSIZE2; c ++) + s [c] = JPEG_ITOFIX (*data ++); + + /* Multiply against the AAN factors. */ + for (row = 0; row < JPEG_DCTSIZE; row ++) + for (col = 0; col < JPEG_DCTSIZE; col ++) + { + JPEG_FIXED_TYPE *item = &s [col + row * JPEG_DCTSIZE]; + + *item = JPEG_FIXMUL (*item, JPEG_AANScaleFactor [JPEG_ToZigZag [row * JPEG_DCTSIZE + col]]); + } + } + + JPEG_Assert (data == end); /* Ensure we've finished it. */ + break; + } + + case JPEG_Marker_DRI: /* Define restart interval. */ + JPEG_Assert (((data [0] << 8) | data [1]) == 4); /* Check the length. */ + decoder->restartInterval = (data [2] << 8) | data [3]; + data += 4; + break; + + case JPEG_Marker_SOF0: /* Start of Frame: Baseline Sequential Huffman. */ + if (!JPEG_FrameHeader_Read (&decoder->frame, &data, marker)) + return 0; + break; + + case JPEG_Marker_SOS: /* Start of scan, immediately followed by the image. */ + if (!JPEG_ScanHeader_Read (&decoder->scan, &data)) + return 0; + *dataBase = data; + return 1; + + default: /* No known marker of this type. */ + JPEG_Assert (0); + break; + } + } +} + +/* Perform the two steps necessary to decompress a JPEG image. + * Nothing fancy about it. + */ +int JPEG_DecompressImage (const unsigned char *data, volatile JPEG_OUTPUT_TYPE *out, int outWidth, int outHeight) +{ + JPEG_Decoder decoder; + + if (!JPEG_Decoder_ReadHeaders (&decoder, &data)) + return 0; + if (!JPEG_Decoder_ReadImage (&decoder, &data, out, outWidth, outHeight)) + return 0; + + return 1; +} + +/* Return whether this code is a JPEG file. Unfortunately it will incorrectly + * match variants such as JPEG 2000 and JPEG-LS. A better function would + * skip known markers until it reaches an unknown marker or a handled + * SOFn. + */ + +int JPEG_Match (const unsigned char *data, int length) +{ + if (length == 0) return 0; + if (data [0] != 0xFF) return 0; + if (length == 1) return 1; + if (data [1] != 0xD8) return 0; + if (length == 2) return 1; + return 1; + if (data [2] != 0xFF) return 0; + if (length == 3) return 1; + if (data [3] < 0xC0 || data [3] > 0xCF) return 0; + if (data [3] == 0xC0) return 1; + return 0; +} diff --git a/source/arm9/keyboard.map.c b/source/arm9/keyboard.map.c index bbdd32c..e64fdda 100644 --- a/source/arm9/keyboard.map.c +++ b/source/arm9/keyboard.map.c @@ -1,518 +1,518 @@ -/* - * 32x128 map data - */ -const unsigned short keyboard_Map[4096] = { -0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, -0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, -0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, -0x0001, 0x0002, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x0008, 0x000a, -0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, -0x0008, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, -0x0019, 0x001a, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, -0x0023, 0x0020, 0x0021, 0x0024, 0x0021, 0x0025, 0x001d, 0x0024, -0x0021, 0x0026, 0x0021, 0x0027, 0x0021, 0x0028, 0x0029, 0x002a, -0x002b, 0x002c, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, -0x0035, 0x0036, 0x0037, 0x0036, 0x0038, 0x0039, 0x003a, 0x0032, -0x003b, 0x003c, 0x002f, 0x003d, 0x003e, 0x003d, 0x003f, 0x0040, -0x0041, 0x0042, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, -0x004b, 0x001d, 0x004c, 0x004d, 0x004e, 0x004f, 0x0049, 0x0050, -0x0051, 0x0052, 0x0049, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, -0x0058, 0x0059, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x005a, 0x005b, 0x005c, 0x0018, 0x005d, 0x005e, 0x005f, 0x005e, -0x0060, 0x0061, 0x0062, 0x005e, 0x0063, 0x0064, 0x005d, 0x0065, -0x0066, 0x0067, 0x005f, 0x0068, 0x003c, 0x0069, 0x006a, 0x006b, -0x006c, 0x006d, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, -0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, -0x007e, 0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, -0x0086, 0x0087, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0088, 0x0089, 0x008a, 0x008b, 0x0018, 0x008c, 0x008d, 0x008e, -0x005e, 0x008f, 0x0090, 0x0091, 0x0064, 0x005d, 0x0092, 0x005d, -0x0093, 0x0094, 0x0065, 0x003c, 0x0065, 0x003c, 0x0095, 0x0096, -0x0097, 0x0098, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, 0x00a0, -0x0075, 0x009e, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, -0x00a7, 0x00a8, 0x00a9, 0x001d, 0x00aa, 0x001d, 0x00ab, 0x0082, -0x00ac, 0x00ad, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x00ae, 0x0097, 0x00af, 0x00b0, 0x003c, 0x00b1, 0x003c, 0x00b2, -0x003c, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, -0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00c0, 0x00c1, -0x00c2, 0x00c3, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x00c4, 0x0097, 0x00af, 0x00c5, 0x00c6, 0x00c7, 0x001d, 0x00c5, -0x00c6, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, -0x00cf, 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x007e, 0x00d5, -0x00d6, 0x001a, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x00d7, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, -0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, -0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, -0x00d8, 0x00d9, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, -0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, -0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, -0x0001, 0x0002, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0004, 0x00da, 0x0006, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, -0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, -0x00e8, 0x00e9, 0x00be, 0x00ea, 0x00eb, 0x0065, 0x003c, 0x00ec, -0x00ed, 0x001a, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x001b, 0x00ee, 0x0082, 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, -0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x001d, 0x00f8, 0x00f9, 0x00fa, -0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x004f, 0x00ff, 0x009e, 0x0100, -0x0101, 0x002c, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x002d, 0x002e, 0x0102, 0x0103, 0x0104, 0x000b, 0x000c, 0x000f, -0x000c, 0x0008, 0x0105, 0x0106, 0x0107, 0x00e2, 0x000a, 0x000b, -0x0108, 0x003c, 0x0102, 0x0103, 0x000c, 0x0008, 0x003f, 0x0040, -0x0041, 0x0042, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0043, 0x0044, 0x0109, 0x010a, 0x010b, 0x010c, 0x001e, 0x00d3, -0x010d, 0x010e, 0x0025, 0x001d, 0x0025, 0x001d, 0x0024, 0x0021, -0x0025, 0x001d, 0x0024, 0x0021, 0x010f, 0x0082, 0x0056, 0x0057, -0x0058, 0x0059, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x005a, 0x005b, 0x005c, 0x0110, 0x0111, 0x0012, 0x00be, 0x0112, -0x0103, 0x0113, 0x0114, 0x0014, 0x0114, 0x0115, 0x0116, 0x0065, -0x0117, 0x0118, 0x0119, 0x0068, 0x003c, 0x0069, 0x006a, 0x006b, -0x006c, 0x006d, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x006e, 0x006f, 0x0070, 0x011a, 0x0023, 0x011b, 0x011c, 0x011d, -0x0021, 0x0077, 0x0082, 0x0024, 0x0021, 0x011e, 0x011f, 0x011b, -0x011c, 0x0120, 0x0121, 0x00d2, 0x001f, 0x0083, 0x0084, 0x0085, -0x0086, 0x0087, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0088, 0x0089, 0x008a, 0x008b, 0x0122, 0x0123, 0x0107, 0x00e2, -0x0102, 0x0106, 0x0124, 0x0125, 0x000c, 0x0008, 0x0126, 0x000b, -0x0127, 0x0128, 0x0129, 0x0036, 0x012a, 0x012b, 0x012c, 0x012d, -0x0097, 0x0098, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0099, 0x009a, 0x009b, 0x009c, 0x012e, 0x00d3, 0x012f, 0x010e, -0x0075, 0x009e, 0x00a1, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, -0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x0052, 0x013a, 0x001d, -0x00ac, 0x00ad, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x00ae, 0x0097, 0x00af, 0x013b, 0x013c, 0x00b1, 0x003c, 0x013d, -0x0123, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, -0x00ba, 0x00bb, 0x00bc, 0x013e, 0x00be, 0x013f, 0x003c, 0x0108, -0x003c, 0x00c3, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x00c4, 0x0097, 0x00af, 0x00c5, 0x00c6, 0x0140, 0x00c6, 0x00c5, -0x00c6, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, -0x00cf, 0x00d0, 0x00d1, 0x0141, 0x0142, 0x0143, 0x00c6, 0x0144, -0x00c6, 0x001a, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x00d7, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, -0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, -0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, -0x00d8, 0x00d9, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, -0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003 -}; - +/* + * 32x128 map data + */ +const unsigned short keyboard_Map[4096] = { +0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, +0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, +0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, +0x0001, 0x0002, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x0008, 0x000a, +0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, +0x0008, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, +0x0019, 0x001a, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, +0x0023, 0x0020, 0x0021, 0x0024, 0x0021, 0x0025, 0x001d, 0x0024, +0x0021, 0x0026, 0x0021, 0x0027, 0x0021, 0x0028, 0x0029, 0x002a, +0x002b, 0x002c, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, +0x0035, 0x0036, 0x0037, 0x0036, 0x0038, 0x0039, 0x003a, 0x0032, +0x003b, 0x003c, 0x002f, 0x003d, 0x003e, 0x003d, 0x003f, 0x0040, +0x0041, 0x0042, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, +0x004b, 0x001d, 0x004c, 0x004d, 0x004e, 0x004f, 0x0049, 0x0050, +0x0051, 0x0052, 0x0049, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, +0x0058, 0x0059, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x005a, 0x005b, 0x005c, 0x0018, 0x005d, 0x005e, 0x005f, 0x005e, +0x0060, 0x0061, 0x0062, 0x005e, 0x0063, 0x0064, 0x005d, 0x0065, +0x0066, 0x0067, 0x005f, 0x0068, 0x003c, 0x0069, 0x006a, 0x006b, +0x006c, 0x006d, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, +0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, +0x007e, 0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, +0x0086, 0x0087, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0088, 0x0089, 0x008a, 0x008b, 0x0018, 0x008c, 0x008d, 0x008e, +0x005e, 0x008f, 0x0090, 0x0091, 0x0064, 0x005d, 0x0092, 0x005d, +0x0093, 0x0094, 0x0065, 0x003c, 0x0065, 0x003c, 0x0095, 0x0096, +0x0097, 0x0098, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, 0x00a0, +0x0075, 0x009e, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, +0x00a7, 0x00a8, 0x00a9, 0x001d, 0x00aa, 0x001d, 0x00ab, 0x0082, +0x00ac, 0x00ad, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x00ae, 0x0097, 0x00af, 0x00b0, 0x003c, 0x00b1, 0x003c, 0x00b2, +0x003c, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, +0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00c0, 0x00c1, +0x00c2, 0x00c3, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x00c4, 0x0097, 0x00af, 0x00c5, 0x00c6, 0x00c7, 0x001d, 0x00c5, +0x00c6, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, +0x00cf, 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x007e, 0x00d5, +0x00d6, 0x001a, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x00d7, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, +0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, +0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, +0x00d8, 0x00d9, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, +0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, +0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, +0x0001, 0x0002, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0004, 0x00da, 0x0006, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, +0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, +0x00e8, 0x00e9, 0x00be, 0x00ea, 0x00eb, 0x0065, 0x003c, 0x00ec, +0x00ed, 0x001a, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x001b, 0x00ee, 0x0082, 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, +0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x001d, 0x00f8, 0x00f9, 0x00fa, +0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x004f, 0x00ff, 0x009e, 0x0100, +0x0101, 0x002c, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x002d, 0x002e, 0x0102, 0x0103, 0x0104, 0x000b, 0x000c, 0x000f, +0x000c, 0x0008, 0x0105, 0x0106, 0x0107, 0x00e2, 0x000a, 0x000b, +0x0108, 0x003c, 0x0102, 0x0103, 0x000c, 0x0008, 0x003f, 0x0040, +0x0041, 0x0042, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0043, 0x0044, 0x0109, 0x010a, 0x010b, 0x010c, 0x001e, 0x00d3, +0x010d, 0x010e, 0x0025, 0x001d, 0x0025, 0x001d, 0x0024, 0x0021, +0x0025, 0x001d, 0x0024, 0x0021, 0x010f, 0x0082, 0x0056, 0x0057, +0x0058, 0x0059, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x005a, 0x005b, 0x005c, 0x0110, 0x0111, 0x0012, 0x00be, 0x0112, +0x0103, 0x0113, 0x0114, 0x0014, 0x0114, 0x0115, 0x0116, 0x0065, +0x0117, 0x0118, 0x0119, 0x0068, 0x003c, 0x0069, 0x006a, 0x006b, +0x006c, 0x006d, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x006e, 0x006f, 0x0070, 0x011a, 0x0023, 0x011b, 0x011c, 0x011d, +0x0021, 0x0077, 0x0082, 0x0024, 0x0021, 0x011e, 0x011f, 0x011b, +0x011c, 0x0120, 0x0121, 0x00d2, 0x001f, 0x0083, 0x0084, 0x0085, +0x0086, 0x0087, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0088, 0x0089, 0x008a, 0x008b, 0x0122, 0x0123, 0x0107, 0x00e2, +0x0102, 0x0106, 0x0124, 0x0125, 0x000c, 0x0008, 0x0126, 0x000b, +0x0127, 0x0128, 0x0129, 0x0036, 0x012a, 0x012b, 0x012c, 0x012d, +0x0097, 0x0098, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0099, 0x009a, 0x009b, 0x009c, 0x012e, 0x00d3, 0x012f, 0x010e, +0x0075, 0x009e, 0x00a1, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, +0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x0052, 0x013a, 0x001d, +0x00ac, 0x00ad, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x00ae, 0x0097, 0x00af, 0x013b, 0x013c, 0x00b1, 0x003c, 0x013d, +0x0123, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, +0x00ba, 0x00bb, 0x00bc, 0x013e, 0x00be, 0x013f, 0x003c, 0x0108, +0x003c, 0x00c3, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x00c4, 0x0097, 0x00af, 0x00c5, 0x00c6, 0x0140, 0x00c6, 0x00c5, +0x00c6, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, +0x00cf, 0x00d0, 0x00d1, 0x0141, 0x0142, 0x0143, 0x00c6, 0x0144, +0x00c6, 0x001a, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x00d7, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, +0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, +0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, 0x00d8, +0x00d8, 0x00d9, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, +0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003 +}; + diff --git a/source/arm9/keyboard.pal.c b/source/arm9/keyboard.pal.c index 8d8d317..428032c 100644 --- a/source/arm9/keyboard.pal.c +++ b/source/arm9/keyboard.pal.c @@ -1,5 +1,5 @@ -const unsigned short keyboard_Palette[16] = { -0x7c1f, 0x20c7, 0x6252, 0x72b5, 0x72f7, 0x7718, 0x7b39, 0x7fde, -0x0000, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - +const unsigned short keyboard_Palette[16] = { +0x7c1f, 0x20c7, 0x6252, 0x72b5, 0x72f7, 0x7718, 0x7b39, 0x7fde, +0x0000, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + diff --git a/source/arm9/keyboard.raw.c b/source/arm9/keyboard.raw.c index 5b2fa9d..bf143db 100644 --- a/source/arm9/keyboard.raw.c +++ b/source/arm9/keyboard.raw.c @@ -1,656 +1,656 @@ -// -// keyboard (10400 uncompressed bytes) -// -const unsigned char keyboard_Tiles[10400] = { -0x00, 0x00, 0x80, 0x88, 0x00, 0x80, 0x88, 0x66, 0x00, 0x88, 0x65, 0x66, 0x80, 0x58, 0x66, 0x66, -0x80, 0x54, 0x55, 0x45, 0x88, 0x44, 0x44, 0x33, 0x38, 0x33, 0x33, 0x33, 0x28, 0x33, 0x33, 0x83, -0x88, 0x88, 0x88, 0x88, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, -0x44, 0x44, 0x44, 0x44, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, -0x88, 0x08, 0x00, 0x00, 0x66, 0x88, 0x08, 0x00, 0x66, 0x56, 0x88, 0x00, 0x66, 0x66, 0x85, 0x08, -0x54, 0x55, 0x45, 0x08, 0x33, 0x44, 0x44, 0x88, 0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x82, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, -0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, -0x22, 0x79, 0x77, 0x77, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, -0x77, 0x67, 0x24, 0x82, 0x77, 0x77, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x44, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x66, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x88, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x88, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x88, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x55, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x88, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x84, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x84, 0x88, 0x79, 0x44, 0x55, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x82, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, -0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, -0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, -0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x86, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x34, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x67, 0x77, 0x54, 0x86, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x76, 0x77, 0x53, 0x86, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x88, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x76, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x88, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, -0x67, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x66, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x86, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x76, 0x77, 0x53, 0x66, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x68, 0x79, 0x54, 0x85, 0x68, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x66, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x67, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x88, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x76, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x88, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x33, 0x33, 0x22, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, -0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, -0x28, 0x32, 0x33, 0x84, 0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x43, 0x83, 0x28, 0x42, 0x33, 0x83, -0x28, 0x42, 0x43, 0x83, 0x28, 0x32, 0x43, 0x84, 0x28, 0x42, 0x33, 0x84, 0x28, 0x42, 0x43, 0x84, -0x22, 0x69, 0x22, 0x82, 0x92, 0x69, 0x23, 0x82, 0x99, 0x27, 0x23, 0x82, 0x77, 0x22, 0x22, 0x82, -0x77, 0x28, 0x22, 0x88, 0x67, 0x88, 0x23, 0x88, 0x88, 0x88, 0x28, 0x88, 0x88, 0x88, 0x88, 0x88, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x88, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x84, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x88, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x84, 0x55, 0x79, 0x33, 0x84, 0x86, 0x79, 0x44, 0x85, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x88, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x84, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x84, 0x85, 0x79, 0x33, 0x84, 0x68, 0x79, 0x44, 0x85, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, -0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x84, 0x88, 0x79, 0x33, 0x44, 0x68, 0x79, 0x44, 0x55, 0x68, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x84, 0x55, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x55, 0x68, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x84, 0x55, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x66, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x84, 0x88, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x66, -0x22, 0x69, 0x34, 0x43, 0x92, 0x79, 0x66, 0x66, 0x99, 0x26, 0x22, 0x22, 0x79, 0x22, 0x22, 0x22, -0x77, 0x22, 0x22, 0x22, 0x67, 0x22, 0x22, 0x82, 0x67, 0x22, 0x22, 0x88, 0x77, 0x22, 0x82, 0x88, -0x65, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x28, 0x22, 0x22, 0x22, 0x28, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -0x65, 0x46, 0x22, 0x82, 0x66, 0x56, 0x23, 0x82, 0x22, 0x22, 0x23, 0x82, 0x22, 0x22, 0x22, 0x82, -0x22, 0x32, 0x23, 0x82, 0x22, 0x33, 0x23, 0x82, 0x88, 0x44, 0x24, 0x82, 0x88, 0x54, 0x25, 0x82, -0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x43, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, -0x33, 0x34, 0x23, 0x82, 0x33, 0x33, 0x24, 0x82, 0x34, 0x34, 0x23, 0x82, 0x43, 0x33, 0x24, 0x82, -0x28, 0x43, 0x43, 0x83, 0x28, 0x42, 0x43, 0x84, 0x31, 0x42, 0x44, 0x84, 0x21, 0x42, 0x43, 0x84, -0x21, 0x44, 0x44, 0x84, 0x21, 0x42, 0x44, 0x84, 0x21, 0x43, 0x44, 0x84, 0x31, 0x43, 0x44, 0x84, -0x88, 0x88, 0x28, 0x88, 0x77, 0x88, 0x24, 0x88, 0x67, 0x38, 0x24, 0x88, 0x76, 0x22, 0x24, 0x82, -0x33, 0x33, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x65, 0x88, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x67, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x86, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x54, 0x66, 0x88, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x88, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x86, 0x78, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x78, 0x67, 0x47, 0x82, 0x66, 0x77, 0x46, 0x82, 0x77, 0x76, 0x47, 0x82, 0x66, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x88, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x88, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x67, 0x22, 0x32, 0x88, 0x77, 0x22, 0x22, 0x83, 0x67, 0x22, 0x22, 0x32, 0x76, 0x22, 0x22, 0x32, -0x33, 0x23, 0x22, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x88, 0x88, 0x88, 0x88, 0x38, 0x33, 0x33, 0x33, 0x38, 0x33, 0x33, 0x44, 0x32, 0x32, 0x32, 0x23, -0x32, 0x22, 0x23, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x88, 0x65, 0x25, 0x82, 0x44, 0x55, 0x25, 0x82, 0x43, 0x65, 0x25, 0x82, 0x43, 0x54, 0x25, 0x82, -0x33, 0x44, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x43, 0x43, 0x23, 0x82, 0x43, 0x34, 0x24, 0x82, 0x34, 0x34, 0x34, 0x82, 0x43, 0x34, 0x24, 0x82, -0x44, 0x43, 0x23, 0x12, 0x44, 0x34, 0x34, 0x82, 0x44, 0x44, 0x34, 0x12, 0x44, 0x34, 0x24, 0x12, -0x21, 0x44, 0x44, 0x84, 0x41, 0x42, 0x44, 0x84, 0x21, 0x44, 0x44, 0x84, 0x41, 0x44, 0x44, 0x84, -0x31, 0x52, 0x44, 0x84, 0x41, 0x44, 0x44, 0x84, 0x21, 0x53, 0x44, 0x84, 0x41, 0x44, 0x44, 0x84, -0x22, 0x79, 0x34, 0x43, 0x92, 0x69, 0x66, 0x66, 0x99, 0x27, 0x22, 0x22, 0x77, 0x22, 0x22, 0x22, -0x77, 0x22, 0x22, 0x22, 0x87, 0x28, 0x82, 0x22, 0x78, 0x22, 0x28, 0x28, 0x68, 0x22, 0x88, 0x38, -0x65, 0x46, 0x22, 0x82, 0x66, 0x56, 0x23, 0x82, 0x22, 0x22, 0x23, 0x82, 0x22, 0x22, 0x22, 0x82, -0x22, 0x32, 0x23, 0x82, 0x88, 0x33, 0x84, 0x88, 0x38, 0x48, 0x28, 0x82, 0x88, 0x55, 0x85, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x54, 0x88, 0x79, 0x44, 0x84, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x84, 0x88, 0x79, 0x44, 0x55, 0x68, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x88, 0x79, 0x44, 0x85, 0x66, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x58, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x86, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, -0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x68, -0x22, 0x79, 0x66, 0x66, 0x92, 0x69, 0x66, 0x66, 0x99, 0x27, 0x22, 0x22, 0x77, 0x22, 0x22, 0x22, -0x77, 0x22, 0x22, 0x22, 0x67, 0x22, 0x22, 0x22, 0x67, 0x22, 0x22, 0x22, 0x77, 0x22, 0x22, 0x33, -0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x38, 0x32, 0x32, 0x83, 0x28, 0x23, -0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x82, 0x88, 0x22, 0x22, -0x82, 0x88, 0x22, 0x22, 0x82, 0x88, 0x22, 0x22, 0x82, 0x88, 0x23, 0x23, 0x83, 0x88, 0x32, 0x32, -0x44, 0x34, 0x22, 0x82, 0x66, 0x56, 0x23, 0x82, 0x22, 0x22, 0x23, 0x82, 0x22, 0x22, 0x22, 0x82, -0x22, 0x32, 0x23, 0x82, 0x32, 0x33, 0x23, 0x82, 0x33, 0x44, 0x24, 0x82, 0x43, 0x54, 0x25, 0x82, -0x44, 0x44, 0x24, 0x13, 0x44, 0x44, 0x34, 0x12, 0x44, 0x44, 0x44, 0x12, 0x44, 0x44, 0x24, 0x12, -0x44, 0x44, 0x44, 0x12, 0x44, 0x44, 0x34, 0x13, 0x44, 0x44, 0x24, 0x13, 0x44, 0x44, 0x44, 0x12, -0x31, 0x54, 0x54, 0x84, 0x41, 0x44, 0x55, 0x85, 0x21, 0x54, 0x44, 0x85, 0x48, 0x44, 0x54, 0x85, -0x48, 0x54, 0x55, 0x85, 0x48, 0x54, 0x55, 0x85, 0x48, 0x54, 0x55, 0x85, 0x28, 0x54, 0x55, 0x84, -0x78, 0x22, 0x28, 0x38, 0x87, 0x28, 0x38, 0x48, 0x67, 0x22, 0x33, 0x43, 0x76, 0x22, 0x33, 0x43, -0x33, 0x23, 0x32, 0x43, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x58, 0x66, 0x26, 0x88, 0x58, 0x66, 0x88, 0x82, 0x65, 0x66, 0x26, 0x82, 0x55, 0x66, 0x25, 0x82, -0x44, 0x44, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x88, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x66, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x88, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x88, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x86, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x66, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x68, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x67, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x54, 0x66, 0x88, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x85, 0x88, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x88, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, -0x68, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x76, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x67, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x88, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x78, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x68, 0x79, 0x54, 0x85, 0x86, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x76, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x86, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x67, 0x22, 0x22, 0x33, 0x77, 0x22, 0x32, 0x33, 0x67, 0x22, 0x22, 0x42, 0x67, 0x22, 0x22, 0x22, -0x33, 0x23, 0x22, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x33, 0x88, 0x88, 0x88, 0x83, 0x88, 0x88, 0x88, 0x44, 0x88, 0x88, 0x88, 0x33, 0x83, 0x48, 0x44, -0x32, 0x22, 0x28, 0x23, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x88, 0x88, 0x33, 0x33, 0x88, 0x88, 0x43, 0x43, 0x88, 0x48, 0x44, 0x44, 0x44, 0x44, 0x33, 0x33, -0x23, 0x22, 0x23, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x43, 0x65, 0x25, 0x82, 0x54, 0x66, 0x25, 0x82, 0x54, 0x55, 0x26, 0x82, 0x43, 0x55, 0x25, 0x82, -0x33, 0x44, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x44, 0x44, 0x34, 0x14, 0x44, 0x44, 0x34, 0x12, 0x44, 0x44, 0x44, 0x84, 0x44, 0x44, 0x44, 0x83, -0x43, 0x44, 0x44, 0x82, 0x44, 0x44, 0x44, 0x84, 0x43, 0x54, 0x44, 0x82, 0x43, 0x45, 0x44, 0x84, -0x48, 0x54, 0x55, 0x84, 0x28, 0x54, 0x55, 0x84, 0x28, 0x54, 0x55, 0x84, 0x28, 0x54, 0x55, 0x83, -0x28, 0x53, 0x55, 0x83, 0x28, 0x52, 0x45, 0x83, 0x28, 0x42, 0x34, 0x83, 0x28, 0x32, 0x33, 0x83, -0x22, 0x79, 0x66, 0x66, 0x92, 0x69, 0x66, 0x66, 0x99, 0x27, 0x22, 0x22, 0x77, 0x22, 0x22, 0x22, -0x77, 0x22, 0x22, 0x22, 0x67, 0x22, 0x88, 0x82, 0x67, 0x82, 0x22, 0x82, 0x77, 0x82, 0x88, 0x82, -0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x82, 0x82, 0x82, 0x88, 0x82, 0x82, 0x82, 0x22, 0x88, 0x83, 0x83, 0x88, -0x65, 0x46, 0x22, 0x82, 0x66, 0x56, 0x23, 0x82, 0x22, 0x22, 0x23, 0x82, 0x22, 0x22, 0x22, 0x82, -0x22, 0x32, 0x23, 0x82, 0x82, 0x88, 0x23, 0x82, 0x33, 0x48, 0x24, 0x82, 0x43, 0x58, 0x25, 0x82, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x55, 0x68, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x84, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x84, 0x88, 0x79, 0x44, 0x84, 0x66, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x88, 0x88, 0x79, 0x44, 0x58, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x66, 0x78, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, -0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, -0x43, 0x44, 0x45, 0x82, 0x43, 0x45, 0x44, 0x82, 0x43, 0x55, 0x45, 0x82, 0x33, 0x55, 0x44, 0x82, -0x33, 0x45, 0x45, 0x82, 0x33, 0x54, 0x25, 0x82, 0x33, 0x54, 0x25, 0x82, 0x33, 0x43, 0x24, 0x82, -0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, -0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, -0x67, 0x22, 0x82, 0x83, 0x77, 0x82, 0x38, 0x83, 0x67, 0x22, 0x22, 0x43, 0x76, 0x22, 0x22, 0x33, -0x33, 0x23, 0x22, 0x22, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x83, 0x83, 0x83, 0x33, 0x84, 0x83, 0x83, 0x43, 0x44, 0x44, 0x44, 0x44, 0x43, 0x44, 0x44, 0x33, -0x23, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x43, 0x68, 0x25, 0x82, 0x54, 0x68, 0x26, 0x82, 0x55, 0x56, 0x25, 0x82, 0x43, 0x55, 0x25, 0x82, -0x33, 0x44, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x86, 0x76, 0x77, 0x53, 0x86, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x86, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x86, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, -0x68, 0x77, 0x47, 0x82, 0x78, 0x76, 0x46, 0x82, 0x67, 0x77, 0x47, 0x82, 0x76, 0x67, 0x46, 0x82, -0x67, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x76, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x68, 0x86, 0x79, 0x54, 0x68, 0x86, 0x79, 0x53, 0x68, 0x86, 0x77, 0x54, 0x68, 0x86, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, -0x76, 0x78, 0x47, 0x82, 0x76, 0x78, 0x46, 0x82, 0x76, 0x78, 0x47, 0x82, 0x67, 0x78, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x86, -0x66, 0x46, 0x65, 0x68, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x86, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x68, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, -0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, -0x33, 0x33, 0x22, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, -0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, -0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, -0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, -0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, -0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x66, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, -0x22, 0x69, 0x34, 0x43, 0x92, 0x79, 0x66, 0x66, 0x99, 0x26, 0x22, 0x22, 0x79, 0x22, 0x22, 0x22, -0x77, 0x22, 0x22, 0x22, 0x67, 0x22, 0x22, 0x22, 0x67, 0x22, 0x22, 0x22, 0x77, 0x22, 0x22, 0x33, -0x65, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x32, 0x33, 0x32, 0x33, -0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x32, 0x33, 0x32, 0x33, -0x65, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x82, 0x23, 0x23, 0x23, 0x28, 0x32, 0x33, 0x32, 0x88, -0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x28, 0x88, 0x22, 0x82, 0x22, 0x28, 0x28, 0x28, 0x38, 0x88, 0x32, 0x88, -0x65, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x22, 0x82, 0x28, 0x88, 0x28, 0x28, 0x22, 0x28, 0x38, 0x38, 0x33, 0x88, -0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x28, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x38, 0x32, 0x33, 0x32, -0x65, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x33, 0x32, 0x33, 0x32, -0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x33, 0x32, 0x33, 0x32, -0x65, 0x46, 0x22, 0x82, 0x66, 0x56, 0x23, 0x82, 0x22, 0x22, 0x23, 0x82, 0x22, 0x22, 0x22, 0x82, -0x22, 0x32, 0x23, 0x82, 0x22, 0x33, 0x23, 0x82, 0x33, 0x44, 0x24, 0x82, 0x43, 0x54, 0x25, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, -0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x68, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, -0x66, 0x66, 0x25, 0x82, 0x77, 0x77, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x44, 0x46, 0x82, -0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x77, 0x77, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, -0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, -0x77, 0x67, 0x25, 0x82, 0x77, 0x77, 0x35, 0x82, 0x43, 0x44, 0x46, 0x82, 0x44, 0x44, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, -0x33, 0x33, 0x22, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, -0x28, 0x32, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, -0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x67, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x23, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x68, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x67, 0x22, 0x32, 0x32, 0x77, 0x22, 0x22, 0x33, 0x67, 0x22, 0x22, 0x32, 0x76, 0x22, 0x22, 0x32, -0x33, 0x23, 0x22, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x44, 0x32, 0x32, 0x32, 0x23, -0x32, 0x22, 0x23, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x44, 0x44, 0x44, 0x44, 0x33, 0x33, 0x33, 0x33, -0x22, 0x22, 0x32, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x88, 0x44, 0x44, 0x44, 0x44, 0x33, 0x33, 0x44, 0x44, -0x32, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x38, 0x38, 0x33, 0x38, 0x43, 0x38, 0x34, 0x48, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, -0x22, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x38, 0x38, 0x33, 0x38, 0x38, 0x84, 0x38, 0x88, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, -0x32, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x33, 0x33, 0x33, 0x33, 0x38, 0x34, 0x33, 0x33, 0x44, 0x44, 0x44, 0x44, 0x44, 0x34, 0x33, 0x33, -0x22, 0x32, 0x32, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x44, 0x44, 0x44, 0x44, 0x33, 0x33, 0x33, 0x23, -0x22, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x44, 0x33, 0x33, 0x33, 0x23, 0x23, 0x23, 0x23, -0x32, 0x32, 0x32, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x43, 0x65, 0x25, 0x82, 0x44, 0x55, 0x25, 0x82, 0x43, 0x65, 0x25, 0x82, 0x43, 0x54, 0x25, 0x82, -0x33, 0x44, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x67, 0x77, 0x53, 0x66, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x67, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x28, 0x22, 0x33, 0x33, 0x28, 0x22, 0x32, 0x33, 0x88, 0x22, 0x22, 0x33, 0x80, 0x22, 0x22, 0x22, -0x80, 0x28, 0x22, 0x22, 0x00, 0x88, 0x22, 0x22, 0x00, 0x80, 0x88, 0x22, 0x00, 0x00, 0x80, 0x88, -0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x22, 0x22, 0x22, 0x22, -0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x33, 0x23, 0x22, 0x82, 0x33, 0x23, 0x22, 0x82, 0x33, 0x22, 0x22, 0x88, 0x22, 0x22, 0x22, 0x08, -0x22, 0x22, 0x82, 0x08, 0x22, 0x22, 0x88, 0x00, 0x22, 0x88, 0x08, 0x00, 0x88, 0x08, 0x00, 0x00, -0x22, 0x79, 0x77, 0x77, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, -0x22, 0x79, 0x66, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x48, 0x84, 0x79, 0x42, 0x48, 0x68, 0x79, 0x44, 0x58, 0x68, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x68, 0x68, 0x46, 0x82, 0x68, 0x68, 0x47, 0x82, 0x68, 0x78, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x84, 0x88, 0x79, 0x33, 0x44, 0x68, 0x79, 0x44, 0x55, 0x68, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x88, 0x68, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x43, 0x88, 0x79, 0x42, 0x84, 0x84, 0x79, 0x33, 0x84, 0x86, 0x79, 0x44, 0x55, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x58, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x48, 0x48, 0x79, 0x42, 0x48, 0x58, 0x79, 0x43, 0x84, 0x66, 0x79, 0x43, 0x54, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x58, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x48, 0x84, 0x79, 0x42, 0x84, 0x85, 0x79, 0x33, 0x44, 0x88, 0x79, 0x44, 0x85, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x68, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x68, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x84, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x82, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x86, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x34, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x68, 0x68, 0x79, 0x54, 0x68, 0x86, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x66, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x78, 0x78, 0x47, 0x82, 0x88, 0x67, 0x47, 0x82, 0x67, 0x77, 0x47, 0x82, 0x88, 0x67, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x88, 0x88, 0x79, 0x53, 0x86, 0x86, 0x77, 0x54, 0x86, 0x86, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x78, 0x67, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x85, 0x86, 0x79, 0x54, 0x66, 0x88, 0x77, 0x53, 0x66, 0x86, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x77, 0x47, 0x82, 0x86, 0x67, 0x47, 0x82, 0x68, 0x77, 0x47, 0x82, 0x76, 0x67, 0x46, 0x82, -0x67, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x86, 0x66, 0x77, 0x53, 0x86, 0x67, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x78, 0x78, 0x47, 0x82, 0x68, 0x78, 0x46, 0x82, 0x87, 0x67, 0x47, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x67, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x66, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x78, 0x78, 0x47, 0x82, 0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x47, 0x82, 0x68, 0x68, 0x46, 0x82, -0x76, 0x76, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x68, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x76, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x78, 0x47, 0x82, 0x76, 0x76, 0x46, 0x82, 0x67, 0x77, 0x47, 0x82, 0x76, 0x67, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x78, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x86, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x76, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x67, 0x47, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x84, 0x79, 0x33, 0x84, 0x86, 0x79, 0x44, 0x85, 0x86, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x88, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x86, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x86, 0x77, 0x54, 0x66, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, -0x88, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x86, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x68, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x76, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x78, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, -0x67, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x67, 0x77, 0x54, 0x86, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x68, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x66, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, -0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x88, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x86, 0x79, 0x44, 0x85, 0x68, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, -0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x79, 0x44, 0x85, 0x88, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x76, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x67, 0x77, 0x53, 0x86, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x78, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x86, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x86, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x86, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x67, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x88, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, -0x58, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x44, 0x68, 0x79, 0x44, 0x55, 0x68, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x83, 0x48, 0x79, 0x42, 0x84, 0x58, 0x79, 0x33, 0x84, 0x86, 0x79, 0x44, 0x85, 0x86, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x58, 0x79, 0x33, 0x84, 0x68, 0x79, 0x44, 0x85, 0x86, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, -0x84, 0x66, 0x46, 0x82, 0x88, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x68, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, -0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x68, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, -0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x86, 0x66, 0x77, 0x53, 0x86, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x86, 0x66, 0x77, 0x53, 0x86, 0x76, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x78, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x86, 0x88, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x86, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, -0x88, 0x67, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x85, 0x86, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x67, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, -0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x76, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, -0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x76, 0x77, 0x53, 0x66, 0x66, -0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x68, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, -0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, -0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x68, 0x46, 0x82, -0x88, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, -0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, -0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x68, -0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, -0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x44, 0x68, 0x79, 0x44, 0x55, 0x86, -0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x67, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x23, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x67, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x23, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, -0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x78, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x86, 0x67, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x23, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, -0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x87, -0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x23, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88 -}; - +// +// keyboard (10400 uncompressed bytes) +// +const unsigned char keyboard_Tiles[10400] = { +0x00, 0x00, 0x80, 0x88, 0x00, 0x80, 0x88, 0x66, 0x00, 0x88, 0x65, 0x66, 0x80, 0x58, 0x66, 0x66, +0x80, 0x54, 0x55, 0x45, 0x88, 0x44, 0x44, 0x33, 0x38, 0x33, 0x33, 0x33, 0x28, 0x33, 0x33, 0x83, +0x88, 0x88, 0x88, 0x88, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, +0x44, 0x44, 0x44, 0x44, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, +0x88, 0x08, 0x00, 0x00, 0x66, 0x88, 0x08, 0x00, 0x66, 0x56, 0x88, 0x00, 0x66, 0x66, 0x85, 0x08, +0x54, 0x55, 0x45, 0x08, 0x33, 0x44, 0x44, 0x88, 0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x82, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, +0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, +0x22, 0x79, 0x77, 0x77, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, +0x77, 0x67, 0x24, 0x82, 0x77, 0x77, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x44, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x66, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x88, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x88, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x88, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x55, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x88, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x84, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x84, 0x88, 0x79, 0x44, 0x55, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x82, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, +0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, +0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, +0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x86, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x34, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x67, 0x77, 0x54, 0x86, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x76, 0x77, 0x53, 0x86, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x88, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x76, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x88, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, +0x67, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x66, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x86, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x76, 0x77, 0x53, 0x66, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x68, 0x79, 0x54, 0x85, 0x68, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x66, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x67, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x88, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x76, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x88, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x33, 0x33, 0x22, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, +0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, +0x28, 0x32, 0x33, 0x84, 0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x43, 0x83, 0x28, 0x42, 0x33, 0x83, +0x28, 0x42, 0x43, 0x83, 0x28, 0x32, 0x43, 0x84, 0x28, 0x42, 0x33, 0x84, 0x28, 0x42, 0x43, 0x84, +0x22, 0x69, 0x22, 0x82, 0x92, 0x69, 0x23, 0x82, 0x99, 0x27, 0x23, 0x82, 0x77, 0x22, 0x22, 0x82, +0x77, 0x28, 0x22, 0x88, 0x67, 0x88, 0x23, 0x88, 0x88, 0x88, 0x28, 0x88, 0x88, 0x88, 0x88, 0x88, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x88, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x84, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x88, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x84, 0x55, 0x79, 0x33, 0x84, 0x86, 0x79, 0x44, 0x85, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x88, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x84, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x84, 0x85, 0x79, 0x33, 0x84, 0x68, 0x79, 0x44, 0x85, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, +0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x84, 0x88, 0x79, 0x33, 0x44, 0x68, 0x79, 0x44, 0x55, 0x68, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x84, 0x55, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x55, 0x68, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x84, 0x55, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x66, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x84, 0x88, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x66, +0x22, 0x69, 0x34, 0x43, 0x92, 0x79, 0x66, 0x66, 0x99, 0x26, 0x22, 0x22, 0x79, 0x22, 0x22, 0x22, +0x77, 0x22, 0x22, 0x22, 0x67, 0x22, 0x22, 0x82, 0x67, 0x22, 0x22, 0x88, 0x77, 0x22, 0x82, 0x88, +0x65, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x28, 0x22, 0x22, 0x22, 0x28, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, +0x65, 0x46, 0x22, 0x82, 0x66, 0x56, 0x23, 0x82, 0x22, 0x22, 0x23, 0x82, 0x22, 0x22, 0x22, 0x82, +0x22, 0x32, 0x23, 0x82, 0x22, 0x33, 0x23, 0x82, 0x88, 0x44, 0x24, 0x82, 0x88, 0x54, 0x25, 0x82, +0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x43, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, +0x33, 0x34, 0x23, 0x82, 0x33, 0x33, 0x24, 0x82, 0x34, 0x34, 0x23, 0x82, 0x43, 0x33, 0x24, 0x82, +0x28, 0x43, 0x43, 0x83, 0x28, 0x42, 0x43, 0x84, 0x31, 0x42, 0x44, 0x84, 0x21, 0x42, 0x43, 0x84, +0x21, 0x44, 0x44, 0x84, 0x21, 0x42, 0x44, 0x84, 0x21, 0x43, 0x44, 0x84, 0x31, 0x43, 0x44, 0x84, +0x88, 0x88, 0x28, 0x88, 0x77, 0x88, 0x24, 0x88, 0x67, 0x38, 0x24, 0x88, 0x76, 0x22, 0x24, 0x82, +0x33, 0x33, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x65, 0x88, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x67, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x86, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x54, 0x66, 0x88, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x88, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x86, 0x78, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x78, 0x67, 0x47, 0x82, 0x66, 0x77, 0x46, 0x82, 0x77, 0x76, 0x47, 0x82, 0x66, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x88, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x88, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x67, 0x22, 0x32, 0x88, 0x77, 0x22, 0x22, 0x83, 0x67, 0x22, 0x22, 0x32, 0x76, 0x22, 0x22, 0x32, +0x33, 0x23, 0x22, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x88, 0x88, 0x88, 0x88, 0x38, 0x33, 0x33, 0x33, 0x38, 0x33, 0x33, 0x44, 0x32, 0x32, 0x32, 0x23, +0x32, 0x22, 0x23, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x88, 0x65, 0x25, 0x82, 0x44, 0x55, 0x25, 0x82, 0x43, 0x65, 0x25, 0x82, 0x43, 0x54, 0x25, 0x82, +0x33, 0x44, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x43, 0x43, 0x23, 0x82, 0x43, 0x34, 0x24, 0x82, 0x34, 0x34, 0x34, 0x82, 0x43, 0x34, 0x24, 0x82, +0x44, 0x43, 0x23, 0x12, 0x44, 0x34, 0x34, 0x82, 0x44, 0x44, 0x34, 0x12, 0x44, 0x34, 0x24, 0x12, +0x21, 0x44, 0x44, 0x84, 0x41, 0x42, 0x44, 0x84, 0x21, 0x44, 0x44, 0x84, 0x41, 0x44, 0x44, 0x84, +0x31, 0x52, 0x44, 0x84, 0x41, 0x44, 0x44, 0x84, 0x21, 0x53, 0x44, 0x84, 0x41, 0x44, 0x44, 0x84, +0x22, 0x79, 0x34, 0x43, 0x92, 0x69, 0x66, 0x66, 0x99, 0x27, 0x22, 0x22, 0x77, 0x22, 0x22, 0x22, +0x77, 0x22, 0x22, 0x22, 0x87, 0x28, 0x82, 0x22, 0x78, 0x22, 0x28, 0x28, 0x68, 0x22, 0x88, 0x38, +0x65, 0x46, 0x22, 0x82, 0x66, 0x56, 0x23, 0x82, 0x22, 0x22, 0x23, 0x82, 0x22, 0x22, 0x22, 0x82, +0x22, 0x32, 0x23, 0x82, 0x88, 0x33, 0x84, 0x88, 0x38, 0x48, 0x28, 0x82, 0x88, 0x55, 0x85, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x54, 0x88, 0x79, 0x44, 0x84, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x84, 0x88, 0x79, 0x44, 0x55, 0x68, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x88, 0x79, 0x44, 0x85, 0x66, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x58, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x86, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, +0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x68, +0x22, 0x79, 0x66, 0x66, 0x92, 0x69, 0x66, 0x66, 0x99, 0x27, 0x22, 0x22, 0x77, 0x22, 0x22, 0x22, +0x77, 0x22, 0x22, 0x22, 0x67, 0x22, 0x22, 0x22, 0x67, 0x22, 0x22, 0x22, 0x77, 0x22, 0x22, 0x33, +0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x38, 0x32, 0x32, 0x83, 0x28, 0x23, +0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x82, 0x88, 0x22, 0x22, +0x82, 0x88, 0x22, 0x22, 0x82, 0x88, 0x22, 0x22, 0x82, 0x88, 0x23, 0x23, 0x83, 0x88, 0x32, 0x32, +0x44, 0x34, 0x22, 0x82, 0x66, 0x56, 0x23, 0x82, 0x22, 0x22, 0x23, 0x82, 0x22, 0x22, 0x22, 0x82, +0x22, 0x32, 0x23, 0x82, 0x32, 0x33, 0x23, 0x82, 0x33, 0x44, 0x24, 0x82, 0x43, 0x54, 0x25, 0x82, +0x44, 0x44, 0x24, 0x13, 0x44, 0x44, 0x34, 0x12, 0x44, 0x44, 0x44, 0x12, 0x44, 0x44, 0x24, 0x12, +0x44, 0x44, 0x44, 0x12, 0x44, 0x44, 0x34, 0x13, 0x44, 0x44, 0x24, 0x13, 0x44, 0x44, 0x44, 0x12, +0x31, 0x54, 0x54, 0x84, 0x41, 0x44, 0x55, 0x85, 0x21, 0x54, 0x44, 0x85, 0x48, 0x44, 0x54, 0x85, +0x48, 0x54, 0x55, 0x85, 0x48, 0x54, 0x55, 0x85, 0x48, 0x54, 0x55, 0x85, 0x28, 0x54, 0x55, 0x84, +0x78, 0x22, 0x28, 0x38, 0x87, 0x28, 0x38, 0x48, 0x67, 0x22, 0x33, 0x43, 0x76, 0x22, 0x33, 0x43, +0x33, 0x23, 0x32, 0x43, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x58, 0x66, 0x26, 0x88, 0x58, 0x66, 0x88, 0x82, 0x65, 0x66, 0x26, 0x82, 0x55, 0x66, 0x25, 0x82, +0x44, 0x44, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x88, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x66, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x88, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x88, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x86, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x66, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x68, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x67, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x54, 0x66, 0x88, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x85, 0x88, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x88, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, +0x68, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x76, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x67, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x88, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x78, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x68, 0x79, 0x54, 0x85, 0x86, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x76, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x86, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x67, 0x22, 0x22, 0x33, 0x77, 0x22, 0x32, 0x33, 0x67, 0x22, 0x22, 0x42, 0x67, 0x22, 0x22, 0x22, +0x33, 0x23, 0x22, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x33, 0x88, 0x88, 0x88, 0x83, 0x88, 0x88, 0x88, 0x44, 0x88, 0x88, 0x88, 0x33, 0x83, 0x48, 0x44, +0x32, 0x22, 0x28, 0x23, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x88, 0x88, 0x33, 0x33, 0x88, 0x88, 0x43, 0x43, 0x88, 0x48, 0x44, 0x44, 0x44, 0x44, 0x33, 0x33, +0x23, 0x22, 0x23, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x43, 0x65, 0x25, 0x82, 0x54, 0x66, 0x25, 0x82, 0x54, 0x55, 0x26, 0x82, 0x43, 0x55, 0x25, 0x82, +0x33, 0x44, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x44, 0x44, 0x34, 0x14, 0x44, 0x44, 0x34, 0x12, 0x44, 0x44, 0x44, 0x84, 0x44, 0x44, 0x44, 0x83, +0x43, 0x44, 0x44, 0x82, 0x44, 0x44, 0x44, 0x84, 0x43, 0x54, 0x44, 0x82, 0x43, 0x45, 0x44, 0x84, +0x48, 0x54, 0x55, 0x84, 0x28, 0x54, 0x55, 0x84, 0x28, 0x54, 0x55, 0x84, 0x28, 0x54, 0x55, 0x83, +0x28, 0x53, 0x55, 0x83, 0x28, 0x52, 0x45, 0x83, 0x28, 0x42, 0x34, 0x83, 0x28, 0x32, 0x33, 0x83, +0x22, 0x79, 0x66, 0x66, 0x92, 0x69, 0x66, 0x66, 0x99, 0x27, 0x22, 0x22, 0x77, 0x22, 0x22, 0x22, +0x77, 0x22, 0x22, 0x22, 0x67, 0x22, 0x88, 0x82, 0x67, 0x82, 0x22, 0x82, 0x77, 0x82, 0x88, 0x82, +0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x82, 0x82, 0x82, 0x88, 0x82, 0x82, 0x82, 0x22, 0x88, 0x83, 0x83, 0x88, +0x65, 0x46, 0x22, 0x82, 0x66, 0x56, 0x23, 0x82, 0x22, 0x22, 0x23, 0x82, 0x22, 0x22, 0x22, 0x82, +0x22, 0x32, 0x23, 0x82, 0x82, 0x88, 0x23, 0x82, 0x33, 0x48, 0x24, 0x82, 0x43, 0x58, 0x25, 0x82, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x55, 0x68, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x84, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x84, 0x88, 0x79, 0x44, 0x84, 0x66, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x88, 0x88, 0x79, 0x44, 0x58, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x66, 0x78, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, +0x43, 0x44, 0x45, 0x82, 0x43, 0x45, 0x44, 0x82, 0x43, 0x55, 0x45, 0x82, 0x33, 0x55, 0x44, 0x82, +0x33, 0x45, 0x45, 0x82, 0x33, 0x54, 0x25, 0x82, 0x33, 0x54, 0x25, 0x82, 0x33, 0x43, 0x24, 0x82, +0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, +0x28, 0x32, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, 0x28, 0x22, 0x33, 0x83, 0x28, 0x32, 0x33, 0x83, +0x67, 0x22, 0x82, 0x83, 0x77, 0x82, 0x38, 0x83, 0x67, 0x22, 0x22, 0x43, 0x76, 0x22, 0x22, 0x33, +0x33, 0x23, 0x22, 0x22, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x83, 0x83, 0x83, 0x33, 0x84, 0x83, 0x83, 0x43, 0x44, 0x44, 0x44, 0x44, 0x43, 0x44, 0x44, 0x33, +0x23, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x43, 0x68, 0x25, 0x82, 0x54, 0x68, 0x26, 0x82, 0x55, 0x56, 0x25, 0x82, 0x43, 0x55, 0x25, 0x82, +0x33, 0x44, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x86, 0x76, 0x77, 0x53, 0x86, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x86, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x86, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, +0x68, 0x77, 0x47, 0x82, 0x78, 0x76, 0x46, 0x82, 0x67, 0x77, 0x47, 0x82, 0x76, 0x67, 0x46, 0x82, +0x67, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x76, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x76, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x68, 0x86, 0x79, 0x54, 0x68, 0x86, 0x79, 0x53, 0x68, 0x86, 0x77, 0x54, 0x68, 0x86, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, +0x76, 0x78, 0x47, 0x82, 0x76, 0x78, 0x46, 0x82, 0x76, 0x78, 0x47, 0x82, 0x67, 0x78, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x86, +0x66, 0x46, 0x65, 0x68, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x86, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x68, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, +0x33, 0x33, 0x22, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, +0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, +0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, +0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, +0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, +0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, 0x33, 0x33, 0x33, 0x83, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x66, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, +0x22, 0x69, 0x34, 0x43, 0x92, 0x79, 0x66, 0x66, 0x99, 0x26, 0x22, 0x22, 0x79, 0x22, 0x22, 0x22, +0x77, 0x22, 0x22, 0x22, 0x67, 0x22, 0x22, 0x22, 0x67, 0x22, 0x22, 0x22, 0x77, 0x22, 0x22, 0x33, +0x65, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x32, 0x33, 0x32, 0x33, +0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x32, 0x33, 0x32, 0x33, +0x65, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x82, 0x23, 0x23, 0x23, 0x28, 0x32, 0x33, 0x32, 0x88, +0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x28, 0x88, 0x22, 0x82, 0x22, 0x28, 0x28, 0x28, 0x38, 0x88, 0x32, 0x88, +0x65, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x22, 0x82, 0x28, 0x88, 0x28, 0x28, 0x22, 0x28, 0x38, 0x38, 0x33, 0x88, +0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x28, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x38, 0x32, 0x33, 0x32, +0x65, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x33, 0x32, 0x33, 0x32, +0x66, 0x66, 0x34, 0x43, 0x66, 0x66, 0x66, 0x66, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x33, 0x32, 0x33, 0x32, +0x65, 0x46, 0x22, 0x82, 0x66, 0x56, 0x23, 0x82, 0x22, 0x22, 0x23, 0x82, 0x22, 0x22, 0x22, 0x82, +0x22, 0x32, 0x23, 0x82, 0x22, 0x33, 0x23, 0x82, 0x33, 0x44, 0x24, 0x82, 0x43, 0x54, 0x25, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, +0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x68, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, +0x66, 0x66, 0x25, 0x82, 0x77, 0x77, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x44, 0x46, 0x82, +0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x77, 0x77, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, +0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, +0x77, 0x67, 0x25, 0x82, 0x77, 0x77, 0x35, 0x82, 0x43, 0x44, 0x46, 0x82, 0x44, 0x44, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, +0x33, 0x33, 0x22, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x23, 0x82, 0x33, 0x33, 0x22, 0x82, +0x28, 0x32, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, +0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, 0x28, 0x32, 0x33, 0x33, 0x28, 0x22, 0x33, 0x33, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x67, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x23, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x68, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x67, 0x22, 0x32, 0x32, 0x77, 0x22, 0x22, 0x33, 0x67, 0x22, 0x22, 0x32, 0x76, 0x22, 0x22, 0x32, +0x33, 0x23, 0x22, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x44, 0x32, 0x32, 0x32, 0x23, +0x32, 0x22, 0x23, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x44, 0x44, 0x44, 0x44, 0x33, 0x33, 0x33, 0x33, +0x22, 0x22, 0x32, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x88, 0x44, 0x44, 0x44, 0x44, 0x33, 0x33, 0x44, 0x44, +0x32, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x38, 0x38, 0x33, 0x38, 0x43, 0x38, 0x34, 0x48, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, +0x22, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x38, 0x38, 0x33, 0x38, 0x38, 0x84, 0x38, 0x88, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, +0x32, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x33, 0x33, 0x33, 0x33, 0x38, 0x34, 0x33, 0x33, 0x44, 0x44, 0x44, 0x44, 0x44, 0x34, 0x33, 0x33, +0x22, 0x32, 0x32, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x44, 0x44, 0x44, 0x44, 0x33, 0x33, 0x33, 0x23, +0x22, 0x32, 0x22, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x44, 0x33, 0x33, 0x33, 0x23, 0x23, 0x23, 0x23, +0x32, 0x32, 0x32, 0x32, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x43, 0x65, 0x25, 0x82, 0x44, 0x55, 0x25, 0x82, 0x43, 0x65, 0x25, 0x82, 0x43, 0x54, 0x25, 0x82, +0x33, 0x44, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x67, 0x77, 0x53, 0x66, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x67, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x28, 0x22, 0x33, 0x33, 0x28, 0x22, 0x32, 0x33, 0x88, 0x22, 0x22, 0x33, 0x80, 0x22, 0x22, 0x22, +0x80, 0x28, 0x22, 0x22, 0x00, 0x88, 0x22, 0x22, 0x00, 0x80, 0x88, 0x22, 0x00, 0x00, 0x80, 0x88, +0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x22, 0x22, 0x22, 0x22, +0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x33, 0x23, 0x22, 0x82, 0x33, 0x23, 0x22, 0x82, 0x33, 0x22, 0x22, 0x88, 0x22, 0x22, 0x22, 0x08, +0x22, 0x22, 0x82, 0x08, 0x22, 0x22, 0x88, 0x00, 0x22, 0x88, 0x08, 0x00, 0x88, 0x08, 0x00, 0x00, +0x22, 0x79, 0x77, 0x77, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, +0x22, 0x79, 0x66, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x48, 0x84, 0x79, 0x42, 0x48, 0x68, 0x79, 0x44, 0x58, 0x68, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x68, 0x68, 0x46, 0x82, 0x68, 0x68, 0x47, 0x82, 0x68, 0x78, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x84, 0x88, 0x79, 0x33, 0x44, 0x68, 0x79, 0x44, 0x55, 0x68, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x88, 0x68, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x43, 0x88, 0x79, 0x42, 0x84, 0x84, 0x79, 0x33, 0x84, 0x86, 0x79, 0x44, 0x55, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x58, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x48, 0x48, 0x79, 0x42, 0x48, 0x58, 0x79, 0x43, 0x84, 0x66, 0x79, 0x43, 0x54, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x58, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x48, 0x84, 0x79, 0x42, 0x84, 0x85, 0x79, 0x33, 0x44, 0x88, 0x79, 0x44, 0x85, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x68, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x68, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x84, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x82, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x86, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x34, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x68, 0x68, 0x79, 0x54, 0x68, 0x86, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x66, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x78, 0x78, 0x47, 0x82, 0x88, 0x67, 0x47, 0x82, 0x67, 0x77, 0x47, 0x82, 0x88, 0x67, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x88, 0x88, 0x79, 0x53, 0x86, 0x86, 0x77, 0x54, 0x86, 0x86, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x78, 0x67, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x85, 0x86, 0x79, 0x54, 0x66, 0x88, 0x77, 0x53, 0x66, 0x86, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x77, 0x47, 0x82, 0x86, 0x67, 0x47, 0x82, 0x68, 0x77, 0x47, 0x82, 0x76, 0x67, 0x46, 0x82, +0x67, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x86, 0x66, 0x77, 0x53, 0x86, 0x67, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x78, 0x78, 0x47, 0x82, 0x68, 0x78, 0x46, 0x82, 0x87, 0x67, 0x47, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x67, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x66, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x78, 0x78, 0x47, 0x82, 0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x47, 0x82, 0x68, 0x68, 0x46, 0x82, +0x76, 0x76, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x68, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x76, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x78, 0x47, 0x82, 0x76, 0x76, 0x46, 0x82, 0x67, 0x77, 0x47, 0x82, 0x76, 0x67, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x78, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x86, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x66, 0x77, 0x53, 0x66, 0x76, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, 0x76, 0x67, 0x47, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x84, 0x79, 0x33, 0x84, 0x86, 0x79, 0x44, 0x85, 0x86, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x88, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x86, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x86, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x86, 0x77, 0x54, 0x66, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, +0x88, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x86, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x68, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x76, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x78, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x87, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, +0x67, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x67, 0x77, 0x54, 0x86, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x84, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x68, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x66, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, +0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x54, 0x68, 0x79, 0x44, 0x55, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x88, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x66, 0x79, 0x44, 0x85, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x86, 0x67, 0x47, 0x82, 0x88, 0x76, 0x46, 0x82, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x84, 0x86, 0x79, 0x44, 0x85, 0x68, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, +0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x79, 0x44, 0x85, 0x88, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x76, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x67, 0x77, 0x53, 0x86, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x78, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x86, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x86, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x86, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x86, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x67, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x78, 0x76, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x88, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x48, 0x64, 0x46, 0x82, +0x58, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x54, 0x79, 0x33, 0x44, 0x68, 0x79, 0x44, 0x55, 0x68, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x86, 0x66, 0x46, 0x82, 0x68, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x83, 0x48, 0x79, 0x42, 0x84, 0x58, 0x79, 0x33, 0x84, 0x86, 0x79, 0x44, 0x85, 0x86, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x84, 0x58, 0x79, 0x33, 0x84, 0x68, 0x79, 0x44, 0x85, 0x86, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x84, 0x64, 0x46, 0x82, +0x84, 0x66, 0x46, 0x82, 0x88, 0x66, 0x46, 0x82, 0x88, 0x67, 0x47, 0x82, 0x86, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x68, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x54, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x68, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x88, +0x79, 0x32, 0x43, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x68, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x64, 0x46, 0x82, +0x58, 0x66, 0x46, 0x82, 0x68, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x86, 0x66, 0x77, 0x53, 0x86, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x86, 0x66, 0x77, 0x53, 0x86, 0x76, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x78, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x86, 0x88, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x78, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x66, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x76, 0x77, 0x54, 0x86, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, +0x88, 0x67, 0x47, 0x82, 0x88, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x85, 0x86, 0x79, 0x54, 0x85, 0x66, 0x79, 0x53, 0x86, 0x66, 0x77, 0x54, 0x86, 0x67, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x33, 0x33, 0x88, 0x88, 0x88, 0x88, +0x86, 0x67, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, 0x86, 0x76, 0x47, 0x82, 0x87, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x33, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x66, 0x79, 0x54, 0x66, 0x76, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x67, 0x77, 0x46, 0x82, +0x66, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x33, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x68, 0x79, 0x54, 0x66, 0x76, 0x77, 0x53, 0x66, 0x66, +0x66, 0x46, 0x65, 0x76, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x66, 0x68, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x35, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x88, +0x79, 0x32, 0x83, 0x44, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, +0x77, 0x77, 0x25, 0x82, 0x77, 0x67, 0x35, 0x82, 0x43, 0x44, 0x46, 0x83, 0x44, 0x68, 0x46, 0x82, +0x88, 0x66, 0x46, 0x82, 0x66, 0x66, 0x46, 0x82, 0x66, 0x67, 0x47, 0x82, 0x66, 0x76, 0x46, 0x82, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x48, +0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x55, 0x79, 0x33, 0x44, 0x66, 0x79, 0x44, 0x55, 0x66, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x33, 0x44, +0x79, 0x32, 0x43, 0x84, 0x79, 0x42, 0x44, 0x85, 0x79, 0x33, 0x44, 0x86, 0x79, 0x44, 0x55, 0x68, +0x22, 0x79, 0x67, 0x66, 0x92, 0x79, 0x77, 0x77, 0x99, 0x47, 0x32, 0x33, 0x99, 0x24, 0x83, 0x44, +0x79, 0x32, 0x43, 0x48, 0x79, 0x42, 0x44, 0x58, 0x79, 0x33, 0x44, 0x68, 0x79, 0x44, 0x55, 0x86, +0x79, 0x44, 0x55, 0x66, 0x79, 0x54, 0x65, 0x76, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x67, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x23, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x67, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x23, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x76, 0x67, 0x47, 0x82, 0x76, 0x77, 0x46, 0x82, 0x76, 0x76, 0x47, 0x82, 0x68, 0x77, 0x46, 0x82, +0x76, 0x66, 0x25, 0x82, 0x55, 0x45, 0x22, 0x82, 0x22, 0x22, 0x22, 0x82, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x68, 0x79, 0x54, 0x65, 0x78, 0x79, 0x54, 0x66, 0x68, 0x77, 0x53, 0x86, 0x67, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x23, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88, +0x79, 0x44, 0x55, 0x86, 0x79, 0x54, 0x65, 0x86, 0x79, 0x54, 0x66, 0x86, 0x77, 0x53, 0x66, 0x87, +0x66, 0x46, 0x65, 0x66, 0x52, 0x55, 0x55, 0x55, 0x22, 0x23, 0x22, 0x22, 0x88, 0x88, 0x88, 0x88 +}; + diff --git a/sys/arm7_maxmod_dswifi/source/main.c b/sys/arm7_maxmod_dswifi/source/main.c index 7a59990..a57ab06 100644 --- a/sys/arm7_maxmod_dswifi/source/main.c +++ b/sys/arm7_maxmod_dswifi/source/main.c @@ -1,48 +1,48 @@ -/////////////////////////////////// -// PAlib ARM7_MAXMOD_DSWIFI core // -// by fincs // -/////////////////////////////////// - -#include - -static volatile bool pa_exit_loop = false; - -static void PA_PowerButtonCallback(void){ - pa_exit_loop = true; -} - -static void PA_VBL(void){ - PA_InputGetAndSend(); - - // Legacy IPC - PA_LegacyIPCManage(); - - // Wifi - Wifi_Update(); -} - -int main(int argc, char *argv[]){ - // Enable exception handler by default - defaultExceptionHandler(); - - // Initialize PAlib and initialize the sound hardware - PA_Init(); - - // Initialize Wifi - installWifiFIFO(); - - // Initialize Maxmod - mmInstall(FIFO_MAXMOD); - - // Callback called when the power button in a DSi console is pressed. - setPowerButtonCB(PA_PowerButtonCallback); - - irqSet(IRQ_VBLANK, PA_VBL); - irqEnable(IRQ_VBLANK); - - while (!pa_exit_loop){ // Keep the ARM7 mostly idle... - swiWaitForVBlank(); - } - - return 0; -} +/////////////////////////////////// +// PAlib ARM7_MAXMOD_DSWIFI core // +// by fincs // +/////////////////////////////////// + +#include + +static volatile bool pa_exit_loop = false; + +static void PA_PowerButtonCallback(void){ + pa_exit_loop = true; +} + +static void PA_VBL(void){ + PA_InputGetAndSend(); + + // Legacy IPC + PA_LegacyIPCManage(); + + // Wifi + Wifi_Update(); +} + +int main(int argc, char *argv[]){ + // Enable exception handler by default + defaultExceptionHandler(); + + // Initialize PAlib and initialize the sound hardware + PA_Init(); + + // Initialize Wifi + installWifiFIFO(); + + // Initialize Maxmod + mmInstall(FIFO_MAXMOD); + + // Callback called when the power button in a DSi console is pressed. + setPowerButtonCB(PA_PowerButtonCallback); + + irqSet(IRQ_VBLANK, PA_VBL); + irqEnable(IRQ_VBLANK); + + while (!pa_exit_loop){ // Keep the ARM7 mostly idle... + swiWaitForVBlank(); + } + + return 0; +} diff --git a/sys/arm7_mp3/source/main.c b/sys/arm7_mp3/source/main.c index 6fadbe5..2e237e7 100644 --- a/sys/arm7_mp3/source/main.c +++ b/sys/arm7_mp3/source/main.c @@ -1,46 +1,46 @@ -/////////////////////////////////// -// PAlib ARM7_MP3 core // -// by fincs // -/////////////////////////////////// - -#include - -static volatile bool pa_exit_loop = false; - -static void PA_PowerButtonCallback(void){ - pa_exit_loop = true; -} - -static void PA_VBL(void){ - PA_InputGetAndSend(); - - // Legacy IPC - PA_LegacyIPCManage(); - - // ASlib - AS_SoundVBL(); -} - -int main(int argc, char *argv[]){ - // Enable exception handler by default - defaultExceptionHandler(); - - // Initialize PAlib and initialize the sound hardware (for ASlib) - PA_Init(); - - // Callback called when the power button in a DSi console is pressed. - setPowerButtonCB(PA_PowerButtonCallback); - - irqSet(IRQ_VBLANK, PA_VBL); - irqEnable(IRQ_VBLANK); - - // Initialize ASlib - AS_Init(); - - while (!pa_exit_loop){ // Keep the ARM7 mostly idle... - swiWaitForVBlank(); - AS_MP3Engine(); // ...except for this ;_; - } - - return 0; -} +/////////////////////////////////// +// PAlib ARM7_MP3 core // +// by fincs // +/////////////////////////////////// + +#include + +static volatile bool pa_exit_loop = false; + +static void PA_PowerButtonCallback(void){ + pa_exit_loop = true; +} + +static void PA_VBL(void){ + PA_InputGetAndSend(); + + // Legacy IPC + PA_LegacyIPCManage(); + + // ASlib + AS_SoundVBL(); +} + +int main(int argc, char *argv[]){ + // Enable exception handler by default + defaultExceptionHandler(); + + // Initialize PAlib and initialize the sound hardware (for ASlib) + PA_Init(); + + // Callback called when the power button in a DSi console is pressed. + setPowerButtonCB(PA_PowerButtonCallback); + + irqSet(IRQ_VBLANK, PA_VBL); + irqEnable(IRQ_VBLANK); + + // Initialize ASlib + AS_Init(); + + while (!pa_exit_loop){ // Keep the ARM7 mostly idle... + swiWaitForVBlank(); + AS_MP3Engine(); // ...except for this ;_; + } + + return 0; +} diff --git a/sys/arm7_mp3_dswifi/source/main.c b/sys/arm7_mp3_dswifi/source/main.c index a13b28b..ccb8043 100644 --- a/sys/arm7_mp3_dswifi/source/main.c +++ b/sys/arm7_mp3_dswifi/source/main.c @@ -1,52 +1,52 @@ -/////////////////////////////////// -// PAlib ARM7_MP3_DSWIFI core // -// by fincs // -/////////////////////////////////// - -#include - -static volatile bool pa_exit_loop = false; - -static void PA_PowerButtonCallback(void){ - pa_exit_loop = true; -} - -static void PA_VBL(void){ - PA_InputGetAndSend(); - - // Legacy IPC - PA_LegacyIPCManage(); - - // ASlib - AS_SoundVBL(); - - // Wifi - Wifi_Update(); -} - -int main(int argc, char *argv[]){ - // Enable exception handler by default - defaultExceptionHandler(); - - // Initialize PAlib and initialize the sound hardware (for ASlib) - PA_Init(); - - // Initialize Wifi - installWifiFIFO(); - - // Callback called when the power button in a DSi console is pressed. - setPowerButtonCB(PA_PowerButtonCallback); - - irqSet(IRQ_VBLANK, PA_VBL); - irqEnable(IRQ_VBLANK); - - // Initialize ASlib - AS_Init(); - - while (!pa_exit_loop){ // Keep the ARM7 mostly idle... - swiWaitForVBlank(); - AS_MP3Engine(); // ...except for this ;_; - } - - return 0; -} +/////////////////////////////////// +// PAlib ARM7_MP3_DSWIFI core // +// by fincs // +/////////////////////////////////// + +#include + +static volatile bool pa_exit_loop = false; + +static void PA_PowerButtonCallback(void){ + pa_exit_loop = true; +} + +static void PA_VBL(void){ + PA_InputGetAndSend(); + + // Legacy IPC + PA_LegacyIPCManage(); + + // ASlib + AS_SoundVBL(); + + // Wifi + Wifi_Update(); +} + +int main(int argc, char *argv[]){ + // Enable exception handler by default + defaultExceptionHandler(); + + // Initialize PAlib and initialize the sound hardware (for ASlib) + PA_Init(); + + // Initialize Wifi + installWifiFIFO(); + + // Callback called when the power button in a DSi console is pressed. + setPowerButtonCB(PA_PowerButtonCallback); + + irqSet(IRQ_VBLANK, PA_VBL); + irqEnable(IRQ_VBLANK); + + // Initialize ASlib + AS_Init(); + + while (!pa_exit_loop){ // Keep the ARM7 mostly idle... + swiWaitForVBlank(); + AS_MP3Engine(); // ...except for this ;_; + } + + return 0; +} diff --git a/template/Makefile b/template/Makefile index 23487d9..91bf337 100644 --- a/template/Makefile +++ b/template/Makefile @@ -1,363 +1,363 @@ -# SPDX-License-Identifier: CC0-1.0 -# -# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024 - -export BLOCKSDS ?= /opt/blocksds/core -export BLOCKSDSEXT ?= /opt/blocksds/external - -export WONDERFUL_TOOLCHAIN ?= /opt/wonderful -ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/ - -# User config -# =========== - -NAME := $(shell basename $(CURDIR)) - -GAME_TITLE := PAlib Project -GAME_SUBTITLE := Change this text -GAME_AUTHOR := for your project! -GAME_ICON := $(BLOCKSDSEXT)/palib/defaultlogo.bmp - -ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_maxmod_dswifi.elf - -# DLDI and internal SD slot of DSi -# -------------------------------- - -# Root folder of the SD image -SDROOT := sdroot -# Name of the generated image it "DSi-1.sd" for no$gba in DSi mode -SDIMAGE := image.bin - -# Source code paths -# ----------------- - -SOURCEDIRS := source gfx/bin -INCLUDEDIRS := gfx -GFXDIRS := -BINDIRS := gfx/bin -AUDIODIRS := -NITROFSDIR := - -# Defines passed to all files -# --------------------------- - -DEFINES := -DPA_NO_DEPRECATION - -# Libraries -# --------- - -LIBS := -lmm9 -lnds9 -ldswifi9 -lpa9 -LIBDIRS := $(BLOCKSDS)/libs/maxmod \ - $(BLOCKSDS)/libs/dswifi \ - $(BLOCKSDS)/libs/libnds \ - $(BLOCKSDSEXT)/palib - -# Build artifacts -# --------------- - -BUILDDIR := build/$(NAME) -ELF := build/$(NAME).elf -DUMP := build/$(NAME).dump -MAP := build/$(NAME).map -ROM := $(NAME).nds - -# If NITROFSDIR is set, the soundbank created by mmutil will be saved to NitroFS -SOUNDBANKINFODIR := $(BUILDDIR)/maxmod -ifeq ($(strip $(NITROFSDIR)),) - SOUNDBANKDIR := $(BUILDDIR)/maxmod -else - SOUNDBANKDIR := $(BUILDDIR)/maxmod_nitrofs -endif - -# Tools -# ----- - -PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi- -CC := $(PREFIX)gcc -CXX := $(PREFIX)g++ -LD := $(PREFIX)gcc -OBJDUMP := $(PREFIX)objdump -MKDIR := mkdir -RM := rm -rf - -# Verbose flag -# ------------ - -ifeq ($(VERBOSE),1) -V := -else -V := @ -endif - -# Source files -# ------------ - -ifneq ($(BINDIRS),) - SOURCES_BIN_BIN := $(shell find -L $(BINDIRS) -name "*.bin") - SOURCES_BIN_BMP := $(shell find -L $(BINDIRS) -name "*.bmp") - SOURCES_BIN_JPG := $(shell find -L $(BINDIRS) -name "*.jpg") - SOURCES_BIN_PNG := $(shell find -L $(BINDIRS) -name "*.png") - SOURCES_BIN_GIF := $(shell find -L $(BINDIRS) -name "*.gif") - SOURCES_BIN_RAW := $(shell find -L $(BINDIRS) -name "*.raw") - SOURCES_BIN_MP3 := $(shell find -L $(BINDIRS) -name "*.mp3") - SOURCES_BIN_MOD := $(shell find -L $(BINDIRS) -name "*.mod") - INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(BINDIRS)) -endif -ifneq ($(GFXDIRS),) - SOURCES_PNG := $(shell find -L $(GFXDIRS) -name "*.png") - INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(GFXDIRS)) -endif -ifneq ($(AUDIODIRS),) - SOURCES_AUDIO := $(shell find -L $(AUDIODIRS) -regex '.*\.\(it\|mod\|s3m\|wav\|xm\)') - ifneq ($(SOURCES_AUDIO),) - INCLUDEDIRS += $(SOUNDBANKINFODIR) - endif -endif - -SOURCES_S := $(shell find -L $(SOURCEDIRS) -name "*.s") -SOURCES_C := $(shell find -L $(SOURCEDIRS) -name "*.c") -SOURCES_CPP := $(shell find -L $(SOURCEDIRS) -name "*.cpp") - -# Compiler and linker flags -# ------------------------- - -ARCH := -mthumb -mcpu=arm946e-s+nofp - -SPECS := $(BLOCKSDS)/sys/crts/ds_arm9.specs - -WARNFLAGS := -Wall - -ifeq ($(SOURCES_CPP),) - LIBS += -lc -else - LIBS += -lstdc++ -lc -endif - -INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \ - $(foreach path,$(LIBDIRS),-I$(path)/include) - -LIBDIRSFLAGS := $(foreach path,$(LIBDIRS),-L$(path)/lib) - -ASFLAGS += -x assembler-with-cpp $(INCLUDEFLAGS) $(DEFINES) \ - $(ARCH) -ffunction-sections -fdata-sections \ - -specs=$(SPECS) - -CFLAGS += -std=gnu17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \ - $(ARCH) -O2 -ffunction-sections -fdata-sections \ - -specs=$(SPECS) - -CXXFLAGS += -std=gnu++17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \ - $(ARCH) -O2 -ffunction-sections -fdata-sections \ - -fno-exceptions -fno-rtti \ - -specs=$(SPECS) - -LDFLAGS := $(ARCH) $(LIBDIRSFLAGS) -Wl,-Map,$(MAP) $(DEFINES) \ - -Wl,--start-group $(LIBS) -Wl,--end-group -specs=$(SPECS) - -# Intermediate build files -# ------------------------ - -OBJS_ASSETS := $(patsubst %.bin,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BIN))) \ - $(patsubst %.bmp,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BMP))) \ - $(patsubst %.jpg,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_JPG))) \ - $(patsubst %.png,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_PNG))) \ - $(patsubst %.gif,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_GIF))) \ - $(patsubst %.raw,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_RAW))) \ - $(patsubst %.mp3,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MP3))) \ - $(patsubst %.mod,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MOD))) \ - $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG))) - -HEADERS_ASSETS := $(patsubst %.bin,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BIN))) \ - $(patsubst %.bmp,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BMP))) \ - $(patsubst %.jpg,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_JPG))) \ - $(patsubst %.png,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_PNG))) \ - $(patsubst %.gif,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_GIF))) \ - $(patsubst %.raw,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_RAW))) \ - $(patsubst %.mp3,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MP3))) \ - $(patsubst %.mod,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MOD))) \ - $(patsubst %.png,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG))) - -ifneq ($(SOURCES_AUDIO),) - ifeq ($(strip $(NITROFSDIR)),) - OBJS_ASSETS += $(SOUNDBANKDIR)/soundbank.c.o - endif - HEADERS_ASSETS += $(SOUNDBANKINFODIR)/soundbank.h -endif - -OBJS_SOURCES := $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_S))) \ - $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_C))) \ - $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_CPP))) - -OBJS := $(OBJS_ASSETS) $(OBJS_SOURCES) - -DEPS := $(OBJS:.o=.d) - -# Targets -# ------- - -.PHONY: all clean dump dldipatch sdimage - -all: $(ROM) - -ifneq ($(strip $(NITROFSDIR)),) -# Additional arguments for ndstool -NDSTOOL_ARGS := -d $(NITROFSDIR) - -ifneq ($(SOURCES_AUDIO),) - NDSTOOL_ARGS += -d $(SOUNDBANKDIR) -endif - -# Make the NDS ROM depend on the filesystem only if it is needed -$(ROM): $(NITROFSDIR) -endif - -# Combine the title strings -ifeq ($(strip $(GAME_SUBTITLE)),) - GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_AUTHOR) -else - GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_SUBTITLE);$(GAME_AUTHOR) -endif - -$(ROM): $(ELF) - @echo " NDSTOOL $@" - $(V)$(BLOCKSDS)/tools/ndstool/ndstool -c $@ \ - -7 $(ARM7ELF) -9 $(ELF) \ - -b $(GAME_ICON) "$(GAME_FULL_TITLE)" \ - $(NDSTOOL_ARGS) - -$(ELF): $(OBJS) - @echo " LD $@" - $(V)$(LD) -o $@ $(OBJS) $(LDFLAGS) - -$(DUMP): $(ELF) - @echo " OBJDUMP $@" - $(V)$(OBJDUMP) -h -C -S $< > $@ - -dump: $(DUMP) - -clean: - @echo " CLEAN" - $(V)$(RM) $(ROM) $(DUMP) build $(SDIMAGE) - -sdimage: - @echo " MKFATIMG $(SDIMAGE) $(SDROOT)" - $(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(SDROOT) $(SDIMAGE) - -dldipatch: $(ROM) - @echo " DLDIPATCH $(ROM)" - $(V)$(BLOCKSDS)/tools/dldipatch/dldipatch patch \ - $(BLOCKSDS)/sys/dldi_r4/r4tf.dldi $(ROM) - -# Rules -# ----- - -$(BUILDDIR)/%.s.o : %.s - @echo " AS $<" - @$(MKDIR) -p $(@D) - $(V)$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $< - -$(BUILDDIR)/%.c.o : %.c - @echo " CC $<" - @$(MKDIR) -p $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $@ $< - -$(BUILDDIR)/%.arm.c.o : %.arm.c - @echo " CC $<" - @$(MKDIR) -p $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $< - -$(BUILDDIR)/%.cpp.o : %.cpp - @echo " CXX $<" - @$(MKDIR) -p $(@D) - $(V)$(CXX) $(CXXFLAGS) -MMD -MP -c -o $@ $< - -$(BUILDDIR)/%.arm.cpp.o : %.arm.cpp - @echo " CXX $<" - @$(MKDIR) -p $(@D) - $(V)$(CXX) $(CXXFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $< - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.bin - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.bmp - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.jpg - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.gif - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.raw - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.mp3 - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.mod - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.png - @echo " BIN2C $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c - -$(BUILDDIR)/%.png.o $(BUILDDIR)/%.h : %.png %.grit - @echo " GRIT $<" - @$(MKDIR) -p $(@D) - $(V)$(BLOCKSDS)/tools/grit/grit $< -ftc -W1 -o$(BUILDDIR)/$* - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.c - $(V)touch $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.h - -ifneq ($(SOURCES_AUDIO),) - -$(SOUNDBANKINFODIR)/soundbank.h: $(SOURCES_AUDIO) - @echo " MMUTIL $^" - @$(MKDIR) -p $(SOUNDBANKDIR) - @$(MKDIR) -p $(SOUNDBANKINFODIR) - @$(BLOCKSDS)/tools/mmutil/mmutil $^ -d \ - -o$(SOUNDBANKDIR)/soundbank.bin -h$(SOUNDBANKINFODIR)/soundbank.h - -ifeq ($(strip $(NITROFSDIR)),) -$(SOUNDBANKDIR)/soundbank.c.o: $(SOUNDBANKINFODIR)/soundbank.h - @echo " BIN2C soundbank.bin" - $(V)$(BLOCKSDS)/tools/bin2c/bin2c $(SOUNDBANKDIR)/soundbank.bin \ - $(SOUNDBANKDIR) - @echo " CC.9 soundbank_bin.c" - $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(SOUNDBANKDIR)/soundbank.c.o \ - $(SOUNDBANKDIR)/soundbank_bin.c -endif - -endif - -# All assets must be built before the source code -# ----------------------------------------------- - -$(SOURCES_S) $(SOURCES_C) $(SOURCES_CPP): $(HEADERS_ASSETS) - -# Include dependency files if they exist -# -------------------------------------- - --include $(DEPS) +# SPDX-License-Identifier: CC0-1.0 +# +# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024 + +export BLOCKSDS ?= /opt/blocksds/core +export BLOCKSDSEXT ?= /opt/blocksds/external + +export WONDERFUL_TOOLCHAIN ?= /opt/wonderful +ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/ + +# User config +# =========== + +NAME := $(shell basename $(CURDIR)) + +GAME_TITLE := PAlib Project +GAME_SUBTITLE := Change this text +GAME_AUTHOR := for your project! +GAME_ICON := $(BLOCKSDSEXT)/palib/defaultlogo.bmp + +ARM7ELF := $(BLOCKSDSEXT)/palib/sys/arm7_maxmod_dswifi.elf + +# DLDI and internal SD slot of DSi +# -------------------------------- + +# Root folder of the SD image +SDROOT := sdroot +# Name of the generated image it "DSi-1.sd" for no$gba in DSi mode +SDIMAGE := image.bin + +# Source code paths +# ----------------- + +SOURCEDIRS := source gfx/bin +INCLUDEDIRS := gfx +GFXDIRS := +BINDIRS := gfx/bin +AUDIODIRS := +NITROFSDIR := + +# Defines passed to all files +# --------------------------- + +DEFINES := -DPA_NO_DEPRECATION + +# Libraries +# --------- + +LIBS := -lmm9 -lnds9 -ldswifi9 -lpa9 +LIBDIRS := $(BLOCKSDS)/libs/maxmod \ + $(BLOCKSDS)/libs/dswifi \ + $(BLOCKSDS)/libs/libnds \ + $(BLOCKSDSEXT)/palib + +# Build artifacts +# --------------- + +BUILDDIR := build/$(NAME) +ELF := build/$(NAME).elf +DUMP := build/$(NAME).dump +MAP := build/$(NAME).map +ROM := $(NAME).nds + +# If NITROFSDIR is set, the soundbank created by mmutil will be saved to NitroFS +SOUNDBANKINFODIR := $(BUILDDIR)/maxmod +ifeq ($(strip $(NITROFSDIR)),) + SOUNDBANKDIR := $(BUILDDIR)/maxmod +else + SOUNDBANKDIR := $(BUILDDIR)/maxmod_nitrofs +endif + +# Tools +# ----- + +PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi- +CC := $(PREFIX)gcc +CXX := $(PREFIX)g++ +LD := $(PREFIX)gcc +OBJDUMP := $(PREFIX)objdump +MKDIR := mkdir +RM := rm -rf + +# Verbose flag +# ------------ + +ifeq ($(VERBOSE),1) +V := +else +V := @ +endif + +# Source files +# ------------ + +ifneq ($(BINDIRS),) + SOURCES_BIN_BIN := $(shell find -L $(BINDIRS) -name "*.bin") + SOURCES_BIN_BMP := $(shell find -L $(BINDIRS) -name "*.bmp") + SOURCES_BIN_JPG := $(shell find -L $(BINDIRS) -name "*.jpg") + SOURCES_BIN_PNG := $(shell find -L $(BINDIRS) -name "*.png") + SOURCES_BIN_GIF := $(shell find -L $(BINDIRS) -name "*.gif") + SOURCES_BIN_RAW := $(shell find -L $(BINDIRS) -name "*.raw") + SOURCES_BIN_MP3 := $(shell find -L $(BINDIRS) -name "*.mp3") + SOURCES_BIN_MOD := $(shell find -L $(BINDIRS) -name "*.mod") + INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(BINDIRS)) +endif +ifneq ($(GFXDIRS),) + SOURCES_PNG := $(shell find -L $(GFXDIRS) -name "*.png") + INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(GFXDIRS)) +endif +ifneq ($(AUDIODIRS),) + SOURCES_AUDIO := $(shell find -L $(AUDIODIRS) -regex '.*\.\(it\|mod\|s3m\|wav\|xm\)') + ifneq ($(SOURCES_AUDIO),) + INCLUDEDIRS += $(SOUNDBANKINFODIR) + endif +endif + +SOURCES_S := $(shell find -L $(SOURCEDIRS) -name "*.s") +SOURCES_C := $(shell find -L $(SOURCEDIRS) -name "*.c") +SOURCES_CPP := $(shell find -L $(SOURCEDIRS) -name "*.cpp") + +# Compiler and linker flags +# ------------------------- + +ARCH := -mthumb -mcpu=arm946e-s+nofp + +SPECS := $(BLOCKSDS)/sys/crts/ds_arm9.specs + +WARNFLAGS := -Wall + +ifeq ($(SOURCES_CPP),) + LIBS += -lc +else + LIBS += -lstdc++ -lc +endif + +INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \ + $(foreach path,$(LIBDIRS),-I$(path)/include) + +LIBDIRSFLAGS := $(foreach path,$(LIBDIRS),-L$(path)/lib) + +ASFLAGS += -x assembler-with-cpp $(INCLUDEFLAGS) $(DEFINES) \ + $(ARCH) -ffunction-sections -fdata-sections \ + -specs=$(SPECS) + +CFLAGS += -std=gnu17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \ + $(ARCH) -O2 -ffunction-sections -fdata-sections \ + -specs=$(SPECS) + +CXXFLAGS += -std=gnu++17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \ + $(ARCH) -O2 -ffunction-sections -fdata-sections \ + -fno-exceptions -fno-rtti \ + -specs=$(SPECS) + +LDFLAGS := $(ARCH) $(LIBDIRSFLAGS) -Wl,-Map,$(MAP) $(DEFINES) \ + -Wl,--start-group $(LIBS) -Wl,--end-group -specs=$(SPECS) + +# Intermediate build files +# ------------------------ + +OBJS_ASSETS := $(patsubst %.bin,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BIN))) \ + $(patsubst %.bmp,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BMP))) \ + $(patsubst %.jpg,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_JPG))) \ + $(patsubst %.png,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_PNG))) \ + $(patsubst %.gif,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_GIF))) \ + $(patsubst %.raw,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_RAW))) \ + $(patsubst %.mp3,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MP3))) \ + $(patsubst %.mod,%.o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MOD))) \ + $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG))) + +HEADERS_ASSETS := $(patsubst %.bin,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BIN))) \ + $(patsubst %.bmp,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_BMP))) \ + $(patsubst %.jpg,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_JPG))) \ + $(patsubst %.png,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_PNG))) \ + $(patsubst %.gif,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_GIF))) \ + $(patsubst %.raw,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_RAW))) \ + $(patsubst %.mp3,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MP3))) \ + $(patsubst %.mod,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN_MOD))) \ + $(patsubst %.png,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG))) + +ifneq ($(SOURCES_AUDIO),) + ifeq ($(strip $(NITROFSDIR)),) + OBJS_ASSETS += $(SOUNDBANKDIR)/soundbank.c.o + endif + HEADERS_ASSETS += $(SOUNDBANKINFODIR)/soundbank.h +endif + +OBJS_SOURCES := $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_S))) \ + $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_C))) \ + $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_CPP))) + +OBJS := $(OBJS_ASSETS) $(OBJS_SOURCES) + +DEPS := $(OBJS:.o=.d) + +# Targets +# ------- + +.PHONY: all clean dump dldipatch sdimage + +all: $(ROM) + +ifneq ($(strip $(NITROFSDIR)),) +# Additional arguments for ndstool +NDSTOOL_ARGS := -d $(NITROFSDIR) + +ifneq ($(SOURCES_AUDIO),) + NDSTOOL_ARGS += -d $(SOUNDBANKDIR) +endif + +# Make the NDS ROM depend on the filesystem only if it is needed +$(ROM): $(NITROFSDIR) +endif + +# Combine the title strings +ifeq ($(strip $(GAME_SUBTITLE)),) + GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_AUTHOR) +else + GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_SUBTITLE);$(GAME_AUTHOR) +endif + +$(ROM): $(ELF) + @echo " NDSTOOL $@" + $(V)$(BLOCKSDS)/tools/ndstool/ndstool -c $@ \ + -7 $(ARM7ELF) -9 $(ELF) \ + -b $(GAME_ICON) "$(GAME_FULL_TITLE)" \ + $(NDSTOOL_ARGS) + +$(ELF): $(OBJS) + @echo " LD $@" + $(V)$(LD) -o $@ $(OBJS) $(LDFLAGS) + +$(DUMP): $(ELF) + @echo " OBJDUMP $@" + $(V)$(OBJDUMP) -h -C -S $< > $@ + +dump: $(DUMP) + +clean: + @echo " CLEAN" + $(V)$(RM) $(ROM) $(DUMP) build $(SDIMAGE) + +sdimage: + @echo " MKFATIMG $(SDIMAGE) $(SDROOT)" + $(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(SDROOT) $(SDIMAGE) + +dldipatch: $(ROM) + @echo " DLDIPATCH $(ROM)" + $(V)$(BLOCKSDS)/tools/dldipatch/dldipatch patch \ + $(BLOCKSDS)/sys/dldi_r4/r4tf.dldi $(ROM) + +# Rules +# ----- + +$(BUILDDIR)/%.s.o : %.s + @echo " AS $<" + @$(MKDIR) -p $(@D) + $(V)$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $< + +$(BUILDDIR)/%.c.o : %.c + @echo " CC $<" + @$(MKDIR) -p $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $@ $< + +$(BUILDDIR)/%.arm.c.o : %.arm.c + @echo " CC $<" + @$(MKDIR) -p $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $< + +$(BUILDDIR)/%.cpp.o : %.cpp + @echo " CXX $<" + @$(MKDIR) -p $(@D) + $(V)$(CXX) $(CXXFLAGS) -MMD -MP -c -o $@ $< + +$(BUILDDIR)/%.arm.cpp.o : %.arm.cpp + @echo " CXX $<" + @$(MKDIR) -p $(@D) + $(V)$(CXX) $(CXXFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $< + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.bin + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.bmp + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.jpg + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.gif + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.raw + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.mp3 + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.mod + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.o $(BUILDDIR)/%.h : %.png + @echo " BIN2C $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/bin2c/bin2c --noext $< $(@D) + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.o $(BUILDDIR)/$*.c + +$(BUILDDIR)/%.png.o $(BUILDDIR)/%.h : %.png %.grit + @echo " GRIT $<" + @$(MKDIR) -p $(@D) + $(V)$(BLOCKSDS)/tools/grit/grit $< -ftc -W1 -o$(BUILDDIR)/$* + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.c + $(V)touch $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.h + +ifneq ($(SOURCES_AUDIO),) + +$(SOUNDBANKINFODIR)/soundbank.h: $(SOURCES_AUDIO) + @echo " MMUTIL $^" + @$(MKDIR) -p $(SOUNDBANKDIR) + @$(MKDIR) -p $(SOUNDBANKINFODIR) + @$(BLOCKSDS)/tools/mmutil/mmutil $^ -d \ + -o$(SOUNDBANKDIR)/soundbank.bin -h$(SOUNDBANKINFODIR)/soundbank.h + +ifeq ($(strip $(NITROFSDIR)),) +$(SOUNDBANKDIR)/soundbank.c.o: $(SOUNDBANKINFODIR)/soundbank.h + @echo " BIN2C soundbank.bin" + $(V)$(BLOCKSDS)/tools/bin2c/bin2c $(SOUNDBANKDIR)/soundbank.bin \ + $(SOUNDBANKDIR) + @echo " CC.9 soundbank_bin.c" + $(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(SOUNDBANKDIR)/soundbank.c.o \ + $(SOUNDBANKDIR)/soundbank_bin.c +endif + +endif + +# All assets must be built before the source code +# ----------------------------------------------- + +$(SOURCES_S) $(SOURCES_C) $(SOURCES_CPP): $(HEADERS_ASSETS) + +# Include dependency files if they exist +# -------------------------------------- + +-include $(DEPS) diff --git a/template/ReadMe.txt b/template/ReadMe.txt index 84311f2..c4a7a14 100644 --- a/template/ReadMe.txt +++ b/template/ReadMe.txt @@ -1,76 +1,76 @@ -/-----------------------------------------\ -|/---------------------------------------\| -|| Welcome to the PAlib Project Template || -|\---------------------------------------/| -\-----------------------------------------/ - -Using this template you can get a PAlib Nintendo DS application running in almost no time. -You must get familiar with the structure of a PAlib project: - -Folders: - data - Contains data files that you want to include in your project. - include - Contains header files (.h). - source - Contains source files (.c, .cpp and .s). Those are your program. - gfx - Contains PAGfx (a graphics converter) and the graphics for your program. - audio - Contains module files (mod, s3m, xm and it) and sound effects (wav) for use with Maxmod. - filesystem - Contains files which will be embedded in the .nds file. Use libfilesystem to read them. - -Files: - build.bat and clean.bat - These are used to compile and clean your project (on Windows), respectively. - Makefile - This is a special file that tells your system how to convert your project files into a .nds file (how to compile your project). - (Optional) logo.bmp - This is a custom logo that will be shown in the application loader of your Nintendo DS instead of the default PAlib one. - ReadMe.txt - The file you are reading! :P - source/main.c - This contains your program. - -================================= -| Quick start guide for newbies | -================================= - -- When you want to compile your project launch build.bat. A command prompt should open and you will see - the status of the compiling process. - /------------------------------------------------------------------------------------------------------------------------\ - | TIP: Watch out for the warnings and errors! If you don't know what they mean, ask in the PAlib forums (palib-dev.com). | - \------------------------------------------------------------------------------------------------------------------------/ -- When you want to run your project, launch your favorite emulator (for example: PAlib/emulators/no$gba/no$gba.exe) and open the - .nds file that has been generated. -- If you're using libfilesystem and your program doesn't work on your card use HomebrewMenu by devkitPro (go to devkitPro.org/hbmenu). - -============================================ -| Linux/Mac/Other users, please read this! | -============================================ - -If you want to use PAGfx copy the Mono-ready PAGfx binaries from PAlib\tools\PAGfx\Mono to the gfx folder. - -====================================== -| Preparing your program for release | -====================================== - -You should replace the project description in the Makefile with something more appropriate. The default is: -TEXT1 := PAlib Project -TEXT2 := Change this text -TEXT3 := for your project! - -As the last step, consider creating a custom logo.bmp for your project even if your card doesn't show this icon. -Its size has to be 32x32 and it can have up to 16 colors (color index 0 is transparent). -If your card doesn't show the internal logo of .nds files, you can use DSOrganize to view it on the DS and confirm that it looks OK. - -============================== -| Section for advanced users | -============================== - -To use special features like Maxmod you have to select an ARM7 core for your project. -You can do this in the Makefile - open it with an editor and read the first few lines. - -The following features are available: - -Sound/Music: - ASlib - RAW and MP3 file playback using Noda's ASlib (examples\Sound\ASlib\ASlib_General) - this is the default - Maxmod - module playback (mod, s3m, xm and it) using eKid's Maxmod (it comes with libnds) - -Networking: - dswifi - dswifi for DS<->AccessPoint connections (examples\Wifi\dswifi) - -/-----------------------------------------------------------------------------------------------------------------------------\ -| IMPORTANT: Your project will only work on the G6 and M3 Real cards if you choose an ARM7 core which is smaller than 64 KBs. | -| Currently the only cores that can be used on those cards are the ARM7_MP3 and ARM7_MAXMOD_DSWIFI cores. | -\-----------------------------------------------------------------------------------------------------------------------------/ +/-----------------------------------------\ +|/---------------------------------------\| +|| Welcome to the PAlib Project Template || +|\---------------------------------------/| +\-----------------------------------------/ + +Using this template you can get a PAlib Nintendo DS application running in almost no time. +You must get familiar with the structure of a PAlib project: + +Folders: + data - Contains data files that you want to include in your project. + include - Contains header files (.h). + source - Contains source files (.c, .cpp and .s). Those are your program. + gfx - Contains PAGfx (a graphics converter) and the graphics for your program. + audio - Contains module files (mod, s3m, xm and it) and sound effects (wav) for use with Maxmod. + filesystem - Contains files which will be embedded in the .nds file. Use libfilesystem to read them. + +Files: + build.bat and clean.bat - These are used to compile and clean your project (on Windows), respectively. + Makefile - This is a special file that tells your system how to convert your project files into a .nds file (how to compile your project). + (Optional) logo.bmp - This is a custom logo that will be shown in the application loader of your Nintendo DS instead of the default PAlib one. + ReadMe.txt - The file you are reading! :P + source/main.c - This contains your program. + +================================= +| Quick start guide for newbies | +================================= + +- When you want to compile your project launch build.bat. A command prompt should open and you will see + the status of the compiling process. + /------------------------------------------------------------------------------------------------------------------------\ + | TIP: Watch out for the warnings and errors! If you don't know what they mean, ask in the PAlib forums (palib-dev.com). | + \------------------------------------------------------------------------------------------------------------------------/ +- When you want to run your project, launch your favorite emulator (for example: PAlib/emulators/no$gba/no$gba.exe) and open the + .nds file that has been generated. +- If you're using libfilesystem and your program doesn't work on your card use HomebrewMenu by devkitPro (go to devkitPro.org/hbmenu). + +============================================ +| Linux/Mac/Other users, please read this! | +============================================ + +If you want to use PAGfx copy the Mono-ready PAGfx binaries from PAlib\tools\PAGfx\Mono to the gfx folder. + +====================================== +| Preparing your program for release | +====================================== + +You should replace the project description in the Makefile with something more appropriate. The default is: +TEXT1 := PAlib Project +TEXT2 := Change this text +TEXT3 := for your project! + +As the last step, consider creating a custom logo.bmp for your project even if your card doesn't show this icon. +Its size has to be 32x32 and it can have up to 16 colors (color index 0 is transparent). +If your card doesn't show the internal logo of .nds files, you can use DSOrganize to view it on the DS and confirm that it looks OK. + +============================== +| Section for advanced users | +============================== + +To use special features like Maxmod you have to select an ARM7 core for your project. +You can do this in the Makefile - open it with an editor and read the first few lines. + +The following features are available: + +Sound/Music: + ASlib - RAW and MP3 file playback using Noda's ASlib (examples\Sound\ASlib\ASlib_General) - this is the default + Maxmod - module playback (mod, s3m, xm and it) using eKid's Maxmod (it comes with libnds) + +Networking: + dswifi - dswifi for DS<->AccessPoint connections (examples\Wifi\dswifi) + +/-----------------------------------------------------------------------------------------------------------------------------\ +| IMPORTANT: Your project will only work on the G6 and M3 Real cards if you choose an ARM7 core which is smaller than 64 KBs. | +| Currently the only cores that can be used on those cards are the ARM7_MP3 and ARM7_MAXMOD_DSWIFI cores. | +\-----------------------------------------------------------------------------------------------------------------------------/ diff --git a/template/source/main.c b/template/source/main.c index b2401ba..db4cf1a 100644 --- a/template/source/main.c +++ b/template/source/main.c @@ -1,26 +1,26 @@ -//////////////////////////// -// PAlib project template // -//////////////////////////// - -// Lines starting with two slashes are ignored by the compiler -// Basically you can use them to comment what are you doing -// In fact, this kind of lines are called comments :P - -// Include PAlib so that you can use it -#include - -int main(){ - // Initialize PAlib - PA_Init(); - - // Put your initialization code here - - // Infinite loop to keep the program running - while(true){ - // Put your game logic here - - // Wait until the next frame. - // The DS runs at 60 frames per second. - PA_WaitForVBL(); - } -} +//////////////////////////// +// PAlib project template // +//////////////////////////// + +// Lines starting with two slashes are ignored by the compiler +// Basically you can use them to comment what are you doing +// In fact, this kind of lines are called comments :P + +// Include PAlib so that you can use it +#include + +int main(){ + // Initialize PAlib + PA_Init(); + + // Put your initialization code here + + // Infinite loop to keep the program running + while(true){ + // Put your game logic here + + // Wait until the next frame. + // The DS runs at 60 frames per second. + PA_WaitForVBL(); + } +}