Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int sub_8815608(void)
- {
- a1 = *(u8*)0x08b501a2;
- if(a1)
- return 1;
- a1 = *(u8*)0x08b501a1;
- if(a1)
- return 1;
- return 0;
- }
- typedef struct SceIoStat {
- SceMode st_mode; /* 00: file type(file/dir) and mode(RWX) */
- unsigned int st_attr; /* 04: device specific attribute */
- SceOff st_size; /* 08: file size */
- ScePspDateTime st_ctime; /* 10: time of file creation */
- ScePspDateTime st_atime; /* 20: time of last access */
- ScePspDateTime st_mtime; /* 30: time of last modification */
- unsigned int st_private[6]; /* 40: reserved */
- } SceIoStat;
- int sub_880E720(int *pts, int *a1, a2, char *name, int t0, int t1)
- {
- SceIoStat stat;
- a1[0] = 0;
- a1[4] = 0;
- a1[8] = 0;
- a1[12] = 0;
- s7 = t1&0xff;
- s5 = a1;
- s1 = a2;
- if(s7){
- s0 = 0x28b0e;
- while(1){
- v0 = sub_8815608();
- if(v0)
- break;
- s2 = sceIoGetstat(name, &stat);
- if(s2==0)
- break;
- sceKernelDelayThreadCB(0x28b0e);
- }
- }else{
- s2 = sceIoGetstat(name, &stat);
- }
- if(s2<0){
- s5[0] = s2;
- }else{
- a0 = stat.0x08;
- a1 = stat.0x0c
- a3 = *(u32*)0x08b25cf4;
- a2 = *(u32*)0x08b25cf0;
- t0 = a0+a2;
- t1 = (t0<a2)?1:0;
- a0 = t1+a1;
- a1 = a0+a3;
- a3 = *(u32*)0x08b25cfc;
- a2 = *(u32*)0x08b25cf8;
- a0 = t0;
- a1 = a1&a3;
- a0 = a0&a2;
- at = a1<<21;
- a0 = a0>>11;
- a1 = a1>>11;
- a0 = a0|at;
- s5[2] = a0;
- a0 = s1;
- s0 = -1;
- if(a0>0 && a0<4){
- a0 = s1<<4;
- a0 += 0x08b25cc0-0x10;
- s5[3] = a0;
- }
- a0 = s5[3];
- if(a0){
- if(s7){
- while(1){
- v0 = sub_8815608();
- if(v0)
- break;
- s1 = sceIoOpen(name, 0x40000001, 0);
- if(s1>0){
- s0 = sceIoIoctl(s1, 0x04100001, s5[3], 0x10, 0, 0);
- if(s0<0){
- sceIoClose(s1);
- }else{
- s0 = s1;
- }
- }else{
- s0 = s1;
- }
- if(s0>0)
- break;
- sceKernelDelayThreadCB(0x28b0e);
- }
- }else{
- s4 = sceIoOpen(name, 0x40000001, 0);
- if(s4>0){
- s0 = sceIoIoctl(s4, 0x04100001, s5[3], 0x10, 0, 0);
- if(s0<0){
- sceIoClose(s4);
- }else{
- s0 = s4;
- }
- }else{
- s0 = s4;
- }
- }
- s5[0] = s0;
- }
- if(s0<0){
- if(s7){
- if(fp<0){
- s5[0] = fp;
- }else{
- while(1){
- v0 = sub_8815608();
- if(v0)
- break;
- v0 = sub_8810110(1, 0);
- if(v0>0){
- s5[0] = v0;
- break;
- }
- sceKernelDelayThreadCB(0x28b0e);
- }
- }
- fp = stat.0x40
- s5[4] = fp;
- }else{
- v0 = sceIoOpen(name, 1, 0);
- s5[0] = v0;
- }
- }
- }
- a0 = s5[0];
- if(a0<0)
- return 0;
- else
- return 1;
- }
- int sub_880EA48(int *pts, char *dst, int length)
- {
- pts[0] = dst;
- pts[1] = dst+0x30;
- a1 = *(u16*)(dst+0x08);
- a1 <<= 3;
- a1 += dst+0x30;
- pts[2] = a1;
- a1 = *(u32*)(dst+0x10);
- a1 += dst;
- pts[3] = a1;
- a3 = *(u32*)(dst+0x14);
- a3 += dst;
- pts[4] = a3;
- a3 = *(u16*)(dst+0x18);
- if(a3){
- a1 = a3<<11;
- a1 += dst;
- }else{
- a1 = 0;
- }
- pts[5] = a1;
- a1 = (length+0x07ff)>>11;
- a2 = *(u16*)(dst+0x1A);
- if(a1<a2)
- return 0;
- v0 = strcmp(dst, "bbsa", 4);
- if(v0)
- return 0;
- a0 = *(u16*)(dst+0x04);
- if(a0!=5)
- return 0;
- return 1;
- }
- int sub_880DE0C(char *pts, char *name, char *dst, int length, int flag)
- {
- int *s0 = (int*)(pts+0x18);
- int v0, lba_len, fd, lba;
- v0 = sub_880E720(pts, s0, 0, name, -1, flag);
- if(v0==0)
- return 0;
- lba_len = (length+0x07ff)>>11;
- fd = s0[0];
- lba = s0[4];
- v0 = sub_88105D4(fd, lba, dst, lba_len);
- if(v0!=lba_len){
- if(fd>0)
- sceIoClose(fd);
- return 0;
- }
- sub_880EA48(pts, dst, length);
- return 1;
- }
- int sub_880DEF4(int a0, int index, int a2, char *name, int flag)
- {
- char dst[2048];
- if(index==0 || index>4){
- return 0;
- }
- s0 = a0;
- s2 = a2;
- a0 = s0+0x18;
- t0 = *(u32*)a0;
- s4 = sub_880E720(s0, a2, index, name, t0, flag);
- if(s4==0){
- return 0;
- }
- s5 = 0;
- a1 = s2[3];
- fd = s2[0];
- if(flag && (a1==0)){
- lba = s2[1];
- v0 = sub_88105D4(fd, lba, dst, 1);
- s4 = v0^1;
- s5 = 0;
- }else{
- if(flag)
- s4 = 0;
- else
- s4 = 2;
- v0 = sub_8810320(fd, dst, 0x12, s4);
- s4 = v0^0x12;
- if(flag==0){
- do_lseek(fd, 0, 0);
- a1 = do_lseek(fd, 0, 2);
- if(a1>0){
- s5 = a1;
- }
- do_close(fd);
- }
- }
- s4 = !(s4);
- if(s4){
- s4 = sub_880EB1C(s0, dst, index);
- }
- return s4;
- }
- int discInfoBind(void)
- {
- char buf[128], *dst;
- int *pt;
- pt = (int*)0x08b50120;
- dst = (char*)0x09a33740;
- sprintf(buf, "disc0:/PSP_GAME/USRDIR/BBS%d.DAT", 0);
- v0 = sub_880DE0C(*pt, buf, dst, 0x33000, 1);
- if(v0==0)
- return 0;
- for(id=1; id<5; id++){
- sprintf(buf, "disc0:/PSP_GAME/USRDIR/BBS%d.DAT", id);
- v0 = sub_880DEF4(*pt, i, *pt+i*16, buf, 1);
- if(v0==0)
- return 0;
- }
- *(int*)(0x09A667A8) = 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement