pspLed library

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
phobox
Posts: 127
Joined: Mon Mar 24, 2008 6:22 pm

pspLed library

Post by phobox »

I decided to reverse the simple led.prx module.

Since the current sdk doesn't have prototypes for that library, i prepared the header file.
I would have made a patch but i don't know how to insert a new library... i think that the whole makefile has to be changes, so... i don't know.

here is the header http://www.megaupload.com/?d=8VDYUYIJ

I want also to say that in this topic
http://forums.ps2dev.org/viewtopic.php?t=9485
the param structure is defined as a 4 int elements structure, but is is five elements structure and the first element may be an array of four chars, i have to investigate it.

the main function, sceLedSetMode has the second arg called mode. modes available are 4 (0, 1, 2, 3) but i discovered how to use mode 2 (modes 0 and 1 were already known), but i'm working on mode 3 (called in the other thread DELAY).

mode 3 use is difficult to find out because it's not used in any of sce modules!.. (afaik)

hope to have been useful!
bye
Ciao! from Italy
shepherd
Posts: 2
Joined: Tue Sep 02, 2008 5:24 pm

Nice

Post by shepherd »

I cann't open the header. Could you paste it again? Please
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

I can downlaod it so you can do it too.

Code: Select all

/*
 * PSP Software Development Kit - http://www.pspdev.org
 * -----------------------------------------------------------------------
 * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
 *
 * pspled.h - Prototypes for the sceLed_driver library.
 *
 * Copyright (c) 2009 Phobox
 */

#ifndef __LED_H
#define __LED_H

#ifdef __cplusplus
extern "C" {
#endif

#define SCE_LED_MS      0
#define SCE_LED_WLAN    1

#define SCE_LED_MODE_OFF        0
#define SCE_LED_MODE_ON         1
#define SCE_LED_MODE_BLINK      2
#define SCE_LED_MODE_UNK        3

typedef struct{
    /** Unknown, used only in SCE_LED_MODE_UNK */
	int param_unk0;
	/** Used in SCE_LED_MODE_BLINK. The time for the led to stay ON during the blink */
	int onTime;
	/** Used in SCE_LED_MODE_BLINK. The time for the led to stay OFF during the blink */
	int offTime;
	/** Used in SCE_LED_MODE_BLINK. The time the blink has to last. After this time the led is set in the status specified in statusAfterBlink. Set -1 for an inifite time */
	int blinkTime;
	/** Used in SCE_LED_MODE_BLINK. The status (1 = on, 0 = off) of the led after the blink */
    int statusAfterBlink;
} SceLedParam;


/**
 * Sets the mode of a led.
 * @param led - the led id.
 * @param mode - one of SCE_LED_MODE_*
 * @param param - used only with modes 2 and 3
 *
 * @ return 0 on success
 *          0x80000102 if "led" argument was not correct &#40;< 0 or >= 2&#41;
 *          0x80000107 if "mode" argument was not correct
 */
int sceLedSetMode&#40;int led, int mode, SceLedParam *param&#41;;

/**
 * Turns off both leds and saves their state.
 * The state can be restored using sceLedResume
 */
void sceLedSuspend&#40;&#41;;

/**
 * Resumes the status of leds as it was before sceLedSuspend was called
 */
void sceLedResume&#40;&#41;;

/**
 * Inits the sceLed library
 * This is the same as calling module_start, so it is called when the module is started
 */
void sceLedInit&#40;&#41;;

/**
 * Terms the sceLed library
 * This is the same as calling module_reboot_before, so is called when there is a kernel reset
 */
void sceLedEnd&#40;&#41;;


#ifdef __cplusplus
&#125;
#endif

#endif

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
Post Reply