PAlib 070717

This commit is contained in:
Antonio Niño Díaz 2007-07-17 12:00:00 +01:00
parent 865277573e
commit 0290702a80
148 changed files with 2101 additions and 1080 deletions

View File

@ -1,4 +1,47 @@
-----------------------------
| PAlib 070717 : Misc Stuff |
-----------------------------
New Stuff
---------
[16bit] Double Buffering added
[Image] ImageSplitter added, an app to split up big images with frames into several smaller sprites. See example to use the app. It's basic and doesn't manage any 'error' ^^
Updated Oldies
--------------
[Text] Now supports %x for Hex output
[16cText] Added PA_16cTextLineSpacing(u8 spacing) and PA_16cTextLetterSpacing(u8 spacing)
[iDeaS] Updated to 1.0.1.7
[Size] Optimised a bit more how PAlib code is organized, saves a few kB everywhere for some projects :)
[Reco] Added PA_RecoInfo.Difference and PA_RecoInfo.Shape for the shape found and the amount of difference (test to find the values you like ^^) to that shape
[Wifi] Updated to latest version
Things Fixed
------------
[RTC] Reverted back to older code, now works
[Linux] PAlib compilation fixed
[3DSprites] Fixed bug of 3D not showing after using scrollable backgrounds. Big thanks to Sumiguchi ^^
[Timers] Chris Liu fixed the Timers !
[Sprites] Fixed PA_GetSpriteAnim (thanks to Doud !)
-----------------------------------
| PAlib 070615 : Sumiguchi's Work |

View File

@ -1,25 +1,26 @@
[iDeaS_Settings_RecentFile]
File0=,1,C:\devkitPro\Demos\Plants\Plants.nds
File1=,1,D:\Users\Mollusk\Desktop\Setsuzoku_v0.1.nds
File2=,1,C:\devkitPro\PAlibExamples\3d\3DSprites\3D1024Sprites\3D1024Sprites.nds
File3=,1,C:\devkitPro\PAlibExamples\3d\3DSprites\Effects\3DAlpha\3DAlpha.nds
File4=,1,C:\devkitPro\Demos\Plasma\Plasma.nds
File5=,1,C:\devkitPro\Demos\Intro\Intro.nds
File6=,1,C:\devkitPro\Apps\TouchIma\TouchIma.nds
File7=,1,\\.PSF\Partage\devkitPro\Games\Sudoku\Sudoku.sc.nds
File8=,1,E:\Dev\Projets\Fireworks\Fireworks.nds
File9=,1,E:\Dev\PAlibExamples\3d\3DSprites\3D1024Sprites\3D1024Sprites.nds
File0=,1,E:\Dev\PAlibExamples\Bitmap8-16bit\16bitDraw\16bitDraw.nds
File1=,1,E:\Dev\PAlibExamples\Backgrounds\RotBg\RotBackgrounds\RotBackgrounds.nds
File2=,1,E:\Dev\PAlibExamples\Backgrounds\Effects\Mode7\Mode7.nds
File3=,1,E:\Dev\PAlibExamples\Backgrounds\Effects\BgAlpha\BgAlpha.nds
File4=,1,E:\Dev\PAlibExamples\Transitions\WindowFade\WindowFade.nds
File5=,1,E:\Dev\PAlibExamples\Sprites\Basics\16bitSprite\16bitSprite.nds
File6=,1,E:\Dev\PAlibExamples\3d\3DSprites\3D1024Sprites\3D1024Sprites.nds
File7=,1,E:\Dev\Demos\Perpetual\Perpetual.nds
File8=,1,E:\Dev\PAlibExamples\Bitmap8-16bit\16bitDoubleBuffer\16bitDoubleBuffer.nds
File9=,1,E:\Dev\Projets\Static\Static.nds
[iDeaS]
Render3D=,3,5341619AF28E994D9702BD5575CBC22C
Audio Render=,3,FB7F4C91E15A024A81603D3AC531F63B
Renderer=,3,00000000000000000000000000000000
Wifi=,3,00000000000000000000000000000000
[iDeaS_Settings]
LastDirectory=,1,E:\Dev\PAlibExamples\3d\3DSprites\3D1024Sprites
LastDirectory=,1,E:\Dev\Projets\Static
EEPROMID=,4,000004F9
TouchSettings=,4,00000001
Language=,4,00000002
KEY_A=,4,0000005A
KEY_B=,4,00000041
KEY_A=,4,00000044
KEY_B=,4,00000053
KEY_SELECT=,4,00000010
KEY_START=,4,0000000D
KEY_RIGHT=,4,00000027
@ -28,7 +29,7 @@ KEY_UP=,4,00000026
KEY_DOWN=,4,00000028
KEY_R=,4,00000058
KEY_L=,4,00000057
KEY_X=,4,00000053
KEY_X=,4,0000005A
KEY_Y=,4,00000051
SkipFrames=,4,FFFFFFFF
DLDI=,4,000004F9

Binary file not shown.

View File

@ -1,15 +1,18 @@
Technical documentation
-----------------------
Product name : iDeaS
Current Version : 1.0.1.6
Current Version : 1.0.1.7
Supported platforms : Windows 95/98/Me/XP + OpenGL + DirectX 7.0 or higher
Supported platforms : Windows 95/98/Me/XP/Vista + OpenGL + DirectX 7.0 or higher
Windows NT4/2000 (not tested but should work...)
Author : Lino
Website : http://spazioinwind.libero.it/linoma/ideas.html
E-mail : linoma@gmail.com
E-mail : linoma@gmail.com
*** please do not send any questions on how to use or play games. ***
Emulation status
@ -30,6 +33,7 @@ Emulation status
* Horizontal/Vertical offset support
* FadeIn/FadeOut Effect support
* Alpha-blending Effect support
* Windows 0/1 support
- Affine Mode
* 16 colors support
* 256 colors support
@ -39,6 +43,7 @@ Emulation status
* Horizontal/Vertical offset support
* FadeIn/FadeOut Effect support
* Alpha-blending Effect support
* Windows 0/1 support
- Extended Mode
* 16 colors support
* 256 colors support
@ -50,6 +55,7 @@ Emulation status
* Horizontal/Vertical offset support
* FadeIn/FadeOut Effect support
* Alpha-blending Effect support
* Windows 0/1 support
- Large Mode
* 256 colors support
* 512x1024 up to 1024x512 tile maps support
@ -57,20 +63,58 @@ Emulation status
* Horizontal/Vertical offset support
* FadeIn/FadeOut Effect support
* Alpha-blending Effect support
* Windows 0/1 support
- OAM support
* Horizontal/Vertical position
* Horizontal/Vertical flip
* 8x8 up to 64x64 sprite size support
* 1D/2D sprite display support
* Rotation/Zoom
* Rotation/Zoom
* Bitmap sprite support
* FadeIn/FadeOut Effect support
* Alpha-blending Effect support
- 3D Mode
* Matrix Load/Multiply
* Polygon Attributes
* Polygon Definitions by Vertices
* Polygon Light Parameters
* Texture Attributes
* Texture Formats
* Texture Coordinates
* Texture Blending
* Status
* Tests
- WiFi
* Nothing.
- IPC
* Sync register and FIFO are emulated.
- SPI
* Firmware access is supported.
* Touchscreen access is supported.
* DS Cartridge Backup is supported.
* Microphone is supported.
- RTC
* Real Time Clock is emulated.
- Keys
* All keys are emulated.
- DMA
* All channels, nearly all modes.
- Timers
* All timers are emulated in both prescalar and count-up mode.
- Interrupts
* Vblank, Hblank, VCounter, DMA, FIFO, 3D FIFO and timer interrupts are emulated,
Special features
----------------
- FAT Emualtion R4DS revolution. (read only)
- ARM CPU debugger (100%)
- THUMB CPU debugger (100%)
* Step by step feature.
* Run to cursor feature.
* Run to next instruction feature.
* Edit memory.
* Enable and disable visualizzation layers.
* View Source Code in Debugger Window.
Acknowledgements (in no particular order)
-----------------------------------------

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<pd><ViewState><e p="PA_lib\PAlib\Emulators" x="false"></e><e p="PA_lib\PAlib\lib\arm7" x="true"></e><e p="PA_lib\PAlib\lib\arm7\temp" x="false"></e><e p="PA_lib\PAlib\lib\arm9" x="true"></e><e p="PA_lib\PAlib\lib\arm9\PA" x="true"></e><e p="PA_lib\PAlib\lib\arm9\PA\8bitText" x="false"></e><e p="PA_lib\PAlib\lib\arm9\PA\backup" x="false"></e><e p="PA_lib\PAlib\vham" x="false"></e><e p="PA_lib\PAlib" x="true"></e><e p="PA_lib\PAlib\lib" x="true"></e><e p="PA_lib\PAlib\lib\arm7\build" x="false"></e><e p="PA_lib\PAlib\lib\arm9\PA\Text" x="false"></e><e p="PA_lib\PAlib\lib\arm9\PA\broken" x="false"></e><e p="PA_lib\PAlib\include" x="true"></e><e p="PA_lib\PAlib\include\nds" x="true"></e><e p="PA_lib\PAlib\lib\arm9\PA\16c" x="false"></e><e p="PA_lib\PAlib\lib\arm9\PA\BgTrans" x="false"></e><e p="PA_lib\PAlib\Tools" x="false"></e><e p="PA_lib\PAlib\include\nds\arm9\gif" x="false"></e><e p="PA_lib\PAlib\include\nds\arm9\old" x="false"></e><e p="PA_lib\PAlib\lib\arm9\build" x="false"></e><e p="PA_lib\PAlib\include\nds\arm7" x="true"></e><e p="PA_lib\PAlib\include\nds\arm9" x="true"></e><e p="PA_lib\PAlib\lib\arm9\PA\API" x="false"></e><e p="PA_lib" x="true"></e><e p="PA_lib\PAlib\lib\arm9\PA\gif" x="false"></e></ViewState></pd>
<pd><ViewState><e p="PA_lib\PAlib\lib" x="true"></e><e p="PA_lib\PAlib\lib\arm7\temp" x="false"></e><e p="PA_lib\PAlib\vham" x="false"></e><e p="PA_lib\PAlib" x="true"></e><e p="PA_lib\PAlib\Tools" x="false"></e><e p="PA_lib\PAlib\lib\arm9\PA\Text" x="false"></e><e p="PA_lib\PAlib\lib\arm9\PA\backup" x="false"></e><e p="PA_lib\PAlib\lib\arm9\PA\gif" x="false"></e><e p="PA_lib" x="true"></e><e p="PA_lib\PAlib\include" x="true"></e><e p="PA_lib\PAlib\include\nds\arm9" x="true"></e><e p="PA_lib\PAlib\include\nds\arm9\gif" x="false"></e><e p="PA_lib\PAlib\lib\arm7" x="true"></e><e p="PA_lib\PAlib\lib\arm9\PA\8bitText" x="false"></e><e p="PA_lib\PAlib\lib\arm9\PA\BgTrans" x="false"></e><e p="PA_lib\PAlib\lib\arm9\PA\broken" x="false"></e><e p="PA_lib\PAlib\Emulators" x="false"></e><e p="PA_lib\PAlib\include\nds" x="true"></e><e p="PA_lib\PAlib\lib\arm9\PA" x="true"></e><e p="PA_lib\PAlib\lib\arm9\PA\API" x="false"></e><e p="PA_lib\PAlib\include\nds\arm7" x="true"></e><e p="PA_lib\PAlib\include\nds\arm9\old" x="false"></e><e p="PA_lib\PAlib\lib\arm9" x="true"></e><e p="PA_lib\PAlib\lib\arm9\PA\16c" x="false"></e></ViewState></pd>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -0,0 +1 @@
ImageSplitter img173.gif 192 192 64 64

View File

@ -38,7 +38,7 @@ extern inline void PA_Mic(void){
}
}
/*
extern inline void PA_SoundUpdates(void){
u8 channel;
@ -63,17 +63,44 @@ extern inline void PA_SoundUpdates(void){
SCHANNEL_PAN(channel) = SOUND_VOL(PA_IPC->Sound[channel].Pan&127);
PA_IPC->Sound[channel].Pan = 0;
}
/*
if(PA_IPC->Sound[channel].Pause){
SOUND_CR |= 1 << 15; // Pause
}*/
}
//modvolume = PA_IPC->Mod.Volume;
}*/
extern inline void PA_SoundUpdates(void){
u8 channel;
static PA_IPCSound Soundold[17];
if(PA_IPC->Sound[16].Volume!=Soundold[16].Volume) { // Change global sound volume
SOUND_CR = SOUND_ENABLE | SOUND_VOL(PA_IPC->Sound[16].Volume&127);
Soundold[16].Volume=PA_IPC->Sound[16].Volume;
}
if(PA_IPC->Sound[16].Busy){ // Change Brightness
PA_SetDSLiteBrightness(PA_IPC->Sound[16].Busy&3);
PA_IPC->Sound[16].Busy = 0; // don't change anymore...
}
for (channel = 0; channel < 16; channel++) {
PA_IPC->Sound[channel].Busy = SCHANNEL_CR(channel)>>31;
if(PA_IPC->Sound[channel].Volume!=Soundold[channel].Volume){ // If you need to change the sound volumes...
SCHANNEL_CR(channel) &= ~SOUND_VOL(127); // reset sound volume
SCHANNEL_CR(channel) |= SOUND_VOL(PA_IPC->Sound[channel].Volume&127);
Soundold[channel].Volume=PA_IPC->Sound[channel].Volume;
}
if(PA_IPC->Sound[channel].Pan!=Soundold[channel].Pan){ // If you need to change the sound volumes...
SCHANNEL_PAN(channel) = SOUND_VOL(PA_IPC->Sound[channel].Pan&127);
Soundold[channel].Pan = PA_IPC->Sound[channel].Pan;
}
/*
if(PA_IPC->Sound[channel].Pause){
SOUND_CR |= 1 << 15; // Pause
}*/
}
//modvolume = PA_IPC->Mod.Volume;
}
extern inline void PA_SoundPlay(u8 channel) {
SCHANNEL_TIMER(channel) = SOUND_FREQ(PA_IPC->Sound[channel].Rate);
SCHANNEL_SOURCE(channel) = (u32)PA_IPC->Sound[channel].Data;
@ -101,9 +128,10 @@ extern inline void PA_SoundProcess(void){
if(PA_IPC->Sound[i].Command) // Something to do...
{
if((PA_IPC->Sound[i].Command>>PAIPC_STOP)&1) PA_SoundStop(i);
if((PA_IPC->Sound[i].Command>>PAIPC_PLAY)&1) PA_SoundPlay(i); // play sound
if((PA_IPC->Sound[i].Command>>PAIPC_PLAY)&1) PA_SoundPlay(i); // play sound
PA_IPC->Sound[i].Command = 0;
}
PA_IPC->Sound[i].Command = 0;
}
}

View File

@ -31,12 +31,19 @@ typedef struct{
extern LetterPos16c PA_16cLetterPos;
typedef struct{
u8 linespacing;
u8 letterspacing;
u8 align;
} text16c_type;
extern text16c_type text16c;
#define ALIGN_LEFT 0
#define ALIGN_RIGHT 1
#define ALIGN_CENTER 2
#define ALIGN_JUSTIFY 3
extern u8 pa_16ctextalign;
@ -550,10 +557,15 @@ extern inline u8 PA_16cGetPixel(u8 screen, s16 x, s16 y){
extern inline void PA_16cTextAlign(u8 align){
pa_16ctextalign = align;
text16c.align = align;
}
extern inline void PA_16cTextLineSpacing(u8 spacing){
text16c.linespacing = spacing;
}
extern inline void PA_16cTextLetterSpacing(u8 spacing){
text16c.letterspacing = spacing;
}

View File

@ -116,7 +116,8 @@ void PA_Init8bitDblBuffer(u8 screen, u8 bg_priority);
*/
void PA_Init16bitBg(u8 screen, u8 bg_priority);
void PA_Init16bitDblBuffer(u8 screen, u8 bg_priority);
void PA_16bitSwapBuffer(u8 screen);
/*! \fn extern inline void PA_Put8bitPixel(u8 screen, s16 x, s16 y, u8 color)
\brief
@ -140,20 +141,11 @@ extern inline void PA_Put8bitPixel(u8 screen, s16 x, s16 y, u8 color) {
u8 decal = ((x&1)<<3);
PA_DrawBg[screen][pos] &= 0xff00>>decal;
PA_DrawBg[screen][pos] |= color<<decal;
//s32 pos = (x >> 1) + (y << 7);
//u16 pixel = PA_DrawBg[screen][pos];
//PA_DrawBg[screen][pos] = (color << ((x&1)<<3)) | (pixel&(0xFF00>>((x&1)<<3)));
/*if (x&1){
PA_DrawBg[screen][pos] = (color << 8) | (pixel&0x00FF);
}
else {
PA_DrawBg[screen][pos] = color | (pixel&0xFF00);
}*/
}
/*! \fn extern inline void PA_Put2_8bitPixels(u8 screen, s16 x, s16 y, u16 colors)
\brief
\~english Draw 2 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. WAY faster than drawing both pixels separately
@ -275,6 +267,7 @@ extern inline void PA_Put16bitPixel(u8 screen, s16 x, s16 y, u16 color) {
}
/*! \def PA_Get16bitPixel(x, y)
\brief
\~english Get the pixel's color in 16 bit Draw mode...

View File

@ -289,7 +289,7 @@ void PA_LoadBgPalN(u8 screen, u8 bg_number, u8 pal_number, void* palette);
\~english RGB value, like PA_RGB(31, 31, 31) for white
\~french Valeur RGB, comme PA_RGB(31, 31, 31) pour blanc
*/
#define PA_SetBgPalCol(screen, color_number, colorRGB) BG_PALETTE[color_number + (screen << 9)] = colorRGB
#define PA_SetBgPalCol(screen, color_number, colorRGB) BG_PALETTE[color_number + ((screen) << 9)] = colorRGB

View File

@ -44,6 +44,8 @@ typedef struct{
u8 minX, minY, maxX, maxY; // Shape limits
u8 startX, startY, endX, endY; // Start and end position
s16 Angle;
s32 Difference;
u8 Shape;
} PA_RecoInfos;
extern PA_RecoInfos PA_RecoInfo;

View File

@ -1215,6 +1215,7 @@ extern inline void PA_Set16bitSpriteAlpha(u8 screen, u8 sprite, u8 alpha){
*/
extern inline void PA_SetSpriteAnimEx(u8 screen, u8 sprite, u8 lx, u8 ly, u8 ncolors, s16 animframe){
u16 gfx = PA_GetSpriteGfx(screen, sprite);
spriteanims[screen][sprite].currentframe = animframe;
//PA_OutputText(1, 0, PA_Rand()&15, "%03d - %03d ", gfx, sprite);
PA_UpdateGfx(screen, gfx, (void*)(PA_SpriteAnimP[screen][gfx] + (animframe * (lx * ly) >> (2 - ncolors))));
}

Binary file not shown.

View File

@ -10,36 +10,9 @@
#include <dswifi7.h>
#include <nds.h>
#include <stdlib.h>
/*
#include <NDS/NDS.h>
#include <NDS/ARM7/BIOS.h>
#include <NDS/ARM7/touch.h>
#include <NDS/ARM7/clock.h>
*/
//////////////////////////////////////////////////////////////////////
/*
void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel, u8 vol, u8 pan, u8 format) {
SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate);
SCHANNEL_SOURCE(channel) = (uint32)data;
SCHANNEL_LENGTH(channel) = bytes >> 2;
SCHANNEL_REPEAT_POINT(channel) = 0;
SCHANNEL_CR(channel) = SCHANNEL_ENABLE | SOUND_ONE_SHOT | SOUND_VOL(vol) | SOUND_PAN(pan) | format;
}
s8 getFreeSoundChannel() {
int i;
for (i=0; i<16; i++) {
if ( (SCHANNEL_CR(i) & SOUND_ENABLE) == 0 ) return i;
}
return -1;
}
*/
void PA_IPCManage(void){
if(PA_SoundBusyInit){ // Sound ready to use...
@ -117,7 +90,20 @@ void VcountHandler() {
}
#define READ_DATA_REG1 0x65
#define READ_STATUS_REG1 0x61
void PA_rtcGetTime(uint8 * time) {
//---------------------------------------------------------------------------------
uint8 command, status;
time[0] = READ_DATA_REG1;
rtcTransaction(&(time[0]), 1, &(time[1]), 7);
command = READ_STATUS_REG1;
rtcTransaction(&command, 1, &status, 1);
time[0] = status;
}
//////////////////////////////////////////////////////////////////////
//u8 testvar = 0;
@ -141,7 +127,7 @@ void PA_VBL(void){
batt = touchRead(TSC_MEASURE_BATTERY);
// Read the time
rtcGetTime((uint8 *)ct);
PA_rtcGetTime((uint8 *)ct);
BCDToInteger((uint8 *)&(ct[1]), 7);
// Read the temperature

View File

@ -17,16 +17,7 @@ u8 pa_giftotextransp = 1;
u16 pa_giftotexcolor= PA_RGB(31, 0, 31);
u32 Blank[130000>>2];
extern const int PA_text_Info[3]; // BgMode, Width, Height
extern const unsigned short PA_text_Map[768] __attribute__ ((aligned (4))) ; // Pal : PA_text_Pal
extern const unsigned char PA_text_Tiles[6080] __attribute__ ((aligned (4))) ; // Pal : PA_text_Pal
extern const unsigned short PA_text_Pal[5] __attribute__ ((aligned (4)));
infos PA_UserInfo;
RTC PA_RTC; // Infos RTC...
volatile PA_IPCType PA_IPC;
@ -47,18 +38,6 @@ s16 PA_ScreenSpace; // Espace entre les 2
PA_GifInfos PA_GifInfo;
// Pour les fenetres
const s16 winfades[][4] = {
{4, 3, -4, -3},
{4, 0, -4, 0},
{8, 0, 0, 0},
{0, 0, -8, 0},
{0, 6, -8, 0},
{8, 0, 0, -6},
{0, 0, -8, -6},
{8, 6, 0, 0},
};
@ -84,148 +63,6 @@ typedef struct{
PA_IPCinfo PA_IPC;*/
//////////////////////////////////////////////////////////////////////
// Général
//////////////////////////////////////////////////////////////////////
void PA_Init2D(void){
// Turn on the screens and 2D cores and switch to mode 0
powerON(POWER_ALL);
// POWER_CR = POWER_ALL_2D;
REG_POWERCNT &= ~SWITCH_SCREENS; // on s'assure que l'écran est bien
/*
VRAM_A_CR=VRAM_ENABLE|VRAM_A_MAIN_BG;
VRAM_B_CR=VRAM_ENABLE|VRAM_B_MAIN_SPRITE;
VRAM_C_CR=VRAM_ENABLE|VRAM_C_SUB_BG;
VRAM_D_CR=VRAM_ENABLE|VRAM_D_SUB_SPRITE; */
videoSetMode( MODE_0_2D |
DISPLAY_SPR_ACTIVE | //turn on sprites
DISPLAY_SPR_1D | //this is used when in tile mode
DISPLAY_SPR_1D_SIZE_128|
DISPLAY_SPR_1D_BMP //and this in bitmap mode
);
videoSetModeSub( MODE_0_2D |
DISPLAY_SPR_ACTIVE | //turn on sprites
DISPLAY_SPR_1D | //this is used when in tile mode
DISPLAY_SPR_1D_SIZE_128|
DISPLAY_SPR_1D_BMP //and this in bitmap mode
);
// DISPLAY_CR = MODE_0_2D | DISPLAY_SPR_1D_LAYOUT | DISPLAY_SPR_ACTIVE|DISPLAY_SPR_1D_SIZE_128|DISPLAY_SPR_1D_BMP;
// SUB_DISPLAY_CR = MODE_0_2D | DISPLAY_SPR_1D_LAYOUT | DISPLAY_SPR_ACTIVE|DISPLAY_SPR_1D_SIZE_128|DISPLAY_SPR_1D_BMP;
vramSetMainBanks(VRAM_A_MAIN_SPRITE,VRAM_B_MAIN_BG_0x06000000,VRAM_C_SUB_BG,VRAM_D_SUB_SPRITE);
// Sprite inits...
PA_ResetSpriteSys(); // Init's the sprite system
PA_InitSpriteExtPal(); // Init's sprite extended palettes
PA_ResetBgSys();
PA_InitBgExtPal(); // Init's bg extended palettes
}
extern funcpointer MotionVBL;
void PA_Init(void) {
s32 i;
for (i = 0; i < 130000>>2; i++) Blank[i] = 0;
PA_Init2D();
pa_checklid = 1; // Autochecklid by default
//WAIT_CR &= ~(1 << 7);
PA_UpdateRTC();
PA_SRand(35329 + PA_RTC.Minutes + PA_RTC.Seconds + PA_RTC.Hour + PA_RTC.Day);
PA_VBLCountersReset();
Stylus.X = 128;
Stylus.Y = 96;
PA_VBLFunctionReset();
irqInit();
//PA_ResetInterrupts();
IPC->mailData = (u32)(&PA_IPC);
for (i = 0; i < 2; i++){
PA_SetBrightness(i, 0); // On affiche les écrans
PA_font[i] = 0;
// #ifndef TEXT_ALLCHARACTERS
PA_textmap[i] = (u16*)PA_text_Map;
PA_texttiles[i] = (u8*)PA_text_Tiles;
PA_textpal[i] = (u16*)PA_text_Pal;
// #endif
/* #ifdef TEXT_ALLCHARACTERS
PA_textmap[i] = (u16*)PA_text2_Map;
PA_texttiles[i] = (u8*)PA_text2_Tiles;
PA_textpal[i] = (u16*)PA_text2_Pal;
#endif */
}
PA_UpdateUserInfo();
PA_ResetRecoSys(); // Reco system init
PA_SetScreenSpace(48); // Default spacing
PA_GifInfo.StartFrame = 0; // start from the beginning
PA_GifInfo.EndFrame = 10000; // random high number
MotionVBL = PA_Nothing;
}
void PA_UpdateUserInfo(void) {
u8 i;
PA_UserInfo.Color = INFO_COLOR;
PA_UserInfo.BdayMonth = INFO_BDAY_MONTH;
PA_UserInfo.BdayDay = INFO_BDAY_DAY;
PA_UserInfo.BdayMonth = INFO_BDAY_MONTH;
PA_UserInfo.AlarmHour = INFO_ALARM_HOUR;
PA_UserInfo.AlarmMinute = INFO_ALARM_MINUTE;
PA_UserInfo.NameLength = INFO_NAME_LENGTH;
for (i = 0; i < PA_UserInfo.NameLength; i++) PA_UserInfo.Name[i] = *(u8*)(0x027FFC86 + (i << 1));
PA_UserInfo.Name[i] = 0; // Pour marquer la fin...
PA_UserInfo.MessageLength = INFO_MESSAGE_LENGTH;
for (i = 0; i < PA_UserInfo.MessageLength; i++) PA_UserInfo.Message[i] = *(u8*)(0x027FFC9C + (i << 1));
PA_UserInfo.Message[i] = 0; // Pour marquer la fin...
PA_UserInfo.Language = (INFO_LANGUAGE)&7;
}
void PA_UpdateRTC(void) {
u8 i;
u8 *temp;
temp = (u8*)&PA_RTC;
for (i = 0; i < 8; i++) temp[i] = IPC->time.curtime[i];
if (PA_RTC.Hour > 12) PA_RTC.Hour -= 40;
if (PA_RTC.OldSeconds != PA_RTC.Seconds){
PA_RTC.FPS = PA_RTC.Frames;
PA_RTC.Frames = 0;
PA_RTC.OldSeconds = PA_RTC.Seconds;
}
}

Binary file not shown.

View File

@ -23,7 +23,7 @@ extern "C" {
u8 c16policeheight[10];
text16c_type text16c = {1, 1, ALIGN_LEFT};
// Pointers...
u16 *PA_Draw16[2];
@ -69,7 +69,6 @@ void PA_Init16cBgEx(u8 screen, u8 bg, u8 npalette){
c16policeheight[2] = c16_text2_Height;
c16policeheight[3] = c16_text3_Height;
c16policeheight[4] = c16_text4_Height;
}
@ -80,8 +79,8 @@ extern inline void PA_AddLetterPos(s16 Letter, s16 x, s16 y){
extern inline s16 pa16csetbasex(s16 basex, s16 maxx, s16 linewidth){
if((pa_16ctextalign == ALIGN_LEFT)||(pa_16ctextalign == ALIGN_JUSTIFY)) return basex;
if(pa_16ctextalign == ALIGN_RIGHT) return (2+maxx-linewidth);
if((text16c.align == ALIGN_LEFT)||(text16c.align == ALIGN_JUSTIFY)) return basex;
if(text16c.align == ALIGN_RIGHT) return (2+maxx-linewidth);
return (1+((basex+maxx)>>1))-(linewidth>>1);
}
@ -99,7 +98,8 @@ void pa_16cTextDecompress(u8 size){
}
}
u8 pa_16ctextalign = ALIGN_LEFT;
s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text, u8 color, u8 size, s32 limit){
s16 i, j;
@ -109,7 +109,7 @@ s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text,
pa_16cTextDecompress(size);
ly = c16policeheight[size];
ly = c16policeheight[size]+text16c.linespacing;
x = basex;
y = basey;
@ -129,7 +129,7 @@ s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text,
linewidth[0] = 0;
nspaces[0] = 0;
if(pa_16ctextalign != ALIGN_LEFT){
if(text16c.align != ALIGN_LEFT){
for (i = 0; (text[i] && y <= ylimiy && i < limit); i++) {
if (text[i] == '\n'){
@ -149,7 +149,7 @@ s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text,
while(!((text[i+wordletter] <= 32) || (i + wordletter >= limit+100))) { // >= 32, donc si 0, '\n', on ' ' :)
letter = text[i+wordletter];
lx = pa16cdefaultsize[size][letter];
lx = pa16cdefaultsize[size][letter]+text16c.letterspacing;
wordx += lx;
wordletter++;
}
@ -171,7 +171,7 @@ s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text,
for (j = i; j < jmax; j++) {
letter = text[j];
lx = pa16cdefaultsize[size][letter];
lx = pa16cdefaultsize[size][letter]+text16c.letterspacing;
linewidth[nlines]+=lx;
x += lx;
}
@ -219,7 +219,7 @@ s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text,
while(!((text[i+wordletter] <= 32) || (i + wordletter >= limit+100))) { // >= 32, donc si 0, '\n', on ' ' :)
letter = text[i+wordletter];
lx = pa16cdefaultsize[size][letter];
lx = pa16cdefaultsize[size][letter]+text16c.letterspacing;
wordx += lx;
wordletter++;
}
@ -242,14 +242,14 @@ s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text,
for (j = i; (j < jmax)&&(j<limit); j++) {
letter = text[j];
lx = pa16cdefaultsize[size][letter];
lx = pa16cdefaultsize[size][letter]+text16c.letterspacing;
PA_16cLetter(screen, x-basex+startx, y, letter, size, color);
PA_AddLetterPos(j, x-basex+startx, y);
x += lx;
}
i=j-1;
if ((pa_16ctextalign == ALIGN_JUSTIFY)&&(text[i+1] != '\n')&&(nlines != lastline)){ // Justifiy
if ((text16c.align == ALIGN_JUSTIFY)&&(text[i+1] != '\n')&&(nlines != lastline)){ // Justifiy
s16 diff = (((2+maxx-basex)-linewidth[nlines])/(nspaces[nlines]-1))+0.5;
x+= diff;
linewidth[nlines]+=diff;

16
PAlib/lib/arm9/PA/PA_2D.c Normal file
View File

@ -0,0 +1,16 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <PA9.h>
#ifdef __cplusplus
}
#endif

View File

@ -540,120 +540,6 @@ currentsprite++; // next sprite...
}
/*
int PAglTexImage2D(int target, int empty1, int type, int sizeX, int sizeY, int empty2, int param, uint8* texture) ;
u16 PA_3DCreate16bitGfx(void *gfx, s16 width, s16 height){
// glBindTexture(0, pa_ntextures);
s16 currenttex = pa_ntextures;
pa_ntextures++;
GFX_TEX_FORMAT = textures[currenttex];
activeTexture = currenttex;
PAglTexImage2D(0, 0, GL_RGBA, width , height, 0, TEXGEN_TEXCOORD, (u8*)gfx);
return currenttex;
}
u16 PA_3DCreateGfx(void *gfx, s16 width, s16 height){
// glBindTexture(0, pa_ntextures);
s16 currenttex = pa_ntextures;
pa_ntextures++;
GFX_TEX_FORMAT = textures[currenttex];
activeTexture = currenttex;
PAglTexImage2D(0, 0, GL_RGB256, width , height, 0, TEXGEN_TEXCOORD, (u8*)gfx);
return currenttex;
}
u16 PA_3DCreate16colGfx(void *gfx, s16 width, s16 height){
// glBindTexture(0, pa_ntextures);
s16 currenttex = pa_ntextures;
pa_ntextures++;
GFX_TEX_FORMAT = textures[currenttex];
activeTexture = currenttex;
PAglTexImage2D(0, 0, GL_RGB16, width , height, 0, TEXGEN_TEXCOORD, (u8*)gfx);
return currenttex;
}
u16 PA_3DCreate4colGfx(void *gfx, s16 width, s16 height){
// glBindTexture(0, pa_ntextures);
s16 currenttex = pa_ntextures;
pa_ntextures++;
GFX_TEX_FORMAT = textures[currenttex];
activeTexture = currenttex;
PAglTexImage2D(0, 0, GL_RGB4, width , height, 0, TEXGEN_TEXCOORD, (u8*)gfx);
return currenttex;
}
int PAglTexImage2D(int target, int empty1, int type, int sizeX, int sizeY, int empty2, int param, uint8* texture) {
uint32 size = 0;
uint32* addr;
size = 1 << (sizeX + sizeY + 6);
switch (type) {
case GL_RGB:
case GL_RGBA:
size = size << 1;
break;
case GL_RGB4:
size = size >> 2;
break;
case GL_RGB16:
size = size >> 1;
break;
default:
break;
}
addr = pa_3dnextblock;
pa_3dnextblock += size >> 2;
//addr = getNextTextureSlot(size);
if(!addr)
return 0;
// unlock texture memory
// vramTemp = vramSetMainBanks(VRAM_A_LCD,VRAM_B_LCD,VRAM_C_LCD,VRAM_D_LCD);
vramSetBankA(VRAM_A_LCD);
if (type == GL_RGB) {
// We do GL_RGB as GL_RGBA, but we set each alpha bit to 1 during the copy
u16 * src = (u16*)texture;
u16 * dest = (u16*)addr;
PA_glTexParameter(sizeX, sizeY, addr, GL_RGBA, param);
while (size--) {
*dest++ = *src | (1 << 15);
src++;
}
} else {
// For everything else, we do a straight copy
PA_glTexParameter(sizeX, sizeY, addr, type, param);
swiCopy((uint32*)texture, addr , size / 4 | COPY_MODE_WORD);
}
vramSetBankA(VRAM_A_TEXTURE);
return 1;
}
*/
void PA_3DStartSpriteAnimEx(u8 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles)
{

View File

@ -6,12 +6,10 @@ extern "C" {
#include "PA9.h"
void PA_Init16bitBg(u8 screen, u8 bg_priority){
PA_DeleteBg(screen, 3);
PA_nBit[screen] = 1; // 16 bit
void PA_Default16bitInit(u8 screen, u8 bg_priority){
PA_DeleteBg(screen, 3);
PA_nBit[screen] = 1; // 16 bit
PA_BGXPA(screen, 3) = 1 << 8;
PA_BGXPB(screen, 3) = 0;
PA_BGXPC(screen, 3) = 0;
@ -19,6 +17,14 @@ PA_nBit[screen] = 1; // 16 bit
PA_BGXX(screen, 3) = 0;
PA_BGXY(screen, 3) = 0;
_REG16(REG_BGSCREEN(screen)) &= ~7;
_REG16(REG_BGSCREEN(screen)) |= (0x100 << (3)) | MODE_3_2D;
}
void PA_Init16bitBg(u8 screen, u8 bg_priority){
PA_Default16bitInit(screen, bg_priority);
PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 128 * 256);
PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen];
DMA_Copy(Blank, (void*)PA_DrawBg[screen], 256*192, DMA_16NOW);
@ -26,217 +32,43 @@ PA_nBit[screen] = 1; // 16 bit
//this is just used so we can write red color bits to one frame and green to the
//other
charsetstart[screen] = 2; // On se réserve la moitié de la mémoire...
charblocks[screen][16] = 1; // Block la mémoire
charsetstart[screen] = 2; // On se réserve la moitié de la mémoire...
charblocks[screen][16] = 1; // Block la mémoire
_REG16(REG_BGSCREEN(screen)) &= ~7;
_REG16(REG_BGSCREEN(screen)) |= (0x100 << (3)) | MODE_3_2D;
_REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP16_256x256 | BG_BMP_BASE(2);
PA_SetDrawSize(screen, 1);
}
void PA_Draw16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color){
int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py;
dx=x2-x1; /* the horizontal distance of the line */
dy=y2-y1; /* the vertical distance of the line */
dxabs = dx;
sdx = 1;
if (dx < 0) {
dxabs = -dx;
sdx = -1;
}
dyabs = dy;
sdy = 1;
if (dy < 0) {
dyabs = -dy;
sdy = -1;
}
x=dyabs>>1;
y=dxabs>>1;
px=x1;
py=y1;
PA_Put16bitPixel(screen, px, py, color);
if (dxabs>=dyabs) {
for(i=0;i<dxabs;i++) {
y+=dyabs;
if (y>=dxabs) {
y-=dxabs;
py+=sdy;
}
px+=sdx;
PA_Put16bitPixel(screen, px, py, color);
}
}
else {
for(i=0;i<dyabs;i++) {
x+=dxabs;
if (x>=dyabs) {
x-=dyabs;
px+=sdx;
}
py+=sdy;
PA_Put16bitPixel(screen, px, py, color);
}
}
}
u8 pa16bitbuffer[2];
void PA_Init16bitDblBuffer(u8 screen, u8 bg_priority){
PA_Default16bitInit(screen, bg_priority);
void PA_16bitDraw(u8 screen, u16 color){
s16 i, j, low, high;
u16 x, y;
if (Stylus.Held){
x = Stylus.X;
y = Stylus.Y;
i = 0;
j = 0;
low = (PA_drawsize[screen] >> 1) - PA_drawsize[screen]+1;
high = (PA_drawsize[screen] >> 1)+1;
// Si nouvelle pression, on fait juste un point. Sinon, on trace un trait entre les 2 points...
if (Stylus.Newpress) {
for (i = low; i < high; i++)
for (j = low; j < high; j++)
if ((x+i > 0) && (y+j > 0) && (x+i < 256) && (y+j < 192))
PA_Put16bitPixel(screen, x+i, y+j, color);
}
else {
PA_Draw16bitLineEx(screen, x, y, PA_oldx[screen], PA_oldy[screen], color, PA_drawsize[screen]);
}
PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y;
}
}
void PA_Draw16bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color, s8 size){
s8 low = (size >> 1) - size +1;
s8 high = (size >> 1)+1;
s16 i, j;
s16 x1, x2, y1, y2;
for (i = low; i < high; i++){
for (j = low; j < high; j++){
if ((basex+i >= 0) && (basey+j >= 0)&&(basex+i < 256) && (basey+j < 192)){
PA_Put16bitPixel(screen, basex+i, basey+j, color);
}
}
}
for (i = low; i < high; i++){
j = low;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw16bitLine(screen, x1, y1, x2, y2, color);
DMA_Copy(Blank, (0x06000000 + (0x200000 * screen)), 256*384, DMA_16NOW);
PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + 192 * 512);
PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen];
j = high-1;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw16bitLine(screen, x1, y1, x2, y2, color);
pa16bitbuffer[screen] = 0; // First buffer...
charsetstart[screen] = 0; // On se réserve la moitié de la mémoire...
_REG16(REG_BGCNT(screen, 3)) = bg_priority | BG_BMP16_256x256 | BG_BMP_BASE(0);
PA_SetDrawSize(screen, 1);
vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000,VRAM_B_MAIN_BG_0x06020000,VRAM_C_SUB_BG,VRAM_D_SUB_SPRITE);
}
for (j = low; j < high; j++){
i = low;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw16bitLine(screen, x1, y1, x2, y2, color);
i = high-1;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw16bitLine(screen, x1, y1, x2, y2, color);
void PA_16bitSwapBuffer(u8 screen){
pa16bitbuffer[screen] = !pa16bitbuffer[screen];
PA_DrawBg[screen] = (u16*)(0x06000000 + (0x200000 * screen) + (192-pa16bitbuffer[screen]*192) * 512);
PA_DrawBg32[screen] = (u32*)PA_DrawBg[screen];
_REG16(REG_BGCNT(screen, 3)) &= ~(BG_BMP_BASE(7));
_REG16(REG_BGCNT(screen, 3)) |= BG_BMP_BASE(pa16bitbuffer[screen]*6);
}
}
void PA_Draw16bitRect(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color){
s16 i, j;
// On met dans le bon ordre...
if (endx < basex) {
i = basex; basex = endx; endx = i;
}
if (basex < 0) basex = 0;
if (endx > 255) endx = 255;
s16 lx = endx - basex;
if (lx){ // Si y'a une surface à faire
if (endy < basey) {
i = basey; basey = endy; endy = i;
}
if (basey < 0) basey = 0;
if (endy > 191) endy = 191;
//u16 *start = (u16*)PA_DrawBg[screen] + basex;
//tempvar = color;
for (j = basey; j < endy; j++){
for(i = basex; i < endx; i++){
PA_Put16bitPixel(screen, i, j, color);
//DMA_Force(tempvar, (void*)(start + (j << 8)), lx, DMA_16NOW);
}
}
}
}
/*
void PA_DrawCircle(int xCenter, int yCenter, int radius, int color){
int x = 0;
int y = radius;
int p = 3 - 2 * radius;
while (x <= y){
PA_DrawPixel(xCenter + x, yCenter + y, color);
PA_DrawPixel(xCenter - x, yCenter + y, color);
PA_DrawPixel(xCenter + x, yCenter - y, color);
PA_DrawPixel(xCenter - x, yCenter - y, color);
PA_DrawPixel(xCenter + y, yCenter + x, color);
PA_DrawPixel(xCenter - y, yCenter + x, color);
PA_DrawPixel(xCenter + y, yCenter - x, color);
PA_DrawPixel(xCenter - y, yCenter - x, color);
if (p < 0) p += 4 * x++ + 6;
else p += 4 * (x++ - y--) + 10;
}
}
*/
#ifdef __cplusplus
}

View File

@ -0,0 +1,212 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "PA9.h"
void PA_Draw16bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color){
int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py;
dx=x2-x1; /* the horizontal distance of the line */
dy=y2-y1; /* the vertical distance of the line */
dxabs = dx;
sdx = 1;
if (dx < 0) {
dxabs = -dx;
sdx = -1;
}
dyabs = dy;
sdy = 1;
if (dy < 0) {
dyabs = -dy;
sdy = -1;
}
x=dyabs>>1;
y=dxabs>>1;
px=x1;
py=y1;
PA_Put16bitPixel(screen, px, py, color);
if (dxabs>=dyabs) {
for(i=0;i<dxabs;i++) {
y+=dyabs;
if (y>=dxabs) {
y-=dxabs;
py+=sdy;
}
px+=sdx;
PA_Put16bitPixel(screen, px, py, color);
}
}
else {
for(i=0;i<dyabs;i++) {
x+=dxabs;
if (x>=dyabs) {
x-=dyabs;
px+=sdx;
}
py+=sdy;
PA_Put16bitPixel(screen, px, py, color);
}
}
}
void PA_16bitDraw(u8 screen, u16 color){
s16 i, j, low, high;
u16 x, y;
if (Stylus.Held){
x = Stylus.X;
y = Stylus.Y;
i = 0;
j = 0;
low = (PA_drawsize[screen] >> 1) - PA_drawsize[screen]+1;
high = (PA_drawsize[screen] >> 1)+1;
// Si nouvelle pression, on fait juste un point. Sinon, on trace un trait entre les 2 points...
if (Stylus.Newpress) {
for (i = low; i < high; i++)
for (j = low; j < high; j++)
if ((x+i > 0) && (y+j > 0) && (x+i < 256) && (y+j < 192))
PA_Put16bitPixel(screen, x+i, y+j, color);
}
else {
PA_Draw16bitLineEx(screen, x, y, PA_oldx[screen], PA_oldy[screen], color, PA_drawsize[screen]);
}
PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y;
}
}
void PA_Draw16bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color, s8 size){
s8 low = (size >> 1) - size +1;
s8 high = (size >> 1)+1;
s16 i, j;
s16 x1, x2, y1, y2;
for (i = low; i < high; i++){
for (j = low; j < high; j++){
if ((basex+i >= 0) && (basey+j >= 0)&&(basex+i < 256) && (basey+j < 192)){
PA_Put16bitPixel(screen, basex+i, basey+j, color);
}
}
}
for (i = low; i < high; i++){
j = low;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw16bitLine(screen, x1, y1, x2, y2, color);
j = high-1;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw16bitLine(screen, x1, y1, x2, y2, color);
}
for (j = low; j < high; j++){
i = low;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw16bitLine(screen, x1, y1, x2, y2, color);
i = high-1;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw16bitLine(screen, x1, y1, x2, y2, color);
}
}
void PA_Draw16bitRect(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color){
s16 i, j;
// On met dans le bon ordre...
if (endx < basex) {
i = basex; basex = endx; endx = i;
}
if (basex < 0) basex = 0;
if (endx > 255) endx = 255;
s16 lx = endx - basex;
if (lx){ // Si y'a une surface à faire
if (endy < basey) {
i = basey; basey = endy; endy = i;
}
if (basey < 0) basey = 0;
if (endy > 191) endy = 191;
//u16 *start = (u16*)PA_DrawBg[screen] + basex;
//tempvar = color;
for (j = basey; j < endy; j++){
for(i = basex; i < endx; i++){
PA_Put16bitPixel(screen, i, j, color);
//DMA_Force(tempvar, (void*)(start + (j << 8)), lx, DMA_16NOW);
}
}
}
}
/*
void PA_DrawCircle(int xCenter, int yCenter, int radius, int color){
int x = 0;
int y = radius;
int p = 3 - 2 * radius;
while (x <= y){
PA_DrawPixel(xCenter + x, yCenter + y, color);
PA_DrawPixel(xCenter - x, yCenter + y, color);
PA_DrawPixel(xCenter + x, yCenter - y, color);
PA_DrawPixel(xCenter - x, yCenter - y, color);
PA_DrawPixel(xCenter + y, yCenter + x, color);
PA_DrawPixel(xCenter - y, yCenter + x, color);
PA_DrawPixel(xCenter + y, yCenter - x, color);
PA_DrawPixel(xCenter - y, yCenter - x, color);
if (p < 0) p += 4 * x++ + 6;
else p += 4 * (x++ - y--) + 10;
}
}
*/
#ifdef __cplusplus
}
#endif

View File

@ -7,11 +7,6 @@ extern "C" {
void PA_Draw8bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u8 color, s8 size);
void PA_Default8bitInit(u8 screen, u8 bg_priority){
PA_DeleteBg(screen, 3);
PA_nBit[screen] = 0; // 8 bit
@ -93,165 +88,6 @@ void PA_Init8bitDblBuffer(u8 screen, u8 bg_priority){
void PA_Draw8bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u8 color){
int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py;
dx=x2-x1; /* the horizontal distance of the line */
dy=y2-y1; /* the vertical distance of the line */
dxabs = dx;
sdx = 1;
if (dx < 0) {
dxabs = -dx;
sdx = -1;
}
dyabs = dy;
sdy = 1;
if (dy < 0) {
dyabs = -dy;
sdy = -1;
}
x=dyabs>>1;
y=dxabs>>1;
px=x1;
py=y1;
PA_Put8bitPixel(screen, px, py, color);
if (dxabs>=dyabs) {
for(i=0;i<dxabs;i++) {
y+=dyabs;
if (y>=dxabs) {
y-=dxabs;
py+=sdy;
}
px+=sdx;
PA_Put8bitPixel(screen, px, py, color);
}
}
else {
for(i=0;i<dyabs;i++) {
x+=dxabs;
if (x>=dyabs) {
x-=dyabs;
px+=sdx;
}
py+=sdy;
PA_Put8bitPixel(screen, px, py, color);
}
}
}
void PA_8bitDraw(u8 screen, u8 color){
s16 i, j, low, high;
u16 x, y;
if (Stylus.Held){
x = Stylus.X;
y = Stylus.Y;
i = 0;
j = 0;
low = (PA_drawsize[screen] >> 1) - PA_drawsize[screen]+1;
high = (PA_drawsize[screen] >> 1)+1;
// Si nouvelle pression, on fait juste un point. Sinon, on trace un trait entre les 2 points...
if (Stylus.Newpress) {
for (i = low; i < high; i++)
for (j = low; j < high; j++)
if ((x+i >= 0) && (y+j >= 0) && (x+i < 256) && (y+j < 192))
PA_Put8bitPixel(screen, x+i, y+j, color);
}
else {
PA_Draw8bitLineEx(screen, x, y, PA_oldx[screen], PA_oldy[screen], color, PA_drawsize[screen]);
}
PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y;
}
}
void PA_Draw8bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u8 color, s8 size){
s8 low = (size >> 1) - size+1;
s8 high = (size >> 1)+1;
s16 i, j;
s16 x1, x2, y1, y2;
for (i = low; i < high; i++){
for (j = low; j < high; j++){
if ((basex+i >= 0) && (basey+j >= 0)&&(basex+i < 256) && (basey+j < 192)){
PA_Put8bitPixel(screen, basex+i, basey+j, color);
}
}
}
for (i = low; i < high; i++){
j = low;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw8bitLine(screen, x1, y1, x2, y2, color);
j = high-1;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw8bitLine(screen, x1, y1, x2, y2, color);
}
for (j = low; j < high; j++){
i = low;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw8bitLine(screen, x1, y1, x2, y2, color);
i = high-1;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw8bitLine(screen, x1, y1, x2, y2, color);
}
}
/*
void PA_DrawCircle(int xCenter, int yCenter, int radius, int color){
int x = 0;
int y = radius;
int p = 3 - 2 * radius;
while (x <= y){
PA_DrawPixel(xCenter + x, yCenter + y, color);
PA_DrawPixel(xCenter - x, yCenter + y, color);
PA_DrawPixel(xCenter + x, yCenter - y, color);
PA_DrawPixel(xCenter - x, yCenter - y, color);
PA_DrawPixel(xCenter + y, yCenter + x, color);
PA_DrawPixel(xCenter - y, yCenter + x, color);
PA_DrawPixel(xCenter + y, yCenter - x, color);
PA_DrawPixel(xCenter - y, yCenter - x, color);
if (p < 0) p += 4 * x++ + 6;
else p += 4 * (x++ - y--) + 10;
}
}
*/
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,172 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "PA9.h"
void PA_Draw8bitLine(u8 screen, u16 x1, u16 y1, u16 x2, u16 y2, u8 color){
int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py;
dx=x2-x1; /* the horizontal distance of the line */
dy=y2-y1; /* the vertical distance of the line */
dxabs = dx;
sdx = 1;
if (dx < 0) {
dxabs = -dx;
sdx = -1;
}
dyabs = dy;
sdy = 1;
if (dy < 0) {
dyabs = -dy;
sdy = -1;
}
x=dyabs>>1;
y=dxabs>>1;
px=x1;
py=y1;
PA_Put8bitPixel(screen, px, py, color);
if (dxabs>=dyabs) {
for(i=0;i<dxabs;i++) {
y+=dyabs;
if (y>=dxabs) {
y-=dxabs;
py+=sdy;
}
px+=sdx;
PA_Put8bitPixel(screen, px, py, color);
}
}
else {
for(i=0;i<dyabs;i++) {
x+=dxabs;
if (x>=dyabs) {
x-=dyabs;
px+=sdx;
}
py+=sdy;
PA_Put8bitPixel(screen, px, py, color);
}
}
}
void PA_8bitDraw(u8 screen, u8 color){
s16 i, j, low, high;
u16 x, y;
if (Stylus.Held){
x = Stylus.X;
y = Stylus.Y;
i = 0;
j = 0;
low = (PA_drawsize[screen] >> 1) - PA_drawsize[screen]+1;
high = (PA_drawsize[screen] >> 1)+1;
// Si nouvelle pression, on fait juste un point. Sinon, on trace un trait entre les 2 points...
if (Stylus.Newpress) {
for (i = low; i < high; i++)
for (j = low; j < high; j++)
if ((x+i >= 0) && (y+j >= 0) && (x+i < 256) && (y+j < 192))
PA_Put8bitPixel(screen, x+i, y+j, color);
}
else {
PA_Draw8bitLineEx(screen, x, y, PA_oldx[screen], PA_oldy[screen], color, PA_drawsize[screen]);
}
PA_oldx[screen] = Stylus.X; PA_oldy[screen] = Stylus.Y;
}
}
void PA_Draw8bitLineEx(u8 screen, s16 basex, s16 basey, s16 endx, s16 endy, u8 color, s8 size){
s8 low = (size >> 1) - size+1;
s8 high = (size >> 1)+1;
s16 i, j;
s16 x1, x2, y1, y2;
for (i = low; i < high; i++){
for (j = low; j < high; j++){
if ((basex+i >= 0) && (basey+j >= 0)&&(basex+i < 256) && (basey+j < 192)){
PA_Put8bitPixel(screen, basex+i, basey+j, color);
}
}
}
for (i = low; i < high; i++){
j = low;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw8bitLine(screen, x1, y1, x2, y2, color);
j = high-1;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw8bitLine(screen, x1, y1, x2, y2, color);
}
for (j = low; j < high; j++){
i = low;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw8bitLine(screen, x1, y1, x2, y2, color);
i = high-1;
x1 = basex+i; x2 = endx+i; y1 = basey+j; y2 = endy+j;
while(x1 < 0) x1++; while(x1 > 255) x1--;
while(x2 < 0) x2++; while(x2 > 255) x2--;
while(y1 < 0) y1++; while(y1 > 191) y1--;
while(y2 < 0) y2++; while(y2 > 191) y2--;
PA_Draw8bitLine(screen, x1, y1, x2, y2, color);
}
}
/*
void PA_DrawCircle(int xCenter, int yCenter, int radius, int color){
int x = 0;
int y = radius;
int p = 3 - 2 * radius;
while (x <= y){
PA_DrawPixel(xCenter + x, yCenter + y, color);
PA_DrawPixel(xCenter - x, yCenter + y, color);
PA_DrawPixel(xCenter + x, yCenter - y, color);
PA_DrawPixel(xCenter - x, yCenter - y, color);
PA_DrawPixel(xCenter + y, yCenter + x, color);
PA_DrawPixel(xCenter - y, yCenter + x, color);
PA_DrawPixel(xCenter + y, yCenter - x, color);
PA_DrawPixel(xCenter - y, yCenter - x, color);
if (p < 0) p += 4 * x++ + 6;
else p += 4 * (x++ - y--) + 10;
}
}
*/
#ifdef __cplusplus
}
#endif

View File

@ -284,76 +284,6 @@ u16 spritepal[256]; // sprite decoding palette
u8* PA_GifToTiles(void *gif, u16 *temppal){
u8 zero = 0;
u16 width = PA_GetGifWidth(gif);
u16 height = PA_GetGifHeight(gif);
u8 *decodgif = (u8*)malloc(width*height);
u8 *newtiles = (u8*)malloc(width*height);
DMA_Force(zero, decodgif, (width*height)>>1, DMA_16NOW); // Blank out the gif
DecodeGif((const u8*)gif, decodgif, temppal, 0, width);
s32 i, j, tile;
tile = 0;
s32 tempx, tempy;
tempx = 0; tempy = 0;
u16 temp;
u16 tilemax = (width*height)>>6;
for (tile = 0; tile < tilemax; tile++){
//tileexists[0][tile] = 0;
for (i = 0; i < 8; i++){ // put the right transp color
for (j = 0; j < 8; j++) {
temp = decodgif[tempx + i + ((tempy+j)*width)];
/*if (temp == 0) temp = pal0;
else if (temp == pal0) temp = 0;*/
newtiles[(tile<<6) + i + (j<<3)] = temp;
//tileexists[0][tile] |= temp;
}
}
tempx += 8;
if (tempx >= width) {
tempy += 8;
tempx = 0;
}
}
if(pa_giftotextransp){
// Scan palette for magenta...
s16 magenta = 0;
u32 pos = 0;
while((magenta < 255) && ((temppal[magenta]|(1<<15)) != pa_giftotexcolor)) magenta++;
if(magenta == 256) magenta = 255;
temppal[magenta] = temppal[0];
if(magenta != 0){
for(j = 0; j < height; j++){
pos = j*width;
for(i = 0; i < width; i++){
if(newtiles[pos] == 0){
newtiles[pos] = magenta;
}
else if(newtiles[pos] == magenta){
newtiles[pos] = 0;
}
pos++;
}
}
}
}
free(decodgif); // free the malloc
return (newtiles);
}

View File

@ -0,0 +1,124 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <PA9.h>
extern u8 pa_giftotextransp;
extern u16 pa_giftotexcolor;
u8* PA_GifToTiles(void *gif, u16 *temppal){
u8 zero = 0;
u16 width = PA_GetGifWidth(gif);
u16 height = PA_GetGifHeight(gif);
u8 *decodgif = (u8*)malloc(width*height);
u8 *newtiles = (u8*)malloc(width*height);
DMA_Force(zero, decodgif, (width*height)>>1, DMA_16NOW); // Blank out the gif
DecodeGif((const u8*)gif, decodgif, temppal, 0, width);
s32 i, j, tile;
tile = 0;
s32 tempx, tempy;
tempx = 0; tempy = 0;
u16 temp;
u16 tilemax = (width*height)>>6;
for (tile = 0; tile < tilemax; tile++){
//tileexists[0][tile] = 0;
for (i = 0; i < 8; i++){ // put the right transp color
for (j = 0; j < 8; j++) {
temp = decodgif[tempx + i + ((tempy+j)*width)];
/*if (temp == 0) temp = pal0;
else if (temp == pal0) temp = 0;*/
newtiles[(tile<<6) + i + (j<<3)] = temp;
//tileexists[0][tile] |= temp;
}
}
tempx += 8;
if (tempx >= width) {
tempy += 8;
tempx = 0;
}
}
if(pa_giftotextransp){
// Scan palette for magenta...
s16 magenta = 0;
u32 pos = 0;
while((magenta < 255) && ((temppal[magenta]|(1<<15)) != pa_giftotexcolor)) magenta++;
if(magenta == 256) magenta = 255;
temppal[magenta] = temppal[0];
if(magenta != 0){
for(j = 0; j < height; j++){
pos = j*width;
for(i = 0; i < width; i++){
if(newtiles[pos] == 0){
newtiles[pos] = magenta;
}
else if(newtiles[pos] == magenta){
newtiles[pos] = 0;
}
pos++;
}
}
}
}
free(decodgif); // free the malloc
return (newtiles);
}
/*
PA_GifToTiles((void*)mario_old, (u8*)spritegfx, spritepal, 64, 64);
PA_LoadSpritePal(0, 0, (void*)spritepal);
PA_CreateSprite(0, 0, (void*)spritegfx, OBJ_SIZE_64X64, 1, 0, 128, 64);
PA_SetSpritePrio(0, 0, 3);
PA_SetSpriteDblsize(0, 0, 1);
PA_SetSpriteRotEnable(0,0,0);
PA_SetRotset(0, 0, 0, 128, 128);
//Background
PA_LoadGif(0, skinALL[skinnumber].back);
//Tiles
PA_GifToTiles(skinALL[skinnumber].gif, (u8*)tiles[0], palette, 128, 128);
PA_LoadBg(0, 2, tiles[0], 256*8*8, Blank, BG_256X256, 0, 1);
PA_LoadBgPal(0, 2, (void*)palette);
*/
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,143 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <PA9.h>
extern const int PA_text_Info[3]; // BgMode, Width, Height
extern const unsigned short PA_text_Map[768] __attribute__ ((aligned (4))) ; // Pal : PA_text_Pal
extern const unsigned char PA_text_Tiles[6080] __attribute__ ((aligned (4))) ; // Pal : PA_text_Pal
extern const unsigned short PA_text_Pal[5] __attribute__ ((aligned (4)));
// Pour les fenetres
const s16 winfades[][4] = {
{4, 3, -4, -3},
{4, 0, -4, 0},
{8, 0, 0, 0},
{0, 0, -8, 0},
{0, 6, -8, 0},
{8, 0, 0, -6},
{0, 0, -8, -6},
{8, 6, 0, 0},
};
void PA_UpdateSpriteVBL(void);
extern funcpointer SpriteVBL;
void PA_Init2D(void){
// Turn on the screens and 2D cores and switch to mode 0
powerON(POWER_ALL);
// POWER_CR = POWER_ALL_2D;
REG_POWERCNT &= ~SWITCH_SCREENS; // on s'assure que l'écran est bien
/*
VRAM_A_CR=VRAM_ENABLE|VRAM_A_MAIN_BG;
VRAM_B_CR=VRAM_ENABLE|VRAM_B_MAIN_SPRITE;
VRAM_C_CR=VRAM_ENABLE|VRAM_C_SUB_BG;
VRAM_D_CR=VRAM_ENABLE|VRAM_D_SUB_SPRITE; */
videoSetMode( MODE_0_2D |
DISPLAY_SPR_ACTIVE | //turn on sprites
DISPLAY_SPR_1D | //this is used when in tile mode
DISPLAY_SPR_1D_SIZE_128|
DISPLAY_SPR_1D_BMP //and this in bitmap mode
);
videoSetModeSub( MODE_0_2D |
DISPLAY_SPR_ACTIVE | //turn on sprites
DISPLAY_SPR_1D | //this is used when in tile mode
DISPLAY_SPR_1D_SIZE_128|
DISPLAY_SPR_1D_BMP //and this in bitmap mode
);
// DISPLAY_CR = MODE_0_2D | DISPLAY_SPR_1D_LAYOUT | DISPLAY_SPR_ACTIVE|DISPLAY_SPR_1D_SIZE_128|DISPLAY_SPR_1D_BMP;
// SUB_DISPLAY_CR = MODE_0_2D | DISPLAY_SPR_1D_LAYOUT | DISPLAY_SPR_ACTIVE|DISPLAY_SPR_1D_SIZE_128|DISPLAY_SPR_1D_BMP;
vramSetMainBanks(VRAM_A_MAIN_SPRITE,VRAM_B_MAIN_BG_0x06000000,VRAM_C_SUB_BG,VRAM_D_SUB_SPRITE);
// Sprite inits...
PA_ResetSpriteSys(); // Init's the sprite system
PA_InitSpriteExtPal(); // Init's sprite extended palettes
PA_ResetBgSys();
PA_InitBgExtPal(); // Init's bg extended palettes
// VBL Inits
SpriteVBL = PA_UpdateSpriteVBL;
}
extern funcpointer MotionVBL;
void PA_Init(void) {
s32 i;
for (i = 0; i < 130000>>2; i++) Blank[i] = 0;
PA_Init2D();
pa_checklid = 1; // Autochecklid by default
//WAIT_CR &= ~(1 << 7);
PA_UpdateRTC();
PA_SRand(35329 + PA_RTC.Minutes + PA_RTC.Seconds + PA_RTC.Hour + PA_RTC.Day);
PA_VBLCountersReset();
Stylus.X = 128;
Stylus.Y = 96;
PA_VBLFunctionReset();
irqInit();
//PA_ResetInterrupts();
IPC->mailData = (u32)(&PA_IPC);
for (i = 0; i < 2; i++){
PA_SetBrightness(i, 0); // On affiche les écrans
PA_font[i] = 0;
// #ifndef TEXT_ALLCHARACTERS
PA_textmap[i] = (u16*)PA_text_Map;
PA_texttiles[i] = (u8*)PA_text_Tiles;
PA_textpal[i] = (u16*)PA_text_Pal;
// #endif
/* #ifdef TEXT_ALLCHARACTERS
PA_textmap[i] = (u16*)PA_text2_Map;
PA_texttiles[i] = (u8*)PA_text2_Tiles;
PA_textpal[i] = (u16*)PA_text2_Pal;
#endif */
}
PA_UpdateUserInfo();
PA_ResetRecoSys(); // Reco system init
PA_SetScreenSpace(48); // Default spacing
PA_GifInfo.StartFrame = 0; // start from the beginning
PA_GifInfo.EndFrame = 10000; // random high number
MotionVBL = PA_Nothing;
}
#ifdef __cplusplus
}
#endif

View File

@ -13,15 +13,14 @@ extern "C" {
//u16 Int_Flag;
//funcpointer interruptfunc[14];
funcpointer CustomVBL;
funcpointer MotionVBL;
funcpointer CustomVBL = PA_Nothing;
funcpointer MotionVBL = PA_Nothing;
funcpointer SpriteVBL = PA_Nothing;
volatile u8 PA_vblok; // Passe à 1 quand VBL activé...
volatile u8 PA_Newframe;
void PA_UpdateSpriteAnims(void);
volatile s32 PA_TestVBLs;
@ -55,21 +54,18 @@ u8 i;
u8 PA_oldVolume;
extern inline void PA_UpdateMoveSprite(void) {
PA_MovedSprite.Time++;
if ((PA_MovedSprite.Time > 2) || Stylus.Released) {
PA_MovedSprite.Moving = 0;
PA_MovedSprite.Time = 0;
}
}
void PA_vblFunc(void){
//PA_OutputText(0, 0, 0, "VBL Ok");
DC_FlushAll();
PA_UpdatePad(); // Updates the Keypad...
PA_UpdateStylus(); // Updates the stylus input
PA_UpdateMoveSprite(); // Met à jour les infos sur les déplacements de sprites
PA_UpdateOAM(); // Updates the Object on screen
(*SpriteVBL)();
MotionVBL(); // Update DS Motion info
@ -84,10 +80,6 @@ void PA_vblFunc(void){
// Counters
PA_RunCounters();
CustomVBL(); // runs the user's custom VBL function
PA_UpdateSpriteAnims(); // Update the sprite animations... done last because less important...
}

View File

@ -139,134 +139,7 @@ u8 temp = ((~IPC->buttons) >> 6) & 1;
u8 PA_MoveSpriteEx(u8 screen, u8 sprite, u8 lx, u8 ly) {
u8 truelx = (PA_GetSpriteLx(screen, sprite) >>1);
u8 truely = (PA_GetSpriteLy(screen, sprite) >>1);
s16 x = PA_GetSpriteX(screen, sprite) + truelx;
s16 y = PA_GetSpriteY(screen, sprite) + truely;
lx = lx >> 1;
ly = ly >> 1;
if (x >= 458) x -=511; // normalize the X coordinate...
if (y >= 220) y -=256; // normalize the X coordinate...
if (Stylus.Released) {
PA_MovedSprite.Moving = 0;
}
else{
if (Stylus.Held & !PA_MovedSprite.Moving) { // Si nouvelle pression, on regarde si on touche ou pas le truc
PA_MovedSprite.NextVx = 0;
PA_MovedSprite.NextVx = 0;
if ((PA_MoveSpriteType == 0) && (Stylus.X > x - lx) && (Stylus.X < x + lx) && (Stylus.Y > y - ly) && (Stylus.Y < y + ly)){ // Square collision
PA_MovedSprite.Moving = 1;
PA_MovedSprite.Sprite = sprite;
}
else if (PA_MoveSpriteType && (PA_Distance(Stylus.X, Stylus.Y, x, y) < lx*ly)){ // Distance collision
PA_MovedSprite.Moving = 1;
PA_MovedSprite.Sprite = sprite;
}
}
if (PA_MovedSprite.Moving && (PA_MovedSprite.Sprite == sprite)) { // Si on peut le déplacer...
PA_MovedSprite.Vx = PA_MovedSprite.NextVx;
PA_MovedSprite.Vy = PA_MovedSprite.NextVy;
PA_MovedSprite.NextVx = Stylus.X - PA_MovedSprite.X;
PA_MovedSprite.NextVy = Stylus.Y - PA_MovedSprite.Y;
PA_MovedSprite.X = Stylus.X;
PA_MovedSprite.Y = Stylus.Y;
PA_SetSpriteXY(screen, sprite, Stylus.X - truelx, Stylus.Y - truely);
PA_MovedSprite.Time = 0; //Si on passe 2 vbl sans le bouger, on changera de cible
return(1); // On a bougé...
}
}
return(0);
}
u8 PA_MoveSpritePix(u8 sprite){
if (Stylus.Released) {
PA_MovedSprite.Moving = 0;
}
else{
if (Stylus.Held & !PA_MovedSprite.Moving) { // Si nouvelle pression, on regarde si on touche ou pas le truc
PA_MovedSprite.NextVx = 0;
PA_MovedSprite.NextVx = 0;
if ((PA_MoveSpriteType == 0) && PA_SpriteTouchedPix(sprite)){ //New sprite moving !
PA_MovedSprite.Moving = 1;
PA_MovedSprite.Sprite = sprite;
PA_MovedSprite.X = PA_GetSpriteX(PA_Screen, sprite);
PA_MovedSprite.Y = PA_GetSpriteY(PA_Screen, sprite);
if (PA_MovedSprite.X >= 458) PA_MovedSprite.X -=511; // normalize the X coordinate...
if (PA_MovedSprite.Y >= 220) PA_MovedSprite.Y -=256; // normalize the y coordinate...
}
}
else if ((!Stylus.Newpress) && PA_MovedSprite.Moving && (PA_MovedSprite.Sprite == sprite)) { // Si on peut le déplacer...
PA_MovedSprite.Vx = PA_MovedSprite.NextVx;
PA_MovedSprite.Vy = PA_MovedSprite.NextVy;
PA_MovedSprite.NextVx = Stylus.Vx;
PA_MovedSprite.NextVy = Stylus.Vy;
PA_MovedSprite.X += Stylus.Vx;
PA_MovedSprite.Y += Stylus.Vy;
PA_SetSpriteXY(PA_Screen, sprite, PA_MovedSprite.X, PA_MovedSprite.Y);
PA_MovedSprite.Time = 0; //Si on passe 2 vbl sans le bouger, on changera de cible
return(1); // On a bougé...
}
}
return(0);
}
/*
u8 PA_MoveSpriteDistance(u8 sprite, u8 distance) {
u8 truelx = (PA_GetSpriteLx(0, sprite) >>1);
u8 truely = (PA_GetSpriteLy(0, sprite) >>1);
s16 x = PA_GetSpriteX(0, sprite) + truelx;
s16 y = PA_GetSpriteY(0, sprite) + truely;
if (Stylus.Released) PA_MovedSprite.Moving = 0;
if (Stylus.Held & !PA_MovedSprite.Moving) { // Si nouvelle pression, on regarde si on touche ou pas le truc
if (PA_Distance(Stylus.X, Stylus.Y, x, y) < distance*distance){
PA_MovedSprite.Moving = 1;
PA_MovedSprite.Sprite = sprite;
}
}
if (PA_MovedSprite.Moving && (PA_MovedSprite.Sprite == sprite)) { // Si on peut le déplacer...
PA_MovedSprite.Vx = Stylus.X - PA_MovedSprite.X;
PA_MovedSprite.Vy = Stylus.Y - PA_MovedSprite.Y;
PA_MovedSprite.X = Stylus.X;
PA_MovedSprite.Y = Stylus.Y;
PA_SetSpriteXY(0, sprite, Stylus.X - truelx, Stylus.Y - truely);
PA_MovedSprite.Time = 0; //Si on passe 2 vbl sans le bouger, on changera de cible
return(1); // On a bougé...
}
return(0);
}
*/
#ifdef __cplusplus
}

View File

@ -20,15 +20,14 @@ for (i = 0; i < 256; i++){
void PA_CreatePalTransition(u16 *pal, u16 *newpal, s8 level, u8 destr, u8 destg, u8 destb){
u16 i;
s16 r, g, b;
for (i = 0; i < 256; i++){
r = ((pal[i]&31)*(31-level) + level*destr)>>5;
g = (((pal[i]>>5)&31)*(31-level) + level*destr)>>5;
b = (((pal[i]>>10)&31)*(31-level) + level*destr)>>5;
newpal[i] = PA_RGB(r, g, b);
}
u16 i;
s16 r, g, b;
for (i = 0; i < 256; i++){
r = ((pal[i]&31)*(31-level) + level*destr)>>5;
g = (((pal[i]>>5)&31)*(31-level) + level*destr)>>5;
b = (((pal[i]>>10)&31)*(31-level) + level*destr)>>5;
newpal[i] = PA_RGB(r, g, b);
}
}

View File

@ -0,0 +1,61 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <PA9.h>
infos PA_UserInfo;
RTC PA_RTC; // Infos RTC...
void PA_UpdateUserInfo(void) {
u8 i;
PA_UserInfo.Color = INFO_COLOR;
PA_UserInfo.BdayMonth = INFO_BDAY_MONTH;
PA_UserInfo.BdayDay = INFO_BDAY_DAY;
PA_UserInfo.BdayMonth = INFO_BDAY_MONTH;
PA_UserInfo.AlarmHour = INFO_ALARM_HOUR;
PA_UserInfo.AlarmMinute = INFO_ALARM_MINUTE;
PA_UserInfo.NameLength = INFO_NAME_LENGTH;
for (i = 0; i < PA_UserInfo.NameLength; i++) PA_UserInfo.Name[i] = *(u8*)(0x027FFC86 + (i << 1));
PA_UserInfo.Name[i] = 0; // Pour marquer la fin...
PA_UserInfo.MessageLength = INFO_MESSAGE_LENGTH;
for (i = 0; i < PA_UserInfo.MessageLength; i++) PA_UserInfo.Message[i] = *(u8*)(0x027FFC9C + (i << 1));
PA_UserInfo.Message[i] = 0; // Pour marquer la fin...
PA_UserInfo.Language = (INFO_LANGUAGE)&7;
}
void PA_UpdateRTC(void) {
u8 i;
u8 *temp;
temp = (u8*)&PA_RTC;
for (i = 0; i < 8; i++) temp[i] = IPC->time.curtime[i];
if (PA_RTC.Hour > 12) PA_RTC.Hour -= 40;
if (PA_RTC.OldSeconds != PA_RTC.Seconds){
PA_RTC.FPS = PA_RTC.Frames;
PA_RTC.Frames = 0;
PA_RTC.OldSeconds = PA_RTC.Seconds;
}
}
#ifdef __cplusplus
}
#endif

View File

@ -193,6 +193,8 @@ char PA_AnalyzeShape(void){
}
}
PA_RecoInfo.Difference = diff; // Difference to perfect shape
PA_RecoInfo.Shape = letter;
return letter;
}
@ -200,30 +202,30 @@ char PA_AnalyzeShape(void){
char PA_CheckLetter(void){
if(Stylus.Newpress){
PA_Reco.nvalues = 0; // Start over again
PA_Reco.oldn = 0;
PA_Reco.veryold = 0;
PA_RecoInfo.startX = PA_StylusPos[PA_Reco.nvalues].x = Stylus.X; // start values
PA_RecoInfo.startY = PA_StylusPos[PA_Reco.nvalues].y = Stylus.Y;
PA_RecoInfo.minX = PA_RecoInfo.maxX = PA_RecoInfo.startX;
PA_RecoInfo.minY = PA_RecoInfo.maxY = PA_RecoInfo.startY;
PA_Reco.nvalues++;
}
else if(Stylus.Held) {
PA_StylusLine(PA_StylusPos[PA_Reco.nvalues-1].x, PA_StylusPos[PA_Reco.nvalues-1].y, Stylus.X, Stylus.Y);
}
if(Stylus.Newpress){
PA_Reco.nvalues = 0; // Start over again
PA_Reco.oldn = 0;
PA_Reco.veryold = 0;
PA_RecoInfo.startX = PA_StylusPos[PA_Reco.nvalues].x = Stylus.X; // start values
PA_RecoInfo.startY = PA_StylusPos[PA_Reco.nvalues].y = Stylus.Y;
PA_RecoInfo.minX = PA_RecoInfo.maxX = PA_RecoInfo.startX;
PA_RecoInfo.minY = PA_RecoInfo.maxY = PA_RecoInfo.startY;
PA_Reco.nvalues++;
}
else if(Stylus.Held) {
PA_StylusLine(PA_StylusPos[PA_Reco.nvalues-1].x, PA_StylusPos[PA_Reco.nvalues-1].y, Stylus.X, Stylus.Y);
}
if(Stylus.Released){ // Start analyzing...
PA_Reco.nvalues = PA_Reco.veryold;
return PA_AnalyzeShape();
}
PA_Reco.veryold = PA_Reco.oldn;
PA_Reco.oldn = PA_Reco.nvalues;
return 0;
if(Stylus.Released){ // Start analyzing...
PA_Reco.nvalues = PA_Reco.veryold;
return PA_AnalyzeShape();
}
PA_Reco.veryold = PA_Reco.oldn;
PA_Reco.oldn = PA_Reco.nvalues;
return 0;
}

View File

@ -26,7 +26,7 @@ void PA_PlaySoundEx2(u8 PA_Channel, const void* data, s32 length, u8 volume, int
// use PA system for normal sounds
// Sound commands
PA_IPC.Sound[PA_Channel].Command |= (1<<PAIPC_PLAY); // play
//PA_IPC.Sound[PA_Channel].Command |= (1<<PAIPC_PLAY); // play
PA_IPC.Sound[PA_Channel].Data = (u32*)data;
PA_IPC.Sound[PA_Channel].Volume = volume;
PA_IPC.Sound[PA_Channel].Pan = 64;
@ -37,6 +37,7 @@ void PA_PlaySoundEx2(u8 PA_Channel, const void* data, s32 length, u8 volume, int
PA_IPC.Sound[PA_Channel].RepeatPoint = repeatPoint;
PA_IPC.Sound[PA_Channel].Duty = 0;
// PA_IPC.Sound[PA_Channel].Pause = 0;
PA_IPC.Sound[PA_Channel].Command |= (1<<PAIPC_PLAY); // play
}

View File

@ -602,6 +602,24 @@ else{ // Use the extended priorities
extern inline void PA_UpdateMoveSprite(void) {
PA_MovedSprite.Time++;
if ((PA_MovedSprite.Time > 2) || Stylus.Released) {
PA_MovedSprite.Moving = 0;
PA_MovedSprite.Time = 0;
}
}
void PA_UpdateSpriteVBL(void){
PA_UpdateMoveSprite(); // Met à jour les infos sur les déplacements de sprites
PA_UpdateOAM(); // Updates the Object on screen
PA_UpdateSpriteAnims(); // Update the sprite animations... done last because less important...
}
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,104 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "PA9.h"
#include <arm9/PA_Keys.h>
u8 PA_MoveSpriteEx(u8 screen, u8 sprite, u8 lx, u8 ly) {
u8 truelx = (PA_GetSpriteLx(screen, sprite) >>1);
u8 truely = (PA_GetSpriteLy(screen, sprite) >>1);
s16 x = PA_GetSpriteX(screen, sprite) + truelx;
s16 y = PA_GetSpriteY(screen, sprite) + truely;
lx = lx >> 1;
ly = ly >> 1;
if (x >= 458) x -=511; // normalize the X coordinate...
if (y >= 220) y -=256; // normalize the X coordinate...
if (Stylus.Released) {
PA_MovedSprite.Moving = 0;
}
else{
if (Stylus.Held & !PA_MovedSprite.Moving) { // Si nouvelle pression, on regarde si on touche ou pas le truc
PA_MovedSprite.NextVx = 0;
PA_MovedSprite.NextVx = 0;
if ((PA_MoveSpriteType == 0) && (Stylus.X > x - lx) && (Stylus.X < x + lx) && (Stylus.Y > y - ly) && (Stylus.Y < y + ly)){ // Square collision
PA_MovedSprite.Moving = 1;
PA_MovedSprite.Sprite = sprite;
}
else if (PA_MoveSpriteType && (PA_Distance(Stylus.X, Stylus.Y, x, y) < lx*ly)){ // Distance collision
PA_MovedSprite.Moving = 1;
PA_MovedSprite.Sprite = sprite;
}
}
if (PA_MovedSprite.Moving && (PA_MovedSprite.Sprite == sprite)) { // Si on peut le déplacer...
PA_MovedSprite.Vx = PA_MovedSprite.NextVx;
PA_MovedSprite.Vy = PA_MovedSprite.NextVy;
PA_MovedSprite.NextVx = Stylus.X - PA_MovedSprite.X;
PA_MovedSprite.NextVy = Stylus.Y - PA_MovedSprite.Y;
PA_MovedSprite.X = Stylus.X;
PA_MovedSprite.Y = Stylus.Y;
PA_SetSpriteXY(screen, sprite, Stylus.X - truelx, Stylus.Y - truely);
PA_MovedSprite.Time = 0; //Si on passe 2 vbl sans le bouger, on changera de cible
return(1); // On a bougé...
}
}
return(0);
}
u8 PA_MoveSpritePix(u8 sprite){
if (Stylus.Released) {
PA_MovedSprite.Moving = 0;
}
else{
if (Stylus.Held & !PA_MovedSprite.Moving) { // Si nouvelle pression, on regarde si on touche ou pas le truc
PA_MovedSprite.NextVx = 0;
PA_MovedSprite.NextVx = 0;
if ((PA_MoveSpriteType == 0) && PA_SpriteTouchedPix(sprite)){ //New sprite moving !
PA_MovedSprite.Moving = 1;
PA_MovedSprite.Sprite = sprite;
PA_MovedSprite.X = PA_GetSpriteX(PA_Screen, sprite);
PA_MovedSprite.Y = PA_GetSpriteY(PA_Screen, sprite);
if (PA_MovedSprite.X >= 458) PA_MovedSprite.X -=511; // normalize the X coordinate...
if (PA_MovedSprite.Y >= 220) PA_MovedSprite.Y -=256; // normalize the y coordinate...
}
}
else if ((!Stylus.Newpress) && PA_MovedSprite.Moving && (PA_MovedSprite.Sprite == sprite)) { // Si on peut le déplacer...
PA_MovedSprite.Vx = PA_MovedSprite.NextVx;
PA_MovedSprite.Vy = PA_MovedSprite.NextVy;
PA_MovedSprite.NextVx = Stylus.Vx;
PA_MovedSprite.NextVy = Stylus.Vy;
PA_MovedSprite.X += Stylus.Vx;
PA_MovedSprite.Y += Stylus.Vy;
PA_SetSpriteXY(PA_Screen, sprite, PA_MovedSprite.X, PA_MovedSprite.Y);
PA_MovedSprite.Time = 0; //Si on passe 2 vbl sans le bouger, on changera de cible
return(1); // On a bougé...
}
}
return(0);
}
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,19 @@
#include <PA9.h>
#ifdef __cplusplus
extern "C" {
#endif
u32 Blank[130000>>2];
#ifdef __cplusplus
}
#endif

View File

@ -172,6 +172,21 @@ va_list varg; /* Variable identifiant le prochain param
}
j += 1;
}
else if ((text[j+1] == 'x')) {
u32 test = va_arg(varg, u32);
u8 temp;
u8 started = 0;
for(i = 0; i < 32; i+=4){
temp = (test>>(28-i))&15;
if(started || temp){
if(temp >= 10) PA_SetTileLetter(screen, x + textcount, y, 'A'+(temp-10));
else PA_SetTileLetter(screen, x + textcount, y, '0'+(temp));
textcount++;
started = 1;
}
}
j++;
}
else if ((text[j+1] == 'd') || (text[j+1] == 'f')) {
double test = 0;
if (text[j+1] == 'd') {

View File

@ -52,6 +52,20 @@ void PA_Print(u8 screen, char* text, ...) {
}
j += 1;
}
else if ((text[j+1] == 'x')) {
u32 test = va_arg(varg, u32);
u8 temp;
u8 started = 0;
for(i = 0; i < 32; i+=4){
temp = (test>>(28-i))&15;
if(started || temp){
if(temp >= 10) PA_PrintLetter(screen, 'A'+(temp-10));
else PA_PrintLetter(screen, '0'+(temp));
started = 1;
}
}
j++;
}
else if ((text[j+1] == 'd') || (text[j+1] == 'f')) {
double test = 0;
if (text[j+1] == 'd') {

View File

@ -25,8 +25,8 @@ void StartTime(u8 bNew)
TIMER1_DATA=0;
TIMER2_DATA=0;
TIMER1_CR=TIMER_DIV_1024;
TIMER2_CR=TIMER_CASCADE;
TIMER1_CR=TIMER_DIV_1024 | TIMER_ENABLE;
TIMER2_CR=TIMER_CASCADE | TIMER_ENABLE;
gTime.nCount = 1;

View File

@ -1,3 +1,8 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <PA9.h>
#include <arm9/PA_Wifi.h>
@ -247,7 +252,7 @@ int PA_GetHTTP(char *buffer, char *adress)
break;
strcat(buffer,buffer3);
}
if(sock) close(sock);
if(sock) closesocket(sock);
//closesocket(sock);
return 1;
}
@ -255,4 +260,11 @@ int PA_GetHTTP(char *buffer, char *adress)
#ifdef __cplusplus
}
#endif

Binary file not shown.

Binary file not shown.

View File

@ -17,4 +17,4 @@ clean:
archive:
$(DEVKITPRO)/devkitARM/arm-eabi/bin/ar -cr lib/libpa7.a lib/arm7/build/ModFile.o lib/arm7/build/PA.o lib/arm7/build/Sound7.o
$(DEVKITPRO)/devkitARM/arm-eabi/bin/ar -cr lib/libpa9.a lib/arm9/build/gba-jpeg-decode.o lib/arm9/build/PA.o lib/arm9/build/PA_Draw.o lib/arm9/build/PA_Draw8bit.o lib/arm9/build/PA_Draw16bit.o lib/arm9/build/PA_Keys.o lib/arm9/build/PA_IO.o lib/arm9/build/PA_Math.o lib/arm9/build/PA_Reco.o lib/arm9/build/PA_Sprite.o lib/arm9/build/PA_BgTiles.o lib/arm9/build/PA_BgGetPixel.o lib/arm9/build/PA_BgLargeMap.o lib/arm9/build/PA_Mode7.o lib/arm9/build/PA_Text.o lib/arm9/build/PA_TextSpecial.o lib/arm9/build/PA_TextPrint.o lib/arm9/build/PA_Text8bit.o lib/arm9/build/PA_Interrupt.o lib/arm9/build/PA_Palette.o lib/arm9/build/PA_PaletteEx.o lib/arm9/build/Sound9.o lib/arm9/build/PA_16c.o lib/arm9/build/PA_API.o lib/arm9/build/PA_GBFS.o lib/arm9/build/PA_Gif.o lib/arm9/build/PA_GifToTex.o lib/arm9/build/keyboard.raw.o lib/arm9/build/keyboard.map.o lib/arm9/build/keyboard.pal.o lib/arm9/build/PA_Keyboard.o lib/arm9/build/PA_IA.o lib/arm9/build/PA_IA.o lib/arm9/build/PA_FS.o lib/arm9/build/PA_Video.o lib/arm9/build/PA_Sound.o lib/arm9/build/PA_SoundEx.o lib/arm9/build/PA_Motion.o lib/arm9/build/PA_Timer.o lib/arm9/build/PA_Wifi.o lib/arm9/build/PA_LeaderBoard.o lib/arm9/build/PA_SplashEyes.o lib/arm9/build/PA_SplashBlue.o lib/arm9/build/PA_BgTrans.o lib/arm9/build/PA_3D.o lib/arm9/build/PA_3DSprites.o lib/arm9/build/dgif_lib.o lib/arm9/build/gif_err.o lib/arm9/build/gif_font.o lib/arm9/build/gifalloc.o lib/arm9/build/quantize.o
$(DEVKITPRO)/devkitARM/arm-eabi/bin/ar -cr lib/libpa9.a lib/arm9/build/gba-jpeg-decode.o lib/arm9/build/PA.o lib/arm9/build/PA_Draw.o lib/arm9/build/PA_Draw8bit.o lib/arm9/build/PA_Draw8bitEx.o lib/arm9/build/PA_Draw16bit.o lib/arm9/build/PA_Draw16bitEx.o lib/arm9/build/PA_Keys.o lib/arm9/build/PA_IO.o lib/arm9/build/PA_Math.o lib/arm9/build/PA_Reco.o lib/arm9/build/PA_Sprite.o lib/arm9/build/PA_BgTiles.o lib/arm9/build/PA_BgGetPixel.o lib/arm9/build/PA_BgLargeMap.o lib/arm9/build/PA_Mode7.o lib/arm9/build/PA_Text.o lib/arm9/build/PA_TextSpecial.o lib/arm9/build/PA_TextPrint.o lib/arm9/build/PA_Text8bit.o lib/arm9/build/PA_Interrupt.o lib/arm9/build/PA_Palette.o lib/arm9/build/PA_PaletteEx.o lib/arm9/build/Sound9.o lib/arm9/build/PA_16c.o lib/arm9/build/PA_API.o lib/arm9/build/PA_GBFS.o lib/arm9/build/PA_Gif.o lib/arm9/build/PA_GifToTex.o lib/arm9/build/PA_GifToTiles.o lib/arm9/build/keyboard.raw.o lib/arm9/build/keyboard.map.o lib/arm9/build/keyboard.pal.o lib/arm9/build/PA_Keyboard.o lib/arm9/build/PA_IA.o lib/arm9/build/PA_IA.o lib/arm9/build/PA_FS.o lib/arm9/build/PA_Video.o lib/arm9/build/PA_Sound.o lib/arm9/build/PA_SoundEx.o lib/arm9/build/PA_Motion.o lib/arm9/build/PA_Timer.o lib/arm9/build/PA_Wifi.o lib/arm9/build/PA_LeaderBoard.o lib/arm9/build/PA_SplashEyes.o lib/arm9/build/PA_SplashBlue.o lib/arm9/build/PA_BgTrans.o lib/arm9/build/PA_3D.o lib/arm9/build/PA_3DSprites.o lib/arm9/build/PA_Stuff.o lib/arm9/build/PA_RTC.o lib/arm9/build/PA_2D.o lib/arm9/build/PA_SpriteStylus.o lib/arm9/build/PA_Inits.o lib/arm9/build/dgif_lib.o lib/arm9/build/gif_err.o lib/arm9/build/gif_font.o lib/arm9/build/gifalloc.o lib/arm9/build/quantize.o

View File

@ -64,10 +64,10 @@ CreateBak=0
RemoveReadOnly=0
SaveAsUnixStyle=0
[WorkspaceOptions]
Width=204
Width=215
ShowPane=1
[ConsoleOptions]
Height=168
Height=142
ShowPane=1
[Version]
CurrentVersion=n/a

View File

@ -6,6 +6,8 @@
extern "C" {
#endif
#include "all_gfx.h"
// Background files :
#include "bigfont.c"
@ -15,6 +17,10 @@ extern "C" {
#include "bigfont.pal.c"
#include "smallfont.pal.c"
// Background Pointers :
PAGfx_struct bigfont = {(void*)bigfont_Map, 1024, (void*)bigfont_Tiles, 8256, (void*)bigfont_Pal, (int*)bigfont_Info };
PAGfx_struct smallfont = {(void*)smallfont_Map, 256, (void*)smallfont_Tiles, 3168, (void*)smallfont_Pal, (int*)smallfont_Info };
#ifdef __cplusplus
}

View File

@ -5,6 +5,17 @@
#ifndef ALL_GFX_H
#define ALL_GFX_H
#ifndef PAGfx_struct
typedef struct{
void *Map;
int MapSize;
void *Tiles;
int TileSize;
void *Palette;
int *Info;
} PAGfx_struct;
#endif
// Background files :
extern const char bigfont_Height;
@ -12,12 +23,14 @@ extern const char bigfont_Sizes[256];
extern const int bigfont_Info[3]; // BgMode, Width, Height
extern const unsigned short bigfont_Map[1024] __attribute__ ((aligned (4))) ; // Pal : bigfont_Pal
extern const unsigned char bigfont_Tiles[8256] __attribute__ ((aligned (4))) ; // Pal : bigfont_Pal
extern PAGfx_struct bigfont; // background pointer
extern const char smallfont_Height;
extern const char smallfont_Sizes[256];
extern const int smallfont_Info[3]; // BgMode, Width, Height
extern const unsigned short smallfont_Map[256] __attribute__ ((aligned (4))) ; // Pal : smallfont_Pal
extern const unsigned char smallfont_Tiles[3168] __attribute__ ((aligned (4))) ; // Pal : smallfont_Pal
extern PAGfx_struct smallfont; // background pointer
// Palette files :

View File

@ -0,0 +1 @@
<1F>?<3F>_<EFBFBD><EFBFBD><1F><><EFBFBD><EFBFBD><EFBFBD><1F><><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@ -24,10 +24,8 @@ int main(int argc, char ** argv)
PA_16cText(1, 10, 25, 255, 40, "Small custom font...", 1, 5, 100);
PA_16cText(1, 10, 40, 255, 60, "Big custom font...", 1, 6, 100);
u8 i;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

View File

Before

Width:  |  Height:  |  Size: 950 B

After

Width:  |  Height:  |  Size: 950 B

View File

@ -0,0 +1,35 @@
// Drawing on DS is easy... This'll show you to what point !
// Includes
#include <PA9.h> // Include for PA_Lib
// Function: main()
int main(int argc, char ** argv)
{
PA_Init(); // Initializes PA_Lib
PA_InitVBL(); // Initializes a standard VBL
PA_Init16bitDblBuffer(0, 3); // Double buffer... Draw on the hidden background, then show
PA_InitText(1, 0); // Text background
PA_OutputText(1, 4, 10, "Press A to swap buffer...");
// Infinite loop to keep the program running
while (1)
{
if(Pad.Newpress.A) PA_16bitSwapBuffer(0); // Swap buffer...
// Simple draw function, draws on the screen...
PA_16bitDraw(0, // Screen
PA_RGB(31, 0, 0)); // Palette color
PA_WaitForVBL();
}
return 0;
} // End of main()

View File

@ -0,0 +1,299 @@
PROGNAME = PAlib
OFILES +=
ADD_LIBS +=
PATH := $(DEVKITARM)/bin:$(PATH)
ARM7BIN := -7 $(PAPATH)/lib/arm7/arm7.bin
TEXT1 := PAlib Project
TEXT2 := using PAlib
TEXT3 := www.palib.info
ICON := -b $(CURDIR)/../logo.bmp
LOGO := -o $(CURDIR)/../logo_wifi.bmp
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
endif
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output, if this ends with _mb generates a multiboot image
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := gfx source data
INCLUDES := include build data
EXPORT_DIR := /c/ndsexamples/
#---------------------------------------------------------------------------------
# ARM7BIN is the path to an arm7 binary other than the default
# usage: ARM7BIN := -7 binaryName.bin
#
# ICON is the path to an icon to be used int the header plus text
# usage: ICON := -t iconName.bmp "text line one; text line 2; text line 3"
#
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb-interwork
# note: arm9tdmi isn't the correct CPU arch, but anything newer and LD
# *insists* it has a FPU or VFP, and it won't take no for an answer!
CFLAGS := -g -Wformat=2 -Winline -Wall -O2\
-mcpu=arm946e-s -mtune=arm946e-s -fomit-frame-pointer\
-ffast-math \
$(ARCH)
CFLAGS += $(INCLUDE) -DARM9 -I$(DEVKITPRO)/PAlib/include/nds
ASFLAGS := -g $(ARCH)
LDFLAGS := -g $(ARCH) -mno-fpu -L$(DEVKITPRO)/PAlib/lib
#---------------------------------------------------------------------------------
# path to tools - this can be deleted if you set the path in windows
#---------------------------------------------------------------------------------
# export PATH := /d/dev/ds/devkitARM_r11/bin:/bin
#---------------------------------------------------------------------------------
# PATH to ndslib - just make a system variable called NDSLIBPATH and be done with it
#---------------------------------------------------------------------------------
# NDSLIBPATH := /d/dev/ds/ndslib/
#---------------------------------------------------------------------------------
# the prefix on the compiler executables
#---------------------------------------------------------------------------------
PREFIX := arm-eabi-
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lfat -lnds9 -ldswifi9
LIBSPA := -lpa9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(DEVKITPRO)/libnds
LIBDIRPA := $(PAPATH)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
export CC := $(PREFIX)gcc
export CXX := $(PREFIX)g++
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
export LD := $(CXX)
#export LD := $(CC)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PCXFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcx)))
BINFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin)))
PALFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pal)))
RAWFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.raw)))
MAPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.map)))
JPEGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.jpg)))
MODFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.mod)))
GIFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.gif)))
BMPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bmp)))
export OFILES := $(MAPFILES:.map=.o) $(RAWFILES:.raw=.o) $(PALFILES:.pal=.o) $(BINFILES:.bin=.o) $(PCXFILES:.pcx=.o) $(JPEGFILES:.jpg=.o) $(MODFILES:.mod=.o) $(GIFFILES:.gif=.o) $(BMPFILES:.bmp=.o)\
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include/nds) \
-I$(PAPATH)/include/nds\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
export LIBPATHPA := $(foreach dir,$(LIBDIRPA),-L$(dir)/lib)
.PHONY: $(BUILD) clean export
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...$(TARGET)
@rm -fr $(BUILD) *.elf *.*ds*
export:
@echo exporting ...$(TARGET)
@cp *.nds $(EXPORT_DIR)/$(TARGET).nds
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).ds.gba : $(OUTPUT).nds
$(OUTPUT).nds : $(OUTPUT).bin
$(OUTPUT).bin : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
#---------------------------------------------------------------------------------
%.ds.gba: %.nds
@echo built ... $(notdir $@)
@dsbuild $<
@cp $(CURDIR)/../$(notdir $@) ../$(notdir $(OUTPUT)).sc.nds
#---------------------------------------------------------------------------------
%.nds: %.bin
@ndstool -c $@ -9 $(TARGET).bin $(ARM7BIN) $(LOGO) $(ICON) "$(TEXT1);$(TEXT2);$(TEXT3)"
#---------------------------------------------------------------------------------
%.bin: %.elf
@$(OBJCOPY) -O binary $(TARGET).elf $(TARGET).bin
#---------------------------------------------------------------------------------
%.elf:
@echo $(LD) $(LDFLAGS) -specs=ds_arm9.specs $(OFILES) $(LIBPATHPA) $(LIBSPA) $(LIBPATHS) $(LIBS) -o $(TARGET).elf
@$(LD) $(LDFLAGS) -specs=ds_arm9.specs $(OFILES) $(LIBPATHPA) $(LIBSPA) $(LIBPATHS) $(LIBS) -o $(TARGET).elf
#---------------------------------------------------------------------------------
# Compile Targets for C/C++
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
%.o : %.cpp
@echo $(notdir $<)
@$(CXX) -MM $(CFLAGS) -o $*.d $<
@$(CXX) $(CFLAGS) -c $< -o$@
#---------------------------------------------------------------------------------
%.o : %.c
@echo $(notdir $<)
@$(CC) -MM $(CFLAGS) -o $*.d $<
@$(CC) $(CFLAGS) -c $< -o$@
#---------------------------------------------------------------------------------
%.o : %.s
@echo $(notdir $<)
@$(CC) -MM $(CFLAGS) -o $*.d $<
@$(CC) $(ASFLAGS) -c $< -o$@
define bin2o
cp $(<) $(*).tmp
echo -n $$(( `cat $(*).tmp | wc -c` & 3 )) | sed -e 's/0//g' | sed -e 's/1/000/g' | sed -e 's/2/00/g' | sed -e 's/3/0/g' >> $(*).tmp
$(OBJCOPY) -I binary -O elf32-littlearm -B arm \
--rename-section .data=.rodata \
--redefine-sym _binary_$*_tmp_start=$*\
--redefine-sym _binary_$*_tmp_end=$*_end\
--redefine-sym _binary_$*_tmp_size=$*_size\
$(*).tmp $(@)
echo "extern const u8" $(*)"[];" > $(*).h
echo "extern const u32" $(*)_size[]";" >> $(*).h
rm $(*).tmp
endef
#---------------------------------------------------------------------------------
%.o : %.pcx
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.o : %.raw
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.o : %.pal
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.o : %.map
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.o : %.mdl
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.o : %.jpg
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.o : %.mod
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.o : %.gif
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.o : %.bmp
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

View File

@ -0,0 +1 @@
<Project name="Template"><MagicFolder excludeFolders="CVS;.svn" filter="*.*" name="Template" path=""><MagicFolder excludeFolders="CVS;.svn" filter="*.*" name="source" path="source\"><File path="main.c"></File></MagicFolder><File path="build.bat"></File><File path="clean.bat"></File><File path="logo.bmp"></File><File path="logo_wifi.bmp"></File><File path="Template.pnproj"></File></MagicFolder></Project>

View File

@ -0,0 +1 @@
<pd><ViewState><e p="Template" x="true"></e><e p="Template\Template" x="true"></e><e p="Template\Template\source" x="true"></e></ViewState></pd>

Binary file not shown.

View File

@ -0,0 +1,3 @@
make clean
make
pause

View File

@ -0,0 +1,5 @@
#!/bin/sh
make clean
make
desmume *.ds.gba
sleep 3600

View File

@ -0,0 +1 @@
make clean

View File

@ -0,0 +1,2 @@
#!/bin/sh
make clean

View File

@ -0,0 +1 @@
0B00000A

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 950 B

View File

@ -0,0 +1,2 @@
[VisualHamOFileListV1]
source/main.c

View File

@ -0,0 +1,6 @@
[VisualHAMTreeContentV1]
HAM Workspace=
HAM Workspace\Source Files=
HAM Workspace\Source Files=source/main.c
HAM Workspace\Header Files=
HAM Workspace=makefile

Binary file not shown.

Binary file not shown.

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