Add libcdvd library

This commit is contained in:
Francisco Javier Trujillo Mata 2019-03-09 13:16:12 +01:00
parent 4c24a17119
commit da86549b8e
16 changed files with 2797 additions and 0 deletions

19
ps2/libcdvd/Makefile Normal file
View File

@ -0,0 +1,19 @@
# Remove the line below, if you want to disable silent mode
#.SILENT:
all: lib/libcdvdfs.a lib/cdvd.irx
lib:
mkdir -p $@
clean:
$(MAKE) -C ee clean
$(MAKE) -C iop clean
lib/cdvd.irx: iop | lib
@echo Building IRX
$(MAKE) -C $<
lib/libcdvdfs.a: ee | lib
@echo Building EE client
$(MAKE) -C $<

45
ps2/libcdvd/common/cdvd.h Normal file
View File

@ -0,0 +1,45 @@
#ifndef _CDVD_H
#define _CDVD_H
// This header contains the common definitions for libcdvd
// that are used by both IOP and EE sides
#define CDVD_IRX 0xB001337
#define CDVD_FINDFILE 0x01
#define CDVD_GETDIR 0x02
#define CDVD_STOP 0x04
#define CDVD_TRAYREQ 0x05
#define CDVD_DISKREADY 0x06
#define CDVD_FLUSHCACHE 0x07
#define CDVD_GETSIZE 0x08
struct TocEntry
{
u32 fileLBA;
u32 fileSize;
u8 fileProperties;
u8 padding1[3];
char filename[128 + 1];
u8 padding2[3];
} __attribute__((packed));
enum CDVD_getMode {
CDVD_GET_FILES_ONLY = 1,
CDVD_GET_DIRS_ONLY = 2,
CDVD_GET_FILES_AND_DIRS = 3
};
// Macros for TrayReq
#define CdTrayOpen 0
#define CdTrayClose 1
#define CdTrayCheck 2
// Macros for DiskReady
#define CdComplete 0x02
#define CdNotReady 0x06
#define CdBlock 0x00
#define CdNonBlock 0x01
#endif // _CDVD_H

Binary file not shown.

10
ps2/libcdvd/ee/Makefile Normal file
View File

@ -0,0 +1,10 @@
EE_LIB = ../lib/libcdvdfs.a
EE_OBJS = cdvd_rpc.o
all: $(EE_LIB)
clean:
rm -f $(EE_LIB) $(EE_OBJS)
include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal

135
ps2/libcdvd/ee/cdvd_rpc.c Normal file
View File

@ -0,0 +1,135 @@
#include <tamtypes.h>
#include <kernel.h>
#include <sifrpc.h>
#include <stdarg.h>
#include <string.h>
#include "cdvd_rpc.h"
int k_sceSifDmaStat(unsigned int id);
static unsigned sbuff[0x1300] __attribute__((aligned(64)));
static SifRpcClientData_t cd0;
int cdvd_inited = 0;
int CDVD_Init()
{
int i;
while (1) {
if (SifBindRpc(&cd0, CDVD_IRX, 0) < 0)
return -1; // bind error
if (cd0.server != 0)
break;
i = 0x10000;
while (i--)
;
}
cdvd_inited = 1;
return 0;
}
int CDVD_DiskReady(int mode)
{
if (!cdvd_inited)
return -1;
sbuff[0] = mode;
SifCallRpc(&cd0, CDVD_DISKREADY, 0, (void *)(&sbuff[0]), 4, (void *)(&sbuff[0]), 4, 0, 0);
return sbuff[0];
}
int CDVD_FindFile(const char *fname, struct TocEntry *tocEntry)
{
if (!cdvd_inited)
return -1;
strncpy((char *)&sbuff, fname, 1024);
SifCallRpc(&cd0, CDVD_FINDFILE, 0, (void *)(&sbuff[0]), 1024, (void *)(&sbuff[0]), sizeof(struct TocEntry) + 1024, 0, 0);
memcpy(tocEntry, &sbuff[256], sizeof(struct TocEntry));
return sbuff[0];
}
void CDVD_Stop()
{
if (!cdvd_inited)
return;
SifCallRpc(&cd0, CDVD_STOP, 0, (void *)(&sbuff[0]), 0, (void *)(&sbuff[0]), 0, 0, 0);
return;
}
int CDVD_TrayReq(int mode)
{
if (!cdvd_inited)
return -1;
SifCallRpc(&cd0, CDVD_TRAYREQ, 0, (void *)(&sbuff[0]), 4, (void *)(&sbuff[0]), 4, 0, 0);
return sbuff[0];
}
int CDVD_GetDir(const char *pathname, const char *extensions, enum CDVD_getMode getMode, struct TocEntry tocEntry[], unsigned int req_entries, char *new_pathname)
{
unsigned int num_entries;
if (!cdvd_inited)
return -1;
// copy the requested pathname to the rpc buffer
strncpy((char *)sbuff, pathname, 1023);
// copy in the extension list to the rpc buffer
if (extensions == NULL) {
// Can't copy in the extension list since there isnt one, so just null the string in the rpc buffer
sbuff[1024 / 4] = 0;
} else {
strncpy((char *)&sbuff[1024 / 4], extensions, 127);
}
sbuff[1152 / 4] = getMode;
sbuff[1156 / 4] = (int)tocEntry;
sbuff[1160 / 4] = req_entries;
SifWriteBackDCache(tocEntry, req_entries * sizeof(struct TocEntry));
// This will get the directory contents, and fill tocEntry via DMA
SifCallRpc(&cd0, CDVD_GETDIR, 0, (void *)(&sbuff[0]), 1024 + 128 + 4 + 4 + 4, (void *)(&sbuff[0]), 4 + 1024, 0, 0);
num_entries = sbuff[0];
if (new_pathname != NULL)
strncpy(new_pathname, (char *)&sbuff[1], 1023);
return (num_entries);
}
void CDVD_FlushCache()
{
if (!cdvd_inited)
return;
SifCallRpc(&cd0, CDVD_FLUSHCACHE, 0, (void *)(&sbuff[0]), 0, (void *)(&sbuff[0]), 0, 0, 0);
return;
}
unsigned int CDVD_GetSize()
{
if (!cdvd_inited)
return -1;
SifCallRpc(&cd0, CDVD_GETSIZE, 0, (void *)(&sbuff[0]), 0, (void *)(&sbuff[0]), 4, 0, 0);
return sbuff[0];
}

28
ps2/libcdvd/ee/cdvd_rpc.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef _CDVD_RPC_H
#define _CDVD_RPC_H
// include the common definitions
#include "../common/cdvd.h"
#ifdef __cplusplus
extern "C" {
#endif
int CDVD_Init();
int CDVD_DiskReady(int mode);
int CDVD_FindFile(const char *fname, struct TocEntry *tocEntry);
void CDVD_Stop();
int CDVD_TrayReq(int mode);
int CDVD_DiskReady(int mode);
int CDVD_GetDir(const char *pathname, const char *extensions, enum CDVD_getMode getMode, struct TocEntry tocEntry[], unsigned int req_entries, char *new_pathname);
void CDVD_FlushCache();
unsigned int CDVD_GetSize();
#ifdef __cplusplus
}
#endif
#endif // _CDVD_H

View File

@ -0,0 +1,17 @@
#update this to point to the location of gslib
GSLIB = /ps2dev/gslib
EE_BIN = example.elf
EE_OBJS = example.o
EE_LDFLAGS += -L../lib -L$(GSLIB)/lib
EE_LIBS += -lkernel -lcdvdfs -lgs -lgcc -lsupc++ -lpad
EE_INCS += -I $(GSLIB)/source -I ../ee
all: $(EE_BIN)
clean:
rm -f *.elf *.o *.a
include $(PS2LIB)/Makefile.pref
include $(PS2LIB)/Makefile.eeglobal

View File

@ -0,0 +1,425 @@
#include <tamtypes.h>
#include <kernel.h>
#include <libpad.h>
#include <fileio.h>
#include <malloc.h>
#include <string.h>
#include <ctype.h>
#include <gsDriver.h>
#include <gsPipe.h>
#include <gsFont.h>
#include <sifrpc.h>
#include <loadfile.h>
#include "cdvd_rpc.h"
#define scr_w 640
#define scr_h 480
#define TEXT_COL_BRIGHT GS_SET_RGBA(0xFF, 0xFF, 0xFF, 0x80)
#define TEXT_COL_DIM GS_SET_RGBA(0x40, 0x40, 0xFF, 0x80)
#define TRUE 1
#define FALSE 0
gsDriver *pDisplay;
extern int screen;
int filelisty = 60;
static float selected = 1; // The currently selected file/dir
int button_released = TRUE;
//A pointer to an array of TocEntries to be alloc'd later
static struct TocEntry *TocEntryList;
gsFontTex *fontTex;
// pathname on CD
char pathname[1024 + 1] __attribute__((aligned(64)));
gsFont myFont;
int WaitPadReady(int port, int slot);
void SetPadMode(int port, int slot);
void ClearScreen(void)
{
pDisplay->drawPipe.setAlphaEnable(GS_DISABLE);
pDisplay->drawPipe.RectFlat(0, 0, scr_w, scr_h, 0, GS_SET_RGBA(0, 0, 0, 0x80));
pDisplay->drawPipe.setAlphaEnable(GS_ENABLE);
pDisplay->drawPipe.Flush();
}
int main(void)
{
SifInitRpc(0);
SifLoadModule("rom0:SIO2MAN", 0, NULL); /* load sio2 manager irx */
SifLoadModule("rom0:PADMAN", 0, NULL); /* load pad manager irx */
SifLoadModule("host:cdvd.irx", 0, NULL);
CDVD_Init();
padInit(0);
char *padBuf = (char *)memalign(64, 256);
padPortOpen(0, 0, padBuf);
SetPadMode(0, 0);
// allocate the memory for a large file list
TocEntryList = (TocEntry *)memalign(64, 4000 * sizeof(struct TocEntry));
// open the font file, find the size of the file, allocate memory for it, and load it
int fontfile = fioOpen("host:font.fnt", O_RDONLY);
int fontsize = fioLseek(fontfile, 0, SEEK_END);
fioLseek(fontfile, 0, SEEK_SET);
fontTex = (gsFontTex *)memalign(64, fontsize);
fioRead(fontfile, fontTex, fontsize);
fioClose(fontfile);
// Upload the background to the texture buffer
pDisplay = new gsDriver;
pDisplay->setDisplayMode(scr_w, scr_h,
170, 80,
GS_PSMCT32, 2,
GS_TV_AUTO, GS_TV_INTERLACE,
GS_DISABLE, GS_DISABLE);
// Enable Alpha Blending
pDisplay->drawPipe.setAlphaEnable(GS_ENABLE);
myFont.assignPipe(&(pDisplay->drawPipe));
// Upload the font into the texture memory past the screen buffers
myFont.uploadFont(fontTex, pDisplay->getTextureBufferBase(),
fontTex->TexWidth, // Use the fontTex width as texbuffer width (can use diff width)
0, 0);
#define list_max 21
int list_size = 21; // Number of files to display in list
int first_file = 1; // The first file to display in the on-screen list
int num_files = 0; // The total number of files in the list
int offset; // Offset of the selected file into the displayed list
struct padButtonStatus padButtons;
int ps2_buttons;
button_released = TRUE;
while (1) {
while (1) // until we've selected a file
{
// Get entries from specified path, don't filter by file extension,
// get files and directories, get a maximum of 4000 entries, and update path if dir changed
num_files = CDVD_GetDir(pathname, NULL, CDVD_GET_FILES_AND_DIRS, TocEntryList, 4000, pathname);
if (num_files < list_max)
list_size = num_files;
else
list_size = list_max;
// Don't leave the drive spinning, it's annoying !
CDVD_Stop();
while (1) // Until we've selected something (dir or file)
{
// Get button presses
// If X then select the previously highlighted file
// If up/down then increase/decrease the selected file
int padState;
// only listen to pad input if it's plugged in, and stable
padState = padGetState(0, 0);
if (padState == PAD_STATE_STABLE) {
padRead(0, 0, &padButtons);
ps2_buttons = (padButtons.btns[0] << 8) | padButtons.btns[1];
ps2_buttons = ~ps2_buttons;
if (num_files > 0) {
// file Selected
if (ps2_buttons & PAD_CROSS) {
if (button_released == TRUE) {
button_released = FALSE;
break;
}
} else
button_released = TRUE;
// DPAD + Shoulder file Selection
if (ps2_buttons & PAD_UP)
selected -= 0.15;
else if (ps2_buttons & PAD_DOWN)
selected += 0.15;
else if (ps2_buttons & PAD_R1)
selected -= 1;
else if (ps2_buttons & PAD_R2)
selected += 1;
else if (ps2_buttons & PAD_L1)
selected = 1;
else if (ps2_buttons & PAD_L2)
selected = num_files;
}
if (ps2_buttons & PAD_SELECT) {
strcpy(pathname, "/");
ClearScreen();
myFont.Print(0, 640, 220, 4,
TEXT_COL_BRIGHT,
GSFONT_ALIGN_CENTRE, "Please Change CD\nThen Press 'X'");
pDisplay->drawPipe.Flush();
// Wait for VSync and then swap buffers
pDisplay->WaitForVSync();
pDisplay->swapBuffers();
CDVD_FlushCache();
strcpy(pathname, "/");
while (1) {
int padState;
// only listen to pad input if it's plugged in, and stable
padState = padGetState(0, 0);
if (padState == PAD_STATE_STABLE) {
padRead(0, 0, &padButtons);
ps2_buttons = (padButtons.btns[0] << 8) | padButtons.btns[1];
ps2_buttons = ~ps2_buttons;
// ROM Selected
if (ps2_buttons & PAD_CROSS) {
break;
}
}
pDisplay->WaitForVSync();
}
num_files = CDVD_GetDir(pathname, NULL, CDVD_GET_FILES_AND_DIRS, TocEntryList, 4000, pathname);
if (num_files < list_max)
list_size = num_files;
else
list_size = list_max;
selected = 1;
CDVD_Stop();
}
if ((padButtons.mode >> 4) == 0x07) {
// Analogue file selection
float pad_v;
pad_v = (float)(padButtons.ljoy_v - 128); // Range = +127 to -128
if (pad_v > 32) {
// scrolling down, so incrementing selected tom
pad_v -= 32;
selected += (pad_v / 96);
}
if (pad_v < -32) {
// scrolling down, so incrementing selected tom
pad_v += 32;
selected += (pad_v / 96);
}
}
if (selected < 1)
selected = 1;
if ((int)selected > num_files)
selected = (float)num_files;
}
// calculate which file to display first in the list
if ((int)selected <= list_size / 2)
first_file = 1;
else {
if ((int)selected >= (num_files - (list_size / 2) + 1))
first_file = num_files - list_size + 1;
else
first_file = (int)selected - ((list_size / 2));
}
// calculate the offset of the selected file into the displayed list
offset = (int)selected - first_file;
ClearScreen();
if (num_files > 0) {
// pDisplay->drawPipe.setScissorRect(list_xpos,list_ypos,list_xpos+list_width,list_ypos+list_height);
for (int file = 0; file < list_size; file++) {
// if the entry is a dir, then display the directory symbol before the name
if (TocEntryList[first_file + file - 1].fileProperties & 0x02) {
// display a dir symbol (character 001 in the bitmap font)
myFont.Print(128, 640, filelisty + (file * 18), 4, GS_SET_RGBA(0x80, 0x80, 0x80, 0x80), GSFONT_ALIGN_LEFT, "\001");
if (file == ((int)selected - first_file)) {
myFont.Print(148, 640, filelisty + (file * 18), 4, TEXT_COL_BRIGHT, GSFONT_ALIGN_LEFT,
TocEntryList[first_file + file - 1].filename);
} else {
myFont.Print(148, 640, filelisty + (file * 18), 4, TEXT_COL_DIM, GSFONT_ALIGN_LEFT,
TocEntryList[first_file + file - 1].filename);
}
} else {
if (file == ((int)selected - first_file)) {
myFont.Print(128, 640, filelisty + (file * 18), 4, TEXT_COL_BRIGHT, GSFONT_ALIGN_LEFT,
TocEntryList[first_file + file - 1].filename);
} else {
myFont.Print(128, 640, filelisty + (file * 18), 4, TEXT_COL_DIM, GSFONT_ALIGN_LEFT,
TocEntryList[first_file + file - 1].filename);
}
}
}
myFont.Print(420, 640, 440, 0, TEXT_COL_BRIGHT, GSFONT_ALIGN_LEFT,
"Press X to Select");
myFont.Print(420, 640, 458, 0, TEXT_COL_BRIGHT, GSFONT_ALIGN_LEFT,
"Press SELECT to Change CD");
}
pDisplay->drawPipe.Flush();
// Wait for VSync and then swap buffers
pDisplay->WaitForVSync();
pDisplay->swapBuffers();
}
// We've selected something, but is it a file or a dir ?
if (TocEntryList[((int)selected) - 1].fileProperties & 0x02) {
// Append name onto current path
//gui_getfile_dispname((int)selected, tempname);
strcat(pathname, "/");
strcat(pathname, TocEntryList[((int)selected) - 1].filename);
// file list will be got next time round the while loop
// Start from top of list
selected = 1;
} else {
// It's not a dir, so it must be a file
break;
}
}
char size_string[64];
if (TocEntryList[((int)selected) - 1].fileSize < (2 * 1024))
sprintf(size_string, "%d bytes", TocEntryList[((int)selected) - 1].fileSize);
else {
if (TocEntryList[((int)selected) - 1].fileSize < (2 * 1024 * 1024))
sprintf(size_string, "%d Kb", TocEntryList[((int)selected) - 1].fileSize / 1024);
else
sprintf(size_string, "%d Mb", TocEntryList[((int)selected) - 1].fileSize / (1024 * 1024));
}
for (int frame = 0; frame < 200; frame++) {
// Selected a file, so display file properties for a couple of seconds
ClearScreen();
myFont.Print(100, 200, 220, 1, TEXT_COL_BRIGHT, GSFONT_ALIGN_LEFT,
"File name:");
myFont.Print(200, 640, 220, 1, TEXT_COL_BRIGHT, GSFONT_ALIGN_LEFT,
TocEntryList[((int)selected) - 1].filename);
myFont.Print(100, 200, 240, 1, TEXT_COL_BRIGHT, GSFONT_ALIGN_LEFT,
"File path:");
myFont.Print(200, 640, 240, 1, TEXT_COL_BRIGHT, GSFONT_ALIGN_LEFT,
pathname);
myFont.Print(100, 200, 260, 1, TEXT_COL_BRIGHT, GSFONT_ALIGN_LEFT,
"File size:");
myFont.Print(200, 640, 260, 1, TEXT_COL_BRIGHT, GSFONT_ALIGN_LEFT,
size_string);
pDisplay->drawPipe.Flush();
// Wait for VSync and then swap buffers
pDisplay->WaitForVSync();
pDisplay->swapBuffers();
}
}
free(fontTex);
free(TocEntryList);
delete pDisplay;
return 0;
}
int WaitPadReady(int port, int slot)
{
int state = 0;
while ((state != PAD_STATE_STABLE) &&
(state != PAD_STATE_FINDCTP1)) {
state = padGetState(port, slot);
if (state == PAD_STATE_DISCONN)
break; // If no pad connected then dont wait for it to be plugged in
//pEmuDisplay->WaitForVSync();
}
return state;
}
void SetPadMode(int port, int slot)
{
// If the controller is already plugged in then
// put the controller into Analogue mode (and lock it)
// so that analogue stick can be used
if (WaitPadReady(port, slot) == PAD_STATE_STABLE) // if pad is connected then initialise it
{
padSetMainMode(port, slot, PAD_MMODE_DUALSHOCK, PAD_MMODE_LOCK);
WaitPadReady(port, slot);
}
}

Binary file not shown.

12
ps2/libcdvd/iop/Makefile Normal file
View File

@ -0,0 +1,12 @@
IOP_BIN = ../lib/cdvd.irx
IOP_OBJS = cdvd_iop.o imports.o
all: $(IOP_BIN)
clean:
rm -f $(IOP_BIN) $(IOP_OBJS)
include $(PS2SDK)/Defs.make
include Rules.make

View File

@ -0,0 +1,54 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004.
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
IOP_CC_VERSION := $(shell $(IOP_CC) -v 2>&1 | sed -n 's/^.*version //p')
ASFLAGS_TARGET = -mcpu=r3000
ifeq ($(IOP_CC_VERSION),3.2.2)
CFLAGS_TARGET = -miop
ASFLAGS_TARGET = -march=r3000
LDFLAGS_TARGET = -miop
endif
IOP_INCS := $(IOP_INCS) -I$(PS2SDK)/iop/include -I$(PS2SDK)/common/include
IOP_CFLAGS := $(CFLAGS_TARGET) -O2 -G0 -D_IOP -c $(IOP_INCS) $(IOP_CFLAGS)
IOP_ASFLAGS := $(ASFLAGS_TARGET) -EL -G0 $(IOP_ASFLAGS)
IOP_LDFLAGS := $(LDFLAGS_TARGET) -nostdlib $(IOP_LDFLAGS)
# Externally defined variables: IOP_BIN, IOP_OBJS, IOP_LIB
%.o : %.c
$(IOP_CC) $(IOP_CFLAGS) $< -o $@
%.o : %.s
$(IOP_AS) $(IOP_ASFLAGS) $< -o $@
# A rule to build imports.lst.
%.o : %.lst
echo "#include \"irx_imports.h\"" > build-imports.c
cat $< >> build-imports.c
$(IOP_CC) $(IOP_CFLAGS) build-imports.c -o $@
-rm -f build-imports.c
# A rule to build exports.tab.
%.o : %.tab
echo "#include \"irx.h\"" > build-exports.c
cat $< >> build-exports.c
$(IOP_CC) $(IOP_CFLAGS) build-exports.c -o $@
-rm -f build-exports.c
$(IOP_BIN) : $(IOP_OBJS)
$(IOP_CC) $(IOP_LDFLAGS) -o $(IOP_BIN) $(IOP_OBJS) $(IOP_LIBS)
$(IOP_LIB) : $(IOP_OBJS)
$(IOP_AR) cru $(IOP_LIB) $(IOP_OBJS)

1852
ps2/libcdvd/iop/cdvd_iop.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
#ifndef _CDVD_IOP_H
#define _CDVD_IOP_H
#include "../common/cdvd.h"
// Macros for READ Data pattan
#define CdSecS2048 0 // sector size 2048
#define CdSecS2328 1 // sector size 2328
#define CdSecS2340 2 // sector size 2340
// Macros for Spindle control
#define CdSpinMax 0
#define CdSpinNom 1 // Starts reading data at maximum rotational velocity and if a read error occurs, the rotational velocity is reduced.
#define CdSpinStm 0 // Recommended stream rotation speed.
typedef struct
{
u8 stat; // 0: normal. Any other: error
u8 second; // second (BCD value)
u8 minute; // minute (BCD value)
u8 hour; // hour (BCD value)
u8 week; // week (BCD value)
u8 day; // day (BCD value)
u8 month; // month (BCD value)
u8 year; // year (BCD value)
} CdCLOCK;
typedef struct
{
u32 lsn; // Logical sector number of file
u32 size; // File size (in bytes)
char name[16]; // Filename
u8 date[8]; // 1th: Seconds
// 2th: Minutes
// 3th: Hours
// 4th: Date
// 5th: Month
// 6th 7th: Year (4 digits)
} CdlFILE;
typedef struct
{
u8 minute; // Minutes
u8 second; // Seconds
u8 sector; // Sector
u8 track; // Track number
} CdlLOCCD;
typedef struct
{
u8 trycount; // Read try count (No. of error retries + 1) (0 - 255)
u8 spindlctrl; // SCECdSpinStm: Recommended stream rotation speed.
// SCECdSpinNom: Starts reading data at maximum rotational velocity and if a read error occurs, the rotational velocity is reduced.
u8 datapattern; // SCECdSecS2048: Data size 2048 bytes
// SCECdSecS2328: 2328 bytes
// SCECdSecS2340: 2340 bytes
u8 pad; // Padding data produced by alignment.
} CdRMode;
int CdBreak(void);
int CdCallback(void (*func)());
int CdDiskReady(int mode);
int CdGetDiskType(void);
int CdGetError(void);
u32 CdGetReadPos(void);
int CdGetToc(u8 *toc);
int CdInit(int init_mode);
CdlLOCCD *CdIntToPos(int i, CdlLOCCD *p);
int CdPause(void);
int CdPosToInt(CdlLOCCD *p);
int CdRead(u32 lsn, u32 sectors, void *buf, CdRMode *mode);
int CdReadClock(CdCLOCK *rtc);
int CdSearchFile(CdlFILE *fp, const char *name);
int CdSeek(u32 lsn);
int CdStandby(void);
int CdStatus(void);
int CdStop(void);
int CdSync(int mode);
int CdTrayReq(int mode, u32 *traycnt);
int CdFlushCache(void);
unsigned int CdGetSize(void);
#endif // _CDVD_H

View File

@ -0,0 +1,62 @@
cdvdman_IMPORTS_start
I_sceCdInit
I_sceCdGetError
I_sceCdRead
I_sceCdStop
I_sceCdSync
I_sceCdDiskReady
I_sceCdGetDiskType
I_sceCdTrayReq
cdvdman_IMPORTS_end
intrman_IMPORTS_start
I_CpuSuspendIntr
I_CpuResumeIntr
intrman_IMPORTS_end
ioman_IMPORTS_start
I_AddDrv
I_DelDrv
ioman_IMPORTS_end
sifcmd_IMPORTS_start
I_sceSifInitRpc
I_sceSifSetRpcQueue
I_sceSifRegisterRpc
I_sceSifRpcLoop
sifcmd_IMPORTS_end
sifman_IMPORTS_start
I_sceSifSetDma
I_sceSifDmaStat
sifman_IMPORTS_end
stdio_IMPORTS_start
I_printf
I_puts
stdio_IMPORTS_end
sysclib_IMPORTS_start
I_tolower
I_strcpy
I_strncpy
I_strncmp
I_strtok
I_strrchr
I_strcat
I_strlen
I_memset
I_memcpy
I_memcmp
sysclib_IMPORTS_end
sysmem_IMPORTS_start
I_AllocSysMemory
sysmem_IMPORTS_end
thbase_IMPORTS_start
I_GetThreadId
I_CreateThread
I_StartThread
I_SleepThread
thbase_IMPORTS_end

View File

@ -0,0 +1,9 @@
#include <cdvdman.h>
#include <intrman.h>
#include <ioman.h>
#include <sifcmd.h>
#include <sifman.h>
#include <stdio.h>
#include <sysclib.h>
#include <sysmem.h>
#include <thbase.h>

45
ps2/libcdvd/license.txt Normal file
View File

@ -0,0 +1,45 @@
Copyright (c) 2002, A.Lee & Nicholas Van Veen
All rights reserved.
Redistribution and use of this software, in source and binary forms, with or
without modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. You are granted a license to use this software for academic, research and
non-commercial purposes only.
4. The copyright holder imposes no restrictions on any code developed using
this software. However, the copyright holder retains a non-exclusive
royalty-free license to any modifications to the distribution made by the
licensee.
5. Any licensee wishing to make commercial use of this software should contact
the copyright holder to execute the appropriate license for such commercial
use. Commercial use includes:
- Integration of all or part of the source code into a product for sale
or commercial license by or on behalf of Licensee to third parties, or
- Distribution of the binary code or source code to third parties that
need it to utilize a commercial product sold or licensed by or on
behalf of Licensee.
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.