Exemple #1
0
void gamepatches(u8 videoSelected, u8 videoPatchDol, u8 aspectForce, u8 languageChoice, u8 patchcountrystring,
				 u8 vipatch, u8 sneekVideoPatch, u8 hooktype, u64 returnTo, u8 privateServer)
{
	int i;

	/* If a wip file is loaded for this game this does nothing - Dimok */
	PoPPatch();
	NSMBPatch();

	for(i = 0; i < dolCount; ++i)
	{
		u8 *dst = dolList[i].dst;
		int len = dolList[i].len;

		VideoModePatcher(dst, len, videoSelected, videoPatchDol);

		dogamehooks(hooktype, dst, len);

		if (vipatch)
			vidolpatcher(dst, len);

		if(sneekVideoPatch)
			sneek_video_patch(dst, len);

		/*LANGUAGE PATCH - FISHEARS*/
		langpatcher(dst, len, languageChoice);

		/*Thanks to WiiPower*/
		if (patchcountrystring == 1)
			PatchCountryStrings(dst, len);

		do_wip_code(dst, len);

		Anti_002_fix(dst, len);

		if(returnTo)
			PatchReturnTo(dst, len, (u32) returnTo);

		if(aspectForce < 2)
			PatchAspectRatio(dst, len, aspectForce);

		if(privateServer)
			PrivateServerPatcher(dst, len, privateServer);
			
		DCFlushRange(dst, len);
		ICInvalidateRange(dst, len);
	}

	/* ERROR 002 fix (thanks to WiiPower for sharing this)*/
	*(u32 *)0x80003140 = *(u32 *)0x80003188;

	DCFlushRange((void*) 0x80000000, 0x3f00);

	free_wip();
	ClearDOLList();
}
Exemple #2
0
s32 Disc_BootPartition(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio)
{
	entry_point p_entry;

	IOSReloadBlock(IOS_GetVersion());
	
	s32 ret = WDVD_OpenPartition(offset, 0, 0, 0, Tmd_Buffer);
	if (ret < 0) return ret;

	/* Select an appropriate video mode */
	__Disc_SelectVMode(vidMode, 0);

	/* Setup low memory */;
	__Disc_SetLowMem();

	/* Run apploader */
	ret = Apploader_Run(&p_entry, vidMode, vmode, vipatch, countryString, patchVidMode, aspectRatio);
	free_wip();
	if (ret < 0) return ret;

	if (hooktype != 0)
		ocarina_do_code();

	gprintf("\n\nEntry Point is: %0x8\n", p_entry);
//	gprintf("Lowmem:\n\n");
//	ghexdump((void*)0x80000000, 0x3f00);

	/* Set time */
	__Disc_SetTime();

	/* Set an appropriate video mode */
	__Disc_SetVMode();

	u8 temp_data[4];

	// fix for PeppaPig
	memcpy((char *) &temp_data, (void*)0x800000F4,4);

	usleep(100 * 1000);

	/* Shutdown IOS subsystems */
	SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);

	/* Originally from tueidj - taken from NeoGamma (thx) */
	*(vu32*)0xCC003024 = 1;
	
	// fix for PeppaPig
	memcpy((void*)0x800000F4,(char *) &temp_data, 4);

	appentrypoint = (u32) p_entry;
	
	gprintf("Jumping to entrypoint\n");
	
	if (hooktype != 0) //2x "nop\n" removed From Mod
	{
		__asm__(
			"lis %r3, appentrypoint@h\n"
			"ori %r3, %r3, appentrypoint@l\n"
			"lwz %r3, 0(%r3)\n"
			"mtlr %r3\n"
			"lis %r3, 0x8000\n"
			"ori %r3, %r3, 0x18A8\n"
			"nop\n"
			"mtctr %r3\n"
			"bctr\n"
		);
	}
	else
	{
		__asm__(
			"lis %r3, appentrypoint@h\n"
			"ori %r3, %r3, appentrypoint@l\n"
			"lwz %r3, 0(%r3)\n"
			"mtlr %r3\n"
			"blr\n"
		);
	}

	return 0;
}