2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
10 # $Id: misc.c 1370 2007-01-17 02:28:14Z jbit $
11 # Miscellaneous routines
16 char myPassHash
[APA_PASSMAX
]={0};
18 void *allocMem(int size
)
23 CpuDisableIntr(&intrStat
);
24 mem
= AllocSysMemory(ALLOC_FIRST
, size
, NULL
);
25 CpuEnableIntr(intrStat
);
30 int getPs2Time(ps2time
*tm
)
35 0, 0x0D, 0x0E, 0x0A, 0x0D, 1, 2003// used if can not get time...
38 if(CdReadClock(&cdtime
)!=0 && cdtime
.stat
==0)
41 timeBuf
.sec
=(u32
)(((tmp
<<2)+tmp
)<<1)+(cdtime
.second
&0x0F);
43 timeBuf
.min
=(((tmp
<<2)+tmp
)<<1)+(cdtime
.minute
&0x0F);
45 timeBuf
.hour
=(((tmp
<<2)+tmp
)<<1)+(cdtime
.hour
&0x0F);
46 // timeBuf.hour = (timeBuf.hour + 4) % 24; // TEMP FIX (need to deal with timezones?) ... aparently not
48 timeBuf
.day
=(((tmp
<<2)+tmp
)<<1)+(cdtime
.day
&0x0F);
50 timeBuf
.month
=(((tmp
<<2)+tmp
)<<1)+(cdtime
.month
&0x0F);
52 timeBuf
.year
=(((tmp
<<2)+tmp
)<<1)+(cdtime
.year
&0xF)+2000;
54 memcpy(tm
, &timeBuf
, sizeof(ps2time
));
58 int passcmp(char *pw1
, char *pw2
)
60 if(pw2
==NULL
) pw2
=myPassHash
;
61 return memcmp(pw1
, pw2
, APA_PASSMAX
) ? -EACCES
: 0;
64 int getIlinkID(u8
*idbuf
)
70 // v12/v13 HDD fix: do not check iLinkID
71 //if(CdReadIlinkID(idbuf, &err))
74 //dprintf1("ps2hdd: Error: cannot get ilink id\n");
76 CdReadIlinkID(idbuf
, &err
);