示例#1
0
文件: ios.c 项目: Alcaro/RetroArch
// These two functions deal with the "internal" IOS subsystems that are used by default by libogc
// Other stuff should be inited by the user and deinited by the exit callbacks. The user is also responsible
// for deiniting other stuff before an IOS reload and reiniting them after.
s32 __IOS_InitializeSubsystems(void)
{
	s32 res;
	s32 ret = 0;
#ifdef DEBUG_IOS
	printf("IOS Subsystem Init\n");
#endif
	res = __ES_Init();
	if(res < 0) {
		ret = res;
#ifdef DEBUG_IOS
		printf("ES Init failed: %d\n",ret);
#endif
	}
	res = __STM_Init();
	if(res < 0) {
		ret = res;
#ifdef DEBUG_IOS
		printf("STM Init failed: %d\n",ret);
#endif
	}
#ifdef DEBUG_IOS
	printf("IOS Subsystem Init Done: %d\n",ret);
#endif
	return ret;
}
示例#2
0
s32 __attribute__((weak)) __IOS_LoadStartupIOS()
{
#if 0
	int version;
	int res;

	res = __ES_Init();
	if(res < 0) return res;
	version = IOS_GetPreferredVersion();
	if(version < 0) {
#ifdef DEBUG_IOS
		printf("GetPreferredVersion failed: %d\n",version);
#endif
		__ES_Close();
		return version;
	}
#ifdef DEBUG_IOS
	printf("Loading startup IOS: %d\n",version);
#endif
	res = __IOS_LaunchNewIOS(version);
	if(res < 0) return res;
#endif

	return 0;
}
示例#3
0
文件: main.c 项目: volt72/Nintendont
s32 __IOS_LoadStartupIOS(void)
{
	int res;

	res = __ES_Init();
	if(res < 0)
		return res;

	return 0;
}
示例#4
0
文件: ios.c 项目: Alcaro/RetroArch
s32 IOS_ReloadIOS(int version)
{
	int ret = 0;
	int res;

#ifdef DEBUG_IOS
	printf("Reloading to IOS%d\n",version);
#endif

	res = __IOS_ShutdownSubsystems();
	if(res < 0) {
#ifdef DEBUG_IOS
		printf("__IOS_ShutdownSubsystems failed: %d\n", res);
#endif
		ret = res;
	}

	res = __ES_Init();
	if(res < 0) {
#ifdef DEBUG_IOS
		printf("__ES_Init failed: %d\n", res);
#endif
		ret = res;
	} else {
		res = __IOS_LaunchNewIOS(version);
		if(res < 0) {
#ifdef DEBUG_IOS
			printf("__IOS_LaunchNewIOS failed: %d\n", res);
#endif
			ret = res;
			__ES_Close();
		}
	}

	res = __IOS_InitializeSubsystems();
	if(res < 0) {
#ifdef DEBUG_IOS
		printf("__IOS_InitializeSubsystems failed: %d\n", res);
#endif
		ret = res;
	}

	return ret;
}
示例#5
0
s32 ES_GetTitleID(u64 *tid)
{
	s32 fd, ret;

	/* Open ES */
	fd = __ES_Init();
	if (fd < 0)
		return fd;

	/* Setup vector */
	vector[0].data = tid;
	vector[0].len  = sizeof(u64);

	/* Get title ID */
	ret = os_ioctlv(fd, IOCTL_ES_GETTITLEID, 0, 1, vector);

	/* Close ES */
	__ES_Close(fd);

	return ret;
}
示例#6
0
文件: stubload.c 项目: comex/libogc
s32 __DI_LoadStub(void)
{
	int ret = 0;
	int res;
#ifdef DEBUG_IOS
	dprintf("Reloading to IOS%d\n",version);
#endif
	res = __IOS_ShutdownSubsystems();
	if(res < 0) ret = res;
	res = __ES_Init();
	if(res < 0) ret = res;
	else {
		res = __DI_StubLaunch();
		if(res < 0) {
			ret = res;
			__ES_Close();
		}
	}
	res = __IOS_InitializeSubsystems();
	if(res < 0) ret = res;
	return ret;
}
示例#7
0
文件: stubload.c 项目: comex/libogc
s32 __DI_StubLaunch(void)
{
	u64 titleID = DVD_TITLEID;
	static tikview views[4] ATTRIBUTE_ALIGN(32);
	u32 numviews;
	s32 res;
	
	u32 ints;
	
	dprintf("Shutting down IOS subsystems\n");
	res = __IOS_ShutdownSubsystems();
	if(res < 0) {
		dprintf("Shutdown failed: %d\n",res);
	}
	dprintf("Initializing ES\n");
	res = __ES_Init();
	if(res < 0) {
		dprintf("ES init failed: %d\n",res);
		return res;
	}
	
	dprintf("Launching TitleID: %016llx\n",titleID);
	
	res = ES_GetNumTicketViews(titleID, &numviews);
	if(res < 0) {
		dprintf(" GetNumTicketViews failed: %d\n",res);
		return res;
	}
	if(numviews > 4) {
		dprintf(" GetNumTicketViews too many views: %u\n",numviews);
		return IOS_ETOOMANYVIEWS;
	}
	res = ES_GetTicketViews(titleID, views, numviews);
	if(res < 0) {
		dprintf(" GetTicketViews failed: %d\n",res);
		return res;
	}
	dprintf("Ready to launch channel\n");
	res = ES_LaunchTitleBackground(titleID, &views[0]);
	if(res<0) {
		dprintf("Launch failed: %d\n",res);
		return res;
	}
	dprintf("Channel launching in the background\n");
	dprintf("Pre-stub status:\n");
	dumpregs();
	dprintf("ISR Disable...\n");
	_CPU_ISR_Disable( ints );
	dprintf("Saving regs...\n");
	__distub_saveregs();
	dprintf("Taking the plunge...\n");
	__distub_take_plunge(&di_ctx);
	
	dprintf("We're back!\n");
	dprintf("Restoring regs...\n");
	__distub_restregs();
	dprintf("ISR Enable...\n");
	_CPU_ISR_Restore( ints );
	
	dprintf("Post-stub status:\n");
	dumpregs();
	
	__IPC_Reinitialize();
	__ES_Reset();
	
	dprintf("IPC reinitialized\n");
	sleep(1);
	dprintf("Restarting IOS subsystems\n");
	
	res = __IOS_InitializeSubsystems();
	
	dprintf("Subsystems running!\n");
	
	res = ES_GetNumTicketViews(titleID, &numviews);
	if(res < 0) {
		dprintf(" GetNumTicketViews failed: %d\n",res);
		return res;
	}
	dprintf(" GetNumTicketViews: %d",numviews);
	
	return 0;
}