Exemple #1
0
void PatchCountryStrings(void *Address, int Size)
{
    u8 SearchPattern[4]    = { 0x00, 0x00, 0x00, 0x00 };
    u8 PatchData[4]        = { 0x00, 0x00, 0x00, 0x00 };
    u8 *Addr            = (u8*)Address;

    int wiiregion = CONF_GetRegion();

    switch (wiiregion)
    {
        case CONF_REGION_JP:
            SearchPattern[0] = 0x00;
            SearchPattern[1] = 0x4A; // J
            SearchPattern[2] = 0x50; // P
            break;
        case CONF_REGION_EU:
            SearchPattern[0] = 0x02;
            SearchPattern[1] = 0x45; // E
            SearchPattern[2] = 0x55; // U
            break;
        case CONF_REGION_KR:
            SearchPattern[0] = 0x04;
            SearchPattern[1] = 0x4B; // K
            SearchPattern[2] = 0x52; // R
            break;
        case CONF_REGION_CN:
            SearchPattern[0] = 0x05;
            SearchPattern[1] = 0x43; // C
            SearchPattern[2] = 0x4E; // N
            break;
        case CONF_REGION_US:
        default:
            SearchPattern[0] = 0x01;
            SearchPattern[1] = 0x55; // U
            SearchPattern[2] = 0x53; // S
    }

    switch (diskid[3])
    {
        case 'J':
            PatchData[1] = 0x4A; // J
            PatchData[2] = 0x50; // P
            break;

        case 'D':
        case 'F':
        case 'P':
        case 'X':
        case 'Y':
            PatchData[1] = 0x45; // E
            PatchData[2] = 0x55; // U
            break;

        case 'E':
        default:
            PatchData[1] = 0x55; // U
            PatchData[2] = 0x53; // S
    }

    while (Size >= 4)
    {
        if (Addr[0] == SearchPattern[0] && Addr[1] == SearchPattern[1] && Addr[2] == SearchPattern[2] && Addr[3] == SearchPattern[3])
        {
            //*Addr = PatchData[0];
            Addr += 1;
            *Addr = PatchData[1];
            Addr += 1;
            *Addr = PatchData[2];
            Addr += 1;
            //*Addr = PatchData[3];
            Addr += 1;
            Size -= 4;
        } else
        {
            Addr += 4;
            Size -= 4;
        }
    }
} // PatchCountryStrings
Exemple #2
0
int DMLRunNew (char *folder, char *id, s_gameConfig *gameconf, u32 slot)
	{
	DML_CFG cfg;
	char path[256];
	
	memset (&cfg, 0, sizeof (DML_CFG));
	
	Debug ("DMLRunNew (%s, %s, %u, %u, %u, %u)", folder, id, gameconf->dmlVideoMode, gameconf->dmlNoDisc, gameconf->dmlPadHook, gameconf->dmlNMM);
	
	cfg.Config |= DML_CFG_GAME_PATH;

	if (slot)
		{
		sprintf (path, "usb:/%s/game.iso", folder);
		sprintf (cfg.CheatPath, "usb:/codes/%s.gct", id);
		}
	else
		{
		sprintf (path, "sd:/%s/game.iso", folder);
		sprintf (cfg.CheatPath, "sd:/codes/%s.gct", id);
		}
		
	if (fsop_FileExist (path))
		{
		sprintf (path, "%s/game.iso", folder);
		}
	else
		{
		sprintf (path, "%s/", folder);
		}

	Debug ("DMLRunNew -> using %s", path);

	//if (!devices_Get(DEV_SD)) return 0;
	
	Shutdown ();

	cfg.Magicbytes = 0xD1050CF6;
	if (config.dmlVersion == GCMODE_DM22 || config.dmlVersion == GCMODE_DMAUTO)
		cfg.CfgVersion = 0x00000002;
	else
		cfg.CfgVersion = 0x00000001;
		
	if (gameconf->dmlVideoMode == PLGC_Auto) // AUTO
		{
		cfg.VideoMode |= DML_VID_DML_AUTO;
		}
	if (gameconf->dmlVideoMode == PLGC_Game) // GAME
		{
		if (id[3] == 'E' || id[3] == 'J' || id[3] == 'N')
			cfg.VideoMode |= DML_VID_FORCE_NTSC;
		else
			cfg.VideoMode |= DML_VID_FORCE_PAL50;
		}
	if (gameconf->dmlVideoMode == PLGC_WII) // WII
		{
		if (CONF_GetRegion() == CONF_REGION_EU)
			cfg.VideoMode |= DML_VID_FORCE_PAL50;
		else
			cfg.VideoMode |= DML_VID_FORCE_NTSC;
		}
	
	if (gameconf->dmlVideoMode == PLGC_NTSC)
		cfg.VideoMode |= DML_VID_FORCE_NTSC;

	if (gameconf->dmlVideoMode == PLGC_PAL50)
		cfg.VideoMode |= DML_VID_FORCE_PAL50;

	if (gameconf->dmlVideoMode == PLGC_PAL60)
		cfg.VideoMode |= DML_VID_FORCE_PAL60;
		
	//kept as nodisc for legacy purposes, but it also controls
	//widescreen force 16:9 in 2.1+
	if (gameconf->dmlNoDisc)
		cfg.Config |= DML_CFG_NODISC;

	if (gameconf->dmlFullNoDisc)
		cfg.Config |= DML_CFG_NODISC2;

	if (gameconf->dmlPadHook)
		cfg.Config |= DML_CFG_PADHOOK;

	if (gameconf->dmlNMM)
		cfg.Config |= DML_CFG_NMM;
		
    if(gameconf->ocarina)
        cfg.Config |= DML_CFG_CHEATS;

	strcpy (cfg.GamePath, path);
 	memcpy ((char *)0x80000000, id, 6);
	
	//Write options into memory
	memcpy((void *)0x80001700, &cfg, sizeof(DML_CFG));
	DCFlushRange((void *)(0x80001700), sizeof(DML_CFG));

	//DML v1.2+
	memcpy((void *)0x81200000, &cfg, sizeof(DML_CFG));
	DCFlushRange((void *)(0x81200000), sizeof(DML_CFG));

	/* Boot BC */
	WII_Initialize();
	return WII_LaunchTitle(0x100000100LL);
	}