summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9')
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/background.h59
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/boxtest.h108
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/cache.h86
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/console.h85
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/exceptions.h42
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/image.h69
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/input.h95
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/math.h225
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/ndsmotion.h190
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/pcx.h57
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/postest.h88
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/rumble.h59
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sound.h43
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sprite.h224
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/trig_lut.h41
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/video.h591
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/videoGL.h1295
17 files changed, 0 insertions, 3357 deletions
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/background.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/background.h
deleted file mode 100644
index 4aa8287161..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/background.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- background.h -- definitions for DS backgrounds
-
- Copyright (C) 2007
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef _libnds_background_h_
-#define _libnds_background_h_
-
-#include <nds/jtypes.h>
-
-// Background control defines
-
-// BGxCNT defines ///
-#define BG_MOSAIC_ENABLE 0x40
-#define BG_COLOR_256 0x80
-#define BG_COLOR_16 0x00
-
-#define CHAR_BASE_BLOCK(n) (((n)*0x4000)+ 0x06000000)
-#define CHAR_BASE_BLOCK_SUB(n) (((n)*0x4000)+ 0x06200000)
-#define SCREEN_BASE_BLOCK(n) (((n)*0x800) + 0x06000000)
-#define SCREEN_BASE_BLOCK_SUB(n) (((n)*0x800) + 0x06200000)
-
-#define CHAR_SHIFT 2
-#define SCREEN_SHIFT 8
-#define TEXTBG_SIZE_256x256 0x0
-#define TEXTBG_SIZE_256x512 0x8000
-#define TEXTBG_SIZE_512x256 0x4000
-#define TEXTBG_SIZE_512x512 0xC000
-
-#define ROTBG_SIZE_128x128 0x0
-#define ROTBG_SIZE_256x256 0x4000
-#define ROTBG_SIZE_512x512 0x8000
-#define ROTBG_SIZE_1024x1024 0xC000
-
-#define WRAPAROUND 0x1
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/boxtest.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/boxtest.h
deleted file mode 100644
index 5591bddd72..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/boxtest.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*---------------------------------------------------------------------------------
-BoxTest.h -- Code for performing hardware box test against viewing frustrum
-
-Copyright (C) 2005
-Michael Noland (joat)
-Jason Rogers (dovoto)
-Dave Murphy (WinterMute)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you
-must not claim that you wrote the original software. If you use
-this software in a product, an acknowledgment in the product
-documentation would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-
-
----------------------------------------------------------------------------------*/
-#ifndef BOX_TEST_INCLUDE
-#define BOX_TEST_INCLUDE
-
-#include <nds/arm9/video.h>
-#include <nds/arm9/videoGL.h>
-
-/*! \file boxtest.h
-\brief Box Test Functions.
-
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*! \fn int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth)
-\brief Performs a test to determine if the provided box is in the view frustrum.
-\param x (x, y, z) point of a vertex on the box
-\param y (x, y, z) point of a vertex on the box
-\param z (x, y, z) point of a vertex on the box
-\param height (height, width, depth) describe the size of the box referenced from (x, y, z)
-\param width (height, width, depth) describe the size of the box referenced from (x, y, z)
-\param depth (height, width, depth) describe the size of the box referenced from (x, y, z)
-
-\return non zero if any or all of the box is in the view frustum
-*/
-int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth);
-
-/*! \fn int BoxTestf(float x, float y, float z, float width, float height, float depth)
-\brief Performs a test to determine if the provided box is in the view frustum.
-\param x (x, y, z) point of a vertex on the box
-\param y (x, y, z) point of a vertex on the box
-\param z (x, y, z) point of a vertex on the box
-\param width (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param height (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param depth (width, height, depth) describe the size of the box referenced from (x, y, z)
-
-\return non zero if any or all of the box is in the view frustum
-*/
-int BoxTestf(float x, float y, float z, float width, float height, float depth);
-
-/*! \fn void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth)
-\brief Performs a test to determine if the provided box is in the view frustum.
-\param x (x, y, z) point of a vertex on the box
-\param y (x, y, z) point of a vertex on the box
-\param z (x, y, z) point of a vertex on the box
-\param width (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param height (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param depth (width, height, depth) describe the size of the box referenced from (x, y, z)
-
-Performs a test to determine if the provided box is in the view frustum. BoxTestResult must be called to get the result of this
-operation.
-*/
-void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 height, v16 width, v16 depth);
-
-/*! \fn void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth)
-\brief Performs a test to determine if the provided box is in the view frustum.
-\param x (x, y, z) point of a vertex on the box
-\param y (x, y, z) point of a vertex on the box
-\param z (x, y, z) point of a vertex on the box
-\param width (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param height (width, height, depth) describe the size of the box referenced from (x, y, z)
-\param depth (width, height, depth) describe the size of the box referenced from (x, y, z)
-
-Performs a test to determine if the provided box is in the view frustum. BoxTestResult must be called to get the result of this
-operation.
-*/
-void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth);
-
-/*! \fn void BoxTestResult(void)
-\brief Gets the result of the last box test. Needed for asynch box test calls.
-\return non zero if any or all of the box is in the view frustum
-
-*/
-int BoxTestResult(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/cache.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/cache.h
deleted file mode 100644
index d2ba67158f..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/cache.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*---------------------------------------------------------------------------------
- key input code -- provides slightly higher level input forming
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-/*! \file cache.h
-\brief ARM9 cache control functions.
-
-*/
-#ifndef _cache_h_
-#define _cache_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "nds/jtypes.h"
-
-
-/*! \fn IC_InvalidateAll(void)
- \brief invalidate entire instruction cache.
-*/
-void IC_InvalidateAll(void);
-
-
-/*! \fn IC_InvalidateRange(const void *base, u32 size)
- \brief invalidate the instruction cache for a range of addresses.
- \param base base address of the region to invalidate
- \param size size of the region to invalidate.
-*/
-void IC_InvalidateRange(const void *base, u32 size);
-
-
-/*! \fn DC_FlushAll(void)
- \brief flush the entire data cache to memory.
-*/
-void DC_FlushAll(void);
-
-
-/*! \fn DC_FlushRange(const void *base, u32 size)
- \brief flush the data cache for a range of addresses to memory.
- \param base base address of the region to flush.
- \param size size of the region to flush.
-*/
-void DC_FlushRange(const void *base, u32 size);
-
-
-/*! \fn DC_InvalidateAll(void)
- \brief invalidate the entire data cache.
-*/
-void DC_InvalidateAll(void);
-
-
-/*! \fn DC_InvalidateRange(const void *base, u32 size)
- \brief invalidate the data cache for a range of addresses.
- \param base base address of the region to invalidate
- \param size size of the region to invalidate.
-*/
-void DC_InvalidateRange(const void *base, u32 size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/console.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/console.h
deleted file mode 100644
index c258401070..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/console.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*---------------------------------------------------------------------------------
- console functions
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
-
----------------------------------------------------------------------------------*/
-
-/*! \file console.h
- \brief nds stdio support.
-*/
-
-#ifndef CONSOLE_H
-#define CONSOLE_H
-
-#define CONSOLE_USE_COLOR255 16
-
-#include <nds/jtypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*! \fn void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16* map, u8 pal, u8 bitDepth)
- \brief Initialise the console.
- \param font base address of the 16 color font to use
- \param charBase VRAM address to load the font
- \param numCharacters number of characters in the font
- \param charStart ascii code of the first character in the font
- \param map base address of the map to use for printing
- \param pal 16 color palette index to use
- \param bitDepth 256/16 color tile flag.
-
- Initializes the console with the given parameters. When pal is greater than 15 and
- bitDepth is 16 then all non zero entries in the font are set to index 255. When bitDepth
- is not 16 then the font tiles are created as 8bit (256 color).
-
-*/
-void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16* map, u8 pal, u8 bitDepth);
-/*! \fn void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth)
- \brief Initialize the console with some default parameters.
- \param charBase VRAM address to load the font
- \param map base address of the map to use for printing
- \param bitDepth 256/16 color tile flag
-
- This function calls consoleInit() with the default built in font and character ranges, the parameters given
- are as for that function.
-*/
-void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth);
-
-/*! \fn void consoleDemoInit(void)
-\brief Initialize the console to a default state for prototyping.
-This function sets the console to use sub display, VRAM_C, and BG0 and enables MODE_0_2D on the
-sub display. It is intended for use in prototyping applications which need print ability and not actual
-game use. Print functionality can be utilized with just this call.
-*/
-void consoleDemoInit(void);
-/*! \fn void consoleClear(void)
-\brief Clears the screan by iprintf("\x1b[2J");
-*/
-void consoleClear(void);
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/exceptions.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/exceptions.h
deleted file mode 100644
index 1127e3ff4c..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/exceptions.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef _exceptions_h_
-#define _exceptions_h_
-//---------------------------------------------------------------------------------
-
-#define EXCEPTION_VECTOR (*(VoidFunctionPointer *)(0x27FFD9C))
-
-
-extern VoidFunctionPointer exceptionC[] ;
-extern unsigned long exceptionStack ;
-extern signed long exceptionRegisters[];
-
-void enterException(void);
-void setExceptionHandler(VoidFunctionPointer handler);
-void defaultExceptionHandler(void);
-
-u32 getCPSR(void);
-
-//---------------------------------------------------------------------------------
-#endif // _exceptions_h_
-//---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/image.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/image.h
deleted file mode 100644
index b2a5d00821..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/image.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- Copyright (C) 2005
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef IMAGE_H
-#define IMAGE_H
-
-#include <nds/arm9/video.h>
-
-//holds a rgb triplet
- typedef struct
- {
- unsigned char r,g,b;
- }__attribute__ ((packed)) RGB_24;
-
- //holds a basic image type for loading image files
- typedef struct
- {
- short height,width;
- int bpp;
- unsigned short* palette;
-
- union
- {
- unsigned char* data8;
- unsigned short* data16;
- unsigned int* data32;
- } image;
-
- } sImage, *psImage;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void image24to16(sImage* img);
-void image8to16(sImage* img);
-void image8to16trans(sImage* img, u8 transperentColor);
-void imageDestroy(sImage* img);
-void imageTileData(sImage* img);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#include <nds/arm9/pcx.h>
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/input.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/input.h
deleted file mode 100644
index c08eed1e5d..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/input.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*---------------------------------------------------------------------------------
- key input code -- provides slightly higher level input forming
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Christian Auby (DesktopMan)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-//! NDS input support.
-/*! \file input.h
-*/
-
-//---------------------------------------------------------------------------------
-#ifndef INPUT_HEADER_INCLUDE
-#define INPUT_HEADER_INCLUDE
-//---------------------------------------------------------------------------------
-
-#include <nds/jtypes.h>
-
-// Keyboard
-
-//! Bit values for the keypad buttons.
-typedef enum KEYPAD_BITS {
- KEY_A = BIT(0), //!< Keypad A button.
- KEY_B = BIT(1), //!< Keypad B button.
- KEY_SELECT = BIT(2), //!< Keypad SELECT button.
- KEY_START = BIT(3), //!< Keypad START button.
- KEY_RIGHT = BIT(4), //!< Keypad RIGHT button.
- KEY_LEFT = BIT(5), //!< Keypad LEFT button.
- KEY_UP = BIT(6), //!< Keypad UP button.
- KEY_DOWN = BIT(7), //!< Keypad DOWN button.
- KEY_R = BIT(8), //!< Right shoulder button.
- KEY_L = BIT(9), //!< Left shoulder button.
- KEY_X = BIT(10), //!< Keypad X button.
- KEY_Y = BIT(11), //!< Keypad Y button.
- KEY_TOUCH = BIT(12), //!< Touchscreen pendown.
- KEY_LID = BIT(13) //!< Lid state.
-} KEYPAD_BITS;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//! Obtains the current keypad state.
-/*! Call this function once per main loop in order to use the keypad functions.
-*/
-void scanKeys(void);
-
-//! Obtains the current keypad held state.
-uint32 keysHeld(void);
-
-//! Obtains the current keypad pressed state.
-uint32 keysDown(void);
-
-//! Obtains the current keypad pressed or repeating state.
-uint32 keysDownRepeat(void);
-
-//! Sets the key repeat parameters.
-/*! \param setDelay Number of %scanKeys calls before keys start to repeat.
- \param setRepeat Number of %scanKeys calls before keys repeat.
-*/
-void keysSetRepeat( u8 setDelay, u8 setRepeat );
-
-//! Obtains the current keypad released state.
-uint32 keysUp(void);
-
-//! Obtains the current touchscreen co-ordinates.
-touchPosition touchReadXY(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-//---------------------------------------------------------------------------------
-#endif // INPUT_HEADER_INCLUDE
-//---------------------------------------------------------------------------------
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/math.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/math.h
deleted file mode 100644
index f1296a19fc..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/math.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*---------------------------------------------------------------------------------
- math functions
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef MATH_ARM9_INCLUDE
-#define MATH_ARM9_INCLUDE
-
-#include <nds/jtypes.h>
-
-// Math coprocessor register definitions
-
-#define DIV_CR (*(vuint16*)(0x04000280))
-#define DIV_NUMERATOR64 (*(vint64*) (0x04000290))
-#define DIV_NUMERATOR32 (*(vint32*) (0x04000290))
-#define DIV_DENOMINATOR64 (*(vint64*) (0x04000298))
-#define DIV_DENOMINATOR32 (*(vint32*) (0x04000298))
-#define DIV_RESULT64 (*(vint64*) (0x040002A0))
-#define DIV_RESULT32 (*(vint32*) (0x040002A0))
-#define DIV_REMAINDER64 (*(vint64*) (0x040002A8))
-#define DIV_REMAINDER32 (*(vint32*) (0x040002A8))
-
-#define SQRT_CR (*(vuint16*)(0x040002B0))
-#define SQRT_PARAM64 (*(vint64*) (0x040002B8))
-#define SQRT_RESULT32 (*(vint32*) (0x040002B4))
-#define SQRT_PARAM32 (*(vint32*) (0x040002B8))
-
-// Math coprocessor modes
-
-#define DIV_64_64 2
-#define DIV_64_32 1
-#define DIV_32_32 0
-#define DIV_BUSY (1<<15)
-
-#define SQRT_64 1
-#define SQRT_32 0
-#define SQRT_BUSY (1<<15)
-
-// Fixed Point versions
-
-// Fixed point divide
-// Takes 20.12 numerator and denominator
-// and returns 20.12 result
-static inline int32 divf32(int32 num, int32 den)
-{
- DIV_CR = DIV_64_32;
-
- while(DIV_CR & DIV_BUSY);
-
- DIV_NUMERATOR64 = ((int64)num) << 12;
- DIV_DENOMINATOR32 = den;
-
- while(DIV_CR & DIV_BUSY);
-
- return (DIV_RESULT32);
-}
-
-// Fixed point multiply
-// Takes 20.12 values and returns
-// 20.12 result
-static inline int32 mulf32(int32 a, int32 b)
-{
- long long result = (long long)a*(long long)b;
- return (int32)(result >> 12);
-}
-
-// Fixed point square root
-// Takes 20.12 fixed point value and
-// returns the fixed point result
-static inline int32 sqrtf32(int32 a)
-{
- SQRT_CR = SQRT_64;
-
- while(SQRT_CR & SQRT_BUSY);
-
- SQRT_PARAM64 = ((int64)a) << 12;
-
- while(SQRT_CR & SQRT_BUSY);
-
- return SQRT_RESULT32;
-}
-
-// Integer versions
-
-// Integer divide
-// Takes a 32 bit numerator and 32 bit
-// denominator and returns 32 bit result
-static inline int32 div32(int32 num, int32 den)
-{
- DIV_CR = DIV_32_32;
-
- while(DIV_CR & DIV_BUSY);
-
- DIV_NUMERATOR32 = num;
- DIV_DENOMINATOR32 = den;
-
- while(DIV_CR & DIV_BUSY);
-
- return (DIV_RESULT32);
-}
-
-// Integer divide
-// Takes a 32 bit numerator and 32 bit
-// denominator and returns 32 bit result
-static inline int32 mod32(int32 num, int32 den)
-{
- DIV_CR = DIV_32_32;
-
- while(DIV_CR & DIV_BUSY);
-
- DIV_NUMERATOR32 = num;
- DIV_DENOMINATOR32 = den;
-
- while(DIV_CR & DIV_BUSY);
-
- return (DIV_REMAINDER32);
-}
-
-// Integer divide
-// Takes a 64 bit numerator and 32 bit
-// denominator are returns 32 bit result
-static inline int32 div64(int64 num, int32 den)
-{
- DIV_CR = DIV_64_32;
-
- while(DIV_CR & DIV_BUSY);
-
- DIV_NUMERATOR64 = num;
- DIV_DENOMINATOR32 = den;
-
- while(DIV_CR & DIV_BUSY);
-
- return (DIV_RESULT32);
-}
-
-// Integer divide
-// Takes a 64 bit numerator and 32 bit
-// denominator are returns 32 bit result
-static inline int32 mod64(int64 num, int32 den)
-{
- DIV_CR = DIV_64_32;
-
- while(DIV_CR & DIV_BUSY);
-
- DIV_NUMERATOR64 = num;
- DIV_DENOMINATOR32 = den;
-
- while(DIV_CR & DIV_BUSY);
-
- return (DIV_REMAINDER32);
-}
-
-// Integer square root
-// takes a 32 bit integer and returns
-// 32 bit result
-static inline int32 sqrt32(int a)
-{
- SQRT_CR = SQRT_32;
-
- while(SQRT_CR & SQRT_BUSY);
-
- SQRT_PARAM32 = a;
-
- while(SQRT_CR & SQRT_BUSY);
-
- return SQRT_RESULT32;
-}
-
-// Trig Functions 1.19.12 fixed point
-
-// Cross product
-// x = Ay * Bz - By * Az
-// y = Az * Bx - Bz * Ax
-// z = Ax * By - Bx * Ay
-static inline void crossf32(int32 *a, int32 *b, int32 *result)
-{
- result[0] = mulf32(a[1], b[2]) - mulf32(b[1], a[2]);
- result[1] = mulf32(a[2], b[0]) - mulf32(b[2], a[0]);
- result[2] = mulf32(a[0], b[1]) - mulf32(b[0], a[1]);
-}
-
-// Dot Product
-// result = Ax * Bx + Ay * By + Az * Bz
-static inline int32 dotf32(int32 *a, int32 *b)
-{
- return mulf32(a[0], b[0]) + mulf32(a[1], b[1]) + mulf32(a[2], b[2]);
-}
-
-// Normalize
-// Ax = Ax / mag
-// Ay = Ay / mag
-// Az = Az / mag
-static inline void normalizef32(int32* a)
-{
- // magnitude = sqrt ( Ax^2 + Ay^2 + Az^2 )
- int32 magnitude = sqrtf32( mulf32(a[0], a[0]) + mulf32(a[1], a[1]) + mulf32(a[2], a[2]) );
-
- a[0] = divf32(a[0], magnitude);
- a[1] = divf32(a[1], magnitude);
- a[2] = divf32(a[2], magnitude);
-}
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/ndsmotion.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/ndsmotion.h
deleted file mode 100644
index f3940f5f2f..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/ndsmotion.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*---------------------------------------------------------------------------------
- DS Motion Card/DS Motion Pak functionality
-
- Copyright (C) 2007
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Keith Epstein (KeithE)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-/*! \file ndsmotion.h
-\brief interface code for the ds motion card, ds motion pak, MK6
-
-*/
-#ifndef NDS_MOTION_INCLUDE
-#define NDS_MOTION_INCLUDE
-//---------------------------------------------------------------------------------
-
-
-typedef struct
-{
- short xoff, yoff, zoff, goff;
- short xsens, ysens, zsens, gsens;
-}MotionCalibration;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*! \fn int motion_init(void)
-\brief Initializes the DS Motion Sensor.
-Run this before using any of the DS Motion Sensor functions
-save the return value and pass it to the other motion_ functions
-*/
-int motion_init(void);
-
-/*! \fn int motion_deinit(void)
-\brief Deinitializes the DS Motion Sensor
-*/
-void motion_deinit(void);
-
-/*! \fn signed int motion_read_x(void)
-\brief read the X acceleration
-*/
-signed int motion_read_x(void);
-
-/*! \fn signed int motion_read_y(void)
-\brief read the Y acceleration
-*/
-signed int motion_read_y(void);
-
-/*! \fn signed int motion_read_z(void)
-\brief read the Z acceleration
-*/
-signed int motion_read_z(void);
-
-/*! \fn signed int motion_read_gyro(void)
-\brief read the Z rotational speed
-*/
-signed int motion_read_gyro(void);
-
-/*! \fn int motion_acceleration_x(void)
-\brief gets acceleration value to mili G (where g is 9.8 m/s*s)
-*/
-int motion_acceleration_x(void);
-
-/*! \fn int motion_acceleration_y(void)
-\brief gets acceleration value to mili G (where g is 9.8 m/s*s)
-*/
-int motion_acceleration_y(void);
-
-/*! \fn int motion_acceleration_z(void)
-\brief gets acceleration value to mili G (where g is 9.8 m/s*s)
-*/
-int motion_acceleration_z(void);
-
-/*! \fn void motion_set_sens_x(int sens)
-\brief this should be passed the raw reading at 1g for accurate
-acceleration calculations. Default is 819
-*/
-void motion_set_sens_x(int sens);
-
-/*! \fn void motion_set_sens_y(int sens)
-\brief this should be passed the raw reading at 1g for accurate
-acceleration calculations. Default is 819
-*/
-void motion_set_sens_y(int sens);
-
-/*! \fn void motion_set_sens_z(int sens)
-\brief this should be passed the raw reading at 1g for accurate
-acceleration calculations. Default is 819
-*/
-void motion_set_sens_z(int sens);
-
-/*! \fn void motion_set_sens_x(int sens)
-\brief this should be passed the raw reading at 1g for accurate
-acceleration calculations. Default is 825
-*/
-void motion_set_sens_gyro(int sens);
-
-/*! \fn void motion_set_offs_x(void)
-\brief this should be called when the axis is under no acceleration
-default is 2048
-*/
-void motion_set_offs_x(void);
-
-/*! \fn void motion_set_offs_y(void)
-\brief this should be called when the axis is under no acceleration
-default is 2048
-*/
-void motion_set_offs_y(void);
-
-/*! \fn void motion_set_offs_z(void)
-\brief this should be called when the axis is under no acceleration
-default is 2048
-*/
-void motion_set_offs_z(void);
-
-/*! \fn void motion_set_offs_gyro(void)
-\brief this should be called when the axis is under no rotation
-default is 1680
-*/
-void motion_set_offs_gyro(void);
-
-/*! \fn int motion_rotation(void)
-\brief converts raw rotation value to degrees per second
-*/
-int motion_rotation(void);
-
-/*! \fn MotionCalibration* motion_get_calibration(void)void
-\brief This returns the current calibration settings for saving
-*/
-MotionCalibration* motion_get_calibration(void);
-
-/*! \fn void motion_set_calibration(MotionCalibration* cal)
-\brief This sets the calibration settings. Intended
-to restore saved calibration settings
-*/
-void motion_set_calibration(MotionCalibration* cal);
-
-/*! \fn MotionCalibration* motion_enable_ain_1(void)
-\brief This enables the analog input number 1.
-Required before reading analog input number 1.
-*/
-void motion_enable_ain_1(void);
-
-/*! \fn MotionCalibration* motion_enable_ain_2(void)
-\brief This enables the analog input number 2.
-Required before reading analog input number 2.
-*/
-void motion_enable_ain_2(void);
-
-/*! \fn MotionCalibration* motion_read_ain_1(void)
-\brief This reads the analog input number 1.
-analog input number 1 needs to be enabled before reading.
-*/
-int motion_read_ain_1(void);
-
-/*! \fn MotionCalibration* motion_read_ain_2(void)
-\brief This reads the analog input number 2.
-analog input number 2 needs to be enabled before reading.
-*/
-int motion_read_ain_2(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/pcx.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/pcx.h
deleted file mode 100644
index f050224cd0..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/pcx.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- Copyright (C) 2005
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef PCX_H
-#define PCX_H
-
-typedef struct
-{
- char manufacturer; //should be 0
- char version; //should be 5
- char encoding; //should be 1
- char bitsPerPixel; //should be 8
- short int xmin,ymin; //coordinates for top left,bottom right
- short int xmax,ymax;
- short int hres; //resolution
- short int vres;
- char palette16[48]; //16 color palette if 16 color image
- char reserved; //ignore
- char colorPlanes; //ignore
- short int bytesPerLine;
- short int paletteYype; //should be 2
- char filler[58]; //ignore
-}__attribute__ ((packed)) PCXHeader, *pPCXHeader;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int loadPCX(unsigned char* pcx, sImage* image);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/postest.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/postest.h
deleted file mode 100644
index e08b3f4702..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/postest.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*---------------------------------------------------------------------------------
-
-PosTest.c -- Code for performing hardware position testing
-
-Copyright (C) 2007
-Gabe Ghearing (gabebear)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you
-must not claim that you wrote the original software. If you use
-this software in a product, an acknowledgment in the product
-documentation would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef POS_TEST_INCLUDE
-#define POS_TEST_INCLUDE
-
-#include <nds/arm9/video.h>
-#include <nds/arm9/videoGL.h>
-
-/*! \brief true if the hardware is currently performing a position/vertex/box test.
-\return whether a test is being performed */
-GL_STATIC_INL bool PosTestBusy() {
- return (GFX_STATUS & BIT(0))!=0;
-}
-
-/*! \file postest.h
-\brief Position Test Functions.<BR>
-The position test multiplies a given vector by the position matrix and returns the coords(x,y,z,w). The position test is really quick, about 10x faster than a box test.
-*/
-
-/*! \brief Starts a position test asynchronously
-\param x specifies x offset from the current modelview matrix
-\param y specifies y offset from the current modelview matrix
-\param z specifies z offset from the current modelview matrix */
-GL_STATIC_INL void PosTest_Asynch(v16 x, v16 y, v16 z){
- GFX_POS_TEST = VERTEX_PACK(x, y);
- GFX_POS_TEST = z;
-}
-
-/*! \brief Performs a position test
-\param x specifies x offset from the current modelview matrix
-\param y specifies y offset from the current modelview matrix
-\param z specifies z offset from the current modelview matrix */
-GL_STATIC_INL void PosTest(v16 x, v16 y, v16 z) {
- PosTest_Asynch(x,y,z);
- while(PosTestBusy());
-}
-
-/*! \brief Returns the distance from the camera of the last position test, pretty darn useful
-\return W magnitude */
-GL_STATIC_INL int32 PosTestWresult() {
- return GFX_POS_RESULT[3];
-}
-
-/*! \brief Returns absolute X position of the last position test (location if the modelview matrix was identity)
-\return Absolute X position */
-GL_STATIC_INL int32 PosTestXresult() {
- return GFX_POS_RESULT[0];
-}
-
-/*! \brief Returns absolute Y position of the last position test (location if the modelview matrix was identity)
-\return Absolute Y position */
-GL_STATIC_INL int32 PosTestYresult() {
- return GFX_POS_RESULT[1];
-}
-
-/*! \brief Returns absolute Z position of the last position test (location if the modelview matrix was identity)
-\return Absolute Z position */
-GL_STATIC_INL int32 PosTestZresult() {
- return GFX_POS_RESULT[2];
-}
-
-#endif // ifndef POS_TEST_INCLUDE
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/rumble.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/rumble.h
deleted file mode 100644
index 0361052827..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/rumble.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Mike Parks (BigRedPimp)
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-/*! \file rumble.h
- \brief nds rumble option pak support.
-*/
-#ifndef RUMBLE_HEADER_INCLUDE
-#define RUMBLE_HEADER_INCLUDE
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define RUMBLE_PAK (*(vuint16 *)0x08000000)
-#define WARIOWARE_PAK (*(vuint16 *)0x080000C4)
-#define WARIOWARE_ENABLE (*(vuint16 *)0x080000C6)
-
-typedef enum {
- RUMBLE,
- WARIOWARE
-}RUMBLE_TYPE;
-
-/*! \fn bool isRumbleInserted(void);
- \brief Check for rumble option pak.
- Returns true if the cart in the GBA slot is a Rumble option pak.
-*/
-bool isRumbleInserted(void);
-
-/*! \fn void setRumble(bool position);
- \param position Alternates position of the actuator in the pak
- \brief Fires the rumble actuator.
-*/
-void setRumble(bool position);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sound.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sound.h
deleted file mode 100644
index 96b63f4405..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sound.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*---------------------------------------------------------------------------------
- Sound Functions
-
- Copyright (C) 2005
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef _sound_h_
-#define _sound_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <nds/ipc.h>
-
-void playSound( pTransferSoundData sound);
-void setGenericSound( u32 rate, u8 vol, u8 pan, u8 format);
-void playGenericSound(const void* data, u32 length);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _sound_h_
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sprite.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sprite.h
deleted file mode 100644
index bbfefad6a3..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/sprite.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- sprite.h -- definitions for DS sprites
-
- Copyright (C) 2007
- Liran Nuna (LiraNuna)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef _libnds_sprite_h_
-#define _libnds_sprite_h_
-
-#ifndef ARM9
-#error Sprites are only available on the ARM9
-#endif
-
-#include <nds/jtypes.h>
-
-// Sprite control defines
-
-// Attribute 0 consists of 8 bits of Y plus the following flags:
-#define ATTR0_NORMAL (0<<8)
-#define ATTR0_ROTSCALE (1<<8)
-#define ATTR0_DISABLED (2<<8)
-#define ATTR0_ROTSCALE_DOUBLE (3<<8)
-
-#define ATTR0_TYPE_NORMAL (0<<10)
-#define ATTR0_TYPE_BLENDED (1<<10)
-#define ATTR0_TYPE_WINDOWED (2<<10)
-#define ATTR0_BMP (3<<10)
-
-#define ATTR0_MOSAIC (1<<12)
-
-#define ATTR0_COLOR_16 (0<<13) //16 color in tile mode...16 bit in bitmap mode
-#define ATTR0_COLOR_256 (1<<13)
-
-#define ATTR0_SQUARE (0<<14)
-#define ATTR0_WIDE (1<<14)
-#define ATTR0_TALL (2<<14)
-
-#define OBJ_Y(m) ((m)&0x00ff)
-
-// Atribute 1 consists of 9 bits of X plus the following flags:
-#define ATTR1_ROTDATA(n) ((n)<<9) // note: overlaps with flip flags
-#define ATTR1_FLIP_X (1<<12)
-#define ATTR1_FLIP_Y (1<<13)
-#define ATTR1_SIZE_8 (0<<14)
-#define ATTR1_SIZE_16 (1<<14)
-#define ATTR1_SIZE_32 (2<<14)
-#define ATTR1_SIZE_64 (3<<14)
-
-#define OBJ_X(m) ((m)&0x01ff)
-
-// Atribute 2 consists of the following:
-#define ATTR2_PRIORITY(n) ((n)<<10)
-#define ATTR2_PALETTE(n) ((n)<<12)
-#define ATTR2_ALPHA(n) ((n)<<12)
-
-/**
- * @enum tObjMode
- * @brief Sprite display mode.
- */
-typedef enum
-{
- OBJMODE_NORMAL, /**< No special mode is on - Normal sprite state. */
- OBJMODE_BLENDED, /**< Color blending is on - Sprite can use HW blending features. */
- OBJMODE_WINDOWED, /**< Sprite can be seen only inside the sprite window. */
- OBJMODE_BITMAP, /**< Sprite is not using tiles - per pixel image data. */
-
-} tObjMode;
-
-/**
- * @enum tObjShape
- * @brief Sprite shape mode.
- */
-typedef enum {
- OBJSHAPE_SQUARE, /**< Sprite shape is NxN (Height == Width). */
- OBJSHAPE_WIDE, /**< Sprite shape is NxM with N > M (Height < Width). */
- OBJSHAPE_TALL, /**< Sprite shape is NxM with N < M (Height > Width). */
- OBJSHAPE_FORBIDDEN, /**< Sprite shape is undefined. */
-} tObjShape;
-
-/**
- * @enum tObjSize
- * @brief Object shape mode.
- */
-typedef enum {
- OBJSIZE_8, /**< Major sprite size is 8px. */
- OBJSIZE_16, /**< Major sprite size is 16px. */
- OBJSIZE_32, /**< Major sprite size is 32px. */
- OBJSIZE_64, /**< Major sprite size is 64px. */
-} tObjSize;
-
-/**
- * @enum tObjColMode
- * @brief Object color mode.
- */
-typedef enum {
- OBJCOLOR_16, /**< sprite has 16 colors. */
- OBJCOLOR_256, /**< sprite has 256 colors. */
-} tObjColMode;
-
-/**
- * @enum tObjColMode
- * @brief Object color mode.
- */
-typedef enum {
- OBJPRIORITY_0, /**< sprite priority level 0 - highest. */
- OBJPRIORITY_1, /**< sprite priority level 1. */
- OBJPRIORITY_2, /**< sprite priority level 2. */
- OBJPRIORITY_3, /**< sprite priority level 3 - lowest. */
-} tObjPriority;
-
-// Sprite structures
-
-typedef union {
- struct {
-
- struct {
- u16 posY :8; /**< Sprite Y position. */
- union {
- struct {
- u8 :1;
- bool isHidden :1; /**< Sprite is hidden (isRotoscale cleared). */
- u8 :6;
- };
- struct {
- bool isRotoscale :1; /**< Sprite uses affine parameters if set. */
- bool rsDouble :1; /**< Sprite bounds is doubled (isRotoscale set). */
- tObjMode objMode :2; /**< Sprite object mode. */
- bool isMosaic :1; /**< Enables mosaic effect if set. */
- tObjColMode colMode :1; /**< Sprite color mode. */
- tObjShape objShape :2; /**< Sprite shape. */
- };
- };
- };
-
- union {
- struct {
- u16 posX :9; /**< Sprite X position. */
- u8 :7;
- };
- struct {
- u8 :8;
- union {
- struct {
- u8 :4;
- bool hFlip :1; /**< Flip sprite horizontally (isRotoscale cleared). */
- bool vFlip :1; /**< Flip sprite vertically (isRotoscale cleared).*/
- u8 :2;
- };
- struct {
- u8 :1;
- u8 rsMatrixIdx :5; /**< Affine parameter number to use (isRotoscale set). */
- tObjSize objSize :2; /**< Sprite size. */
- };
- };
- };
- };
-
- struct {
- u16 tileIdx :10;/**< Upper-left tile index. */
- tObjPriority objPriority :2; /**< Sprite priority. */
- u8 objPal :4; /**< Sprite palette to use in paletted color modes. */
- };
-
- u16 attribute3; /**< Four of those are used as a sprite rotation matrice */
- };
-
- struct {
- uint16 attribute[3];
- uint16 filler;
- };
-
-} SpriteEntry, * pSpriteEntry;
-
-
-typedef struct sSpriteRotation {
- uint16 filler1[3];
- int16 hdx;
-
- uint16 filler2[3];
- int16 hdy;
-
- uint16 filler3[3];
- int16 vdx;
-
- uint16 filler4[3];
- int16 vdy;
-} SpriteRotation, * pSpriteRotation;
-
-#define SPRITE_COUNT 128
-#define MATRIX_COUNT 32
-
-/**
- * @union tOAM
- * @brief Final OAM representation in memory
-*/
-typedef union {
- SpriteEntry spriteBuffer[SPRITE_COUNT];
- SpriteRotation matrixBuffer[MATRIX_COUNT];
-} tOAM;
-
-
-#endif // _libnds_sprite_h_
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/trig_lut.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/trig_lut.h
deleted file mode 100644
index 7d946bfafc..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/trig_lut.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*---------------------------------------------------------------------------------
- Trig_lut.h provides access to external precompiled trig look up tables
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef TRIG_LUT_H
-#define TRIG_LUT_H
-
-
-extern short COS_bin[];
-extern short SIN_bin[];
-extern short TAN_bin[];
-
-
-#define COS COS_bin
-#define SIN SIN_bin
-#define TAN TAN_bin
-
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/video.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/video.h
deleted file mode 100644
index 9e910c621f..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/video.h
+++ /dev/null
@@ -1,591 +0,0 @@
-/*---------------------------------------------------------------------------------
- Video registers and defines
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef VIDEO_ARM9_INCLUDE
-#define VIDEO_ARM9_INCLUDE
-
-
-#ifndef ARM9
-#error Video is only available on the ARM9
-#endif
-
-#include <nds/jtypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// macro creates a 15 bit color from 3x5 bit components
-#define RGB15(r,g,b) ((r)|((g)<<5)|((b)<<10))
-#define RGB5(r,g,b) ((r)|((g)<<5)|((b)<<10))
-#define RGB8(r,g,b) (((r)>>3)|(((g)>>3)<<5)|(((b)>>3)<<10))
-
-
-#define SCREEN_HEIGHT 192
-#define SCREEN_WIDTH 256
-// Vram Control
-#define VRAM_CR (*(vuint32*)0x04000240)
-#define VRAM_A_CR (*(vuint8*)0x04000240)
-#define VRAM_B_CR (*(vuint8*)0x04000241)
-#define VRAM_C_CR (*(vuint8*)0x04000242)
-#define VRAM_D_CR (*(vuint8*)0x04000243)
-#define VRAM_E_CR (*(vuint8*)0x04000244)
-#define VRAM_F_CR (*(vuint8*)0x04000245)
-#define VRAM_G_CR (*(vuint8*)0x04000246)
-#define WRAM_CR (*(vuint8*)0x04000247)
-#define VRAM_H_CR (*(vuint8*)0x04000248)
-#define VRAM_I_CR (*(vuint8*)0x04000249)
-
-#define VRAM_ENABLE (1<<7)
-
-#define VRAM_OFFSET(n) ((n)<<3)
-
-
-typedef enum {
- VRAM_A_LCD = 0,
- VRAM_A_MAIN_BG = 1,
- VRAM_A_MAIN_BG_0x06000000 = 1 | VRAM_OFFSET(0),
- VRAM_A_MAIN_BG_0x06020000 = 1 | VRAM_OFFSET(1),
- VRAM_A_MAIN_BG_0x06040000 = 1 | VRAM_OFFSET(2),
- VRAM_A_MAIN_BG_0x06060000 = 1 | VRAM_OFFSET(3),
- VRAM_A_MAIN_SPRITE = 2,
- VRAM_A_MAIN_SPRITE_0x06400000 = 2,
- VRAM_A_MAIN_SPRITE_0x06420000 = 2 | VRAM_OFFSET(1),
- VRAM_A_TEXTURE = 3,
- VRAM_A_TEXTURE_SLOT0 = 3 | VRAM_OFFSET(0),
- VRAM_A_TEXTURE_SLOT1 = 3 | VRAM_OFFSET(1),
- VRAM_A_TEXTURE_SLOT2 = 3 | VRAM_OFFSET(2),
- VRAM_A_TEXTURE_SLOT3 = 3 | VRAM_OFFSET(3)
-} VRAM_A_TYPE;
-
-typedef enum {
- VRAM_B_LCD = 0,
- VRAM_B_MAIN_BG = 1 | VRAM_OFFSET(1),
- VRAM_B_MAIN_BG_0x06000000 = 1 | VRAM_OFFSET(0),
- VRAM_B_MAIN_BG_0x06020000 = 1 | VRAM_OFFSET(1),
- VRAM_B_MAIN_BG_0x06040000 = 1 | VRAM_OFFSET(2),
- VRAM_B_MAIN_BG_0x06060000 = 1 | VRAM_OFFSET(3),
- VRAM_B_MAIN_SPRITE = 2 | VRAM_OFFSET(1),
- VRAM_B_MAIN_SPRITE_0x06400000 = 2,
- VRAM_B_MAIN_SPRITE_0x06420000 = 2 | VRAM_OFFSET(1),
- VRAM_B_TEXTURE = 3 | VRAM_OFFSET(1),
- VRAM_B_TEXTURE_SLOT0 = 3 | VRAM_OFFSET(0),
- VRAM_B_TEXTURE_SLOT1 = 3 | VRAM_OFFSET(1),
- VRAM_B_TEXTURE_SLOT2 = 3 | VRAM_OFFSET(2),
- VRAM_B_TEXTURE_SLOT3 = 3 | VRAM_OFFSET(3)
-} VRAM_B_TYPE;
-
-typedef enum {
- VRAM_C_LCD = 0,
- VRAM_C_MAIN_BG = 1 | VRAM_OFFSET(2),
- VRAM_C_MAIN_BG_0x06000000 = 1 | VRAM_OFFSET(0),
- VRAM_C_MAIN_BG_0x06020000 = 1 | VRAM_OFFSET(1),
- VRAM_C_MAIN_BG_0x06040000 = 1 | VRAM_OFFSET(2),
- VRAM_C_MAIN_BG_0x06060000 = 1 | VRAM_OFFSET(3),
- VRAM_C_ARM7 = 2,
- VRAM_C_ARM7_0x06000000 = 2,
- VRAM_C_ARM7_0x06020000 = 2 | VRAM_OFFSET(1),
- VRAM_C_SUB_BG = 4,
- VRAM_C_SUB_BG_0x06200000 = 4 | VRAM_OFFSET(0),
- VRAM_C_SUB_BG_0x06220000 = 4 | VRAM_OFFSET(1),
- VRAM_C_SUB_BG_0x06240000 = 4 | VRAM_OFFSET(2),
- VRAM_C_SUB_BG_0x06260000 = 4 | VRAM_OFFSET(3),
- VRAM_C_TEXTURE = 3 | VRAM_OFFSET(2),
- VRAM_C_TEXTURE_SLOT0 = 3 | VRAM_OFFSET(0),
- VRAM_C_TEXTURE_SLOT1 = 3 | VRAM_OFFSET(1),
- VRAM_C_TEXTURE_SLOT2 = 3 | VRAM_OFFSET(2),
- VRAM_C_TEXTURE_SLOT3 = 3 | VRAM_OFFSET(3)
-} VRAM_C_TYPE;
-
-typedef enum {
- VRAM_D_LCD = 0,
- VRAM_D_MAIN_BG = 1 | VRAM_OFFSET(3),
- VRAM_D_MAIN_BG_0x06000000 = 1 | VRAM_OFFSET(0),
- VRAM_D_MAIN_BG_0x06020000 = 1 | VRAM_OFFSET(1),
- VRAM_D_MAIN_BG_0x06040000 = 1 | VRAM_OFFSET(2),
- VRAM_D_MAIN_BG_0x06060000 = 1 | VRAM_OFFSET(3),
- VRAM_D_ARM7 = 2 | VRAM_OFFSET(1),
- VRAM_D_ARM7_0x06000000 = 2,
- VRAM_D_ARM7_0x06020000 = 2 | VRAM_OFFSET(1),
- VRAM_D_SUB_SPRITE = 4,
- VRAM_D_TEXTURE = 3 | VRAM_OFFSET(3),
- VRAM_D_TEXTURE_SLOT0 = 3 | VRAM_OFFSET(0),
- VRAM_D_TEXTURE_SLOT1 = 3 | VRAM_OFFSET(1),
- VRAM_D_TEXTURE_SLOT2 = 3 | VRAM_OFFSET(2),
- VRAM_D_TEXTURE_SLOT3 = 3 | VRAM_OFFSET(3)
-} VRAM_D_TYPE;
-
-typedef enum {
- VRAM_E_LCD = 0,
- VRAM_E_MAIN_BG = 1,
- VRAM_E_MAIN_SPRITE = 2,
- VRAM_E_TEX_PALETTE = 3,
- VRAM_E_BG_EXT_PALETTE = 4,
- VRAM_E_OBJ_EXT_PALETTE = 5,
-} VRAM_E_TYPE;
-
-typedef enum {
- VRAM_F_LCD = 0,
- VRAM_F_MAIN_BG = 1,
- VRAM_F_MAIN_SPRITE = 2,
- VRAM_F_MAIN_SPRITE_0x06000000 = 2,
- VRAM_F_MAIN_SPRITE_0x06004000 = 2 | VRAM_OFFSET(1),
- VRAM_F_MAIN_SPRITE_0x06010000 = 2 | VRAM_OFFSET(2),
- VRAM_F_MAIN_SPRITE_0x06014000 = 2 | VRAM_OFFSET(3),
- VRAM_F_TEX_PALETTE = 3,
- VRAM_F_BG_EXT_PALETTE = 4,
- VRAM_F_OBJ_EXT_PALETTE = 5,
-} VRAM_F_TYPE;
-
-typedef enum {
- VRAM_G_LCD = 0,
- VRAM_G_MAIN_BG = 1,
- VRAM_G_MAIN_SPRITE = 2,
- VRAM_G_MAIN_SPRITE_0x06000000 = 2,
- VRAM_G_MAIN_SPRITE_0x06004000 = 2 | VRAM_OFFSET(1),
- VRAM_G_MAIN_SPRITE_0x06010000 = 2 | VRAM_OFFSET(2),
- VRAM_G_MAIN_SPRITE_0x06014000 = 2 | VRAM_OFFSET(3),
- VRAM_G_TEX_PALETTE = 3,
- VRAM_G_BG_EXT_PALETTE = 4,
- VRAM_G_OBJ_EXT_PALETTE = 5,
-} VRAM_G_TYPE;
-
-typedef enum {
- VRAM_H_LCD = 0,
- VRAM_H_SUB_BG = 1,
- VRAM_H_SUB_BG_EXT_PALETTE = 2,
-} VRAM_H_TYPE;
-
-typedef enum {
- VRAM_I_LCD = 0,
- VRAM_I_SUB_BG = 1,
- VRAM_I_SUB_SPRITE = 2,
- VRAM_I_SUB_SPRITE_EXT_PALETTE = 3,
-}VRAM_I_TYPE;
-
-
-typedef u16 _palette[256];
-typedef _palette _ext_palette[16];
-
-#define VRAM_E_EXT_PALETTE ((_ext_palette *)VRAM_E)
-#define VRAM_F_EXT_PALETTE ((_ext_palette *)VRAM_F)
-#define VRAM_G_EXT_PALETTE ((_ext_palette *)VRAM_G)
-#define VRAM_H_EXT_PALETTE ((_ext_palette *)VRAM_H)
-
-
-uint32 vramSetMainBanks(VRAM_A_TYPE a, VRAM_B_TYPE b, VRAM_C_TYPE c, VRAM_D_TYPE d);
-void vramRestoreMainBanks(uint32 vramTemp);
-
-void vramSetBankA(VRAM_A_TYPE a);
-void vramSetBankB(VRAM_B_TYPE b);
-void vramSetBankC(VRAM_C_TYPE c);
-void vramSetBankD(VRAM_D_TYPE d);
-void vramSetBankE(VRAM_E_TYPE e);
-void vramSetBankF(VRAM_F_TYPE f);
-void vramSetBankG(VRAM_G_TYPE g);
-void vramSetBankH(VRAM_H_TYPE h);
-void vramSetBankI(VRAM_I_TYPE i);
-
-
-// Display control registers
-#define DISPLAY_CR (*(vuint32*)0x04000000)
-#define SUB_DISPLAY_CR (*(vuint32*)0x04001000)
-
-#define MODE_0_2D 0x10000
-#define MODE_1_2D 0x10001
-#define MODE_2_2D 0x10002
-#define MODE_3_2D 0x10003
-#define MODE_4_2D 0x10004
-#define MODE_5_2D 0x10005
-
-// main display only
-#define MODE_6_2D 0x10006
-#define MODE_FIFO (3<<16)
-
-#define ENABLE_3D (1<<3)
-
-#define DISPLAY_BG0_ACTIVE (1 << 8)
-#define DISPLAY_BG1_ACTIVE (1 << 9)
-#define DISPLAY_BG2_ACTIVE (1 << 10)
-#define DISPLAY_BG3_ACTIVE (1 << 11)
-#define DISPLAY_SPR_ACTIVE (1 << 12)
-#define DISPLAY_WIN0_ON (1 << 13)
-#define DISPLAY_WIN1_ON (1 << 14)
-#define DISPLAY_SPR_WIN_ON (1 << 15)
-
-
-// Main display only
-#define MODE_0_3D (MODE_0_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_1_3D (MODE_1_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_2_3D (MODE_2_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_3_3D (MODE_3_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_4_3D (MODE_4_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_5_3D (MODE_5_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-#define MODE_6_3D (MODE_6_2D | DISPLAY_BG0_ACTIVE | ENABLE_3D)
-
-#define MODE_FB0 (0x00020000)
-#define MODE_FB1 (0x00060000)
-#define MODE_FB2 (0x000A0000)
-#define MODE_FB3 (0x000E0000)
-
-#define DISPLAY_SPR_HBLANK (1 << 23)
-
-#define DISPLAY_SPR_1D_LAYOUT (1 << 4)
-
-#define DISPLAY_SPR_1D (1 << 4)
-#define DISPLAY_SPR_2D (0 << 4)
-#define DISPLAY_SPR_1D_BMP (4 << 4)
-#define DISPLAY_SPR_2D_BMP_128 (0 << 4)
-#define DISPLAY_SPR_2D_BMP_256 (2 << 4)
-
-
-#define DISPLAY_SPR_1D_SIZE_32 (0 << 20)
-#define DISPLAY_SPR_1D_SIZE_64 (1 << 20)
-#define DISPLAY_SPR_1D_SIZE_128 (2 << 20)
-#define DISPLAY_SPR_1D_SIZE_256 (3 << 20)
-#define DISPLAY_SPR_1D_BMP_SIZE_128 (0 << 22)
-#define DISPLAY_SPR_1D_BMP_SIZE_256 (1 << 22)
-
-
-#define DISPLAY_SPR_EXT_PALETTE (1 << 31)
-#define DISPLAY_BG_EXT_PALETTE (1 << 30)
-
-#define DISPLAY_SCREEN_OFF (1 << 7)
-
-// The next two defines only apply to MAIN 2d engine
-// In tile modes, this is multiplied by 64KB and added to BG_TILE_BASE
-// In all bitmap modes, it is not used.
-#define DISPLAY_CHAR_BASE(n) (((n)&7)<<24)
-
-// In tile modes, this is multiplied by 64KB and added to BG_MAP_BASE
-// In bitmap modes, this is multiplied by 64KB and added to BG_BMP_BASE
-// In large bitmap modes, this is not used
-#define DISPLAY_SCREEN_BASE(n) (((n)&7)<<27)
-
-static inline
-void videoSetMode( uint32 mode) { DISPLAY_CR = mode; }
-static inline
-void videoSetModeSub( uint32 mode) { SUB_DISPLAY_CR = mode; }
-
-#define BRIGHTNESS (*(vuint16*)0x0400006C)
-#define SUB_BRIGHTNESS (*(vuint16*)0x0400106C)
-
-#define BGCTRL ((vuint16*)0x04000008)
-#define BG0_CR (*(vuint16*)0x04000008)
-#define BG1_CR (*(vuint16*)0x0400000A)
-#define BG2_CR (*(vuint16*)0x0400000C)
-#define BG3_CR (*(vuint16*)0x0400000E)
-
-#define BGCTRL_SUB ((vuint16*)0x04001008)
-#define SUB_BG0_CR (*(vuint16*)0x04001008)
-#define SUB_BG1_CR (*(vuint16*)0x0400100A)
-#define SUB_BG2_CR (*(vuint16*)0x0400100C)
-#define SUB_BG3_CR (*(vuint16*)0x0400100E)
-
-#define BG_256_COLOR (BIT(7))
-#define BG_16_COLOR (0)
-
-#define BG_MOSAIC_ON (BIT(6))
-#define BG_MOSAIC_OFF (0)
-
-#define BG_PRIORITY(n) (n)
-#define BG_PRIORITY_0 (0)
-#define BG_PRIORITY_1 (1)
-#define BG_PRIORITY_2 (2)
-#define BG_PRIORITY_3 (3)
-
-#define BG_TILE_BASE(base) ((base) << 2)
-#define BG_MAP_BASE(base) ((base) << 8)
-#define BG_BMP_BASE(base) ((base) << 8)
-
-#define BG_MAP_RAM(base) (((base)*0x800) + 0x06000000)
-#define BG_MAP_RAM_SUB(base) (((base)*0x800) + 0x06200000)
-
-#define BG_TILE_RAM(base) (((base)*0x4000) + 0x06000000)
-#define BG_TILE_RAM_SUB(base) (((base)*0x4000) + 0x06200000)
-
-#define BG_BMP_RAM(base) (((base)*0x4000) + 0x06000000)
-#define BG_BMP_RAM_SUB(base) (((base)*0x4000) + 0x06200000)
-
-#define BG_WRAP_OFF (0)
-#define BG_WRAP_ON (1 << 13)
-
-#define BG_32x32 (0 << 14)
-#define BG_64x32 (1 << 14)
-#define BG_32x64 (2 << 14)
-#define BG_64x64 (3 << 14)
-
-#define BG_RS_16x16 (0 << 14)
-#define BG_RS_32x32 (1 << 14)
-#define BG_RS_64x64 (2 << 14)
-#define BG_RS_128x128 (3 << 14)
-
-#define BG_BMP8_128x128 (BG_RS_16x16 | BG_256_COLOR)
-#define BG_BMP8_256x256 (BG_RS_32x32 | BG_256_COLOR)
-#define BG_BMP8_512x256 (BG_RS_64x64 | BG_256_COLOR)
-#define BG_BMP8_512x512 (BG_RS_128x128 | BG_256_COLOR)
-#define BG_BMP8_1024x512 BIT(14)
-#define BG_BMP8_512x1024 0
-
-#define BG_BMP16_128x128 (BG_RS_16x16 | BG_256_COLOR | BIT(2))
-#define BG_BMP16_256x256 (BG_RS_32x32 | BG_256_COLOR | BIT(2))
-#define BG_BMP16_512x256 (BG_RS_64x64 | BG_256_COLOR | BIT(2))
-#define BG_BMP16_512x512 (BG_RS_128x128 | BG_256_COLOR | BIT(2))
-
-#define BG_PALETTE_SLOT0 0
-#define BG_PALETTE_SLOT1 0
-#define BG_PALETTE_SLOT2 BIT(13)
-#define BG_PALETTE_SLOT3 BIT(13)
-
-typedef struct {
- u16 x;
- u16 y;
-} bg_scroll;
-
-typedef struct {
- u16 xdx;
- u16 xdy;
- u16 ydx;
- u16 ydy;
- u32 centerX;
- u32 centerY;
-} bg_rotation;
-
-typedef struct {
- u16 control[4];
- bg_scroll scroll[4];
- bg_rotation bg2_rotation;
- bg_rotation bg3_rotation;
-} bg_attribute;
-
-#define BACKGROUND (*((bg_attribute *)0x04000008))
-#define BACKGROUND_SUB (*((bg_attribute *)0x04001008))
-
-#define BG_OFFSET ((bg_scroll *)(0x04000010))
-
-#define BG0_X0 (*(vuint16*)0x04000010)
-#define BG0_Y0 (*(vuint16*)0x04000012)
-#define BG1_X0 (*(vuint16*)0x04000014)
-#define BG1_Y0 (*(vuint16*)0x04000016)
-#define BG2_X0 (*(vuint16*)0x04000018)
-#define BG2_Y0 (*(vuint16*)0x0400001A)
-#define BG3_X0 (*(vuint16*)0x0400001C)
-#define BG3_Y0 (*(vuint16*)0x0400001E)
-
-#define BG2_XDX (*(vuint16*)0x04000020)
-#define BG2_XDY (*(vuint16*)0x04000022)
-#define BG2_YDX (*(vuint16*)0x04000024)
-#define BG2_YDY (*(vuint16*)0x04000026)
-#define BG2_CX (*(vuint32*)0x04000028)
-#define BG2_CY (*(vuint32*)0x0400002C)
-
-#define BG3_XDX (*(vuint16*)0x04000030)
-#define BG3_XDY (*(vuint16*)0x04000032)
-#define BG3_YDX (*(vuint16*)0x04000034)
-#define BG3_YDY (*(vuint16*)0x04000036)
-#define BG3_CX (*(vuint32*)0x04000038)
-#define BG3_CY (*(vuint32*)0x0400003C)
-
-#define SUB_BG0_X0 (*(vuint16*)0x04001010)
-#define SUB_BG0_Y0 (*(vuint16*)0x04001012)
-#define SUB_BG1_X0 (*(vuint16*)0x04001014)
-#define SUB_BG1_Y0 (*(vuint16*)0x04001016)
-#define SUB_BG2_X0 (*(vuint16*)0x04001018)
-#define SUB_BG2_Y0 (*(vuint16*)0x0400101A)
-#define SUB_BG3_X0 (*(vuint16*)0x0400101C)
-#define SUB_BG3_Y0 (*(vuint16*)0x0400101E)
-
-#define SUB_BG2_XDX (*(vuint16*)0x04001020)
-#define SUB_BG2_XDY (*(vuint16*)0x04001022)
-#define SUB_BG2_YDX (*(vuint16*)0x04001024)
-#define SUB_BG2_YDY (*(vuint16*)0x04001026)
-#define SUB_BG2_CX (*(vuint32*)0x04001028)
-#define SUB_BG2_CY (*(vuint32*)0x0400102C)
-
-#define SUB_BG3_XDX (*(vuint16*)0x04001030)
-#define SUB_BG3_XDY (*(vuint16*)0x04001032)
-#define SUB_BG3_YDX (*(vuint16*)0x04001034)
-#define SUB_BG3_YDY (*(vuint16*)0x04001036)
-#define SUB_BG3_CX (*(vuint32*)0x04001038)
-#define SUB_BG3_CY (*(vuint32*)0x0400103C)
-
-// Window 0
-#define WIN0_X0 (*(vuint8*)0x04000041)
-#define WIN0_X1 (*(vuint8*)0x04000040)
-#define WIN0_Y0 (*(vuint8*)0x04000045)
-#define WIN0_Y1 (*(vuint8*)0x04000044)
-
-// Window 1
-#define WIN1_X0 (*(vuint8*)0x04000042)
-#define WIN1_X1 (*(vuint8*)0x04000043)
-#define WIN1_Y0 (*(vuint8*)0x04000047)
-#define WIN1_Y1 (*(vuint8*)0x04000046)
-
-#define WIN_IN (*(vuint16*)0x04000048)
-#define WIN_OUT (*(vuint16*)0x0400004A)
-
-// Window 0
-#define SUB_WIN0_X0 (*(vuint8*)0x04001041)
-#define SUB_WIN0_X1 (*(vuint8*)0x04001040)
-#define SUB_WIN0_Y0 (*(vuint8*)0x04001045)
-#define SUB_WIN0_Y1 (*(vuint8*)0x04001044)
-
-// Window 1
-#define SUB_WIN1_X0 (*(vuint8*)0x04001042)
-#define SUB_WIN1_X1 (*(vuint8*)0x04001043)
-#define SUB_WIN1_Y0 (*(vuint8*)0x04001047)
-#define SUB_WIN1_Y1 (*(vuint8*)0x04001046)
-
-#define SUB_WIN_IN (*(vuint16*)0x04001048)
-#define SUB_WIN_OUT (*(vuint16*)0x0400104A)
-
-#define MOSAIC_CR (*(vuint16*)0x0400004C)
-#define SUB_MOSAIC_CR (*(vuint16*)0x0400104C)
-
-#define BLEND_CR (*(vuint16*)0x04000050)
-#define BLEND_AB (*(vuint16*)0x04000052)
-#define BLEND_Y (*(vuint16*)0x04000054)
-
-#define SUB_BLEND_CR (*(vuint16*)0x04001050)
-#define SUB_BLEND_AB (*(vuint16*)0x04001052)
-#define SUB_BLEND_Y (*(vuint16*)0x04001054)
-
-#define BLEND_NONE (0<<6)
-#define BLEND_ALPHA (1<<6)
-#define BLEND_FADE_WHITE (2<<6)
-#define BLEND_FADE_BLACK (3<<6)
-
-#define BLEND_SRC_BG0 (1<<0)
-#define BLEND_SRC_BG1 (1<<1)
-#define BLEND_SRC_BG2 (1<<2)
-#define BLEND_SRC_BG3 (1<<3)
-#define BLEND_SRC_SPRITE (1<<4)
-#define BLEND_SRC_BACKDROP (1<<5)
-
-#define BLEND_DST_BG0 (1<<8)
-#define BLEND_DST_BG1 (1<<9)
-#define BLEND_DST_BG2 (1<<10)
-#define BLEND_DST_BG3 (1<<11)
-#define BLEND_DST_SPRITE (1<<12)
-#define BLEND_DST_BACKDROP (1<<13)
-
-// Display capture control
-
-#define REG_DISPCAPCNT (*(vuint32*)0x04000064)
-#define REG_ DISP_MMEM_FIFO (*(vuint32*)0x04000068)
-
-#define DCAP_ENABLE BIT(31)
-#define DCAP_MODE(n) (((n) & 3) << 29)
-#define DCAP_DST(n) (((n) & 3) << 26)
-#define DCAP_SRC(n) (((n) & 3) << 24)
-#define DCAP_SIZE(n) (((n) & 3) << 20)
-#define DCAP_OFFSET(n) (((n) & 3) << 18)
-#define DCAP_BANK(n) (((n) & 3) << 16)
-#define DCAP_B(n) (((n) & 0x1F) << 8)
-#define DCAP_A(n) (((n) & 0x1F) << 0)
-
-
-// 3D core control
-
-#define GFX_CONTROL (*(vuint16*) 0x04000060)
-
-#define GFX_FIFO (*(vuint32*) 0x04000400)
-#define GFX_STATUS (*(vuint32*) 0x04000600)
-#define GFX_COLOR (*(vuint32*) 0x04000480)
-
-#define GFX_VERTEX10 (*(vuint32*) 0x04000490)
-#define GFX_VERTEX_XY (*(vuint32*) 0x04000494)
-#define GFX_VERTEX_XZ (*(vuint32*) 0x04000498)
-#define GFX_VERTEX_YZ (*(vuint32*) 0x0400049C)
-#define GFX_VERTEX_DIFF (*(vuint32*) 0x040004A0)
-
-#define GFX_VERTEX16 (*(vuint32*) 0x0400048C)
-#define GFX_TEX_COORD (*(vuint32*) 0x04000488)
-#define GFX_TEX_FORMAT (*(vuint32*) 0x040004A8)
-#define GFX_PAL_FORMAT (*(vuint32*) 0x040004AC)
-
-#define GFX_CLEAR_COLOR (*(vuint32*) 0x04000350)
-#define GFX_CLEAR_DEPTH (*(vuint16*) 0x04000354)
-
-#define GFX_LIGHT_VECTOR (*(vuint32*) 0x040004C8)
-#define GFX_LIGHT_COLOR (*(vuint32*) 0x040004CC)
-#define GFX_NORMAL (*(vuint32*) 0x04000484)
-
-#define GFX_DIFFUSE_AMBIENT (*(vuint32*) 0x040004C0)
-#define GFX_SPECULAR_EMISSION (*(vuint32*) 0x040004C4)
-#define GFX_SHININESS (*(vuint32*) 0x040004D0)
-
-#define GFX_POLY_FORMAT (*(vuint32*) 0x040004A4)
-#define GFX_ALPHA_TEST (*(vuint16*) 0x04000340)
-
-#define GFX_BEGIN (*(vuint32*) 0x04000500)
-#define GFX_END (*(vuint32*) 0x04000504)
-#define GFX_FLUSH (*(vuint32*) 0x04000540)
-#define GFX_VIEWPORT (*(vuint32*) 0x04000580)
-#define GFX_TOON_TABLE ((vuint16*) 0x04000380)
-#define GFX_EDGE_TABLE ((vuint16*) 0x04000330)
-#define GFX_FOG_COLOR (*(vuint32*) 0x04000358)
-#define GFX_FOG_OFFSET (*(vuint32*) 0x0400035C)
-#define GFX_FOG_TABLE ((vuint8*) 0x04000360)
-#define GFX_BOX_TEST (*(vint32*) 0x040005C0)
-#define GFX_POS_TEST (*(vuint32*) 0x040005C4)
-#define GFX_POS_RESULT ((vint32*) 0x04000620)
-
-#define GFX_BUSY (GFX_STATUS & BIT(27))
-
-#define GFX_VERTEX_RAM_USAGE (*(uint16*) 0x04000606)
-#define GFX_POLYGON_RAM_USAGE (*(uint16*) 0x04000604)
-
-#define GFX_CUTOFF_DEPTH (*(uint16*)0x04000610)
-
-// Matrix processor control
-
-#define MATRIX_CONTROL (*(vuint32*)0x04000440)
-#define MATRIX_PUSH (*(vuint32*)0x04000444)
-#define MATRIX_POP (*(vuint32*)0x04000448)
-#define MATRIX_SCALE (*(vint32*) 0x0400046C)
-#define MATRIX_TRANSLATE (*(vint32*) 0x04000470)
-#define MATRIX_RESTORE (*(vuint32*)0x04000450)
-#define MATRIX_STORE (*(vuint32*)0x0400044C)
-#define MATRIX_IDENTITY (*(vuint32*)0x04000454)
-#define MATRIX_LOAD4x4 (*(vint32*) 0x04000458)
-#define MATRIX_LOAD4x3 (*(vint32*) 0x0400045C)
-#define MATRIX_MULT4x4 (*(vint32*) 0x04000460)
-#define MATRIX_MULT4x3 (*(vint32*) 0x04000464)
-#define MATRIX_MULT3x3 (*(vint32*) 0x04000468)
-
-//matrix operation results
-#define MATRIX_READ_CLIP ((vint32*) (0x04000640))
-#define MATRIX_READ_VECTOR ((vint32*) (0x04000680))
-#define POINT_RESULT ((vint32*) (0x04000620))
-#define VECTOR_RESULT ((vuint16*)(0x04000630))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/videoGL.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/videoGL.h
deleted file mode 100644
index 0f402b434e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm9/videoGL.h
+++ /dev/null
@@ -1,1295 +0,0 @@
-/*---------------------------------------------------------------------------------
- videoGL.h -- Video API vaguely similar to OpenGL
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
-
----------------------------------------------------------------------------------*/
-/*! \file videoGL.h
-\brief openGL (ish) interface to DS 3D hardware.
-*/
-
-#ifndef VIDEOGL_ARM9_INCLUDE
-#define VIDEOGL_ARM9_INCLUDE
-
-//---------------------------------------------------------------------------------
-
-// for some reason doxygen doesn't like "static inline" but is fine with "GL_STATIC_INL"
-#define GL_STATIC_INL static inline
-
-#ifndef ARM9
-#error 3D hardware is only available from the ARM9
-#endif
-
-//---------------------------------------------------------------------------------
-#include <nds/jtypes.h>
-#include <nds/arm9/video.h>
-#include <nds/dma.h>
-#include <nds/memory.h>
-#include <nds/bios.h>
-#include <nds/arm9/math.h>
-#include <nds/arm9/trig_lut.h>
-#include <nds/arm9/cache.h>
-
-/*---------------------------------------------------------------------------------
- lut resolution for trig functions
- (must be power of two and must be the same as LUT resolution)
- in other words dont change unless you also change your LUTs
----------------------------------------------------------------------------------*/
-#define LUT_SIZE (512)
-#define LUT_MASK (0x1FF)
-
-////////////////////////////////////////////////////////////
-// Misc. constants
-////////////////////////////////////////////////////////////
-
-#define MAX_TEXTURES 2048 //this should be enough ! but feel free to change
-
-
-//////////////////////////////////////////////////////////////////////
-// Fixed point / floating point / integer conversion macros
-//////////////////////////////////////////////////////////////////////
-
-typedef uint16 fixed12d3; /*!< \brief Used for depth (glClearDepth, glCutoffDepth) */
-
-#define int_to_12d3(n) ((n) << 3) /*!< \brief convert int to fixed12d3 */
-#define float_to_12d3(n) ((fixed12d3)((n) * (1 << 3))) /*!< \brief convert float to fixed12d3 */
-#define GL_MAX_DEPTH 0x7FFF /*!< \brief the maximum value for type fixed12d3 */
-
-//////////////////////////////////////////////////////////////////////
-
-#define inttof32(n) ((n) << 12) /*!< \brief convert int to f32 */
-#define f32toint(n) ((n) >> 12) /*!< \brief convert f32 to int */
-#define floattof32(n) ((int32)((n) * (1 << 12))) /*!< \brief convert float to f32 */
-#define f32tofloat(n) (((float)(n)) / (float)(1<<12)) /*!< \brief convert f32 to float */
-
-typedef short int t16; /*!< \brief text coordinate 12.4 fixed point */
-#define f32tot16(n) ((t16)(n >> 8)) /*!< \brief convert f32 to t16 */
-#define inttot16(n) ((n) << 4) /*!< \brief convert int to t16 */
-#define t16toint(n) ((n) >> 4) /*!< \brief convert t16 to int */
-#define floattot16(n) ((t16)((n) * (1 << 4))) /*!< \brief convert float to t16 */
-#define TEXTURE_PACK(u,v) ((u & 0xFFFF) | ((v) << 16)) /*!< \brief Pack 2 t16 texture coordinate values into a 32bit value */
-
-typedef short int v16; /*!< \brief vertex 4.12 fixed format */
-#define inttov16(n) ((n) << 12) /*!< \brief convert int to v16 */
-#define f32tov16(n) (n) /*!< \brief f32 to v16 */
-#define v16toint(n) ((n) >> 12) /*!< \brief convert v16 to int */
-#define floattov16(n) ((v16)((n) * (1 << 12))) /*!< \brief convert float to v16 */
-#define VERTEX_PACK(x,y) (((x) & 0xFFFF) | ((y) << 16)) /*!< \brief Pack to v16 values into one 32bit value */
-
-typedef short int v10; /*!< \brief normal .10 fixed point, NOT USED FOR 10bit VERTEXES!!!*/
-#define inttov10(n) ((n) << 9) /*!< \brief convert int to v10 */
-#define f32tov10(n) ((v10)(n >> 3)) /*!< \brief convert f32 to v10 */
-#define v10toint(n) ((n) >> 9) /*!< \brief convert v10 to int */
-#define floattov10(n) ((n>.998) ? 0x1FF : ((v10)((n)*(1<<9)))) /*!< \brief convert float to v10 */
-#define NORMAL_PACK(x,y,z) (((x) & 0x3FF) | (((y) & 0x3FF) << 10) | ((z) << 20)) /*!< \brief Pack 3 v10 normals into a 32bit value */
-
-//////////////////////////////////////////////////////////////////////
-
-typedef unsigned short rgb; /*!< \brief Holds a color value. 1bit alpha, 5bits red, 5bits green, 5bits blue. */
-
-/*! \brief Holds a Matrix of 3x3 */
-typedef struct {
- int32 m[9]; /*!< array that holds matrix */
-} m3x3;
-
-/*! \brief Holds a Matrix of 4x4 */
-typedef struct {
- int32 m[16]; /*!< array that holds matrix */
-} m4x4;
-
-/*! \brief Holds a Matrix of 4x3 */
-typedef struct {
- int32 m[12]; /*!< array that holds matrix */
-} m4x3;
-
-/*! \brief Holds a Vector<BR>related functions: glScalev(), glTranslatev() */
-typedef struct {
- int32 x, y, z;
-} GLvector;
-
-//////////////////////////////////////////////////////////////////////
-
-#define GL_FALSE 0
-#define GL_TRUE 1
-
-/*! \brief Enums selecting polygon draw mode<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices</A><BR>
-related functions: glBegin() */
-typedef enum {
- GL_TRIANGLES = 0, /*!< draw triangles with each 3 vertices defining a triangle */
- GL_QUADS = 1, /*!< draw quads with each 4 vertices defining a quad */
- GL_TRIANGLE_STRIP = 2, /*!< draw triangles with the first triangle defined by 3 vertices, then each additional triangle being defined by one additional vertex */
- GL_QUAD_STRIP = 3, /*!< draw quads with the first quad being defined by 4 vertices, then each additional triangle being defined by 2 vertices. */
- GL_TRIANGLE = 0, /*!< same as GL_TRIANGLES, old non-OpenGL version */
- GL_QUAD = 1 /*!< same as GL_QUADS, old non-OpenGL version */
-} GL_GLBEGIN_ENUM;
-
-/*! \brief Enums selecting matrix mode<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A><BR>
-related functions: glMatrixMode() */
-typedef enum {
- GL_PROJECTION = 0, /*!< used to set the Projection Matrix */
- GL_POSITION = 1, /*!< used to set the Position Matrix */
- GL_MODELVIEW = 2, /*!< used to set the Modelview Matrix */
- GL_TEXTURE = 3 /*!< used to set the Texture Matrix */
-} GL_MATRIX_MODE_ENUM;
-
-/*! \brief Enums for setting up materials<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A><BR>
-related functions: glMaterialf() */
-typedef enum {
- GL_AMBIENT = 0x01, /*!< sets the ambient color for the material. The color when the normal is not facing light*/
- GL_DIFFUSE = 0x02, /*!< sets the diffuse color for the material. The color when the normal is facing light */
- GL_AMBIENT_AND_DIFFUSE = 0x03, /*!< sets the set ambient and diffuse colors for the material; just a two-in-one of the above.*/
- GL_SPECULAR = 0x04, /*!< sets the specular color for the material. The glossy(highlight) color of the polygon */
- GL_SHININESS = 0x08, /*!< sets the shininess color for the material. The color that shines back to the user. I have shiny pants! */
- GL_EMISSION = 0x10 /*!< sets the emission color for the material. bright color that is indepentant of normals and lights*/
-} GL_MATERIALS_ENUM;
-
-/*! \brief Enums for setting how polygons will be displayed<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes</A><BR>
-related functions: glPolyFmt(), glInit(), POLY_ALPHA(), POLY_ID() */
-enum GL_POLY_FORMAT_ENUM {
- POLY_FORMAT_LIGHT0 = (1<<0), /*!< enable light number 0 */
- POLY_FORMAT_LIGHT1 = (1<<1), /*!< enable light number 1 */
- POLY_FORMAT_LIGHT2 = (1<<2), /*!< enable light number 2 */
- POLY_FORMAT_LIGHT3 = (1<<3), /*!< enable light number 3 */
- POLY_MODULATION = (0<<4), /*!< enable modulation shading mode; this is the default */
- POLY_DECAL = (1<<4), /*!< enable decal shading */
- POLY_TOON_HIGHLIGHT = (2<<4), /*!< enable toon/highlight shading mode */
- POLY_SHADOW = (3<<4), /*!< enable shadow shading */
- POLY_CULL_FRONT = (1<<6), /*!< cull front polygons */
- POLY_CULL_BACK = (2<<6), /*!< cull rear polygons */
- POLY_CULL_NONE = (3<<6), /*!< don't cull any polygons */
- POLY_FOG = (1<<15) /*!< enable/disable fog for this polygon */
-};
-
-/*! \brief Enums for size of a texture, specify one for horizontal and one for vertical
-related functions: glTexImage2d(), glTexParameter() */
-enum GL_TEXTURE_SIZE_ENUM {
- TEXTURE_SIZE_8 = 0, /*!< 8 texels */
- TEXTURE_SIZE_16 = 1, /*!< 16 texels */
- TEXTURE_SIZE_32 = 2, /*!< 32 texels */
- TEXTURE_SIZE_64 = 3, /*!< 64 texels */
- TEXTURE_SIZE_128 = 4, /*!< 128 texels */
- TEXTURE_SIZE_256 = 5, /*!< 256 texels */
- TEXTURE_SIZE_512 = 6, /*!< 512 texels */
- TEXTURE_SIZE_1024 = 7 /*!< 1024 texels */
-};
-
-/*! \brief Enums for texture parameters, such as texture wrapping and texture coord stuff<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes</A><BR>
-related functions: glTexImage2d(), glTexParameter() */
-enum GL_TEXTURE_PARAM_ENUM {
- GL_TEXTURE_WRAP_S = (1 << 16), /*!< wrap(repeat) texture on S axis */
- GL_TEXTURE_WRAP_T = (1 << 17), /*!< wrap(repeat) texture on T axis */
- GL_TEXTURE_FLIP_S = (1 << 18), /*!< flip texture on S axis when wrapping */
- GL_TEXTURE_FLIP_T = (1 << 19), /*!< flip texture on T axis when wrapping */
- GL_TEXTURE_COLOR0_TRANSPARENT = (1<<29), /*!< interpret color 0 as clear, same as old GL_TEXTURE_ALPHA_MASK */
- TEXGEN_OFF = (0<<30), /*!< use unmodified texcoord */
- TEXGEN_TEXCOORD = (1<<30), /*!< multiply texcoords by the texture-matrix */
- TEXGEN_NORMAL = (2<<30), /*!< set texcoords equal to normal * texture-matrix, used for spherical reflection mapping */
- TEXGEN_POSITION = (3<<30) /*!< set texcoords equal to vertex * texture-matrix */
-};
-
-/*! \brief Enums for texture formats<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureformats">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureformats</A><BR>
-related functions: glTexImage2d(), glTexParameter() */
-typedef enum {
- GL_RGB32_A3 = 1, /*!< 32 color palette, 3 bits of alpha */
- GL_RGB4 = 2, /*!< 4 color palette */
- GL_RGB16 = 3, /*!< 16 color palette */
- GL_RGB256 = 4, /*!< 256 color palette */
- GL_COMPRESSED = 5, /*!< compressed texture */
- GL_RGB8_A5 = 6, /*!< 8 color palette, 5 bits of alpha */
- GL_RGBA = 7, /*!< 15 bit direct color, 1 bit of alpha */
- GL_RGB = 8 /*!< 15 bit direct color, manually sets alpha bit to 1 */
-} GL_TEXTURE_TYPE_ENUM;
-
-/*! \brief 3D Display Control Register Enums<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A><BR>
-related functions: glEnable(), glDisable(), glInit() */
-enum DISP3DCNT_ENUM {
- GL_TEXTURE_2D = (1<<0), /*!< enable/disable textures on the geometry engine */
- GL_TOON_HIGHLIGHT = (1<<1), /*!< enable = Highlight shading; disable = Toon shading */
- GL_ALPHA_TEST = (1<<2), /*!< whether to use the alpha threshold set in glAlphaFunc() */
- GL_BLEND = (1<<3), /*!< enable/disable alpha blending */
- GL_ANTIALIAS = (1<<4), /*!< nable/disable edge antialiasing; polygons must have different polygon IDs for the effect to work and the rear plane must be clear */
- GL_OUTLINE = (1<<5), /*!< enable/disable edge coloring; the high 3bits of the polygon ID determine the color; glSetOutlineColor() sets the available colors */
- GL_FOG_ONLY_ALPHA = (1<<6), /*!< enable = fade into background?; disable = don't fade? */
- GL_FOG = (1<<7), /*!< enables/disables fog */
- GL_COLOR_UNDERFLOW = (1<<12), /*!< enable = color buffer underflow, setting resets overflow flag; disable = no color buffer overflow */
- GL_POLY_OVERFLOW = (1<<13), /*!< enable = polygon/vertex buffer overflow, setting resets overflow flag; disable = no polygon/vertex buffer overflow */
- GL_CLEAR_BMP = (1<<14) /*!< rear/clear plane is in BMP mode; disable = rear/color plane is in clear mode */
-};
-
-/*! \brief Enums for reading stuff from the geometry engine<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3diomap">http://nocash.emubase.de/gbatek.htm#ds3diomap</A><BR>
-related functions: glGetInt(), glGetFixed()*/
-typedef enum {
- GL_GET_VERTEX_RAM_COUNT, /*!< returns a count of vertexes currently stored in hardware vertex ram. Use glGetInt() to retrieve */
- GL_GET_POLYGON_RAM_COUNT, /*!< returns a count of polygons currently stored in hardware polygon ram. Use glGetInt() to retrieve */
- GL_GET_MATRIX_VECTOR, /*!< returns the current 3x3 directional vector matrix. Use glGetFixed() to retrieve */
- GL_GET_MATRIX_POSITION, /*!< returns the current 4x4 position matrix. Use glGetFixed() to retrieve */
- GL_GET_MATRIX_PROJECTION, /*!< returns the current 4x4 projection matrix. Use glGetFixed() to retrieve */
- GL_GET_MATRIX_CLIP, /*!< returns the current 4x4 clip matrix. Use glGetFixed() to retrieve */
- GL_GET_TEXTURE_WIDTH, /*!< returns the width of the currently bound texture. Use glGetInt() to retrieve */
- GL_GET_TEXTURE_HEIGHT /*!< returns the height of the currently bound texture. Use glGetInt() to retrieve */
-} GL_GET_ENUM;
-
-
-/*! \brief Enums for glFlush()<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A><BR>
-related functions: glEnable(), glDisable(), glInit() */
-enum GLFLUSH_ENUM {
- GL_TRANS_MANUALSORT = (1<<0), /*!< enable manual sorting of translucent polygons, otherwise uses Y-sorting */
- GL_WBUFFERING = (1<<1) /*!< enable W depth buffering of vertices, otherwise uses Z depth buffering */
-};
-
-
-/*---------------------------------------------------------------------------------
-This struct hold hidden globals for videoGL. The structure is initialized in the
-.c file and returned by glGetGlobals() so that it can be used across compilation
-units without problem. This is automatically done by glInit() so don't worry too
-much about it. This is only an issue because of hte mix of inlined/real functions.
----------------------------------------------------------------------------------*/
-typedef struct {
- GL_MATRIX_MODE_ENUM matrixMode; // holds the current Matrix Mode
-
- // holds the current state of the clear color register
- uint32 clearColor; // state of clear color register
-
- // texture globals
- uint32 textures[MAX_TEXTURES];
- uint32 activeTexture;
- uint32* nextBlock;
- uint32 nextPBlock;
- int nameCount;
-
-} gl_hidden_globals;
-
-// Pointer to global data for videoGL
-static gl_hidden_globals* glGlob = 0;
-
-//---------------------------------------------------------------------------------
-//Fifo commands
-//---------------------------------------------------------------------------------
-
-#define FIFO_COMMAND_PACK(c1,c2,c3,c4) (((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1)) /*!< \brief packs four packed commands into a 32bit command for sending to the GFX FIFO */
-
-#define REG2ID(r) (u8)( ( ((u32)(&(r)))-0x04000400 ) >> 2 ) /*!< \brief converts a GFX command for use in a packed command list */
-
-#define FIFO_NOP REG2ID(GFX_FIFO) /*!< \brief packed command for nothing, just here to pad your command lists */
-#define FIFO_STATUS REG2ID(GFX_STATUS) /*!< \brief packed command for geometry engine status register<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dstatus">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dstatus</A> */
-#define FIFO_COLOR REG2ID(GFX_COLOR) /*!< \brief packed command for vertex color directly<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes</A> */
-
-#define FIFO_VERTEX16 REG2ID(GFX_VERTEX16) /*!< \brief packed command for a vertex with 3 16bit paramaters(and 16bits of padding)<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices</A> */
-#define FIFO_TEX_COORD REG2ID(GFX_TEX_COORD) /*!< \brief packed command for a texture coordinate<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtexturecoordinates">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtexturecoordinates</A> */
-#define FIFO_TEX_FORMAT REG2ID(GFX_TEX_FORMAT) /*!< \brief packed command for texture format<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureformats">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureformats</A> */
-#define FIFO_PAL_FORMAT REG2ID(GFX_PAL_FORMAT) /*!< \brief packed command for texture palette attributes<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes</A> */
-
-#define FIFO_CLEAR_COLOR REG2ID(GFX_CLEAR_COLOR) /*!< \brief packed command for clear color of the rear plane<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3drearplane">GBATEK http://nocash.emubase.de/gbatek.htm#ds3drearplane</A> */
-#define FIFO_CLEAR_DEPTH REG2ID(GFX_CLEAR_DEPTH) /*!< \brief sets depth of the rear plane<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3drearplane">GBATEK http://nocash.emubase.de/gbatek.htm#ds3drearplane</A> */
-
-#define FIFO_LIGHT_VECTOR REG2ID(GFX_LIGHT_VECTOR) /*!< \brief packed command for direction of a light source<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-#define FIFO_LIGHT_COLOR REG2ID(GFX_LIGHT_COLOR) /*!< \brief packed command for color for a light<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-#define FIFO_NORMAL REG2ID(GFX_NORMAL) /*!< \brief packed command for normal for following vertices<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-
-#define FIFO_DIFFUSE_AMBIENT REG2ID(GFX_DIFFUSE_AMBIENT) /*!< \brief packed command for setting diffuse and ambient material properties for the following vertices<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-#define FIFO_SPECULAR_EMISSION REG2ID(GFX_SPECULAR_EMISSION) /*!< \brief packed command for setting specular and emmissive material properties for the following vertices<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-#define FIFO_SHININESS REG2ID(GFX_SHININESS) /*!< \brief packed command for setting the shininess table to be used for the following vertices<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A> */
-
-#define FIFO_POLY_FORMAT REG2ID(GFX_POLY_FORMAT) /*!< \brief packed command for setting polygon attributes<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes</A> */
-
-#define FIFO_BEGIN REG2ID(GFX_BEGIN) /*!< \brief packed command that starts a polygon vertex list<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices</A>*/
-#define FIFO_END REG2ID(GFX_END) /*!< \brief packed command that has no discernable effect, it's probably best to never use it since it bloats the size of the list.<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygondefinitionsbyvertices</A>*/
-#define FIFO_FLUSH REG2ID(GFX_FLUSH) /*!< \brief packed command that has the same effect as swiWaitForVBlank()<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A> */
-#define FIFO_VIEWPORT REG2ID(GFX_VIEWPORT) /*!< \brief packed command for setting viewport<BR><A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A> */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*! \brief Rotates the model view matrix by angle about the specified unit vector
-\param angle The angle to rotate by
-\param x X component of the unit vector axis.
-\param y Y component of the unit vector axis.
-\param z Z component of the unit vector axis. */
-void glRotatef32i(int angle, int32 x, int32 y, int32 z);
-
-/*! \brief Loads a 2D texture into texture memory and sets the currently bound texture ID to the attributes specified
-\param target not used, just here for OpenGL compatibility
-\param empty1 not used, just here for OpenGL compatibility
-\param type The format of the texture
-\param sizeX the horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM
-\param sizeY the vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM
-\param empty2 not used, just here for OpenGL compatibility
-\param param parameters for the texture
-\param texture pointer to the texture data to load */
-int glTexImage2D(int target, int empty1, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int empty2, int param, const uint8* texture);
-
-/*! \brief Loads a palette into the specified texture addr
-\param pal pointer to the palette to load
-\param count the size of the palette
-\param addr the offset in VRAM to load the palette */
-void glTexLoadPal(const u16* pal, u16 count, u32 addr );
-
-/*! \brief Loads a palette into the next available palette slot, returns the addr on success or -1
-\param pal pointer to the palette to load
-\param count the size of the palette
-\param format the format of the texture */
-int gluTexLoadPal(const u16* pal, u16 count, uint8 format);
-
-/*! \brief Set parameters for the current texture. Although named the same as its gl counterpart, it is not compatible. Effort may be made in the future to make it so.
-\param sizeX the horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM
-\param sizeY the vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM
-\param addr offset into VRAM where you put the texture
-\param mode the type of texture
-\param param paramaters for the texture */
-void glTexParameter( uint8 sizeX, uint8 sizeY,
- const uint32* addr,
- GL_TEXTURE_TYPE_ENUM mode,
- uint32 param) ;
-
-/*! \brief Returns the active texture parameter (constructed from internal call to glTexParameter) */
-u32 glGetTexParameter(void);
-
-/*! \brief returns the address alocated to the texure named by name
-\param name the name of the texture to get a pointer to */
-void* glGetTexturePointer( int name);
-
-/*! \brief glBindTexure sets the current named texture to the active texture. Target is ignored as all DS textures are 2D
-\param target ignored, only here for OpenGL compatability
-\param name the name(int value) to set to the current texture */
-void glBindTexture(int target, int name);
-
-/*! \brief glColorTable establishes the location of the current palette. Roughly follows glColorTableEXT. Association of palettes with named textures is left to the application. */
-void glColorTable(uint8 format, uint32 addr);
-
-/*! \brief Creates room for the specified number of textures
-\param n the number of textures to generate
-\param names pointer to the names array to fill */
-int glGenTextures(int n, int *names);
-
-/*! \brief Resets the gl texture state freeing all texture memory */
-void glResetTextures(void);
-
-/*! \brief Sets texture coordinates for following vertices<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes</A>
-\param u U(a.k.a. S) texture coordinate (0.0 - 1.0)
-\param v V(a.k.a. T) texture coordinate (0.0 - 1.0)*/
-void glTexCoord2f32(int32 u, int32 v);
-
-/*! \brief specify the material properties to be used in rendering lit polygons
-\param mode which material property to change
-\param color the color to set for that material property */
-void glMaterialf(GL_MATERIALS_ENUM mode, rgb color);
-
-// This handles initialization of the GL state; this is called from glInit to keep globals synced between compilation units
-void glInit_C(void);
-
-// This returns a pointer to the globals for videoGL
-gl_hidden_globals* glGetGlobals(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////// ////////////
-//////////// ////////////
-//////////// ////////////
-//////////// INLINED FUNCTIONS ////////////
-//////////// ////////////
-//////////// ////////////
-//////////// ////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////////////
-
-
-
-/*! \brief used in glPolyFmt() to set the alpha level for the following polygons, set to 0 for wireframe mode
-\param n the level of alpha (0-31) */
-GL_STATIC_INL uint32 POLY_ALPHA(int n) { return (uint32)((n) << 16); };
-
-/*! \brief used in glPolyFmt() to set the Polygon ID for the following polygons
-\param n the ID to set for following polygons (0-63) */
-GL_STATIC_INL uint32 POLY_ID(int n) { return (uint32)((n)<<24); };
-
-/*! \brief Starts a polygon group
-\param mode the draw mode for the polygon */
-GL_STATIC_INL void glBegin(GL_GLBEGIN_ENUM mode) { GFX_BEGIN = mode; }
-
-/*! \brief Ends a polygon group, this seems to be a dummy function that does absolutely nothing, feel free to never use it. */
-GL_STATIC_INL void glEnd(void) { GFX_END = 0; }
-
-/*! \brief reset the depth buffer to this value; generally set this to GL_MAX_DEPTH.<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3drearplane">GBATEK http://nocash.emubase.de/gbatek.htm#ds3drearplane</A>
-\param depth Something to do with the depth buffer, generally set to GL_MAX_DEPTH */
-GL_STATIC_INL void glClearDepth(fixed12d3 depth) { GFX_CLEAR_DEPTH = depth; }
-
-/*! \brief Set the color for following vertices
-\param red the red component (0-31)
-\param green the green component (0-31)
-\param blue the blue component (0-31) */
-
-GL_STATIC_INL void glColor3b(uint8 red, uint8 green, uint8 blue) { GFX_COLOR = (vuint32)RGB15(red>>3, green>>3, blue>>3); }
-
-/*! \brief Set the color for following vertices
-\param color the 15bit color value */
-GL_STATIC_INL void glColor(rgb color) { GFX_COLOR = (vuint32)color; }
-
-/*! \brief specifies a vertex
-\param x the x component for the vertex
-\param y the y component for the vertex
-\param z the z component for the vertex */
-GL_STATIC_INL void glVertex3v16(v16 x, v16 y, v16 z) {
- GFX_VERTEX16 = (y << 16) | (x & 0xFFFF);
- GFX_VERTEX16 = ((uint32)(uint16)z);
-}
-
-/*! \brief Sets texture coordinates for following vertices<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes</A>
-\param u U(a.k.a. S) texture coordinate in texels
-\param v V(a.k.a. T) texture coordinate in texels */
-GL_STATIC_INL void glTexCoord2t16(t16 u, t16 v) { GFX_TEX_COORD = TEXTURE_PACK(u,v); }
-
-/*! \brief Pushs the current matrix onto the stack<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack</A> */
-GL_STATIC_INL void glPushMatrix(void) { MATRIX_PUSH = 0; }
-
-/*! \brief Pops num matrices off the stack<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack</A>
-\param num the number to pop down the stack */
-GL_STATIC_INL void glPopMatrix(int32 num) { MATRIX_POP = num; }
-
-/*! \brief Restores the current matrix from a location in the stack<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack</A>
-\param index the place in the stack to restore to */
-GL_STATIC_INL void glRestoreMatrix(int32 index) { MATRIX_RESTORE = index; }
-
-/*! \brief Place the current matrix into the stack at a location<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixstack</A>
-\param index the place in the stack to put the current matrix */
-GL_STATIC_INL void glStoreMatrix(int32 index) { MATRIX_STORE = index; }
-
-/*! \brief multiply the current matrix by a translation matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\param v the vector to translate by */
-GL_STATIC_INL void glScalev(const GLvector* v) {
- MATRIX_SCALE = v->x;
- MATRIX_SCALE = v->y;
- MATRIX_SCALE = v->z;
-}
-
-/*! \brief multiply the current matrix by a translation matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\param v the vector to translate by */
-GL_STATIC_INL void glTranslatev(const GLvector* v) {
- MATRIX_TRANSLATE = v->x;
- MATRIX_TRANSLATE = v->y;
- MATRIX_TRANSLATE = v->z;
-}
-
-/*! \brief multiply the current matrix by a translation matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\param x translation on the x axis
-\param y translation on the y axis
-\param z translation on the z axis */
-GL_STATIC_INL void glTranslate3f32(int32 x, int32 y, int32 z) {
- MATRIX_TRANSLATE = x;
- MATRIX_TRANSLATE = y;
- MATRIX_TRANSLATE = z;
-}
-
-/*! \brief multiply the current matrix by a scale matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\param factor the factor to scale by */
-GL_STATIC_INL void glScalef32(int32 factor) {
- MATRIX_SCALE = factor;
- MATRIX_SCALE = factor;
- MATRIX_SCALE = factor;
-}
-
-/*! \brief set a light up. Only parallel light sources are supported on the DS<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A>
-\param id the number of the light to setup
-\param color the color of the light
-\param x the x component of the lights directional vector. Direction must be normalized
-\param y the y component of the lights directional vector. Direction must be normalized
-\param z the z component of the lights directional vector. Direction must be normalized */
-GL_STATIC_INL void glLight(int id, rgb color, v10 x, v10 y, v10 z) {
- id = (id & 3) << 30;
- GFX_LIGHT_VECTOR = id | ((z & 0x3FF) << 20) | ((y & 0x3FF) << 10) | (x & 0x3FF);
- GFX_LIGHT_COLOR = id | color;
-}
-
-/*! \brief the normal to use for following vertices<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A>
-\warning The nature of the format means that you can't represent the following normals exactly (0,0,1), (0,1,0), or (1,0,0)
-\param normal the packed normal(3 * 10bit x, y, z) */
-GL_STATIC_INL void glNormal(uint32 normal) { GFX_NORMAL = normal; }
-
-/*! \brief loads an identity matrix to the current matrix, same as glIdentity(void) */
-GL_STATIC_INL void glLoadIdentity(void) { MATRIX_IDENTITY = 0; }
-
-/*! \brief change the current matrix mode<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A><BR>
-\param mode the mode for the matrix */
-GL_STATIC_INL void glMatrixMode(GL_MATRIX_MODE_ENUM mode) { MATRIX_CONTROL = mode; }
-
-/*! \brief specify the viewport for following drawing, can be set several times per frame.<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A>
-\param x1 the left of the viewport
-\param y1 the bottom of the viewport
-\param x2 the right of the viewport
-\param y2 the top of the viewport */
-GL_STATIC_INL void glViewport(uint8 x1, uint8 y1, uint8 x2, uint8 y2) { GFX_VIEWPORT = (x1) + (y1 << 8) + (x2 << 16) + (y2 << 24); }
-
-/*! \brief Waits for a Vblank and swaps the buffers(like swiWaitForVBlank), but lets you specify some 3D options<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A>
-\param mode flags from GLFLUSH_ENUM for enabling Y-sorting of translucent polygons and W-Buffering of all vertices*/
-GL_STATIC_INL void glFlush(uint32 mode) { GFX_FLUSH = mode; }
-
-/*! \brief The DS uses a table for shinyness..this generates a half-ass one */
-GL_STATIC_INL void glMaterialShinyness(void) {
- uint32 shiny32[128/4];
- uint8 *shiny8 = (uint8*)shiny32;
-
- int i;
-
- for (i = 0; i < 128 * 2; i += 2)
- shiny8[i>>1] = i;
-
- for (i = 0; i < 128 / 4; i++)
- GFX_SHININESS = shiny32[i];
-}
-
-/*! \brief throws a packed list of commands into the graphics FIFO via asyncronous DMA<BR>
-The first 32bits is the length of the packed command list, followed by a the packed list.<BR>
-If you want to do this really fast then write your own code that that does this synchronously and only flushes the cache when the list is changed<BR>
-There is sometimes a problem when you pack the GFX_END command into a list, so don't. GFX_END is a dummy command and never needs called<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dgeometrycommands">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dgeometrycommands</A> */
-GL_STATIC_INL void glCallList(const u32* list) {
- u32 count = *list++;
-
- // flush the area that we are going to DMA
- DC_FlushRange(list, count*4);
-
- // don't start DMAing while anything else is being DMAed because FIFO DMA is touchy as hell
- // If anyone can explain this better that would be great. -- gabebear
- while((DMA_CR(0) & DMA_BUSY)||(DMA_CR(1) & DMA_BUSY)||(DMA_CR(2) & DMA_BUSY)||(DMA_CR(3) & DMA_BUSY));
-
- // send the packed list asynchronously via DMA to the FIFO
- DMA_SRC(0) = (uint32)list;
- DMA_DEST(0) = 0x4000400;
- DMA_CR(0) = DMA_FIFO | count;
- while(DMA_CR(0) & DMA_BUSY);
-}
-
-/*! \brief Set the parameters for polygons rendered on the current frame<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonattributes</A>
-\param params the paramters to set for the polygons for the current frame. valid paramters are enumerated in GL_POLY_FORMAT_ENUM and in the functions POLY_ALPHA() and POLY_ID() */
-GL_STATIC_INL void glPolyFmt(uint32 params) { GFX_POLY_FORMAT = params; }
-
-/*! \brief Enables various gl states (blend, alpha test, etc..)
-\param bits bit mask of desired attributes, attributes are enumerated in DISP3DCNT_ENUM */
-GL_STATIC_INL void glEnable(int bits) { GFX_CONTROL |= bits; }
-
-/*! \brief Disables various gl states (blend, alpha test, etc..)
-\param bits bit mask of desired attributes, attributes are enumerated in DISP3DCNT_ENUM */
-GL_STATIC_INL void glDisable(int bits) { GFX_CONTROL &= ~bits; }
-
-/*! \brief Loads a 4x4 matrix into the current matrix
-\param m pointer to a 4x4 matrix */
-GL_STATIC_INL void glLoadMatrix4x4(const m4x4 *m) {
- MATRIX_LOAD4x4 = m->m[0];
- MATRIX_LOAD4x4 = m->m[1];
- MATRIX_LOAD4x4 = m->m[2];
- MATRIX_LOAD4x4 = m->m[3];
-
- MATRIX_LOAD4x4 = m->m[4];
- MATRIX_LOAD4x4 = m->m[5];
- MATRIX_LOAD4x4 = m->m[6];
- MATRIX_LOAD4x4 = m->m[7];
-
- MATRIX_LOAD4x4 = m->m[8];
- MATRIX_LOAD4x4 = m->m[9];
- MATRIX_LOAD4x4 = m->m[10];
- MATRIX_LOAD4x4 = m->m[11];
-
- MATRIX_LOAD4x4 = m->m[12];
- MATRIX_LOAD4x4 = m->m[13];
- MATRIX_LOAD4x4 = m->m[14];
- MATRIX_LOAD4x4 = m->m[15];
-}
-
-/*! \brief Loads a 4x3 matrix into the current matrix
-\param m pointer to a 4x4 matrix */
-GL_STATIC_INL void glLoadMatrix4x3(const m4x3 * m) {
- MATRIX_LOAD4x3 = m->m[0];
- MATRIX_LOAD4x3 = m->m[1];
- MATRIX_LOAD4x3 = m->m[2];
- MATRIX_LOAD4x3 = m->m[3];
-
- MATRIX_LOAD4x3 = m->m[4];
- MATRIX_LOAD4x3 = m->m[5];
- MATRIX_LOAD4x3 = m->m[6];
- MATRIX_LOAD4x3 = m->m[7];
-
- MATRIX_LOAD4x3 = m->m[8];
- MATRIX_LOAD4x3 = m->m[9];
- MATRIX_LOAD4x3 = m->m[10];
- MATRIX_LOAD4x3 = m->m[11];
-}
-
-/*! \brief Multiplies the current matrix by m
-\param m pointer to a 4x4 matrix */
-GL_STATIC_INL void glMultMatrix4x4(const m4x4 * m) {
- MATRIX_MULT4x4 = m->m[0];
- MATRIX_MULT4x4 = m->m[1];
- MATRIX_MULT4x4 = m->m[2];
- MATRIX_MULT4x4 = m->m[3];
-
- MATRIX_MULT4x4 = m->m[4];
- MATRIX_MULT4x4 = m->m[5];
- MATRIX_MULT4x4 = m->m[6];
- MATRIX_MULT4x4 = m->m[7];
-
- MATRIX_MULT4x4 = m->m[8];
- MATRIX_MULT4x4 = m->m[9];
- MATRIX_MULT4x4 = m->m[10];
- MATRIX_MULT4x4 = m->m[11];
-
- MATRIX_MULT4x4 = m->m[12];
- MATRIX_MULT4x4 = m->m[13];
- MATRIX_MULT4x4 = m->m[14];
- MATRIX_MULT4x4 = m->m[15];
-}
-
-/*! \brief multiplies the current matrix by
-\param m pointer to a 4x3 matrix */
-GL_STATIC_INL void glMultMatrix4x3(const m4x3 * m) {
- MATRIX_MULT4x3 = m->m[0];
- MATRIX_MULT4x3 = m->m[1];
- MATRIX_MULT4x3 = m->m[2];
- MATRIX_MULT4x3 = m->m[3];
-
- MATRIX_MULT4x3 = m->m[4];
- MATRIX_MULT4x3 = m->m[5];
- MATRIX_MULT4x3 = m->m[6];
- MATRIX_MULT4x3 = m->m[7];
-
- MATRIX_MULT4x3 = m->m[8];
- MATRIX_MULT4x3 = m->m[9];
- MATRIX_MULT4x3 = m->m[10];
- MATRIX_MULT4x3 = m->m[11];
-
-}
-
-/*! \brief multiplies the current matrix by m
-\param m pointer to a 3x3 matrix */
-GL_STATIC_INL void glMultMatrix3x3(const m3x3 * m) {
- MATRIX_MULT3x3 = m->m[0];
- MATRIX_MULT3x3 = m->m[1];
- MATRIX_MULT3x3 = m->m[2];
-
- MATRIX_MULT3x3 = m->m[3];
- MATRIX_MULT3x3 = m->m[4];
- MATRIX_MULT3x3 = m->m[5];
-
- MATRIX_MULT3x3 = m->m[6];
- MATRIX_MULT3x3 = m->m[7];
- MATRIX_MULT3x3 = m->m[8];
-}
-
-/*! \brief Rotates the current modelview matrix by angle about the x axis
-\param angle The angle to rotate by (angle is 0-511) */
-GL_STATIC_INL void glRotateXi(int angle) {
- int32 sine = SIN[angle & LUT_MASK];
- int32 cosine = COS[angle & LUT_MASK];
-
- MATRIX_MULT3x3 = inttof32(1);
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = 0;
-
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = cosine;
- MATRIX_MULT3x3 = sine;
-
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = -sine;
- MATRIX_MULT3x3 = cosine;
-}
-
-/*! \brief Rotates the current modelview matrix by angle about the y axis
-\param angle The angle to rotate by (angle is 0-511) */
-GL_STATIC_INL void glRotateYi(int angle) {
- int32 sine = SIN[angle & LUT_MASK];
- int32 cosine = COS[angle & LUT_MASK];
-
- MATRIX_MULT3x3 = cosine;
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = -sine;
-
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = inttof32(1);
- MATRIX_MULT3x3 = 0;
-
- MATRIX_MULT3x3 = sine;
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = cosine;
-}
-
-/*! \brief Rotates the current modelview matrix by angle about the z axis
-\param angle The angle to rotate by (angle is 0-511) */
-GL_STATIC_INL void glRotateZi(int angle) {
- int32 sine = SIN[angle & LUT_MASK];
- int32 cosine = COS[angle & LUT_MASK];
-
- MATRIX_MULT3x3 = cosine;
- MATRIX_MULT3x3 = sine;
- MATRIX_MULT3x3 = 0;
-
- MATRIX_MULT3x3 = - sine;
- MATRIX_MULT3x3 = cosine;
- MATRIX_MULT3x3 = 0;
-
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = 0;
- MATRIX_MULT3x3 = inttof32(1);
-}
-
-
-/*! \brief Multiplies the current matrix into ortho graphic mode
-\param left left vertical clipping plane
-\param right right vertical clipping plane
-\param bottom bottom vertical clipping plane
-\param top top vertical clipping plane
-\param zNear near clipping plane
-\param zFar far clipping plane */
-GL_STATIC_INL void glOrthof32(int32 left, int32 right, int32 bottom, int32 top, int32 zNear, int32 zFar) {
- MATRIX_MULT4x4 = divf32(inttof32(2), right - left);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = divf32(inttof32(2), top - bottom);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = divf32(inttof32(-2), zFar - zNear);
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = -divf32(right + left, right - left);//0;
- MATRIX_MULT4x4 = -divf32(top + bottom, top - bottom); //0;
- MATRIX_MULT4x4 = -divf32(zFar + zNear, zFar - zNear);//0;
- MATRIX_MULT4x4 = floattof32(1.0F);
-}
-
-/*! \brief Places the camera at the specified location and orientation (fixed point version)
-\param eyex (eyex, eyey, eyez) Location of the camera.
-\param eyey (eyex, eyey, eyez) Location of the camera.
-\param eyez (eyex, eyey, eyez) Location of the camera.
-\param lookAtx (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param lookAty (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param lookAtz (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param upx <upx, upy, upz> Unit vector describing which direction is up for the camera.
-\param upy <upx, upy, upz> Unit vector describing which direction is up for the camera.
-\param upz <upx, upy, upz> Unit vector describing which direction is up for the camera. */
-GL_STATIC_INL void gluLookAtf32(int32 eyex, int32 eyey, int32 eyez, int32 lookAtx, int32 lookAty, int32 lookAtz, int32 upx, int32 upy, int32 upz) {
- int32 side[3], forward[3], up[3], eye[3];
-
- forward[0] = eyex - lookAtx;
- forward[1] = eyey - lookAty;
- forward[2] = eyez - lookAtz;
-
- normalizef32(forward);
-
- up[0] = upx;
- up[1] = upy;
- up[2] = upz;
- eye[0] = eyex;
- eye[1] = eyey;
- eye[2] = eyez;
-
- crossf32(up, forward, side);
-
- normalizef32(side);
-
- // Recompute local up
- crossf32(forward, side, up);
-
- glMatrixMode(GL_MODELVIEW);
-
-
- // should we use MATRIX_MULT4x3?
- MATRIX_MULT4x3 = side[0];
- MATRIX_MULT4x3 = up[0];
- MATRIX_MULT4x3 = forward[0];
-
- MATRIX_MULT4x3 = side[1];
- MATRIX_MULT4x3 = up[1];
- MATRIX_MULT4x3 = forward[1];
-
- MATRIX_MULT4x3 = side[2];
- MATRIX_MULT4x3 = up[2];
- MATRIX_MULT4x3 = forward[2];
-
- MATRIX_MULT4x3 = -dotf32(eye,side);
- MATRIX_MULT4x3 = -dotf32(eye,up);
- MATRIX_MULT4x3 = -dotf32(eye,forward);
-
-}
-
-
-/*! \brief Specifies the viewing frustum for the projection matrix (fixed point version)
-\param left left right top and bottom describe a rectangle located at the near clipping plane
-\param right left right top and bottom describe a rectangle located at the near clipping plane
-\param top left right top and bottom describe a rectangle located at the near clipping plane
-\param bottom left right top and bottom describe a rectangle located at the near clipping plane
-\param near Location of a the near clipping plane (parallel to viewing window)
-\param far Location of a the far clipping plane (parallel to viewing window) */
-GL_STATIC_INL void glFrustumf32(int32 left, int32 right, int32 bottom, int32 top, int32 near, int32 far) {
-/* MATRIX_MULT4x4 = divf32(2*near, right - left);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = divf32(right + left, right - left);
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = divf32(2*near, top - bottom);
- MATRIX_MULT4x4 = divf32(top + bottom, top - bottom);
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = -divf32(far + near, far - near);
- MATRIX_MULT4x4 = floattof32(-1.0F);
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = -divf32(2 * mulf32(far, near), far - near);
- MATRIX_MULT4x4 = 0;
-*/
-
-
- MATRIX_MULT4x4 = divf32(2*near, right - left);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = divf32(2*near, top - bottom);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
-
- MATRIX_MULT4x4 = divf32(right + left, right - left);
- MATRIX_MULT4x4 = divf32(top + bottom, top - bottom);
- MATRIX_MULT4x4 = -divf32(far + near, far - near);
- MATRIX_MULT4x4 = floattof32(-1.0F);
-
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = -divf32(2 * mulf32(far, near), far - near);
- MATRIX_MULT4x4 = 0;
-
-}
-
-/*! \brief Utility function which sets up the projection matrix (fixed point version)
-\param fovy Specifies the field of view in degrees (0 -511)
-\param aspect Specifies the aspect ratio of the screen (normally screen width/screen height)
-\param zNear Specifies the near clipping plane
-\param zFar Specifies the far clipping plane */
-GL_STATIC_INL void gluPerspectivef32(int fovy, int32 aspect, int32 zNear, int32 zFar) {
- int32 xmin, xmax, ymin, ymax;
-
- ymax = mulf32(zNear, TAN[(fovy>>1) & LUT_MASK]);
- ymin = -ymax;
- xmin = mulf32(ymin, aspect);
- xmax = mulf32(ymax, aspect);
-
- glFrustumf32(xmin, xmax, ymin, ymax, zNear, zFar);
-}
-
-/*! \brief Utility function which generates a picking matrix for selection
-\param x 2D x of center (touch x normally)
-\param y 2D y of center (touch y normally)
-\param width width in pixels of the window (3 or 4 is a good number)
-\param height height in pixels of the window (3 or 4 is a good number)
-\param viewport the current viewport (normaly {0, 0, 255, 191}) */
-GL_STATIC_INL void gluPickMatrix(int x, int y, int width, int height, const int viewport[4]) {
- MATRIX_MULT4x4 = inttof32(viewport[2]) / width;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = inttof32(viewport[3]) / height;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = inttof32(1);
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = inttof32(viewport[2] + ((viewport[0] - x)<<1)) / width;
- MATRIX_MULT4x4 = inttof32(viewport[3] + ((viewport[1] - y)<<1)) / height;
- MATRIX_MULT4x4 = 0;
- MATRIX_MULT4x4 = inttof32(1);
-}
-
-/*! \brief Resets matrix stack to top level */
-GL_STATIC_INL void glResetMatrixStack(void) {
- // make sure there are no push/pops that haven't executed yet
- while(GFX_STATUS & BIT(14)){
- GFX_STATUS |= 1 << 15; // clear push/pop errors or push/pop busy bit never clears
- }
-
- // pop the projection stack to the top; poping 0 off an empty stack causes an error... weird?
- if((GFX_STATUS&(1<<13))!=0) {
- glMatrixMode(GL_PROJECTION);
- glPopMatrix(1);
- }
-
- // 31 deep modelview matrix; 32nd entry works but sets error flag
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix((GFX_STATUS >> 8) & 0x1F);
-
- // load identity to all the matrices
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
-}
-
-/*! \brief Specifies an edge color for polygons
-\param id which outline color to set (0-7)
-\param color the 15bit color to set */
-GL_STATIC_INL void glSetOutlineColor(int id, rgb color) { GFX_EDGE_TABLE[id] = color; }
-
-/*! \brief Loads a toon table
-\param pointer to the 32 color palette to load into the toon table*/
-GL_STATIC_INL void glSetToonTable(const uint16 *table) {
- int i;
- for(i = 0; i < 32; i++ )
- GFX_TOON_TABLE[i] = table[i];
-}
-
-/*! \brief Sets a range of colors on the toon table
-\param start the start of the range
-\param end the end of the range
-\param color the color to set for that range */
-GL_STATIC_INL void glSetToonTableRange(int start, int end, rgb color) {
- int i;
- for(i = start; i <= end; i++ )
- GFX_TOON_TABLE[i] = color;
-}
-
-/*! \brief Grabs fixed format of state variables<BR>
-OpenGL's modelview matrix is handled on the DS with two matrices. The combination of the DS's position matrix and directional vector matrix hold the data that is in OpenGL's one modelview matrix. (a.k.a. modelview = postion and vector)<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3diomap">http://nocash.emubase.de/gbatek.htm#ds3diomap</A>
-\param param The state variable to retrieve
-\param f pointer with room to hold the requested data */
-GL_STATIC_INL void glGetFixed(const GL_GET_ENUM param, int32* f) {
- int i;
- switch (param) {
- case GL_GET_MATRIX_VECTOR:
- while(GFX_BUSY); // wait until the graphics engine has stopped to read matrixes
- for(i = 0; i < 9; i++) f[i] = MATRIX_READ_VECTOR[i];
- break;
- case GL_GET_MATRIX_CLIP:
- while(GFX_BUSY); // wait until the graphics engine has stopped to read matrixes
- for(i = 0; i < 16; i++) f[i] = MATRIX_READ_CLIP[i];
- break;
- case GL_GET_MATRIX_PROJECTION:
- glMatrixMode(GL_POSITION);
- glPushMatrix(); // save the current state of the position matrix
- glLoadIdentity(); // load an identity matrix into the position matrix so that the clip matrix = projection matrix
- while(GFX_BUSY); // wait until the graphics engine has stopped to read matrixes
- for(i = 0; i < 16; i++) f[i] = MATRIX_READ_CLIP[i]; // read out the projection matrix
- glPopMatrix(1); // restore the position matrix
- break;
- case GL_GET_MATRIX_POSITION:
- glMatrixMode(GL_PROJECTION);
- glPushMatrix(); // save the current state of the projection matrix
- glLoadIdentity(); // load a identity matrix into the projection matrix so that the clip matrix = position matrix
- while(GFX_BUSY); // wait until the graphics engine has stopped to read matrixes
- for(i = 0; i < 16; i++) f[i] = MATRIX_READ_CLIP[i]; // read out the position matrix
- glPopMatrix(1); // restore the projection matrix
- break;
- default:
- break;
- }
-}
-
-/*! \brief set the minimum alpha value that will be used<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A>
-\param alphaThreshold minimum alpha value that will be used (0-15) */
-GL_STATIC_INL void glAlphaFunc(int alphaThreshold) { GFX_ALPHA_TEST = alphaThreshold; }
-
-/*! \brief Stop the drawing of polygons that are a certain distance from the camera.<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol">GBATEK http://nocash.emubase.de/gbatek.htm#ds3ddisplaycontrol</A>
-\param polygons that are beyond this W-value(distance from camera) will not be drawn; 15bit value. */
-GL_STATIC_INL void glCutoffDepth(fixed12d3 wVal) { GFX_CUTOFF_DEPTH = wVal; }
-
-/*! \brief Initializes the gl state machine (must be called once before using gl calls) */
-GL_STATIC_INL void glInit(void) {
- glGlob = glGetGlobals(); // make sure globals are synced between compilation units
- glInit_C(); // actually does the initialization
-}
-
-/*! \brief sets the color of the rear-plane(a.k.a Clear Color/Plane)
-\param red component (0-31)
-\param green component (0-31)
-\param blue component (0-31)
-\param alpha from 0(clear) to 31(opaque)*/
-GL_STATIC_INL void glClearColor(uint8 red, uint8 green, uint8 blue, uint8 alpha) {
- GFX_CLEAR_COLOR = glGlob->clearColor = ( glGlob->clearColor & 0xFFE08000) | (0x7FFF & RGB15(red, green, blue)) | ((alpha & 0x1F) << 16);
-}
-
-/*! \brief sets the polygon ID of the rear-plane(a.k.a. Clear/Color Plane), useful for antialiasing and edge coloring
-\param ID the polygon ID to give the rear-plane */
-GL_STATIC_INL void glClearPolyID(uint8 ID) {
- GFX_CLEAR_COLOR = glGlob->clearColor = ( glGlob->clearColor & 0xC0FFFFFF) | (( ID & 0x3F ) << 24 );
-}
-
-/*! \brief Grabs integer state variables from openGL
-\param param The state variable to retrieve
-\param i pointer with room to hold the requested data */
-GL_STATIC_INL void glGetInt(GL_GET_ENUM param, int* i) {
- switch (param) {
- case GL_GET_POLYGON_RAM_COUNT:
- *i = GFX_POLYGON_RAM_USAGE;
- break;
- case GL_GET_VERTEX_RAM_COUNT:
- *i = GFX_VERTEX_RAM_USAGE;
- break;
- case GL_GET_TEXTURE_WIDTH:
- *i = 8 << (((glGlob->textures[glGlob->activeTexture]) >> 20) & 7);
- break;
- case GL_GET_TEXTURE_HEIGHT:
- *i = 8 << (((glGlob->textures[glGlob->activeTexture]) >> 23) & 7);
- break;
- default:
- break;
- }
-}
-
-
-//---------------------------------------------------------------------------------
-// INLINED FlOAT WRAPPERS
-//
-// All floating point functions.
-//
-
-/*! \brief specifies a vertex location
-\warning FLOAT VERSION!!!! please use glVertex3v16()
-\param x the x component of the vertex
-\param y the y component of the vertex
-\param z the z component of the vertex */
-GL_STATIC_INL void glVertex3f(float x, float y, float z) {
- glVertex3v16(floattov16(x), floattov16(y), floattov16(z));
-}
-
-/*! \brief Rotate on an arbitrary axis
-\warning FLOAT VERSION!!!! please use glRotatef32i()
-\param angle the angle to rotate by
-\param x the x component of the axis to rotate on
-\param y the y component of the axis to rotate on
-\param z the z component of the axis to rotate on */
-GL_STATIC_INL void glRotatef32(float angle, int32 x, int32 y, int32 z) {
- glRotatef32i((int)(angle * LUT_SIZE / 360.0), x, y, z);
-}
-
-/*! \brief Rotate about an arbitrary axis
-\warning FLOAT VERSION!!!! please use glRotatef32i()
-\param angle the angle to rotate by
-\param x the x component of the axis to rotate on
-\param y the y component of the axis to rotate on
-\param z the z component of the axis to rotate on */
-GL_STATIC_INL void glRotatef(float angle, float x, float y, float z) {
- glRotatef32(angle, floattof32(x), floattof32(y), floattof32(z));
-}
-
-/*! \brief specify a color for following vertices
-\warning FLOAT VERSION!!!! please use glColor3b()
-\param r the red component of the color
-\param g the green component of the color
-\param b the blue component of the color */
-GL_STATIC_INL void glColor3f(float r, float g, float b) {
- glColor3b((uint8)(r*255), (uint8)(g*255), (uint8)(b*255));
-}
-
-/*! \brief multiply the current matrix by a scale matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\warning FLOAT VERSION!!!! please use glScalev() or glScalef32()
-\param x scaling on the x axis
-\param y scaling on the y axis
-\param z scaling on the z axis */
-GL_STATIC_INL void glScalef(float x, float y, float z) {
- MATRIX_SCALE = floattof32(x);
- MATRIX_SCALE = floattof32(y);
- MATRIX_SCALE = floattof32(z);
-}
-
-/*! \brief multiply the current matrix by a translation matrix<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dmatrixloadmultiply</A>
-\warning FLOAT VERSION!!!! please use glTranslate3f32()
-\param x translation on the x axis
-\param y translation on the y axis
-\param z translation on the z axis */
-GL_STATIC_INL void glTranslatef(float x, float y, float z) {
- MATRIX_TRANSLATE = floattof32(x);
- MATRIX_TRANSLATE = floattof32(y);
- MATRIX_TRANSLATE = floattof32(z);
-}
-
-/*! \brief the normal to use for following vertices<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dpolygonlightparameters</A>
-\warning FLOAT VERSION!!!! please use glNormal()
-\param x x component of the normal, vector must be normalized
-\param y y component of the normal, vector must be normalized
-\param z z component of the normal, vector must be normalized */
-GL_STATIC_INL void glNormal3f(float x, float y, float z) {
- glNormal(NORMAL_PACK(floattov10(x), floattov10(y), floattov10(z)));
-}
-
-/*! \brief Rotates the current modelview matrix by angle degrees about the x axis
-\warning FLOAT VERSION!!!! please use glRotateXi()
-\param angle The angle to rotate by */
-GL_STATIC_INL void glRotateX(float angle) {
- glRotateXi((int)(angle * LUT_SIZE / 360.0));
-}
-
-/*! \brief Rotates the current modelview matrix by angle degrees about the y axis
-\warning FLOAT VERSION!!!! please use glRotateYi()
-\param angle The angle to rotate by */
-GL_STATIC_INL void glRotateY(float angle) {
- glRotateYi((int)(angle * LUT_SIZE / 360.0));
-}
-
-/*! \brief Rotates the current modelview matrix by angle degrees about the z axis
-\warning FLOAT VERSION!!!! please use glRotateZi()
-\param angle The angle to rotate by */
-GL_STATIC_INL void glRotateZ(float angle) {
- glRotateZi((int)(angle * LUT_SIZE / 360.0));
-}
-
-/*! \brief Multiplies the current matrix into ortho graphic mode
-\warning FLOAT VERSION!!!! please use glOrthof32()
-\param left left vertical clipping plane
-\param right right vertical clipping plane
-\param bottom bottom vertical clipping plane
-\param top top vertical clipping plane
-\param zNear near clipping plane
-\param zFar far clipping plane */
-GL_STATIC_INL void glOrtho(float left, float right, float bottom, float top, float zNear, float zFar) {
- glOrthof32(floattof32(left), floattof32(right), floattof32(bottom), floattof32(top), floattof32(zNear), floattof32(zFar));
-}
-
-/*! \brief Places the camera at the specified location and orientation (floating point version)
-\warning FLOAT VERSION!!!! please use gluLookAtf32()
-\param eyex (eyex, eyey, eyez) Location of the camera.
-\param eyey (eyex, eyey, eyez) Location of the camera.
-\param eyez (eyex, eyey, eyez) Location of the camera.
-\param lookAtx (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param lookAty (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param lookAtz (lookAtx, lookAty, lookAtz) Where the camera is looking.
-\param upx <upx, upy, upz> Unit vector describing which direction is up for the camera.
-\param upy <upx, upy, upz> Unit vector describing which direction is up for the camera.
-\param upz <upx, upy, upz> Unit vector describing which direction is up for the camera. */
-GL_STATIC_INL void gluLookAt( float eyex, float eyey, float eyez,
- float lookAtx, float lookAty, float lookAtz,
- float upx, float upy, float upz) {
- gluLookAtf32(floattof32(eyex), floattof32(eyey), floattof32(eyez),
- floattof32(lookAtx), floattof32(lookAty), floattof32(lookAtz),
- floattof32(upx), floattof32(upy), floattof32(upz));
-}
-
-/*! \brief Specifies the viewing frustum for the projection matrix (floating point version)
-\warning FLOAT VERSION!!!! please use glFrustumf32()
-\param left left right top and bottom describe a rectangle located at the near clipping plane
-\param right left right top and bottom describe a rectangle located at the near clipping plane
-\param top left right top and bottom describe a rectangle located at the near clipping plane
-\param bottom left right top and bottom describe a rectangle located at the near clipping plane
-\param near Location of a the near clipping plane (parallel to viewing window)
-\param far Location of a the far clipping plane (parallel to viewing window) */
-GL_STATIC_INL void glFrustum(float left, float right, float bottom, float top, float near, float far) {
- glFrustumf32(floattof32(left), floattof32(right), floattof32(bottom), floattof32(top), floattof32(near), floattof32(far));
-}
-
-/*! \brief Utility function which sets up the projection matrix (floating point version)
-\warning FLOAT VERSION!!!! please use gluPerspectivef32()
-\param fovy Specifies the field of view in degrees
-\param aspect Specifies the aspect ratio of the screen (normally screen width/screen height)
-\param zNear Specifies the near clipping plane
-\param zFar Specifies the far clipping plane */
-GL_STATIC_INL void gluPerspective(float fovy, float aspect, float zNear, float zFar) {
- gluPerspectivef32((int)(fovy * LUT_SIZE / 360.0), floattof32(aspect), floattof32(zNear), floattof32(zFar));
-}
-
-/*! \brief Sets texture coordinates for following vertices<BR>
-<A HREF="http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes">GBATEK http://nocash.emubase.de/gbatek.htm#ds3dtextureattributes</A>
-\warning FLOAT VERSION!!!! please use glTexCoord2t16()
-\param s S(a.k.a. U) texture coordinate (0.0 - 1.0)
-\param t T(a.k.a. V) texture coordinate (0.0 - 1.0)*/
-GL_STATIC_INL void glTexCoord2f(float s, float t) {
- int x = ((glGlob->textures[glGlob->activeTexture]) >> 20) & 7;
- int y = ((glGlob->textures[glGlob->activeTexture]) >> 23) & 7;
-
- glTexCoord2t16(floattot16(s*(8 << x)), floattot16(t*(8<<y)));
-}
-
-
-#endif // #ifndef VIDEOGL_ARM9_INCLUDE
-