コード例 #1
0
ファイル: main.c プロジェクト: cfwprpht/ps3_vsh_menu
/***********************************************************************
* start thread
***********************************************************************/
int32_t vsh_menu_start(uint64_t arg)
{
    sys_ppu_thread_create(&vsh_menu_tid, vsh_menu_thread, 0, 3000, 0x4000, 1, THREAD_NAME);

    _sys_ppu_thread_exit(0);
    return SYS_PRX_RESIDENT;
}
コード例 #2
0
ファイル: lv2.cpp プロジェクト: Aaahh/nucleus
bool LV2::init(U32 entry) {
    // Load and start liblv2.sprx module
    S32 moduleId = sys_prx_load_module("/dev_flash/sys/external/liblv2.sprx", 0, 0);
    if (moduleId <= CELL_OK) {
        logger.error(LOG_HLE, "You need to provide the /dev_flash/sys/external/ firmware files.");
        return false;
    }
    sys_prx_start_module_option_t startFunc;
    sys_prx_start_module(moduleId, 0, &startFunc);

    BE<U64> thread_id;
    sys_ppu_thread_attr_t attr;
    attr.entry = startFunc.entry.ToLE();
    attr.tls_addr = 0;
    sys_ppu_thread_create(&thread_id, &attr, 0, 0, 500/*TODO*/, 0x10000, 0, "main"/*TODO*/);

    // Set sys_initialize_tls arguments for liblv2.sprx's start function
    auto* state = objects.get<sys_ppu_thread_t>(thread_id)->thread->state.get();
    state->r[7] = 0x0; // TODO
    state->r[8] = 0x0; // TODO
    state->r[9] = 0x0; // TODO
    state->r[10] = 0x90;
    state->r[11] = entry;

    sys_ppu_thread_start(thread_id);
    return true;
}
コード例 #3
0
ファイル: main.c プロジェクト: Joonie86/Cobra-7.00
int testplugin_start(uint64_t arg)
{
	sys_ppu_thread_create(&thread_id, testplugin_thread, 0, 3000, 0x2000, SYS_PPU_THREAD_CREATE_JOINABLE, THREAD_NAME);
		
	// Exit thread using directly the syscall and not the user mode library or we will crash
	_sys_ppu_thread_exit(0);	
	return SYS_PRX_RESIDENT;
}
コード例 #4
0
ファイル: CellThreads.c プロジェクト: cdenix/psmame
						CellThread::CellThread			(ThreadFunction aThreadFunction, void* aUserData) : 
	Function(aThreadFunction),
	UserData(aUserData),
	Thread(0),
	Result(0),
	Dead(false)
{
	sys_ppu_thread_create(&Thread, ThreadWrapper, (uint64_t)this, 500, 65536, SYS_PPU_THREAD_CREATE_JOINABLE, "\0");
}
コード例 #5
0
int createThread(void (*func)(uint64_t), uint64_t arg=0) {
	uint64_t val;
	sys_ppu_thread_t thread;
	std::size_t stackSize = 4096;
	if (sys_ppu_thread_create(&thread, func, arg, 1500, stackSize, 0, "Worker")) {
		printf("[!] sys_ppu_thread_create: Something went wrong!\n");
		exit(-1);
	}
}
コード例 #6
0
ファイル: main.c プロジェクト: Joonie86/Cobra-7.00
int testplugin_stop(void)
{
	sys_ppu_thread_t t;
	uint64_t exit_code;
	
	sys_ppu_thread_create(&t, testplugin_stop_thread, 0, 0, 0x2000, SYS_PPU_THREAD_CREATE_JOINABLE, STOP_THREAD_NAME);
	sys_ppu_thread_join(t, &exit_code);	
	
	finalize_module();
	_sys_ppu_thread_exit(0);
	return SYS_PRX_STOP_OK;
}
コード例 #7
0
ファイル: main.c プロジェクト: cfwprpht/ps3_vsh_menu
int vsh_menu_stop(void)
{
    sys_ppu_thread_t t;
    uint64_t exit_code;

    sys_ppu_thread_create(&t, vsh_menu_stop_thread, 0, 0, 0x2000, 1, STOP_THREAD_NAME);
    sys_ppu_thread_join(t, &exit_code);

    finalize_module();
    _sys_ppu_thread_exit(0);
    return SYS_PRX_STOP_OK;
}
コード例 #8
0
int gsiStartThread(GSThreadFunc func, gsi_u32 theStackSize, void *arg, GSIThreadID * id)
{
	int ret;
	ret = sys_ppu_thread_create(id, func, (uint32_t)arg, 1535, theStackSize, 0, NULL);
	if (ret != CELL_OK)
	{
		gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError,
			"Failed to create thread: %d\r\n", ret);
		return -1;
	}

	return 0;	
}
コード例 #9
0
ファイル: XnPS3Threads.cpp プロジェクト: 1170390/OpenNI2
//---------------------------------------------------------------------------
// Code
//---------------------------------------------------------------------------
XN_CORE_API XnStatus XnOSCreateThread(XN_THREAD_PROC_PROTO pThreadProc, const XN_THREAD_PARAM pThreadParam, XN_THREAD_HANDLE* pThreadHandle)
{
	XN_RET_IF_NULL(pThreadHandle, XN_STATUS_OS_THREAD_CREATION_FAILED);

	int nErr = sys_ppu_thread_create(pThreadHandle, pThreadProc, (uint64_t)pThreadParam, 100, 0x4000, SYS_PPU_THREAD_CREATE_JOINABLE, NULL);

	if (nErr != CELL_OK)
	{
		return XN_STATUS_OS_EVENT_CREATION_FAILED;
	}

	return XN_STATUS_OK;
}
コード例 #10
0
int createThreadAndJoin(void (*func)(uint64_t), uint64_t arg=0) {
	uint64_t val;
	sys_ppu_thread_t thread;
	std::size_t stackSize = 4096;
	if (sys_ppu_thread_create(&thread, func, arg, 1500, stackSize, SYS_PPU_THREAD_CREATE_JOINABLE, "Worker")) {
		printf("[!] sys_ppu_thread_create: Something went wrong!\n");
		exit(-1);
	}
	if (sys_ppu_thread_join(thread, &val)) {
		printf("[!] sys_ppu_thread_join: Something went wrong!\n");
		exit(-1);
	}
}
コード例 #11
0
int
sampleSpursUtilSpuPrintfServiceInitialize(SampleUtilSpursPrintfService *service, CellSpurs* spurs, int prio)
{
	int	ret;
	service->spurs = spurs;

	/* create event_queue for printf */
	sys_event_queue_attribute_t	attr;
	sys_event_queue_attribute_initialize (attr);

	/* queue depth must be equal or greater than max_spu_threads */
	ret = sys_event_queue_create (&service->equeue, &attr, SYS_EVENT_QUEUE_LOCAL, 8);
	if (ret) {
		printf ("sys_event_queue_create failed (%d)\n", ret);
		return ret;
	}

	/* 		create ppu_thread for printf handling */
	ret = sys_ppu_thread_create (&service->spu_printf_handler, spu_printf_handler_entry,
								 (uint64_t)(uintptr_t)service, prio, STACK_SIZE, SYS_PPU_THREAD_CREATE_JOINABLE, 
								 "spu_printf_handler");
	if (ret) {
		printf ("sys_ppu_thread_create failed (%d)\n", ret);
		return ret;
	}

	/*
	 * Create the terminating port. This port is used only in 
	 * spu_printf_service_finalize().
	 */
	ret = sys_event_port_create(&service->terminating_port, SYS_EVENT_PORT_LOCAL, TERMINATING_PORT_NAME);
	if (ret) {
		printf ("spu_printf_server_initialize: sys_event_port_create failed %d\n", ret);
		return ret;
	}

	ret = sys_event_port_connect_local(service->terminating_port, service->equeue);
	if (ret) {
		printf ("spu_printf_server_initialize: sys_event_connect failed %d\n", ret);
		return ret;
	}

	/* connect to SPURS */
	uint8_t	port = SPU_PORT_PRINTF;
	ret = cellSpursAttachLv2EventQueue (service->spurs, service->equeue, &port, 0);
	if (ret) {
		printf ("spu_printf_server_initialize: cellSpursAttachLv2EventQueue failed %d\n", ret);
		return ret;
	}
	return CELL_OK;
}
コード例 #12
0
ファイル: gamePKG.cpp プロジェクト: mrlucas84/gamePKG
int c_gamePKG::QueuePKG()
{
	char pszPKGDir[256] ="";
	sprintf(pszPKGDir, "/dev_hdd0/vsh/game_pkg/%d", pkglst[nSelectedPKG].nPKGID);

	CellFsErrno ret;
	ret = cellFsMkdir("/dev_hdd0/vsh/game_pkg", CELL_FS_S_IFDIR | 0777);
	ret = cellFsMkdir(pszPKGDir, CELL_FS_S_IFDIR | 0777);

	if(ret != CELL_FS_SUCCEEDED)
	{
		::cellMsgDialogOpen2(
			CELL_MSGDIALOG_DIALOG_TYPE_NORMAL, 
			"[Error] Could not create the required directory on HDD.", 
			DlgCallbackFunction, NULL, NULL
		);
		pkglst[nSelectedPKG].bQueued = false;
		return 0;
	}

	if(!CreatePDBFiles())
	{
		::cellMsgDialogOpen2(
			CELL_MSGDIALOG_DIALOG_TYPE_NORMAL, 
			"[Error] Could not create / write needed files to HDD.", 
			DlgCallbackFunction, NULL, NULL
		);
		pkglst[nSelectedPKG].bQueued = false;
		return 0;
	}

	sys_ppu_thread_t thread_id;

	sys_ppu_thread_create(
		&thread_id,
		thread_FileCopy,				// callback function
		0x1337,							// arg
		1500,							// priority
		0x1000,							// stack size
		SYS_PPU_THREAD_CREATE_JOINABLE, //
		"File Copy"						// name
	);
	
	return 1;
}
コード例 #13
0
ファイル: ps3_audio.c プロジェクト: AlexFolland/RetroArch
static void *ps3_audio_init(const char *device,
      unsigned rate, unsigned latency)
{
   CellAudioPortParam params;
   ps3_audio_t *data = NULL;

   (void)latency;
   (void)device;
   (void)rate;

   data = calloc(1, sizeof(*data));
   if (!data)
      return NULL;

   cellAudioInit();

   params.numChannels = AUDIO_CHANNELS;
   params.numBlocks = AUDIO_BLOCKS;
#if 0
#ifdef HAVE_HEADSET
   if(global->console.sound.mode == SOUND_MODE_HEADSET)
      params.param_attrib = CELL_AUDIO_PORTATTR_OUT_SECONDARY;
   else
#endif
#endif
      params.param_attrib = 0;

   if (cellAudioPortOpen(&params, &data->audio_port) != CELL_OK)
   {
      cellAudioQuit();
      free(data);
      return NULL;
   }

   data->buffer = fifo_new(CELL_AUDIO_BLOCK_SAMPLES * 
         AUDIO_CHANNELS * AUDIO_BLOCKS * sizeof(float));

#ifdef __PSL1GHT__
   sys_lwmutex_attr_t lock_attr = 
   {SYS_LWMUTEX_ATTR_PROTOCOL, SYS_LWMUTEX_ATTR_RECURSIVE, "\0"};
   sys_lwmutex_attr_t cond_lock_attr =
   {SYS_LWMUTEX_ATTR_PROTOCOL, SYS_LWMUTEX_ATTR_RECURSIVE, "\0"};
   sys_lwcond_attribute_t cond_attr = {"\0"};
#else
   sys_lwmutex_attribute_t lock_attr;
   sys_lwmutex_attribute_t cond_lock_attr;
   sys_lwcond_attribute_t cond_attr;

   sys_lwmutex_attribute_initialize(lock_attr);
   sys_lwmutex_attribute_initialize(cond_lock_attr);
   sys_lwcond_attribute_initialize(cond_attr);
#endif

   sys_lwmutex_create(&data->lock, &lock_attr);
   sys_lwmutex_create(&data->cond_lock, &cond_lock_attr);
   sys_lwcond_create(&data->cond, &data->cond_lock, &cond_attr);

   cellAudioPortStart(data->audio_port);
   data->started = true;
   sys_ppu_thread_create(&data->thread, event_loop,
#ifdef __PSL1GHT__
   data,
#else
   (uint64_t)data,
#endif
   1500, 0x1000, SYS_PPU_THREAD_CREATE_JOINABLE, (char*)"sound");

   return data;
}
コード例 #14
0
ファイル: main.c プロジェクト: Dnawrkshp/ArtemisPS3
int art_start(uint64_t arg)
{
	sys_ppu_thread_create(&thread_id, art_thread, NULL, -0x1d8, 0x8000, SYS_PPU_THREAD_CREATE_JOINABLE, THREAD_NAME);
	_sys_ppu_thread_exit(0);
	return SYS_PRX_RESIDENT;
}
コード例 #15
0
void c_fbaRL::DlgDisplayFrame()
{
	switch(nStatus)
	{
		case STATUS_ROMPATH_CHANGED:
		{
			//::cellMsgDialogOpen2(
			//	CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL, 
			//	"Remeber to rescan ROMs after you finish configuring all paths,\nyou can do so at the Game List section.", 
			//	DlgCallbackFunction, (void*)STATUS_ROMPATH_CHANGED, NULL
			//);

			// Force Re-Scan
			// delete old cache
			cellFsUnlink("/dev_hdd0/game/FBAL00123/USRDIR/FBA.GAMELIST.CACHE.DAT");
			break;		
		}

		case STATUS_ROMSCAN_DLG:
		{
			::cellMsgDialogOpen2(
				CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO|
				CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, 
				"Do you want to Rescan all configured paths for ROM(s) ?", 
				ExitDlgCallbackFunction, (void*)STATUS_ROMSCAN_DLG, NULL
			);
			break;
		}

		case STATUS_MISSING_GAME_DLG:
		{
			::cellMsgDialogOpen2(
				CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO|
				CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, 
				"Error: There was a problem locating the specified game, if you had it on a USB Storage Device, \n"
				"make sure it is properly connected.\n\n"
				"Do you want to Re-Scan all configured paths for ROM(s) ?",
				ExitDlgCallbackFunction, (void*)STATUS_ROMSCAN_DLG, NULL
			);
			break;
		}

		case STATUS_CORRUPT_APP_DLG:
		{
			::cellMsgDialogOpen2(
				CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL
				|CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK
				|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON
				|CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK, 
				"Error: FB Alpha RL installation is corrupted, please re-install it.", 
				ExitDlgCallbackFunction, (void*)STATUS_EXIT, NULL
			);

			break;
		}

		case STATUS_EXIT:
		{
			::cellMsgDialogOpen2(
				CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO|
				CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, 
				"Do you want to exit FB Alpha RL and return to XMB ?", 
				ExitDlgCallbackFunction, (void*)STATUS_EXIT, NULL
			);
			break;
		}

		case STATUS_EXIT_FBARL_RA:
		{
			::cellMsgDialogOpen2(
				CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO|
				CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, 
				"Do you want to exit and load FB Alpha RetroArch (modified core / fb_alpha.SELF) ?",
				ExitDlgCallbackFunction, (void*)STATUS_EXIT_FBARL_RA, NULL
			);
			break;
		}

		case STATUS_EXIT_MMAN:
		{
			::cellMsgDialogOpen2(				
				CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO|
				CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, 
				"Do you want to exit and load \"multiMAN\" ?",
				ExitDlgCallbackFunction, (void*)STATUS_EXIT_MMAN, NULL
			);
			break;
		}

		case STATUS_EXIT_IMANAGER:
		{
			::cellMsgDialogOpen2(				
				CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO|
				CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, 
				"Do you want to exit and load \"Iris Manager\" ?",
				ExitDlgCallbackFunction, (void*)STATUS_EXIT_IMANAGER, NULL
			);
			break;
		}

		case STATUS_UPDATEPREVIEW:
		{
			UpdateBurnSelected(fgames[nSelectedGame]->zipname);
			UpdatePreviewImage();
			break;
		}

		case STATUS_RESETPREVIEW:
		{
			ResetPreviewImage();
			break;
		}

		case STATUS_ROMSCAN_START:
		{
			char szMsg[256] = "";
			sprintf(szMsg, "Scanning ROM(s), please wait...\n\nNotice: If you have MAME complete romset, be patient, the process could take a few minutes.");

			::cellMsgDialogOpen2(
				CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL
				|CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE
				|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON
				|CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE
				|CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE,
				szMsg,
				DlgCallbackFunction, NULL, NULL
			);

			sys_ppu_thread_t thread_id;

			sys_ppu_thread_create(
				&thread_id,
				_ScanROMs,						// callback function
				0x1337,							// arg
				0,								// priority
				0x300000,							// stack size
				SYS_PPU_THREAD_CREATE_JOINABLE, //
				"ROMScan"						// name
			);
			break;
		}

		case STATUS_ROMSCAN_END:
		{
			cellMsgDialogAbort();
			SaveGameListCache();
			fbaRL->InitFilterList();
			break;
		}
	}

	nStatus = STATUS_NORMAL;
}