Ejemplo n.º 1
0
Archivo: stdio.c Proyecto: esxgx/uofw
int _sceTtyProxyDevRead(SceIoIob *iob, char *buf, int size)
{
    dbg_printf("Calling %s\n", __FUNCTION__);
    int cnt;
    int oldK1 = pspShiftK1();
    int count = 0;
    int k1 = 0;
    if (sceIoGetIobUserLevel(iob) != 8)
        k1 = 24;
    // 09D0
    pspSetK1(k1);
    int size2 = g_pipeList[iob->fsNum + 3];
    SceUID id = g_pipeList[iob->fsNum + 0];
    int min;
    // 09F8
    do
    {
        min = size2;
        if (size2 >= size)
            min = size;
        int ret = sceKernelReceiveMsgPipe(id, buf, min, 1, &cnt, 0);
        if (ret < 0) {
            pspSetK1(oldK1);
            return ret;
        }
        size -= cnt;
        buf += cnt;
        count += cnt;
    } while (cnt >= min && size != 0);
    pspSetK1(oldK1);
    return count;
}
Ejemplo n.º 2
0
Archivo: stdio.c Proyecto: esxgx/uofw
int _sceTtyProxyDevWrite(SceIoIob *iob, const char *buf, int size)
{
    dbg_printf("Calling %s\n", __FUNCTION__);
    int oldK1 = pspShiftK1();
    int count = 0;
    int curCnt;
    int k1 = 0;
    if (sceIoGetIobUserLevel(iob) != 8)
        k1 = 24;
    // 0AC4
    pspSetK1(k1);
    int size2 = g_pipeList[iob->fsNum + 3];
    SceUID id = g_pipeList[iob->fsNum + 0];
    // 0AE8
    do
    {
        int minSize = size2;
        if (size2 >= size)
            minSize = size;
        int ret = sceKernelSendMsgPipe(id, (void*)buf, minSize, 0, &curCnt, 0);
        if (ret < 0) {
            pspSetK1(oldK1);
            return ret;
        }
        size -= curCnt;
        count += curCnt;
        buf += curCnt;
    } while (size != 0);
    pspSetK1(oldK1);
    return count;
}
Ejemplo n.º 3
0
Archivo: utils.c Proyecto: Kaegell/uofw
int sceKernelUtilsMd5BlockUpdate(SceKernelUtilsMd5Context *ctx, u8 *data, u32 size)
{
    int oldK1 = pspShiftK1();
    if (!pspK1PtrOk(ctx)
     || !pspK1DynBufOk(data, size)
     || ctx == NULL || data == NULL) {
        pspSetK1(oldK1);
        return 0x800200D3;
    }
    // ED60
    if (ctx->usComputed != 0)
    {
        pspSetK1(oldK1);
        // EE44
        return -1;
    }
    int remaining = ctx->usRemains;
    if (ctx->usRemains >= 64)
    {
        // EE34
        pspSetK1(oldK1);
        return 0x800201BC;
    }
    ctx->ullTotalLen += size;
    int numTotal = ctx->usRemains + size;
    // EDB0
    while (numTotal >= 64)
    {
        if (remaining == 0)
        {
            // EE1C
            data += 64;
            memcpy(ctx->buf, data, 64);
        }
        else
        {
            data += 64 - remaining;
            memcpy(ctx + remaining + 32, data, 64 - remaining);
            remaining = 0;
        }
        // EDD4
        numTotal -= 64;
        md5BlockUpdate(ctx, ctx->buf);
    }
    // EDEC
    if (numTotal != 0) {
        // EE04
        memcpy(ctx + remaining + 32, data, numTotal - remaining);
    }
    ctx->usRemains = numTotal;
    // EDF8
    pspSetK1(oldK1);
    return 0;
}
Ejemplo n.º 4
0
// Name: sceDdrdbSigvryForUser ?
s32 sceDdrdb_F013F8BF(u8 *pData, u8 *pSig) 
{
    s32 status;
    s32 tmpStatus;
    SceSize workSize;
    s32 oldK1;
    u32 i;
    
    oldK1 = pspShiftK1();

    /* Check if the provided buffers are located in userland. */
    if (!pspK1StaBufOk(pData, KIRK_SHA1_DIGEST_LEN) || !pspK1StaBufOk(pSig, KIRK_ECDSA_SIG_LEN)) { // 0x00002E68 & 0x00002E7C
        pspSetK1(oldK1);
        return SCE_ERROR_PRIV_REQUIRED;
    }
         
    tmpStatus = sceKernelWaitSema(g_semaId, 1, NULL); //0x00002EC4
    if (tmpStatus != SCE_ERROR_OK) {
        pspSetK1(oldK1);
        return SCE_ERROR_SEMAPHORE;
    }

    /* Set up the work area. */
    for (i = 0; i < KIRK_ECDSA_PUBLIC_KEY_LEN; i++) // 0x00002ED4 - 0x00002F00
        g_pWorkData[i] = g_pubKeySigForUser[i]; // 0x00002F00

    for (i = 0; i < KIRK_SHA1_DIGEST_LEN; i++) //0x00002F04 - 0x00002F24
        g_pWorkData[KIRK_ECDSA_PUBLIC_KEY_LEN + i] = pData[i];

    for (i = 0; i < KIRK_ECDSA_SIG_LEN; i++) //0x00002F28 - 0x00002F48
        g_pWorkData[KIRK_ECDSA_PUBLIC_KEY_LEN + KIRK_SHA1_DIGEST_LEN + i] = pSig[i]; //0x00002F48

    workSize = KIRK_ECDSA_PUBLIC_KEY_LEN + KIRK_SHA1_DIGEST_LEN + KIRK_ECDSA_SIG_LEN;

    /* Verify the provided signature. */
    tmpStatus = sceUtilsBufferCopyWithRange(NULL, 0, g_pWorkData, workSize, KIRK_CMD_SIG_VER_ECDSA); //0x00002F60
    status = (tmpStatus != SCE_ERROR_OK) ? SCE_ERROR_INVALID_VALUE : SCE_ERROR_OK; //0x00002F64 - 0x00002F6C
    
    /* Clear the work area. */
    for (i = 0; i < workSize; i++) //0x00002F70 - 0x00002F88
        g_pWorkData[i] = 0; //0x00002F88

    tmpStatus = sceKernelSignalSema(g_semaId, 1); //0x00002F90

    pspSetK1(oldK1);
    return (tmpStatus != SCE_ERROR_OK) ? SCE_ERROR_SEMAPHORE : status; //0x00002F98 - 0x00002FA4
}
Ejemplo n.º 5
0
/*
Subroutine sceHttpStorageLseek - Address 0x00000280 
Exported in sceHttpStorage_driver
Exported in sceHttpStorage
*/
u32 sceHttpStorageLseek(int a0) {
	s32 oldk1 = pspShiftK1();
	//0x2AC
	if ((a0 < 2) != 0) {
		//0x2C4
		if (*((int *) ((a0 << 2) + &g_fd[0])) != 0) {
			SceOff pos = sceIoLseek(*((int *) ((a0 << 2) + &g_fd[0])), 0,
			SEEK_END);
			pspSetK1(oldk1);
			return pos;
		}
		pspSetK1(oldk1);
		return 0x80000001;
	}
	pspSetK1(oldk1);
	return 0x80000100;
}
Ejemplo n.º 6
0
//Subroutine sceUmd_BA3D2A5F - Address 0x00000D24 - Aliases: sceUmdUser_340B7686
s32 sceUmdGetDiscInfo(SceUmdDiscInfo *pDiscInfo)
{
    s32 oldK1;
    s32 status;
       
    oldK1 = pspShiftK1();
        
    if (pDiscInfo == NULL || pspK1PtrOk(pDiscInfo) < 0 || pspK1StaBufOk(pDiscInfo, sizeof(SceUmdDiscInfo) - sizeof(u32)) < 0 
            || pDiscInfo->uiSize != sizeof(SceUmdDiscInfo)) {
        pspSetK1(oldK1);
        return SCE_ERROR_ERRNO_INVALID_ARGUMENT;
    }      
    status = _umdGetDiscInfo(pDiscInfo);
    
    pspSetK1(oldK1);
    return status;
}
Ejemplo n.º 7
0
Archivo: stdio.c Proyecto: esxgx/uofw
int sceKernelRegisterStderrPipe(SceUID id)
{
    dbg_printf("Calling %s\n", __FUNCTION__);
    int oldK1 = pspShiftK1();
    int ret = _sceKernelRegisterStdPipe(STDERR, id);
    pspSetK1(oldK1);
    return ret;
}
Ejemplo n.º 8
0
//Subroutine sceUmd_598EC4DC - Address 0x000009A0 - Aliases: sceUmdUser_BD2BDE07
s32 sceUmdUnRegisterUMDCallBack(SceUID callbackId)
{   
    s32 oldK1 = pspShiftK1();
       
    if (callbackId != g_umdCallbackId) {
        pspSetK1(oldK1);
        return SCE_ERROR_ERRNO_INVALID_ARGUMENT;
    }
       
    g_umdCallbackId = 0;
       
    /* Only support PSP SDK versions >= 3.00 */
    if (sceKernelGetCompiledSdkVersion() >= 0x03000000) {
        pspSetK1(oldK1);
        return SCE_ERROR_OK;
    }
    pspSetK1(oldK1);
    return SCE_ERROR_ERRNO_INVALID_ARGUMENT;
}
Ejemplo n.º 9
0
/*
Subroutine sceHttpStorage_bridge_04EF00F8 - Address 0x00000438 
Exported in sceHttpStorage_bridge
*/
u32 sceHttpStorage_bridge_04EF00F8(int a0) {
	u8 buf[16];
	int res = 0x80000023;
	s32 oldk1 = pspShiftK1();
	//0x47C
	if ((((a0 + 8) | a0) & (oldk1 << 11)) >= 0) {
		res = sceKernelSearchModuleByName("sceChkreg");//scekernelfindmodulebyname?
		//0x4A4
		if ((u32) res != 0x8002012E) { //SCE_ERROR_KERNEL_UNKNOWN_MODULE
			//0x4AC
			if (res >= 0) {
				res = sceChkreg_driver_59F8491D((char *) a0);
				goto end;
			}
			pspSetK1(oldk1);
			return res;
		}
		res = sceKernelLoadModule("flash0:/kd/chkreg.prx");
		//0x52C
		if (res == 0) {
			res = sceKernelStartModule(res, 0, 0, buf, 0);
			//0x540
			if (res < 0) {
				goto end;
			}
			res = sceChkreg_driver_59F8491D((char *) a0);
			end:
			//0x4D0
			if (res >= 0) {
				sceKernelStopModule(res, 0, 0, 0, 0);
				res = sceKernelUnloadModule(res);
				pspSetK1(oldk1);
				return (res < 0) ? res : sceKernelUnloadModule(res);
			}
			pspSetK1(oldk1);
			return res;
		}
		pspSetK1(oldk1);
		return res;
	}
	pspSetK1(oldk1);
	return res;
}
Ejemplo n.º 10
0
//Subroutine sceUmd_5EBB491F - Address 0x00000C80 - Aliases: sceUmdUser_AEE7404D
s32 sceUmdRegisterUMDCallBack(SceUID callbackId)
{
    s32 oldK1;
    s32 intrState;
    
    oldK1 = pspShiftK1();
       
    if (sceKernelGetThreadmanIdType(callbackId) != SCE_KERNEL_TMID_Callback) {
        pspSetK1(oldK1);
        return SCE_ERROR_ERRNO_INVALID_ARGUMENT;
    }
    intrState = sceKernelCpuSuspendIntr();
    
    g_umdCallbackId = callbackId;
    
    sceKernelCpuResumeIntr(intrState);
    pspSetK1(oldK1);      
    return SCE_ERROR_OK;
}
Ejemplo n.º 11
0
/*
Subroutine sceHttpStorageClose - Address 0x000000E0 
Exported in sceHttpStorage_driver
Exported in sceHttpStorage
*/
u32 sceHttpStorageClose(int a0) {
	int s0 = 0;
	s32 oldk1 = pspShiftK1();
	SceUID *fd = (a0 << 2) + &g_fd[0];
	//0x110
	if ((a0 < 2) != 0) {
		//0x11C
		if (*((int *) fd) >= 0) {
			s0 = sceIoClose(*((SceUID *) fd));
			*((SceUID *) fd) = -1;
			pspSetK1(oldk1);
			return s0;
		}
		pspSetK1(oldk1);
		return s0;
	}
	pspSetK1(oldk1);
	return 0x80000100;
}
Ejemplo n.º 12
0
// Subroutine sceUmd_E83742BA - Address 0x00000AC8 - Aliases: sceUmdUser_E83742BA
s32 sceUmdDeactivate(s32 mode, const char *aliasName)
{
    s32 oldK1;
    s32 status;
    
    if (mode < 0 || mode > 18 || (mode == SCE_UMD_MODE_POWER_CUR && aliasName == NULL))
        return SCE_ERROR_ERRNO_INVALID_ARGUMENT;
       
    oldK1 = pspShiftK1();
    if (pspK1PtrOk(aliasName) < 0) {
        pspSetK1(oldK1);
        return SCE_ERROR_ERRNO_INVALID_ARGUMENT;       
    }
 
    status = _unmountUMDDevice(mode, aliasName);
    status = sceUmdSetErrorStatus(status);
       
    pspSetK1(oldK1);   
    return status;
}
Ejemplo n.º 13
0
Archivo: utils.c Proyecto: Kaegell/uofw
int UtilsForUser_43C9A8DB(const void *p, u32 size)
{
    int ret;
    int oldK1 = pspShiftK1();
    if (!pspK1DynBufOk(p, size))
        ret = 0x800200D3;
    else
        ret = UtilsForKernel_43C9A8DB(p, size);
    pspSetK1(oldK1);
    return ret;
}
Ejemplo n.º 14
0
Archivo: utils.c Proyecto: Kaegell/uofw
int sceKernelIcacheInvalidateRangeForUser(const void *p, u32 size)
{
    int ret;
    int oldK1 = pspShiftK1();
    if (!pspK1DynBufOk(p, size))
        ret = 0x800200D3;
    else
        ret = sceKernelIcacheInvalidateRange(p, size);
    pspSetK1(oldK1);
    return ret;
}
Ejemplo n.º 15
0
//Subroutine sceUmd_C6183D47 - Address 0x00000A0C - Aliases: sceUmdUser_C6183D47
s32 sceUmdActivate(s32 mode, const char *aliasName)
{
    s32 oldK1;
    s32 status;
    
    if ((mode != SCE_UMD_MODE_POWER_ON && mode != SCE_UMD_MODE_POWER_CUR) || aliasName == NULL 
            || strncmp(aliasName, SCE_UMD_ALIAS_NAME, strlen(SCE_UMD_ALIAS_NAME) + 1) != 0)
        return SCE_ERROR_ERRNO_INVALID_ARGUMENT;
       
    oldK1 = pspShiftK1();   
    if (pspK1PtrOk(aliasName) < 0) {
        pspSetK1(oldK1);
        return SCE_ERROR_ERRNO_INVALID_ARGUMENT;
    }
    
    status = _mountUMDDevice(mode, aliasName);
    sceUmdSetErrorStatus(status);
       
    pspSetK1(oldK1);   
    return SCE_ERROR_OK;
}
Ejemplo n.º 16
0
//Subroutine sceUmd_A9B5B972 - Address 0x00000DA8 - Aliases: sceUmdUser_46EBB729
s32 sceUmdCheckMedium(void)
{
    s32 oldK1;
    s32 status;
    
    oldK1 = pspShiftK1();
    
    status = sub_000004DC();
       
    pspSetK1(oldK1);
    return status;
}
Ejemplo n.º 17
0
//Subroutine sceUmd_AD1444AB - Address 0x00000F4C - Aliases: sceUmdUser_B103FA38
s32 sceUmdUseUMDInMsUsbWlan(void)
{
    s32 oldK1;
    s32 status;
    
    oldK1 = pspShiftK1();
    
    status = sub_0000094C();
    
    pspSetK1(oldK1);
    return status;       
}
Ejemplo n.º 18
0
//Subroutine sceUmd_F0C51280 - Address 0x00000F78 - Aliases: sceUmdUser_14C6C45C
s32 sceUmdUnuseUMDInMsUsbWlan(void)
{
    s32 oldK1;
    s32 status;
    
    oldK1 = pspShiftK1();
    
    status = _setUmdReplaceStatus(SCE_UMD_REPLACE_STATUS_PROHIBITED);
    
    pspSetK1(oldK1);
    return status;
}
Ejemplo n.º 19
0
//Subroutine sceUmd_4F017CDE - Address 0x00000EEC - Aliases: sceUmdUser_87533940
s32 sceUmdReplaceProhibit(void)
{
    s32 oldK1;
    s32 status;
    
    oldK1 = pspShiftK1();
    
    status = _setUmdReplaceStatus(SCE_UMD_REPLACE_STATUS_PROHIBITED);
    
    pspSetK1(oldK1);
    return status;
}
Ejemplo n.º 20
0
//Subroutine sceUmd_0B14CE61 - Address 0x00000F1C - Aliases: sceUmdUser_CBE9F02A
s32 sceUmdReplacePermit(void)
{
    s32 oldK1;
    s32 status;
    
    oldK1 = pspShiftK1();
    
    status = _setUmdReplaceStatus(SCE_UMD_REPLACE_STATUS_ALLOWED);
    
    pspSetK1(oldK1);
    return status;
}
Ejemplo n.º 21
0
Archivo: utils.c Proyecto: Kaegell/uofw
int sceKernelUtilsMd5BlockResult(SceKernelUtilsMd5Context *ctx, u8 *digest)
{
    u8 buf[64];
    int oldK1 = pspShiftK1();
    if (!pspK1PtrOk(ctx) || !pspK1PtrOk(digest)
     || ctx == NULL || digest == NULL) {
        pspSetK1(oldK1);
        return 0x800200D3;
    }
    // EED0
    if (ctx->usComputed == 0)
    {
        short remain = ctx->usRemains;
        if (remain >= 64)
        {
            // EFE4
            pspSetK1(oldK1);
            return 0x800201BC;
        }
        memset(buf, 0, 64);
        memcpy(buf, ctx->buf, remain);
        buf[remain] = 0x80;
        if (remain >= 56)
        {
            // EFC0
            md5BlockUpdate(ctx, buf);
            memset(buf, 0, 64);
        }
        // EF1C
        u64 num = ctx->ullTotalLen * 8;
        // EF38
        int i;
        for (i = 0; i < 8; i++) {
            // EF74
            buf[i + 56] = num >> (i * 8);
        }
        md5BlockUpdate(ctx, buf);
        ctx->usComputed = 1;
        memset(ctx->buf, 0, 64);
    }
Ejemplo n.º 22
0
/*
Subroutine sceHttpStorageRead - Address 0x00000160 
Exported in sceHttpStorage_driver
Exported in sceHttpStorage
*/
u32 sceHttpStorageRead(SceUID a0, char a1, SceSize a2) {
	s32 oldk1 = pspShiftK1();
	//0x190
	if ((int) ((oldk1 << 11) & (((a1 + a2) | a1) | a2)) >= 0) {
		//0x1AC
		if ((a0 < 2) != 0) {
			//0x1C4
			if (*(int *) (((a0 << 2) + &g_fd[0])) != -1) {
				int bytesRead = sceIoRead(*((SceUID *) ((a0 << 2) + &g_fd[0])),
						&a1, a2);
				pspSetK1(oldk1);
				return bytesRead;
			}
			pspSetK1(oldk1);
			return 0x80000001;
		}
		pspSetK1(oldk1);
		return 0x80000100;
	}
	pspSetK1(oldk1);
	return 0x800001FF;
}
Ejemplo n.º 23
0
/*
Subroutine sceHttpStorageGetstat - Address 0x000002F0 
Exported in sceHttpStorage_driver
Exported in sceHttpStorage
*/
u32 sceHttpStorageGetstat(int a0, int a1) {
	s32 oldk1 = pspShiftK1();
	//0x310
	if (((oldk1 << 11) & a1) >= 0) {
		//0x318
		if (a0 != 0) {
			//0x320
			if (a0 != ((oldk1 << 11) & a1)) {
				pspSetK1(oldk1);
				return 0x80000100;
			}
			int stat = sceIoGetstat("flash1:/net/http/cookie.dat", (SceIoStat *) a1);
			pspSetK1(oldk1);
			return stat;
		}
		int stat = sceIoGetstat("flash1:/net/http/auth.dat", (SceIoStat *) a1);
		pspSetK1(oldk1);
		return stat;
	}
	pspSetK1(oldk1);
	return 0x800001FF;
}
Ejemplo n.º 24
0
/*
Subroutine sceHttpStorageOpen - Address 0x00000000 
Exported in sceHttpStorage_driver
Exported in sceHttpStorage
*/
u32 sceHttpStorageOpen(int a0, int a1, int a2) {
	s32 oldk1 = pspShiftK1();
	int s1 = a0 << 2;
	SceUID fd;
	//0x24
	if ((a0 < 2) != 0) {
		//0x48
		if (g_fd[0] != -1) {
			pspSetK1(oldk1);
			return 0x80000020;
		}
		a2 &= 0x1A4;
		//0x88
		if (a0 != 0) {
			//0x94
			if (a0 != 1) {
				fd = 0x8000010;
				goto end;
			}
			fd = sceIoOpen("flash1:/net/http/cookie.dat",
					((a1 & 0x02000603) | 0x04000000), (a2 & 0x000001A4));
			goto end;
		}
		fd = sceIoOpen("flash1:/net/http/auth.dat",
				((a1 & 0x02000603) | 0x04000000), (a2 & 0x000001A4));
		end:
		//0xA0
		if (fd > 0) {
			*((int *) (s1 + &g_fd[0])) = fd;
			pspSetK1(oldk1);
			return 0;
		}
		pspSetK1(oldk1);
		return fd;
	}
	//0x50
	pspSetK1(oldk1);
	return 0x80000100;
}
Ejemplo n.º 25
0
//Subroutine sceUmdUser_20628E6F - Address 0x00000EA0
s32 sceUmdGetErrorStat(void)
{
    s32 oldK1;
    s32 status;
    
    oldK1 = pspShiftK1();
       
    status = sceUmdGetErrorStatus();
    status = sceUmd_040A7090(status);
       
    pspSetK1(oldK1);
    return status;
}
Ejemplo n.º 26
0
/*
Subroutine sceHttpStorageWrite - Address 0x000001F0 
Exported in sceHttpStorage_driver
Exported in sceHttpStorage
*/
u32 sceHttpStorageWrite(SceUID a0, const char a1, SceSize a2) {
	s32 oldk1 = pspShiftK1();
	//0x220
	if ((int) ((oldk1 << 11) & (((a1 + a2) | a1) | a2)) >= 0) {
		//0x23C
		if (((a0 << 2) + &g_fd) != 0) {
			//0x254
			if (*(int *) (((a0 << 2) + &g_fd[0])) != -1) {
				int bytesWritten = sceIoWrite(
						*((SceUID *) ((a0 << 2) + &g_fd[0])), &a1, a2);
				pspSetK1(oldk1);
				return bytesWritten;
			}
			pspSetK1(oldk1);
			return 0x80000001;
		}
		pspSetK1(oldk1);
		return 0x80000100;
	}
	pspSetK1(oldk1);
	return 0x800001FF;
}
Ejemplo n.º 27
0
//Subroutine sceUmd_18E225C8 - Address 0x00000E38 - Aliases: sceUmdUser_6AF9B50A
s32 sceUmdCancelWaitDriveStat(void)
{
    s32 oldK1;
    SceUID eventId;
    s32 driveState;
    s32 status;
    
    eventId = sceUmdGetUserEventFlagId();
    oldK1 = pspShiftK1();
       
    driveState = sceUmdGetDriveStatus();
       
    status = sceKernelCancelEventFlag(eventId, driveState, NULL);
       
    pspSetK1(oldK1);
    return status;
}
Ejemplo n.º 28
0
//Subroutine sceUmd_8EF08FCE - Address 0x00000DD4 - Aliases: sceUmdUser_8EF08FCE
s32 sceUmdWaitDriveStat(s32 umdState)
{
    s32 oldK1;
    SceUID eventId;
    u32 resultBits;
    s32 status;
        
    oldK1 = pspShiftK1();
    eventId = sceUmdGetUserEventFlagId();
        
    if (!(umdState & UMD_SUPPORTED_WAIT_DRIVE_STATES))
        return SCE_ERROR_ERRNO_INVALID_ARGUMENT; 
       
    status = sceKernelWaitEventFlag(eventId, umdState, SCE_KERNEL_EW_OR, &resultBits, NULL);
       
    pspSetK1(oldK1);
    return status;
}
Ejemplo n.º 29
0
//Subroutine sceUmd_98AFBD10 - Address 0x00000BE8 - Aliases: sceUmdUser_4A9E5E29
s32 sceUmdWaitDriveStatCB(u32 umdState, u32 timeout)
{
    s32 oldK1;
    SceUID eventId;
    SceUInt *pTimeout;
    u32 outBits;
    s32 status;
        
    oldK1 = pspShiftK1();
    eventId = sceUmdGetUserEventFlagId();
        
    if (!(umdState & UMD_SUPPORTED_WAIT_DRIVE_STATES))
        return SCE_ERROR_ERRNO_INVALID_ARGUMENT;
       
    if (timeout != 0)
        pTimeout = &timeout;
    else
        pTimeout = NULL;
   
    status = sceKernelWaitEventFlagCB(eventId, umdState, SCE_KERNEL_EW_OR, &outBits, pTimeout);
    pspSetK1(oldK1);
    return status;
}
Ejemplo n.º 30
0
/*
Subroutine sceHttpStorage_bridge_EFE06A20 - Address 0x00000550 
Exported in sceHttpStorage_bridge
*/
u32 sceHttpStorage_bridge_EFE06A20(int a0, int a1, int a2) {
	char *s0 = (char *) a1;
	s32 oldk1 = pspShiftK1();
	//0x57C
	if (a1 != 0) {
		//0x594
		if (((oldk1 << 11) & (((a1 + a2) | a1) | a2)) < 0) {
			pspSetK1(oldk1);
			return 0x80000103;
		}
		SceKernelGameInfo *res = sceKernelGetGameInfo();
		//0x5D0
		if (a0 != 2) {
			//0x5D8
			if ((a0 < 3) != 0) {
				//0x5E4
				if (a0 != 1) {
					pspSetK1(oldk1);
					return 0x800001FF;
				}
				//0x5FC
				if (a0 == 0) {
					//0x60C
					if (*((int *) res + 180) == 0) {
						strncpy((char *)s0, (char *)res + 68, 13);
						pspSetK1(oldk1);
						return 0;
					}
					strncpy((char *)s0, (char *)res + 180, 10);
					pspSetK1(oldk1);
					return 0;
				}
				pspSetK1(oldk1);
				return 0x80000104;
			}
			//0x644
			if (a0 != 3) {
				pspSetK1(oldk1);
				return 0x800001FF;
			}
			//0x650
			if ((a2 < 7) == 0) {
				strncpy((char *)s0, (char *)res + 88, 7);
				pspSetK1(oldk1);
				return 0;
			}
			pspSetK1(oldk1);
			return 0x80000104;
		}
		//0x664
		if ((a2 < 7) != 0) {
			pspSetK1(oldk1);
			return 0x80000104;
		}
		strncpy((char *)s0, (char *)res + 196, 7);
		pspSetK1(oldk1);
		return 0;
	}
	pspSetK1(oldk1);
	return 0x80000103;
}