Exemple #1
0
int LPP_Mp4Init(const char *mpvPath, const char *cbPath)
{
    devkitVersion = sceKernelDevkitVersion();

    if(sceUtilityLoadAvModule(0))
	{
	    #ifdef DEBUG
		dwrite_output("Function %s Line %d : error in sceUtilityLoadAvModule.\n", __FUNCTION__, __LINE__);
		#endif
	    return -1;
	}
	if((mpegvshid = LPP_UtilsLoadStartModule(mpvPath)) <= 0)
	{
	    #ifdef DEBUG
		dwrite_output("Function %s Line %d : Cannot load the module '%s.\n'", __FUNCTION__, __LINE__, mpvPath);
		#endif
	    return -1;
	}
	if((cbridgeid = LPP_UtilsLoadStartModule(cbPath)) <= 0)
	{
	    #ifdef DEBUG
		dwrite_output("Function %s Line %d : Cannot load the module '%s'.\n", __FUNCTION__, __LINE__, cbPath);
		#endif
	    return -1;
	}
	if(sceMpegInit())
	{
	    #ifdef DEBUG
		dwrite_output("Function %s Line %d : error in sceMpegInit.\n", __FUNCTION__, __LINE__);
		#endif
		return -1;
	}
	return 0;
}
Exemple #2
0
void psp_init(void)
{
	SceUID thid;
	char buff[128], *r;

	/* fw 1.5 sometimes returns 8002032c, although getcwd works */
	r = getcwd(buff, sizeof(buff));
	if (r) sceIoChdir(buff);

	main_thread_id = sceKernelGetThreadId();

	lprintf("running on %08x kernel\n", sceKernelDevkitVersion()),
	lprintf("entered psp_init, threadId %08x, priority %i\n", main_thread_id,
		sceKernelGetThreadCurrentPriority());

	thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, NULL);
	if (thid >= 0)
	{
		sceKernelStartThread(thid, 0, 0);
	}

	/* video */
	sceDisplaySetMode(0, 480, 272);
	sceDisplaySetFrameBuf(VRAM_FB1, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
	current_screen = 1;
	psp_screen = VRAM_FB0;

	/* gu */
	sceGuInit();

	sceGuStart(GU_DIRECT, guCmdList);
	sceGuDrawBuffer(GU_PSM_5650, (void *)VRAMOFFS_FB0, 512);
	sceGuDispBuffer(480, 272, (void *)VRAMOFFS_FB1, 512); // don't care
	sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT);
	sceGuDepthBuffer((void *)VRAMOFFS_DEPTH, 512);
	sceGuOffset(2048 - (480 / 2), 2048 - (272 / 2));
	sceGuViewport(2048, 2048, 480, 272);
	sceGuDepthRange(0xc350, 0x2710);
	sceGuScissor(0, 0, 480, 272);
	sceGuEnable(GU_SCISSOR_TEST);

	sceGuDepthMask(0xffff);
	sceGuDisable(GU_DEPTH_TEST);

	sceGuFrontFace(GU_CW);
	sceGuEnable(GU_TEXTURE_2D);
	sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
	sceGuAmbientColor(0xffffffff);
	sceGuColor(0xffffffff);
	sceGuFinish();
	sceGuSync(0, 0);

	sceDisplayWaitVblankStart();
	sceGuDisplay(GU_TRUE);


	/* input */
	sceCtrlSetSamplingCycle(0);
	sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
}
Exemple #3
0
void pmp_play_close(struct pmp_play_struct *p, int usePos, int pspType)
	{
	if (!(p->audio_reserved < 0)) {
		while(sceAudioGetChannelRestLen(0) > 0 );
		sceAudioChRelease(0);
	}
	cooleyesAudioSetFrequency(sceKernelDevkitVersion(), 44100);

	if (!(p->semaphore_can_get   < 0)) sceKernelDeleteSema(p->semaphore_can_get);
	if (!(p->semaphore_can_put   < 0)) sceKernelDeleteSema(p->semaphore_can_put);
	if (!(p->semaphore_can_show  < 0)) sceKernelDeleteSema(p->semaphore_can_show);
	if (!(p->semaphore_show_done < 0)) sceKernelDeleteSema(p->semaphore_show_done);

	if (!(p->output_thread < 0)) sceKernelDeleteThread(p->output_thread);
	if (!(p->show_thread   < 0)) sceKernelDeleteThread(p->show_thread);

	pmp_decode_close(&p->decoder, pspType);

	int i = 0;
	for (i=0; i<p->subtitle_count; i++)
		subtitle_parse_close( &subtitle_parser[i] );
	
	//if (usePos) pmp_stat_save( p );
	pmp_stat_save( p );
	
	pmp_play_safe_constructor(p);
	}
Exemple #4
0
void printUIDList(const char *name)
{
    uidControlBlock *entry;
    uidControlBlock *end;
	int cmp = 0;

	if(sceKernelDevkitVersion() == 0x01000300)
	{
    	entry = (uidControlBlock *) UIDLIST_START_1_0;
	}
	else
	{
		entry = SysMemForKernel_536AD5E1();
	}

	/*
    if(sceKernelDevkitVersion() == 0x01050001)
    	entry = (uidControlBlock *) UIDLIST_START_1_5;
    else
    	entry = (uidControlBlock *) UIDLIST_START_1_0;
	*/
    entry = entry->parent;
    end = entry;
    entry = entry->nextEntry;
    //printf("************ MY UID LIST START ************\n");
    do {
		if(name)
		{
			cmp = strcmp(entry->name, name);
		}

		if(cmp == 0)
		{
			SHELL_PRINT("\n[%s]    UID 0x%08X (attr 0x%X entry 0x%p)\n", entry->name, entry->UID, entry->attribute, entry);
		}

		if (entry->nextChild == entry) {
			if(cmp == 0)
			{
				SHELL_PRINT("    <No UID objects>\n");
			}

		} else {
			do {
				entry = entry->nextChild;
				if(cmp == 0)
				{
					//printf("(Name): %31s, (UID): 0x%08X, (entry): 0x%p (attr): 0x%X \n", entry->name, entry->UID, entry, entry->attribute);
					printUIDEntry(entry);
				}
			} while (entry->nextChild != entry->type);
			entry = entry->nextChild;
		}

		entry = entry->nextEntry;
    } while (entry->nextEntry != end);  //Stop at 'Basic' entry like Sysmem does but not in the same way ;)
    //printf("************ MY UID LIST END ************\n");
}
Exemple #5
0
void CSystem::GetFirmwareVersion()
{
    FirmwareVersion = L"Firmware Version: ";
    unsigned int ver;
    char FirmwareVer[20];
    ver = sceKernelDevkitVersion();
    sprintf(FirmwareVer, "%d.%d%d (0x%08X)", (ver >> 24) & 0xFF, (ver >> 16) & 0xFF,(ver>>8) & 0xFF, ver);
    FirmwareVersion += FirmwareVer;
}
Exemple #6
0
int displayDisable(void){
    u32 k1 = pspSdkSetK1(0);
	int ret;
    if (sceKernelDevkitVersion() < 0x03070110)
        ret = sceDisplayDisable();
    else
        ret = sceDisplayDisable371();
    pspSdkSetK1(k1);
    return ret;
}
// Other functions
static int lua_cfwver(lua_State *L)
{
    if (lua_gettop(L) != 0) return luaL_error(L, "no arguments expected.");
    int ver = sceKernelDevkitVersion();
    char *aStr;
    char buffer[16];
    sprintf(buffer,"%x",ver);
    buffer[1]='.';     buffer[3]= buffer[4];     buffer[4]=0;
    aStr =buffer;
    lua_pushstring(L, aStr);
    return 1;
}
static int lua_SCEShowMessageDialog(lua_State *L)
{
    int buttonif = 0;
    const char* message = luaL_checkstring(L, 1);
    if (sceKernelDevkitVersion() < 0x02000010)
   {
      lua_pushstring(L, message);
    return 1;
   } 
    buttonif = (int)luaL_checknumber(L, 2);
    messagebubble(buttonif, message);
    return 0;
}
Exemple #9
0
//Load and start needed modules:
int initMEAudioModules(){
   if (!HW_ModulesInit){
        if (sceKernelDevkitVersion() == 0x01050001)
        {
            LoadStartAudioModules("flash0:/kd/me_for_vsh.prx", PSP_MEMORY_PARTITION_KERNEL);
            LoadStartAudioModules("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL);
        }
        else
        {
            sceUtilityLoadAvModule(PSP_AV_MODULE_AVCODEC);
        }
       HW_ModulesInit = 1;
   }
   return 0;
}
Exemple #10
0
int module_start(SceSize args, void *argp)
{
  int k = pspSdkSetK1(0);
  int kit = sceKernelDevkitVersion();
  if (kit < 0x03070110) // pre 3.71
  {
    use371nids = 0;
  }
  if (kit >= 0x03070110) { // 3.71+
    use371nids = 1;
  }
  if (kit >= 0x03080000) { // 3.80+
    use371nids = 2;
    useDirectAccess = 1;
  }

  pspSdkSetK1(k);
  return 0;
}
Exemple #11
0
int module_start(SceSize args, void* argp)
{
	char keypath[128];
	int ret;
	SceIoStat stat;

	psp_fw_version = sceKernelDevkitVersion();
	setup_patch_offset_table(psp_fw_version);
	psp_model = sceKernelGetModel();
	memset(&conf, 0, sizeof(conf));
	sctrlSEGetConfig(&conf);
	printk_init("ms0:/popcorn.txt");
	printk("Popcorn: init_file = %s psp_fw_version = 0x%08X psp_model = %d\n", sceKernelInitFileName(), (uint)psp_fw_version, (int)psp_model);

	get_keypath(keypath, sizeof(keypath));
	ret = sceIoGetstat(keypath, &stat);
	g_keys_bin_found = 0;

	if(ret == 0) {
		ret = load_key(keypath, g_keys, sizeof(g_keys));

		if(ret == 0) {
			g_keys_bin_found = 1;
			printk("keys.bin found\n");
		}
	}

	g_is_custom_ps1 = is_custom_ps1();
	g_icon0_status = get_icon0_status();

	if(g_is_custom_ps1) {
		setup_psx_fw_version(psp_fw_version);
	}

	g_previous = sctrlHENSetStartModuleHandler(&popcorn_patch_chain);
	patch_scePops_Manager();
	sync_cache();
	
	return 0;
}
Exemple #12
0
/* Entry point */
int module_start(SceSize args, void *argp)
{
	int ret = 0;

#ifndef _DEBUG
	if (args != 8)
		return -1;
	curr_handler = (PspDebugErrorHandler) ((int *) argp)[0];
	exception_regs = (PspDebugRegBlock *) ((int *) argp)[1];
	if (!curr_handler || !exception_regs)
		return -1;

	if (sceKernelDevkitVersion() < 0x03070110)
		ret = sceKernelRegisterDefaultExceptionHandler((void *)
													   _pspDebugExceptionHandler);
	else
		ret = sceKernelRegisterDefaultExceptionHandler371((void *)
														  _pspDebugExceptionHandler);
#endif

	return ret;
}
Exemple #13
0
void draw_ui_main()
{
    char buf[320];
    drawRect(GU_FRAME_ADDR(work_frame), 0, 0, 480, 272, UI_BGCOLOR);
    drawString("FinalBurn Alpha for PSP (ver: 0.01)", GU_FRAME_ADDR(work_frame), 10, 10, UI_COLOR);
    unsigned int kdv = sceKernelDevkitVersion();
    sprintf(buf, "FW: %X.%X%X.%02X", kdv >> 24, (kdv&0xf0000)>>16, (kdv&0xf00)>>8, kdv&0xff);
    drawString(buf, GU_FRAME_ADDR(work_frame), 470 - getDrawStringLength(buf), 10, UI_COLOR);
    drawRect(GU_FRAME_ADDR(work_frame), 8, 28, 464, 1, UI_COLOR);

    drawRect(GU_FRAME_ADDR(work_frame), 10, 40+ui_mainmenu_select*18, 460, 18, UI_COLOR);

    for(int i=0; i<10; i++)  {
        unsigned short fc = set_ui_main_menu_item_color(i);

        switch ( i ) {
//	    case 6:

        case 7:
            sprintf( buf, ui_main_menu[i], cpu_speeds[cpu_speeds_select].cpu );
            drawString(buf,
                       GU_FRAME_ADDR(work_frame),
                       240 - getDrawStringLength(ui_main_menu[i]) / 2,
                       44 + i * 18, fc);
            break;
        default:
            drawString(ui_main_menu[i],
                       GU_FRAME_ADDR(work_frame),
                       240 - getDrawStringLength(ui_main_menu[i]) / 2,
                       44 + i * 18, fc);
        }
    }

    drawRect(GU_FRAME_ADDR(work_frame), 8, 230, 464, 1, UI_COLOR);
    drawString("FB Alpha contains parts of MAME & Final Burn. (C) 2004, Team FB Alpha.", GU_FRAME_ADDR(work_frame), 10, 238, UI_COLOR);
    drawString("FinalBurn Alpha for PSP (C) 2008, OopsWare.", GU_FRAME_ADDR(work_frame), 10, 255, UI_COLOR);
}
Exemple #14
0
bool Mp3PspStream::initDecoder() {
	DEBUG_ENTER_FUNC();

	if (_decoderInit) {
		PSP_ERROR("Already initialized!");
		return true;
	}

	// Based on PSP firmware version, we need to do different things to do Media Engine processing
	uint32 firmware = sceKernelDevkitVersion();
	PSP_DEBUG_PRINT("Firmware version 0x%x\n", firmware);
    if (firmware == 0x01050001){
		if (!loadStartAudioModule((char *)(void *)"flash0:/kd/me_for_vsh.prx",
			PSP_MEMORY_PARTITION_KERNEL)) {
			PSP_ERROR("failed to load me_for_vsh.prx. ME cannot start.\n");
			_decoderFail = true;
			return false;
		}
        if (!loadStartAudioModule((char *)(void *)"flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL)) {
			PSP_ERROR("failed to load audiocodec.prx. ME cannot start.\n");
			_decoderFail = true;
			return false;
		}
    } else {
        if (sceUtilityLoadAvModule(PSP_AV_MODULE_AVCODEC) < 0) {
			PSP_ERROR("failed to load AVCODEC module. ME cannot start.\n");
			_decoderFail = true;
			return false;
		}
	}

	PSP_DEBUG_PRINT("Using PSP's ME for MP3\n");	// important to know this is happening

	_decoderInit = true;
	return true;
}
Exemple #15
0
bool Mp3PspStream::stopDecoder() {
	DEBUG_ENTER_FUNC();

	if (!_decoderInit)
		return true;

	// Based on PSP firmware version, we need to do different things to do Media Engine processing
    if (sceKernelDevkitVersion() == 0x01050001){  // TODO: how do we unload?
/*      if (!unloadAudioModule("flash0:/kd/me_for_vsh.prx", PSP_MEMORY_PARTITION_KERNEL) ||
			!unloadAudioModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL) {
			PSP_ERROR("failed to unload audio module\n");
			return false;
		}
*/
    }else{
        if (sceUtilityUnloadModule(PSP_MODULE_AV_AVCODEC) < 0) {
			PSP_ERROR("failed to unload avcodec module\n");
			return false;
		}
	}

	_decoderInit = false;
	return true;
}
Exemple #16
0
int main(int argc, char *argv[])
{
	int ret = 0;
	struct SceIoStat stat;
	SceCtrlData ctl;
	u32 key;

	memset(&stat, 0, sizeof(stat));
	pspDebugScreenInit();
	psp_fw_version = sceKernelDevkitVersion();

#ifdef CONFIG_620
	if(psp_fw_version == FW_620) {
		goto version_OK;
	}
#endif

#ifdef CONFIG_635
	if(psp_fw_version == FW_635) {
		goto version_OK;
	}
#endif

#ifdef CONFIG_639
	if(psp_fw_version == FW_639) {
		goto version_OK;
	}
#endif
	
#if defined(CONFIG_660) || defined(CONFIG_661)
	if((psp_fw_version == FW_660) || (psp_fw_version == FW_661)) {
		goto version_OK;
	}
#endif
	
	printf("Sorry. This program doesn't support your FW(0x%08X).\n", (uint)psp_fw_version);
	goto exit;
	
version_OK:
	psp_model = kuKernelGetModel();
	scePowerSetClockFrequency(333, 333, 166);
	init_flash();
	usage();

	printf("Press X to launch CFW.\n");
	printf("Press Triangle to uninstall CFW.\n");
	printf("Hold L to reinstall CFW.\n");
	printf("Press R to exit.\n");

	sceCtrlReadBufferPositive(&ctl, 1);
	key = ctl.Buttons;

	while (0 == (key & (PSP_CTRL_CROSS | PSP_CTRL_RTRIGGER | PSP_CTRL_TRIANGLE))) {
		sceKernelDelayThread(50000);
		sceCtrlReadBufferPositive(&ctl, 1);
		key = ctl.Buttons;
	}

	if (key & PSP_CTRL_RTRIGGER) {
		printf("Exiting...\n");
		cleanup_exit();
		sceKernelDelayThread(100000);
		sceKernelExitGame();
	}

	switch(psp_model) {
		case PSP_GO:
			printf("PSP GO BRITE Detected ....\n");
			break;
		case PSP_9000:
			printf("PSP BRITE 3000(09g) Detected ....\n");
			break;
		case PSP_7000:
			printf("PSP BRITE 3000(07g) Detected ....\n");
			break;
		case PSP_4000:
			printf("PSP BRITE 3000(04g) Detected ....\n");
			break;
		case PSP_3000:
			printf("PSP BRITE 3000 Detected ....\n");
			break;
		case PSP_2000:
			printf("PSP SLIM 2000 Detected ....\n");
			break;
		case PSP_1000:
			printf("PSP FAT 1000 Detected ....\n");
			break;
		case PSP_11000:
			printf("PSP STREET E1000 Detected ....\n");
			break;
		default:
			printf("Unknown PSP model 0%dg\n", psp_model+1);
			break;
	}

	sceCtrlReadBufferPositive(&ctl, 1);

	if (ctl.Buttons & PSP_CTRL_LTRIGGER) {
		disable_smart = 1;
	}

	if (key & PSP_CTRL_CROSS) {
		ret = install_cfw();

		if (ret == 0) {
			printf(" Completed.\nPress X to start CFW.\n");

			sceCtrlReadBufferPositive(&ctl, 1);
			key = ctl.Buttons;

			while (0 == (key & PSP_CTRL_CROSS)) {
				sceKernelDelayThread(50000);
				sceCtrlReadBufferPositive(&ctl, 1);
				key = ctl.Buttons;
			}

			printf("Now reboot to " VERSION_STR " :)\n");
			start_reboot(1);
		}
	} else if (key & PSP_CTRL_TRIANGLE) {
		ret = uninstall_cfw();
		printf("Now reboot to OFW :)\n");
		sceKernelDelayThread(1000000);
		start_reboot(0);
	}

exit:
	printf("Press X to exit.\n");

	sceCtrlReadBufferPositive(&ctl, 1);
	key = ctl.Buttons;

	while (0 == (key & PSP_CTRL_CROSS)) {
		sceKernelDelayThread(50000);
		sceCtrlReadBufferPositive(&ctl, 1);
		key = ctl.Buttons;
	}

	cleanup_exit();
	sceKernelExitGame();

	return 0;
}
Exemple #17
0
//*************************************************************************************
//Used to check for compatible FW, we don't allow anything lower than 4.01
//*************************************************************************************
static void DaedalusFWCheck()
{
// ##define PSP_FIRMWARE Borrowed from Davee
#define PSP_FIRMWARE(f) ((((f >> 8) & 0xF) << 24) | (((f >> 4) & 0xF) << 16) | ((f & 0xF) << 8) | 0x10)

	u32 ver = sceKernelDevkitVersion();
/*
	FILE * fh = fopen( "firmware.txt", "a" );
	if ( fh )
	{
		fprintf( fh,  "version=%d, firmware=0x%08x\n", kuKernelGetModel(), ver );
		fclose(fh);
	}
*/
	if( (ver < PSP_FIRMWARE(0x401)) )
	{
		pspDebugScreenInit();
		pspDebugScreenSetTextColor(0xffffff);
		pspDebugScreenSetBackColor(0x000000);
		pspDebugScreenSetXY(0, 0);
		pspDebugScreenClear();
		pspDebugScreenPrintf( "\n" );
		pspDebugScreenPrintf("XXXXXXX       XXXXXXX        66666666         444444444\n" );
		pspDebugScreenPrintf("X:::::X       X:::::X       6::::::6         4::::::::4\n" );
		pspDebugScreenPrintf("X:::::X       X:::::X      6::::::6         4:::::::::4\n" );
		pspDebugScreenPrintf("X::::::X     X::::::X     6::::::6         4::::44::::4\n" );
		pspDebugScreenPrintf("XXX:::::X   X:::::XXX    6::::::6         4::::4 4::::4\n" );
		pspDebugScreenPrintf("   X:::::X X:::::X      6::::::6         4::::4  4::::4\n" );
		pspDebugScreenPrintf("    X:::::X:::::X      6::::::6         4::::4   4::::4\n" );
		pspDebugScreenPrintf("     X:::::::::X      6::::::::66666   4::::444444::::444\n" );
		pspDebugScreenPrintf("     X:::::::::X     6::::::::::::::66 4::::::::::::::::4\n" );
		pspDebugScreenPrintf( "   X:::::X:::::X    6::::::66666:::::64444444444:::::444\n" );
		pspDebugScreenPrintf("   X:::::X X:::::X   6:::::6     6:::::6         4::::4\n" );
		pspDebugScreenPrintf("XXX:::::X   X:::::XXX6:::::6     6:::::6         4::::4\n" );
		pspDebugScreenPrintf("X::::::X     X::::::X6::::::66666::::::6         4::::4\n" );
		pspDebugScreenPrintf("X:::::X       X:::::X 66:::::::::::::66        44::::::44\n" );
		pspDebugScreenPrintf("X:::::X       X:::::X   66:::::::::66          4::::::::4\n" );
		pspDebugScreenPrintf("XXXXXXX       XXXXXXX     666666666            4444444444\n" );
		pspDebugScreenPrintf( "\n" );
		pspDebugScreenPrintf( "\n" );
		pspDebugScreenPrintf( "--------------------------------------------------------------------\n" );
		pspDebugScreenPrintf( "\n" );
		pspDebugScreenPrintf( "	Unsupported Firmware Detected : 0x%08X\n", ver );
		pspDebugScreenPrintf( "\n" );
		pspDebugScreenPrintf( "	Daedalus requires atleast 4.01 M33 Custom Firmware\n" );
		pspDebugScreenPrintf( "\n" );
		pspDebugScreenPrintf( "--------------------------------------------------------------------\n" );
		sceKernelDelayThread(1000000);
		pspDebugScreenPrintf( "\n" );
		pspDebugScreenPrintf( "\n" );
		pspDebugScreenPrintf( "\n" );
		pspDebugScreenPrintf("\nPress O to Exit or [] to Ignore");
		for (;;)
		{
			SceCtrlData pad;
			sceCtrlPeekBufferPositive(&pad, 1);
			if (pad.Buttons & PSP_CTRL_CIRCLE)
				break;
			if (pad.Buttons & PSP_CTRL_SQUARE)
				return;
		}
		sceKernelExitGame();
	}

}
Exemple #18
0
int main(int argc, char *argv[])
{
    SceCtrlData pad;
    u32 buttonsold = 0;
    int kernelmode = 0;       /* only 0 works for now - some keyboards need baud change */
    const char *config_file = NULL; /* this will force ms0:/seplugins/pspirkeyb.ini */

	SetupCallbacks();

    pspDebugScreenInit();
    printf("PSP Irda Keyboard test - ASCii input \n");

	if (sceKernelDevkitVersion() >= 0x03080010)
	{
        /* Load irda PRX for CFW >= 3.80 - Thanks, ZX81! */
        u32 mod_id = sceKernelLoadModule("flash0:/kd/irda.prx", 0, NULL);
        sceKernelStartModule(mod_id, 0, NULL, NULL, NULL);
	}

    if( pspIrKeybInit( config_file, kernelmode ) != 0 )
    {
        printf( "error: can't inialize the keyboard\n" );
        printf( "       check keyboard type/map in ms0:/seplugins/pspirkeyb.ini\n" );
    }
    else
    {
        unsigned char termchar = 'X';
        unsigned char buffer[255];
        int i, length=0;

        printf("\npress %c on keyboard or any PSP button to exit\n", termchar );

        /* setup output method to ASCii */
        pspIrKeybOutputMode( PSP_IRKBD_OUTPUT_MODE_ASCII );

        while(1) {
            length = 0;
            /* non blocking read */
            if( pspIrKeybReadinput(buffer, &length) >= 0 )
            {
                for( i=0; i < length; i++ )
                    printf( "%c", buffer[i] );
                if( length == 1 && buffer[0] == termchar )
                    break;
            }
            else
            {
                sceKernelDelayThread(10*1000);
                sceCtrlReadBufferPositive(&pad, 1);
                if (pad.Buttons != buttonsold)
                    break;
            }
        }

        /* bye keyboard */
        pspIrKeybFinish();
    }

    printf( "\n bye... (PRESS psp button to quit)\n" );

    buttonsold = 0;
    while (1) {
        sceCtrlReadBufferPositive(&pad, 1);
        if (pad.Buttons != buttonsold) {
            /* Exit */
            sceKernelExitGame();
        }
    }

	return 0;
}
Exemple #19
0
uidControlBlock* findUIDObject(SceUID uid, const char *name, const char *parent)
{
    uidControlBlock *entry;
    uidControlBlock *end;

	if(sceKernelDevkitVersion() == 0x01000300)
	{
    	entry = (uidControlBlock *) UIDLIST_START_1_0;
	}
	else
	{
		entry = SysMemForKernel_536AD5E1();
	}
	/*
    if(sceKernelDevkitVersion() == 0x01050001)
    	entry = (uidControlBlock *) UIDLIST_START_1_5;
    else
    	entry = (uidControlBlock *) UIDLIST_START_1_0;
	*/
    entry = entry->parent;
    end = entry;
    entry = entry->nextEntry;

    do {
		if(entry->UID == uid)
            return entry;
        if (entry->nextChild != entry) {
            do {
				uidControlBlock *ret = NULL;
                entry = entry->nextChild;
				if(name)
				{
					if (strcmp(entry->name, name) == 0)
						ret = entry;
				}
				else
				{
					if(entry->UID == uid)
						ret = entry;
				}

				if(ret)
				{
					if(parent && ret->type)
					{
						if(strcmp(parent, ret->type->name) == 0)
						{
							return ret;
						}
					}
					else
					{
						return ret;
					}
				}

            } while (entry->nextChild != entry->type);
            entry = entry->nextChild;
        }
        entry = entry->nextEntry;
    } while (entry->nextEntry != end);  //Stop at 'Basic' entry like Sysmem does, just not in the same way ;)
    return 0;
}
// 0x00000340
int module_start(SceSize args, void* argp)
{
	SceModule2 *pMod;
	int fd, key_config;
	SEConfig config;
   
	psp_model = sceKernelGetModel();
	psp_fw_version = sceKernelDevkitVersion();
	setup_patch_offset_table(psp_fw_version);

	printk_init("ms0:/LOG_GALAXY.TXT");
	printk("PROGalaxyController started: 0x%08X\n", (uint)psp_fw_version);

	key_config = sceKernelApplicationType();
	sctrlSEGetConfig(&config);
	
	if(config.iso_cache && psp_model != PSP_1000 && key_config == PSP_INIT_KEYCONFIG_GAME) {
		int bufsize;

		bufsize = config.iso_cache_total_size * 1024 * 1024 / config.iso_cache_num;
		
		if((bufsize % 512) != 0) {
			bufsize &= ~(512-1);
		}

		if(bufsize == 0) {
			bufsize = 512;
		}

		infernoCacheSetPolicy(config.iso_cache_policy);
		infernoCacheInit(bufsize, config.iso_cache_num);
	}
	
	g_iso_fn = sctrlSEGetUmdFile();
	pMod = (SceModule2*)sceKernelFindModuleByName("sceThreadManager");

	if(pMod != NULL) {
		// sceKernelCreateThread export
		_sw((u32)&myKernelCreateThread, pMod->text_addr + g_offs->sceKernelCreateThread); 

		// sceKernelStartThread export
		_sw((u32)&myKernelStartThread, pMod->text_addr + g_offs->sceKernelStartThread); 
	} else {
		printk("sceThreadManager cannot be found?!\n");
	}

	clear_cache();

	while( 1 ) {
		fd = sceIoOpen(g_iso_fn, PSP_O_RDONLY, 0);

		if(fd >= 0) {
			break;
		}

		sceKernelDelayThread(10000);
	}

	sceIoClose(fd);
	printk("%s: finished\n", __func__);

	return 0;
}
Exemple #21
0
int main() 
{
	int devkit, size;
	SceUID kpspident;
	SceUID mod;

	(void)size_ipl_block_large;

	CHS_ScreenInit();///|pspDebugScreenInit();
	CHS_ScreenSetTextColor(WHITE);///|pspDebugScreenSetTextColor(WHITE);
	devkit = sceKernelDevkitVersion();

	if(devkit != DEVKIT_VER ) {
		ErrorExit(5000,"FW错误!\n");///|ErrorExit(5000,"FW ERROR!\n");
	}

	kpspident = pspSdkLoadStartModule("kpspident.prx", PSP_MEMORY_PARTITION_KERNEL);

	if (kpspident < 0) {
		ErrorExit(5000, "kpspident.prx 加载失败\n");///|ErrorExit(5000, "kpspident.prx loaded failed\n");
	}

	model = kuKernelGetModel();

	if(!(model == 0 || model == 1) || is_ta88v3()) {
		ErrorExit(5000,"此安装程序不支持此模式。\n");///|ErrorExit(5000,"This installer does not support this model.\n");
	}

	if( model == 0 ) {
		memcpy( ipl_block_large , ipl_block_01g, 0x4000);
	}

	//load module
	mod = sceKernelLoadModule("ipl_update.prx", 0, NULL);

	if (mod < 0) {
		ErrorExit(5000,"无法加载ipl_update.prx!\n");///|ErrorExit(5000,"Could not load ipl_update.prx!\n");
	}

	mod = sceKernelStartModule(mod, 0, NULL, NULL, NULL);

	if (mod < 0) {
		ErrorExit(5000,"无法启动模块!\n");///|ErrorExit(5000,"Could not start module!\n");
	}

	size = pspIplUpdateGetIpl(orig_ipl);

	if(size < 0) {
		ErrorExit(5000,"无法获得 ipl!\n");///|ErrorExit(5000,"Failed to get ipl!\n");
	}

	printf("\n自定义ipl Flasher 为"VERSION_STR"。\n\n\n");///|printf("\nCustom ipl Flasher for "VERSION_STR".\n\n\n");

	int ipl_type = 0;

	if( size == 0x24000 ) {
		printf("安装自定义ipl\n");///|printf("Custom ipl is installed\n");
		size -= 0x4000;
		memmove( ipl_block_large + 0x4000 , orig_ipl + 0x4000 , size);
		ipl_type = 1;
	} else if( size == 0x20000 ) {
		printf("原ipl \n");///|printf("Raw ipl \n");
		memmove( ipl_block_large + 0x4000, orig_ipl, size);
	} else {
		printf("ipl 大小;%08X\n", size);///|printf("ipl size;%08X\n", size);
		ErrorExit(5000,"未知 ipl!\n");///|ErrorExit(5000,"Unknown ipl!\n");
	}

	printf(" 按X键");///|printf(" Press X to ");

	if( ipl_type ) {
		printf("重新");///|printf("Re");
	}

	printf("安装CIPL\n");///|printf("install CIPL\n");

	if( ipl_type ) {
		printf(" 按O键擦除CIPL和还原原IPL\n");///|printf(" Press O to Erase CIPL and Restore Raw IPL\n");
	}

	printf(" 按R键取消\n\n");///|printf(" Press R to cancel\n\n");
    
	while (1) {
        SceCtrlData pad;
        sceCtrlReadBufferPositive(&pad, 1);

		if (pad.Buttons & PSP_CTRL_CROSS) {
			flash_ipl( size );
			break; 
		} else if ( (pad.Buttons & PSP_CTRL_CIRCLE) && ipl_type ) {		
			printf("Flashing IPL...");

			if(pspIplUpdateClearIpl() < 0) {
				ErrorExit(5000,"无法清除 ipl!\n");///|ErrorExit(5000,"Failed to clear ipl!\n");
			}

			if (pspIplUpdateSetIpl( ipl_block_large + 0x4000 , size ) < 0) {
				ErrorExit(5000,"无法写入 ipl!\n");///|ErrorExit(5000,"Failed to write ipl!\n");
			}

			printf("完成。\n");///|printf("Done.\n");
			break; 
		} else if (pad.Buttons & PSP_CTRL_RTRIGGER) {
			ErrorExit(2000,"用户取消。\n");///|ErrorExit(2000,"Cancelled by user.\n");
		}

		sceKernelDelayThread(10000);
	}

	ErrorExit(5000,"\n安装完成。 5秒内重新启动...\n");///|ErrorExit(5000,"\nInstall complete. Restarting in 5 seconds...\n");

	return 0;
}
int getDevkitVersion()
{
    return sceKernelDevkitVersion();
}
Exemple #23
0
//entry point
int main(int argc, char * argv[])
{
	pspDebugScreenInit();

	psp_fw_version = sceKernelDevkitVersion();

#if defined(CONFIG_660) || defined(CONFIG_661)
	if((psp_fw_version == FW_660) || (psp_fw_version == FW_661)) {
		goto version_OK;
	}
#endif

#ifdef CONFIG_639
	if(psp_fw_version == FW_639) {
		goto version_OK;
	}
#endif

#ifdef CONFIG_620
	if(psp_fw_version == FW_620) {
		goto version_OK;
	}
#endif

#ifdef CONFIG_635
	if(psp_fw_version == FW_635) {
		goto version_OK;
	}
#endif

	pspDebugScreenPrintf("Sorry. This program doesn't support your FW(0x%08X).\n", (uint)psp_fw_version);
	sceKernelDelayThread(5*1000000);
	goto exit;

version_OK:
	setup_patch_offset_table(psp_fw_version);
	
	//puzzle installer path
	strcpy(installerpath, argv[0]);

	char * slash = strrchr(installerpath, '/');
	if (slash) slash[1] = '\0';
	
	write_files(installerpath);
	strcat(installerpath, "installer.prx");

	printk_init("ms0:/launcher.txt");
	printk("Hello exploit\n");

	if(sctrlHENGetVersion() >= 0) {
		install_in_cfw();

		return 0;
	}

#if defined(CONFIG_660) || defined(CONFIG_661)
	if((psp_fw_version == FW_660) || (psp_fw_version == FW_661)) {
		do_exploit_660();
	}
#endif

#ifdef CONFIG_639
	if(psp_fw_version == FW_639) {
		do_exploit_639();
	}
#endif

#if defined(CONFIG_620) || defined(CONFIG_635)
	if(psp_fw_version == FW_620 || psp_fw_version == FW_635) {
		do_exploit();
	}
#endif

exit:
	//trigger reboot
	sceKernelExitGame();

	//kill thread
	sceKernelExitDeleteThread(0);

	//return
	return 0;
}
Exemple #24
0
int main() 
{

   	pspDebugScreenInit();
	int devkit = sceKernelDevkitVersion(),
	cursor = 0;
	
		if(devkit != 0x06060010)
		Exit("This program supports only 6.60!");

    printf("USB Mod Flasher\n\n");    
	setcolor(RED);
	printf("This Mod is only for the TN-V8 eCFW for the PS Vita!");
	setcolor(WHITE);
	printf("\n\n\n\n\n\n\n\n\n\n\n\nCredits:\nXMB Mod by The Z\nInstaller Port by KanadeEngel\n\nSpecial Thanks to:\nfrostegater");

	while(1)
	{
		if(cursor > 2)
			cursor = 0;
		else if(cursor < 0)
			cursor = 2;

		if(cursor == 0) setbcolor(GRAY);
		printfc(3, 4, " Install XMB Mod.                       ");
		setbcolor(BLACK);
		if(cursor == 1) setbcolor(GRAY);
		printfc(3, 5, " Restore Original Files.                ");
		setbcolor(BLACK);
		if(cursor == 2) setbcolor(GRAY);
		printfc(3, 6, " Exit.                                  ");
		setbcolor(BLACK);

		int i;
		for(i = 0; i < 4; i++)
			printfc(1, 4 + i, " ");

		setcolor(BLUE);
		printfc(1, 4 + cursor, ">");

		unsigned int Buttons = wait_press(PSP_CTRL_CROSS | PSP_CTRL_UP | PSP_CTRL_DOWN);
		wait_release(PSP_CTRL_CROSS | PSP_CTRL_UP | PSP_CTRL_DOWN);

		SceCtrlData pad;
		sceCtrlReadBufferPositive(&pad, 1);

		if(Buttons & PSP_CTRL_CROSS)
		{
			if(cursor != 2)
			{
				setc(0, 9);
				if(assign_flash_zero() < 0)
					Exit("\n Error in 'flash0:/' assign.");
	

					{
						if(cursor == 0)//Install Mod Module
						{
							flash_file("flash0:/vsh/resource/topmenu_icon.rco", _660_install_X_icon, size__660_install_X_icon);
						}
	                    else if(cursor == 1)//Restore Original Module
							flash_file("flash0:/vsh/resource/topmenu_icon.rco", _660_original_X_icon, size__660_original_X_icon);
						}
					}
			else
				Exit("");

			break;
		}
		else if(Buttons & PSP_CTRL_UP)
			cursor--;
		else if(Buttons & PSP_CTRL_DOWN)
			cursor++;
	}

	Exit("Done.");
   sceKernelExitGame();
	return 0;
}
Exemple #25
0
char *pmp_play_open(struct pmp_play_struct *p, struct movie_file_struct *movie, int usePos, int pspType, int tvAspectRatio, int tvWidth, int tvHeight, int videoMode)
	{
	pmp_play_safe_constructor(p);
	p->subtitle = 0;
	p->subtitle_count = 0;

	
	char *result = pmp_decode_open(&p->decoder, movie->movie_file, pspType, tvAspectRatio, tvWidth, tvHeight, videoMode);
	if (result != 0)
		{
		pmp_play_close(p, 0, pspType);
		return(result);
		}

	if (subtitle_parse_search( movie, p->decoder.reader.file.header.video.rate, p->decoder.reader.file.header.video.scale, &p->subtitle_count)==0) p->subtitle = 1;
	
	if ( cooleyesAudioSetFrequency(sceKernelDevkitVersion(), p->decoder.reader.file.header.audio.rate) != 0)
		{
		pmp_play_close(p, 0, pspType);
		return("pmp_play_open: sceAudioSetFrequency failed");
		}
	p->audio_reserved = sceAudioChReserve(0, p->decoder.reader.file.header.audio.scale, PSP_AUDIO_FORMAT_STEREO);
	if (p->audio_reserved < 0)
		{
		pmp_play_close(p, 0, pspType);
		return("pmp_play_open: sceAudioChReserve failed");
		}


	p->semaphore_can_get = sceKernelCreateSema("can_get", 0, 0, p->decoder.number_of_frame_buffers, 0);
	if (p->semaphore_can_get < 0)
		{
		pmp_play_close(p, 0, pspType);
		return("pmp_play_open: sceKernelCreateSema failed on semaphore_can_get");
		}


	p->semaphore_can_put = sceKernelCreateSema("can_put", 0, p->decoder.number_of_frame_buffers, p->decoder.number_of_frame_buffers, 0);
	if (p->semaphore_can_put < 0)
		{
		pmp_play_close(p, 0, pspType);
		return("pmp_play_open: sceKernelCreateSema failed on semaphore_can_put");
		}


	p->semaphore_can_show = sceKernelCreateSema("can_show", 0, 0, 1, 0);
	if (p->semaphore_can_show < 0)
		{
		pmp_play_close(p, 0, pspType);
		return("pmp_play_open: sceKernelCreateSema failed on semaphore_can_show");
		}


	p->semaphore_show_done = sceKernelCreateSema("show_done", 0, 0, 1, 0);
	if (p->semaphore_show_done < 0)
		{
		pmp_play_close(p, 0, pspType);
		return("pmp_play_open: sceKernelCreateSema failed on semaphore_show_done");
		}




	p->output_thread = sceKernelCreateThread("output", pmp_output_thread, 0x8, 0x10000, 0, 0);
	if (p->output_thread < 0)
		{
		pmp_play_close(p, 0, pspType);
		return("pmp_play_open: sceKernelCreateThread failed on output_thread");
		}


	p->show_thread = sceKernelCreateThread("show", pmp_show_thread, 0x8, 0x10000, 0, 0);
	if (p->show_thread < 0)
		{
		pmp_play_close(p, 0, pspType);
		return("pmp_play_open: sceKernelCreateThread failed on show_thread");
		}




	p->return_request = 0;
	p->return_result  = 0;


	p->paused = 0;
	p->seek   = 0;


	p->audio_stream     = 0;
	//add by cooleyes 2007/02/01
	p->audio_channel    = 0;
	//add end
	p->volume_boost     = 3;
	p->aspect_ratio     = 0;
	p->zoom             = 100;
	p->luminosity_boost = 0;
	p->show_interface   = 0;
	p->loop             = 0;
	p->resume_pos		= 0;
	p->last_keyframe_pos= 0;
	p->subtitle_format  = (((gufont_haveflags&GU_FONT_HAS_UNICODE_CHARMAP))?1:0);
	p->subtitle_fontcolor = 0;
	p->subtitle_bordercolor = 0;
	
	memcpy(p->hash, movie->movie_hash, 16);
	
	if (usePos) pmp_stat_load( p );

	return(0);
	}