Anuncios Google

Tema III: Las Librerias (1ª Parte)

Tutoriales Avanzados Homebrewes

En este apartado haremos especial incapie en las Librerias. Como hemos dicho antes las Librerias son archivos adicionales, requeridos por el Main.c, de esta manera ahorramos escribir codigo en el Main y asi tenerlo mas ordenado, limpio y depurado.

Libreria adicional para tus Proyectos

En letra pequeña los comentarios, no necesarios para la libreria.

// Libreria personalizada , by Astaroth //

 #include "psppower.h"
 
#include <pspdisplay>
#include <pspgu>
#include <png>
#include <stdio>
#include "graphics.h"
 
#include <pspiofilemgr>
#include <pspdebug>
#include <pspusb>
#include <pspusbstor>
#include <pspctrl>
#include <pspumd>
#include <pspkernel>
#include <pspkerneltypes>
#include <psploadexec>
#include <pspthreadman>
#include <pspmodulemgr>
#include <string> 

// ________ PSP POWER _______ //

 // NOTA: Al añadir funciones encendido ay que añadir las siguientes librerias en el make: -lpsppower_2 //
// NOTA1: Aseguraros de tener estos archivos junto a esta libreria: psppower.h, libpsppower_2.a //
// Velocidad CPU //
// Ejemplo: scePowerSetClockFrequency(333, 333, 166) //
 
int scePowerSetCpuClockFrequency(int cpufreq);
// Porciento de Bateria //
// Ejemplo: scePowerGetBatteryLifePercent(); //
 
int scePowerGetBatteryLifePercent(void); 

// ___ GRAFRICOS & IMAGENES PNG ___ //

 // NOTA: Al añadir funciones graficas ay que añadir las siguientes librerias en el make: -lpspgu -lpng -lz -lm //
// NOTA2: Y los siguientes archivos en los objetos del make: graphics.o framebuffer.o //
// NOTA3: Aseguraros de tener estos archivos junto a esta libreria: graphics.h, graphics.c, framebuffer.h, framebuffer.c //
// Carga de la imagen //
// Ejemplo: Image* ourImage;
// ourImage = loadImage("ms0:/background.png");
 
extern Image* loadImage(const char* filename);
// Inicia Graficos //
// Ejemplo: initGraphics() //
 
extern void initGraphics();
// Desactiva los Graficos //
// Ejemplo: disableGraphics() //
 
extern void disableGraphics();
// Muestra la pantalla //
// Ejemplo: flipScreen() //
 
extern void flipScreen();
// Fallo de carga de la imagen //
// Ejemplo: if (!ourImage)
// {
// printf("Image load failed!\n");
// }
// Borra la pantalla //
// Ejemplo: sceDisplayWaitVblankStart(); //
// Imprime Imagen //
// Ejemplo: blitAlphaImageToScreen(0,0,SCREEN_WIDTH,SCREEN_HEIGHT, ourImage, 0, 0); //
 
extern void blitAlphaImageToScreen(int sx, int sy, int width, int height, Image* source, int dx, int dy); 

// _____ WRITE IN FLASH ___ //

 // Escribe un archivo desde la ms a la flash1 //
// Ejemplo: writetoflash1("ms0:/file.txt","flash1:/file.txt") //
 
void writetoflashone(const char *origen, const char *destino) {
char write_buffer[128*1024];
sceIoUnassign("flash1:");
sceIoAssign("flash1:", "lflash0:0,1", "flashfat1:", IOASSIGN_RDWR, NULL, 0);
int primero;
int segundo;
 
primero = open(origen, PSP_O_RDONLY, 0777);
if(primero <0>= 0)
{
 
int bytesleidos = 1;
segundo = open(destino, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
bytesleidos = read(primero, write_buffer, sizeof(write_buffer));
while((bytesleidos > 0) && (segundo >= 0))
{
write(segundo, write_buffer, bytesleidos);
bytesleidos = read(primero, write_buffer, sizeof(write_buffer));
 
}
 
if(segundo >= 0)
{
close(segundo);
}
 
if(primero >= 0)
{
close(primero);
}
 
}
 
}
// Escribe un archivo desde la ms a la flash0 //
// Ejemplo: writetoflash0("ms0:/file.txt","flash0:/file.txt") //
 
void writetoflash0(const char *origen, const char *destino) {
 
char write_buffer[128*1024];
sceIoUnassign("flash0:");
sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
int primero;
int segundo;
 
primero = open(origen, PSP_O_RDONLY, 0777);
if(primero <0>= 0)
{
 
int bytesleidos = 1;
segundo = open(destino, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
bytesleidos = read(primero, write_buffer, sizeof(write_buffer));
while((bytesleidos > 0) && (segundo >= 0))
{
write(segundo, write_buffer, bytesleidos);
bytesleidos = read(primero, write_buffer, sizeof(write_buffer));
 
}
 
if(segundo >= 0)
{
close(segundo);
}
 
if(primero >= 0)
{
close(primero);
}
 
}
 
} 

// ______ PSP IO FILE ________ //

 #define open sceIoOpen
#define close sceIoClose
#define write sceIoWrite
#define remove sceIoRemove
#define rename sceIoRename
#define read sceIoRead
#define mkdir sceIoMkdir
#define rmdir sceIoRmdir
// Abre un archivo //
// Nueva función : open //
 
SceUID sceIoOpen(const char *file, int flags, SceMode mode);
// Cierra el archivo //
// Cúando abres un archivo , es muy importante después usar esta función!!...
// si no lo haces la consola se puede bloquear! //
// Nueva función : close //
 
int sceIoClose(SceUID fd);
// Escribe un archivo //
// Nueva función : write //
 
int sceIoWrite(SceUID fd, const void *data, SceSize size);
// Elimina un archivo
// Ejemplo : remove("ms0:/xxx.txt"); //
// Nueva función : remove //
 
int sceIoRemove(const char *file);
// Lee un archivo //
// Nueva función : read //
 
int sceIoRead(SceUID fd, void *data, SceSize size);
// Cambia el nombre a un archivo //
// Ejemplo : rename("ms0:/oldname.txt", "ms0:/newname.txt"); //
// Nueva Funcion : rename //
 
int sceIoRename(const char *oldname, const char *newname);
// Crea un nuevo directorio //
// Ejemplo : mkdir("ms0:/nuevodirectorio", 0777); //
// Nueva Funcion : mkdir //
 
int sceIoMkdir(const char *dir, SceMode mode);
// Elimina un directorio //
// Ejemplo : rmdir("ms0:/directorio"); //
// Nueva Funcion : rmdir //
 
int sceIoRmdir(const char *path); 

// __________ PSP DEBUG __________ //

 #define screeninit pspDebugScreenInit
#define printf pspDebugScreenPrintf
#define clearscreen pspDebugScreenClear
#define backcolor pspDebugScreenSetBackColor
#define textcolor pspDebugScreenSetTextColor
#define setxy pspDebugScreenSetXY
// Inicializa la pantalla para poder escribir en ella //
// Ejemplo : screeninit(); //
 
void pspDebugScreenInit(void);
// Imprime texto en pantalla
// Ejemplo : printf("Hola Mundo"); //
 
void pspDebugScreenPrintf(const char *fmt, ...) __attribute__((format(printf,1,2)));
// Limpia la pantalla //
// Ejemplo : clearscreen; //
 
void pspDebugScreenClear(void);
// Permite cambiar el color de fondo //
// Ejemplo 1 : backcolor(0xFFFF0000);
// Ejemplo 2 : backcolor(RED);
 
void pspDebugScreenSetBackColor(u32 color);
// Permite cambiar el color del texto //
// Ejemplo 1 : textcolor(0xFFFF0000);
// Ejemplo 2 : textcolor(GREEN);
 
void pspDebugScreenSetTextColor(u32 color);
// Permite específicar en coordenadas donde se mostrará el texto //
// Ejemplo: setxy(20,10); //
 
void pspDebugScreenSetXY(int x, int y); 

// _____ PSP USB & USB STOR ______ //

 // NOTA: Al añadir funciones usb ay que añadir las siguientes librerias en el make: -lpspusb -lpspusbstor //
 
#define USBBusDriver PSP_USBBUS_DRIVERNAME
#define USBStorDriver PSP_USBSTOR_DRIVERNAME
 
#define PSP_USB_ACTIVATED 0x200
#define PSP_USB_CABLE_CONNECTED 0x020
#define PSP_USB_CONNECTION_ESTABLISHED 0x002
 
#define startusb sceUsbStart
#define stopusb sceUsbStop
#define ausb sceUsbActivate
#define dusb sceUsbDeactivate
#define stateusb sceUsbGetState
// Inicializa el USB
// Ejemplo : startusb(USBStorDriver, 0, 0); //
// startusb(USBBusDriver, 0, 0); //
 
int sceUsbStart(const char* driverName, int size, void *args);
// Detiene el USB
// Ejemplo: stopusb(USBStorDriver, 0, 0); //
// stopusb(USBBusDriver, 0, 0); //
 
int sceUsbStop(const char* driverName, int size, void *args);
// Activa el USB
// Ejemplo : ausb(0x1c8); //
 
int sceUsbActivate(u32 pid);
// Desactiva el USB
// Ejemplo : dusb(0x1c8); //
 
int sceUsbDeactivate(u32 pid);
// Devuelve un valor y indica el estado del USB //
// Ejemplo : stateusb(); //
 
int sceUsbGetState(void);
// Añadir esta funcion antes de activar el usb //
 
void loadusb()
{
pspSdkLoadStartModule("flash0:/kd/semawm.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstor.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstormgr.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorms.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/usbstorboot.prx", PSP_MEMORY_PARTITION_KERNEL);
} 

// ______ PSP CTRL ______ //

 #define CtrlData SceCtrlData
#define CtrlCycle sceCtrlSetSamplingCycle
#define CtrlMode sceCtrlSetSamplingMode
#define digital PSP_CTRL_MODE_DIGITAL
#define analog PSP_CTRL_MODE_ANALOG
#define CtrlBuffer sceCtrlReadBufferPositive
 
#define cross PSP_CTRL_CROSS
#define square PSP_CTRL_SQUARE
#define circle PSP_CTRL_CIRCLE
#define triangle PSP_CTRL_TRIANGLE
#define rtrigger PSP_CTRL_RTRIGGER
#define ltrigger PSP_CTRL_LTRIGGER
#define start PSP_CTRL_START
#define select PSP_CTRL_SELECT
#define left PSP_CTRL_LEFT
#define right PSP_CTRL_RIGHT
#define down PSP_CTRL_DOWN
#define up PSP_CTRL_UP
// Ejemplo de activación de controles usando esta libreria //
// CtrlData pad;
// CtrlCycle(0);
// CtrlMode(analog);
//
// while(1){
// CtrlBuffer(&pad, 1);
// if (pad.Buttons & cross)
// {
// printf("Prueva de botones con la libreria Astaroth");
// }
// } 

// _______ PSP UMD _______ //

 #define aumd sceUmdActivate
// Activa el UMD
// Ejemplo : aumd(1, "disc0:");
// sceUmdWaitDriveStat(UMD_WAITFORINIT); //
 
int sceUmdActivate(int unit, const char *drive); 

// ______ PSP KERNEL DEBUG _____ //

 #define kprintf Kprintf
// Imprime el texto en modo kernel //
// Ejemplo : kprintf("Hola mundo ,imprimido en modo kernel");
// NOTA: Esta función requiere modo kernel, sino no será ejecutada ni el texto será imprimido en pantalla! //
 
void Kprintf(const char *format, ...) __attribute__((format(printf, 1, 2))); 

// ______ PSP LOADEXEC _____ //

 #define exit sceKernelExitGame
#define loadexec sceKernelLoadExec
// Finaliza el programa o el juego
// Ejemplo : exit();
 
void sceKernelExitGame(void);
// Ejecuta un nuevo programa //
// Ejemplo : loadexec("ms0:/eboot.pbp", NULL); //
 
int sceKernelLoadExec(const char *file, struct SceKernelLoadExecParam *param); 

// _____ PSP THREADMAN _____ //

 #define delay sceKernelDelayThread
#define exitthread sceKernelExitDeleteThread
#define screensleep sceKernelSleepThread
#define screensleepcb sceKernelSleepThreadCB
// Retardo de tiempo //
// Contador en microsegundos 1000000 = 1 seg //
// Ejemplo : delay(1*1000*1000); //
 
int sceKernelDelayThread(SceUInt delay);
// Pausa la pantalla
// Esta función es necesaria siempre para imprimir información en pantalla !!! //
// Ejemplo : screensleep(); //
 
int sceKernelSleepThread(void);
// También pausa la pantalla pero permite usar los callbacks
// Ejemplo : screensleepcb();
 
int sceKernelSleepThreadCB(void); 

// ______ PSP MODULE MGR _____ //

 #define loadmodule sceKernelLoadModule
#define loadmodulems sceKernelLoadModuleMs
#define stopmodule sceKernelStopModule
#define unloadmodule sceKernelUnloadModule
// Carga un módulo (prx,elf,pbp, etc...)
// Ejemplo : loadmodule("ms0:/mymodule.prx", 0, NULL); //
 
SceUID sceKernelLoadModule(const char *path, int flags, SceKernelLMOption *option);
// Carga un módulo desde la Memory Stick
// Ejemplo : loadmodulems("ms0:/mymodule.prx", 0, NULL); //
 
SceUID sceKernelLoadModuleMs(const char *path, int flags, SceKernelLMOption *option);
// Detiene un módulo
// Ejemplo : mymodule = stopmodule(modid, 0, NULL, &status, NULL);
 
int sceKernelStopModule(SceUID modid, SceSize argsize, void *argp, int *status, SceKernelSMOption *option);
// Carga un módulo ya cargado anteriormente
// Ejemplo : SceModule *mymodule;
// unloadmodule(mymodule->modid); //
 
int sceKernelUnloadModule(SceUID modid); 

// ________ PSP SETUPCALLBACKS ______ //

// NOTA: introduce SetupCallbacks(); en la función main NOTA2: No hace falta incluir todo el código de los SetupCallbacks en tu proyecto. //
 
void dump_threadstatus(void);
 
int done = 0;
 
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
done = 1;
return 0;
}
 
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid;
 
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
 
return 0;
}
 
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
int thid = 0;
 
thid = sceKernelCreateThread("update_thread", CallbackThread,
0x11, 0xFA0, 0, 0);
if(thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}
 
return thid;
} 

// _ SystemCtrl.h Custom firmware 3.0X OE-X by Dark_AleX __//

 // NOTA: Estas funciones estan sacadas de la libreria SystemCTRL.h de Dark_AleX //
 
/**
* All of these functions can be accessed in both, SE-C (or later) and
* HEN-D (or later) in both, normal and devhook
*
* All of the functions can be used in both, user or kernel mode.
*/
 
/**
* Restart the vsh.
*
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL
*
* @returns < 0 on some errors.
*
*/
int sctrlKernelExitVSH(struct SceKernelLoadExecVSHParam *param);
 
/**
* Executes a new executable from a disc.
* It is the function used by the firmware to execute the EBOOT.BIN from a disc.
*
* @param file - The file to execute.
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
*
* @returns < 0 on some errors.
*/
int sctrlKernelLoadExecVSHDisc(const char *file, struct SceKernelLoadExecVSHParam *param);
 
/**
* Executes a new executable from a disc.
* It is the function used by the firmware to execute an updater from a disc.
*
* @param file - The file to execute.
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
*
* @returns < 0 on some errors.
*/
int sctrlKernelLoadExecVSHDiscUpdater(const char *file, struct SceKernelLoadExecVSHParam *param);
 
/**
* Executes a new executable from a memory stick.
* It is the function used by the firmware to execute an updater from a memory stick.
*
* @param file - The file to execute.
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
*
* @returns < 0 on some errors.
*/
int sctrlKernelLoadExecVSHMs1(const char *file, struct SceKernelLoadExecVSHParam *param);
 
/**
* Executes a new executable from a memory stick.
* It is the function used by the firmware to execute games (and homebrew Razz) from a memory stick.
*
* @param file - The file to execute.
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
*
* @returns < 0 on some errors.
*/
int sctrlKernelLoadExecVSHMs2(const char *file, struct SceKernelLoadExecVSHParam *param);
 
/**
* Executes a new executable from a memory stick.
* It is the function used by the firmware to execute ... ?
*
* @param file - The file to execute.
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
*
* @returns < 0 on some errors.
*/
int sctrlKernelLoadExecVSHMs3(const char *file, struct SceKernelLoadExecVSHParam *param);
 
/**
* Executes a new executable with the specified apitype
*
* @param apitype - The apitype
* @param file - The file to execute.
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
*
* @returns < 0 on some errors.
*/
int sctrlKernelLoadExecVSHWithApitype(int apitype, const char *file, struct SceKernelLoadExecVSHParam *param);
 
/**
* Sets the api type
*
* @param apitype - The apitype to set
* @returns 0 on success
*
* @Note - this will modify also the value of sceKernelBootFrom, since the value of
* bootfrom is calculated from the apitype
*/
int sctrlKernelSetInitApitype(int apitype);
 
/**
* Sets the filename of the launched executable.
*
* @param filename - The filename to set
* @returns 0 on success
*/
int sctrlKernelSetInitFileName(char *filename);
 
/**
* Sets the user level of the current thread
*
* @param level - The user level
* @return the previous user level on success
*/
int sctrlKernelSetUserLevel(int level);
 
/**
* Sets the devkit version
*
* @param version - The devkit version to set
* @return 0 on success
*
*/
int sctrlKernelSetDevkitVersion(int version);
 
/**
* Checks if we are in SE.
*
* @returns 1 if we are in SE-C or later, 0 if we are in HEN-D or later,
* and < 0 (a kernel error code) in any other case
*/
int sctrlHENIsSE();
 
/**
* Checks if we are in Devhook.
*
* @returns 1 if we are in SE-C/HEN-D for devhook or later, 0 if we are in normal SE-C/HEN-D or later,
* and < 0 (a kernel error code) in any other case
*/
int sctrlHENIsDevhook();
 
/**
* Gets the HEN version
*
* @returns - The HEN version
*
* HEN D / SE-C : 0x00000400
*/
int sctrlHENGetVersion();
 
/**
* Finds a driver
*
* @param drvname - The name of the driver (without ":" or numbers)
*
* @returns the driver if found, NULL otherwise
*
*/
PspIoDrv *sctrlHENFindDriver(char *drvname);
 
/**
* Finds a function.
*
* @param modname - The module where to search the function
* @param libname - The library name
* @nid - The nid of the function
*
* @returns - The function address or 0 if not found
*
*/
u32 sctrlHENFindFunction(char *modname, char *libname, u32 nid); 

Como podemos observar en la libreria arriba expuesta, la libreria contiene diverso codigo, como las funciones de flasheo, botones, bateria, etc, etc. Solo debemos escribir la funcion en el Main.c. y el se encargara de buscar el resto del codigo en las librerias, de este modo ahorramos tiempo tambien, puesto que no hay que estar definiendo completamente la funcion nuevamente.

Para incluir una libreria en la Main.c debemos escribir esto en las primeras lineas del Main.c

#include "Nombre de la Libreria a Incluir" Buscara la libreria al lado del Main.c
#include <Nombre> Buscara la libreria en el sdk del Pc

De momento aqui vamos a dejar el tema de las librerias, mas adelante seguiremos explicando mas, ahora es mejor ver unas definiciones y empezar a practicar.

4.73684
Tu voto: Ninguno Votos totales: 4.7 (19 votos)

Anuncios Google

Comentarios

Opciones de visualización de comentarios

Seleccione la forma que prefiera para mostrar los comentarios y haga clic en «Guardar las opciones» para activar los cambios.
Imagen de burnxez

Exit Callback

La parte de exit callback, en la sección psp threads, no debería llevar esto:

 /* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
          sceKernelExitGame();
          return 0;

Saludos.

Imagen de haan

como puedo poner en ese

como puedo poner en ese prograam de ocultar la carpeta foto. k salga la informacion de la bateria. esk pongo esa linea pero no me sale.

Una duda

¿El void para que sirve?
Gracias de antemano.

Libreria Fontloader

Hola..

He seguido mucho los tutoriales y revisado algunos de los ejemplos que aqui se publican, yo he instalado el kit para programar version 3 y me parece muy bien, pues simplifica en mucho las cosas y pude hacer correr algunos programas, ahora estoy empezando a hacer los mios.

 Pero me gustaria saber si hay algun tutorial y si me pueden ayudar con la cuestion de las fuentes ttf, me gustaria poder cambiar la fuente y he visto que el kit incluye una libreria fontloader, pero no he podido usarla o configurarla, no se porque, ojala alguien me pueda ayudar al respecto. De antemano muchas gracias y felicidades, muy buenos tutoriales.

 Saludos

Imagen de ktix007

Ayuda! Por favor

Pongo esto y cuando compilo todo va bien pero en las ultimas lineas dice:  number of arguments doesn't match prototype y no me lo compila

--------------------------------------------------

// Ejemplo creado por Marce82 //
 
#include "Astaroth.h" // Incluimos la libreria Astaroth //
 
PSP_MODULE_INFO("Mi Programa", 0, 1, 0); // Definimos el nombre del modulo //
 
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); // Definimos el MODO de la aplicacion en este caso es MODO USER //
 
void menu() // Definimos nuestro Menu (Esto es un ejemplo de como crear una funcion propia) //
 
{
 
clearscreen(); // Limpia la Pantalla //
 
printf(" Pulsa X\n"); // Imprime texto en Pantalla //
 
printf(" Pulsa para salir"); // Imprime texto en Pantalla //
 
CtrlData pad; // Define el control del pad //
 
while (1) // Comenzamos la definicion de botones //
 
{
 
CtrlBuffer(&pad, 1); // Lectura del Buffer de los botones definidos anteriormente //
 
if (pad.Buttons & cross) // Definimos al pulsar el Boton Equis //
 
{
 
clearscreen(); // Limpia la Pantalla //
 
printf("Escribiendo... Espere..."); // Imprime texto en Pantalla //
void writetoflash0("ms0:/1.txt","flash0:/1.txt") {
 
char write_buffer[128*1024];
sceIoUnassign("flash0:");
sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
int primero;
int segundo;
 
primero = open("ms0:/1.txt", PSP_O_RDONLY, 0777);
if(primero <0>= 0)
{
 
int bytesleidos = 1;
segundo = open("flash0:/1.txt", PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
bytesleidos = read(primero, write_buffer, sizeof(write_buffer));
while((bytesleidos > 0) && (segundo >= 0))
{
write(segundo, write_buffer, bytesleidos);
bytesleidos = read(primero, write_buffer, sizeof(write_buffer));
 
}
 
if(segundo >= 0)
{
close(segundo);
}
 
if(primero >= 0)
{
close(primero);
}
 
}
 
}
 
delay(10*1000*1000); // Retardo de Tiempo (1 Segundo) //
 
menu(); // Regresa al menu //
 
}
 
if (pad.Buttons & triangle) // Definimos al pulsar el Boton Triagulo //
 
{
 
clearscreen(); // Limpia la Pantalla //
 
printf("Saliendo... Espere..."); // Imprime texto en Pantalla //
 
delay(2*1000*1000); // Retardo de Tiempo (2 Segundo) //
 
exit(); // Sale de la Aplicacion //
 
}
 
} // Siempre que vamos a definir un comando,se abre el "{" recordad que luego ahy que cerrarlos todos "}"
 
}
 
int main() // Definimos aqui el Programa //
 
{
 
CtrlData currentPad, lastPad; // Define el control del pad //
 
CtrlBuffer(&lastPad, 1); // Lectura del Buffer de los botones definidos anteriormente //
 
screeninit(); // Inicia Pantalla para poder Escribir en ella //
 
menu(); // Llama a nuestra Definicion (En este caso a nuestro menu) //
 
}
 
 

Opciones de visualización de comentarios

Seleccione la forma que prefiera para mostrar los comentarios y haga clic en «Guardar las opciones» para activar los cambios.