Skip to content

Commit

Permalink
add: additional libcdvd definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
uyjulian committed Sep 13, 2024
1 parent 1719b3b commit 20dd409
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
33 changes: 33 additions & 0 deletions common/include/libcdvd-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,15 @@ int sceCdDecSet(unsigned char enable_xor, unsigned char enable_shift, unsigned c
*/
int sceCdReadKey(unsigned char arg1, unsigned char arg2, unsigned int command, unsigned char *key);

/** Determines if unique disc key exists
* Unofficial name.
* SUPPORTED IN NEWER CDVDMAN MODULES INCLUDED WITHIN DNAS IOPRP ONLY
*
* @param status Command status
* @return 1 on success, 0 on failure.
*/
int sceCdDoesUniqueKeyExist(u32 *status);

/** Blocks disc tray eject functionality and turns off the blue eject LED when enabled.
*
* @param mode Set to a non-zero value to enable the tray eject functionality
Expand Down Expand Up @@ -1020,6 +1029,17 @@ int sceCdWriteWakeUpTime(const sceCdCLOCK *clock, u16 userdata, int flags);
*/
int sceRemote2_7(u16 param, u32 *status);

/** Retrieves the value set by sceRemote2_7.
* Minimum Mechacon firmware version: 50000
* Unofficial name.
* SUPPORTED IN XCDVDMAN INCLUDED WITHIN NEWER BOOT ROMS ONLY
*
* @param param The value set by sceRemote2_7
* @param status Command status
* @return 1 on success, 0 on failure.
*/
int sceRemote2_7Get(u32 *param, u32 *status);

/** Set the LED state of the face buttons of the console.
* The state of the buttons will be reset when the power or eject button is pressed.
* Minimum Mechacon firmware version: 50000
Expand Down Expand Up @@ -1047,6 +1067,19 @@ int sceCdReadPS1BootParam(u8 *out, u32 *result);
*/
int sceCdSetFanProfile(u8 param, u32 *result);

/** Sends SCMD 0x1D. Appears to be stubbed in Mechacon firmware 50000.
* Minimum Mechacon firmware version: 50000
* Unofficial name.
* SUPPORTED IN XCDVDMAN INCLUDED WITHIN NEWER BOOT ROMS ONLY
*
* @param arg1 Unknown
* @param arg2 Unknown
* @param arg3 Unknown
* @param status Command status
* @return 1 on success, 0 on failure.
*/
int sceCdSendSCmd1D(int *arg1, unsigned int *arg2, unsigned int *arg3, u32 *status);

/** Change sys.
* SUPPORTED BY ONLY DESR/PSX DVR CDVDMAN MODULES
*
Expand Down
40 changes: 40 additions & 0 deletions iop/kernel/include/cdvdman.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ int sceCdRV(u32 lsn, u32 sectors, void *buf, sceCdRMode *mode, int arg5, void *c
*/
int sceCdApplySCmd2(u8 cmdNum, const void* inBuff, unsigned long int inBuffSize, void *outBuff);

/** send an s-command by function number
* Unofficial name.
* SUPPORTED IN NEWER CDVDMAN MODULES INCLUDED WITHIN NEWER IOPRP ONLY
*
* @param cmdNum command number
* @param inBuff input buffer (can be null)
* @param inBuffSize size of input buffer (>= 16 bytes)
* @param outBuff output buffer (can be null)
* @return 1 on success, 0 on failure.
*/
int sceCdApplySCmd3(u8 cmdNum, const void* inBuff, unsigned long int inBuffSize, void *outBuff);

/** Controls spindle speed? Not sure what it really does.
* SUPPORTED IN XCDVDMAN ONLY
*
Expand All @@ -63,6 +75,16 @@ int sceCdApplySCmd2(u8 cmdNum, const void* inBuff, unsigned long int inBuffSize,
*/
int sceCdSpinCtrlIOP(u32 speed);

/** Set the eject callback when in ATAPI mode.
* Unofficial name.
* SUPPORTED IN NEWER CDVDMAN MODULES INCLUDED WITHIN DNAS IOPRP ONLY
*
* @param cb The pointer to the callback
* @param userdata The pointer to the userdata that will be passed to the callback
* @return The old callback value
*/
void *sceCdSetAtapiEjectCallback(int (*cb)(int reason, void *userdata), void *userdata);

//DNAS functions

/** Reads the Disk ID.
Expand All @@ -73,6 +95,18 @@ int sceCdSpinCtrlIOP(u32 speed);
*/
int sceCdReadDiskID(unsigned int *id);

/** Deobfuscate using unique key.
* Unofficial name.
* SUPPORTED IN NEWER CDVDMAN MODULES INCLUDED WITHIN DNAS IOPRP ONLY
*
* @param buffer Output buffer
* @param shiftval The amount to rotate left shift
* @param xorval The value to XOR the buffer against
* @param status Command status
* @return 1 on success, 0 on failure.
*/
int sceCdDeobfuscateUsingUniqueKey(u8 *buffer, unsigned int shiftval, int xorval, u32 *status);

#define cdvdman_IMPORTS_start DECLARE_IMPORT_TABLE(cdvdman, 1, 1)
#define cdvdman_IMPORTS_end END_IMPORT_TABLE

Expand Down Expand Up @@ -163,17 +197,23 @@ int sceCdReadDiskID(unsigned int *id);
#define I_sceCdApplySCmd2 DECLARE_IMPORT(112, sceCdApplySCmd2)
#define I_sceCdRE DECLARE_IMPORT(114, sceCdRE)
#define I_sceCdRcBypassCtl DECLARE_IMPORT(115, sceCdRcBypassCtl)
#define I_sceCdSendSCmd1D DECLARE_IMPORT(116, sceCdSendSCmd1D)
#define I_sceRemote2_7 DECLARE_IMPORT(117, sceRemote2_7)
#define I_sceCdSetLEDsMode DECLARE_IMPORT(120, sceCdSetLEDsMode)
#define I_sceCdApplySCmd3 DECLARE_IMPORT(125, sceCdApplySCmd3)
#define I_sceRemote2_7Get DECLARE_IMPORT(128, sceRemote2_7Get)
#define I_sceCdReadPS1BootParam DECLARE_IMPORT(148, sceCdReadPS1BootParam)
#define I_sceCdSetFanProfile DECLARE_IMPORT(150, sceCdSetFanProfile)
#define I_sceCdChgSys DECLARE_IMPORT(154, sceCdChgSys)
#define I_sceCdNoticeGameStart DECLARE_IMPORT(156, sceCdNoticeGameStart)
#define I_sceCdDeobfuscateUsingUniqueKey DECLARE_IMPORT(161, sceCdDeobfuscateUsingUniqueKey)
#define I_sceCdXLEDCtl DECLARE_IMPORT(163, sceCdXLEDCtl)
#define I_sceCdBuzzerCtl DECLARE_IMPORT(165, sceCdBuzzerCtl)
#define I_sceCdXBSPowerCtl DECLARE_IMPORT(171, sceCdXBSPowerCtl)
#define I_sceCdSetAtapiEjectCallback DECLARE_IMPORT(173, sceCdSetAtapiEjectCallback)
#define I_sceCdSetMediumRemoval DECLARE_IMPORT(175, sceCdSetMediumRemoval)
#define I_sceCdGetMediumRemoval DECLARE_IMPORT(177, sceCdGetMediumRemoval)
#define I_sceCdDoesUniqueKeyExist DECLARE_IMPORT(179, sceCdDoesUniqueKeyExist)
#define I_sceCdXDVRPReset DECLARE_IMPORT(181, sceCdXDVRPReset)
#define I_sceCdGetWakeUpReason DECLARE_IMPORT(183, sceCdGetWakeUpReason)
#define I_sceCdReadRegionParams DECLARE_IMPORT(189, sceCdReadRegionParams)
Expand Down

0 comments on commit 20dd409

Please sign in to comment.