/*
This file was modified by Eric Hobbs
iointerface.c template
This file is a derivative work of the dldi template.
Copyright (c) 2006 Michael "Chishm" Chisholm
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. All derivative works must be clearly marked as such. Derivatives of this file
must have the author of the derivative indicated within the source.
2. The name of the author may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// When compiling for NDS, make sure NDS is defined
#ifndef NDS
#if defined ARM9 || defined ARM7
#define NDS
#endif
#endif
#ifdef NDS
#include <nds/jtypes.h>
#else
#include "gba_types.h"
#endif
//#include <stdio.h>
#include "dsli.h"
//#include <nds.h>
DSLI dsli;
double alpha = 0;
NE_Material * MaterialGameLogo;
NE_Material * MaterialNDSLogo;
void DrawTopLogo(){
dsli.NE_2DViewInit();
dsli.NE_2DDrawTexturedQuadAlpha(0,0,256,192,1,MaterialGameLogo,alpha,1);
}
void DrawDownLogo(){
dsli.NE_2DViewInit();
if(alpha<31)
{
dsli.NE_2DDrawTexturedQuadAlpha(0,0,256,192,1,MaterialNDSLogo,alpha,1);
} else {
/* Draw BG */
dsli.NE_2DDrawQuad(0,0,256,192,1,NE_Black);
/* Draw Credits */
dsli.NE_TextPrint(0,1,0,NE_White,"Maintainer: Hedzer Oosterwal");
dsli.NE_TextPrint(0,1,1,NE_White,"Modeller: Thomas");
dsli.NE_TextPrint(0,1,3,NE_White,"Credits: ");
dsli.NE_TextPrint(0,1,4,NE_White," - libfat / DLDI (Chism)");
dsli.NE_TextPrint(0,1,5,NE_White," - Libpicture (DragonMinded)");
dsli.NE_TextPrint(0,1,6,NE_White," - LibINI (DragonMinded)");
dsli.NE_TextPrint(0,1,7,NE_White," - Wav Streamer (DiscoStew)");
dsli.NE_TextPrint(0,1,8,NE_White," - Nitro Engine (AntonioND)");
dsli.NE_TextPrint(0,1,9,NE_White," - DevkitARM (WinterMute)");
dsli.NE_TextPrint(0,1,10,NE_White," - LibNDS (Dovoto)");
}
}
/*int strcmp(const char *s1, const char *s2)
{
int ret = 0;
while (!(ret = *(unsigned char *) s1 - *(unsigned char *) s2) && *s2) ++s1, ++s2;
if (ret < 0)
ret = -1;
else if (ret > 0)
ret = 1 ;
return ret;
}*/
void showSplashScreens()
{
while(1)
{
scanKeys();
if(alpha<=31)
{
alpha+=0.5;
}
if(keysHeld() & KEY_TOUCH)
{
break;
}
dsli.NE_ProcessDual(DrawTopLogo,DrawDownLogo);
dsli.NE_WaitForVBL(NE_UPDATE_NORMAL);
}
// -- Fade them out
for(alpha=31;alpha>0;alpha-=0.5)
{
dsli.NE_ProcessDual(DrawTopLogo,DrawDownLogo);
dsli.NE_WaitForVBL(NE_UPDATE_NORMAL);
}
}
/*-----------------------------------------------------------------
startUp
Initialize the interface, geting it into an idle, ready state
returns true if successful, otherwise returns false
-----------------------------------------------------------------*/
bool startup(void * addr) {
//dsli.iprintf("startup(%x)...",addr);
//glInit();
MaterialGameLogo = dsli.NE_MaterialCreate();
MaterialNDSLogo = dsli.NE_MaterialCreate();
//PaletteNDSLogo = dsli.NE_PaletteCreate();
dsli.NE_FATMaterialTexLoadBMPtoRGBA(MaterialGameLogo, "/urazelda/logo.bmp",0);
dsli.NE_FATMaterialTexLoadBMPtoRGBA/*256*/(MaterialNDSLogo/*, PaletteNDSLogo*/, "/urazelda/ndslogo.bmp", 0);
return false;
}
/*-----------------------------------------------------------------
readSectors
Read "numSectors" 512-byte sized sectors from the card into "buffer",
starting at "sector".
The buffer may be unaligned, and the driver must deal with this correctly.
return true if it was successful, false if it failed for any reason
-----------------------------------------------------------------*/
u32 getaddress (char *name) {
return (u32)showSplashScreens;
}
/*-----------------------------------------------------------------
shutdown
shutdown the card, performing any needed cleanup operations
Don't expect this function to be called before power off,
it is merely for disabling the card.
return true if the card is no longer active
-----------------------------------------------------------------*/
bool shutdown(void) {
//dsli.iprintf("shutdown()...");
dsli.NE_MaterialDelete(MaterialGameLogo);
dsli.NE_MaterialDelete(MaterialNDSLogo);
//dsli.NE_PaletteDelete(PaletteNDSLogo);
return false;
} |