Exemple #1
0
static void initMain()
{

    // try to load a saved config, if none then get Wii language menu
    if(!loadConfig(FILE_CFG)) {
        // get the language of the Wii menu and map this to the Mahjongg Wii languages
        if(CONF_GetLanguage()<7) opt_lang = languages[CONF_GetLanguage()];

        // dirty hack to force English if not German as default
        if (opt_lang != 2) {
            opt_lang = 1;
        }
    }
    GRRLIB_Widescreen(opt_widescreen);

    // setup the layouts array for use in menu and game
    setupLayouts();

    //init scores with 0
    int i;
    for( i = 0; i < LAYOUTS * 2; ++i) {
        g_scores[i] = 0;
    }
    //load scores
    loadHighscores( FILE_HIGHSCORE, g_scores);
}
bool Theme::LoadFont(const char *path)
{
	bool result = false;
	FILE *pfile = NULL;

	delete [] customFont;
	customFont = NULL; 
	
	pfile = fopen(path, "rb");

	if (pfile)
	{
		fseek(pfile, 0, SEEK_END);
		customFontSize = ftell(pfile);
		rewind(pfile);

		customFont = new (std::nothrow) FT_Byte[customFontSize];
		if (customFont)
		{
			fread(customFont, 1, customFontSize, pfile);
			result = true;
		}
		fclose(pfile);
	}

	FT_Byte * loadedFont = customFont;
	u32 loadedFontSize = customFontSize;
	
	if(!loadedFont && Settings.UseSystemFont)
	{
		if(!systemFont)
			loadSystemFont(CONF_GetLanguage() == CONF_LANG_KOREAN);
		if(!systemFont)
			loadSystemFont(CONF_GetLanguage() != CONF_LANG_KOREAN);
		
		//! Default to system font if no custom is loaded
		loadedFont = systemFont;
		loadedFontSize = systemFontSize;
	} 
	if(!loadedFont)
	{
		loadedFont = (FT_Byte *) Resources::GetFile("font.ttf");
		loadedFontSize = Resources::GetFileSize("font.ttf");
	}
	
	delete fontSystem;
	
	fontSystem = new FreeTypeGX(loadedFont, loadedFontSize, loadedFont == systemFont);

	return result;
}
Exemple #3
0
/****************************************************************************
 * DefaultSettings
 *
 * Sets all the defaults!
 ***************************************************************************/
void
DefaultSettings ()
{
	memset (&GCSettings, 0, sizeof (GCSettings));
	ResetControls(); // controller button mappings

	GCSettings.currpal = 1; // color palette
	GCSettings.timing = 2; // 0 - NTSC, 1 - PAL, 2 - Automatic
	GCSettings.videomode = 0; // automatic video mode detection
	GCSettings.Controller = CTRL_PAD2; // NES pad, Four Score, Zapper
	GCSettings.crosshair = 1; // show zapper crosshair
	GCSettings.spritelimit = 1; // enforce 8 sprite limit
	GCSettings.gamegenie = 1;

	GCSettings.render = 2; // Unfiltered
	GCSettings.hideoverscan = 2; // hide both horizontal and vertical

	GCSettings.widescreen = 0; // no aspect ratio correction
	GCSettings.zoomHor = 1.0; // horizontal zoom level
	GCSettings.zoomVert = 1.0; // vertical zoom level
	GCSettings.xshift = 0; // horizontal video shift
	GCSettings.yshift = 0; // vertical video shift

	GCSettings.WiimoteOrientation = 0;
	GCSettings.ExitAction = 0;
	GCSettings.MusicVolume = 40;
	GCSettings.SFXVolume = 40;
	GCSettings.Rumble = 1;
#ifdef HW_RVL
	GCSettings.language = CONF_GetLanguage();
	
	if(GCSettings.language == LANG_JAPANESE || 
		GCSettings.language == LANG_SIMP_CHINESE || 
		GCSettings.language == LANG_TRAD_CHINESE || 
		GCSettings.language == LANG_KOREAN)
		GCSettings.language = LANG_ENGLISH;
#else
	GCSettings.language = LANG_ENGLISH;
#endif

	GCSettings.LoadMethod = DEVICE_AUTO; // Auto, SD, DVD, USB, Network (SMB)
	GCSettings.SaveMethod = DEVICE_AUTO; // Auto, SD, USB, Network (SMB)
	sprintf (GCSettings.LoadFolder, "%s/roms", APPFOLDER); // Path to game files
	sprintf (GCSettings.SaveFolder, "%s/saves", APPFOLDER); // Path to save files
	sprintf (GCSettings.CheatFolder, "%s/cheats", APPFOLDER); // Path to cheat files
	GCSettings.AutoLoad = 1; // Auto Load RAM
	GCSettings.AutoSave = 1; // Auto Save RAM

	strcpy(GCSettings.netplayPort, DEFAULT_NETPLAY_PORT);
}
Exemple #4
0
u8 get_wii_language()
{
	switch (CONF_GetLanguage())
	{
		case CONF_LANG_GERMAN:
			return SRAM_GERMAN;
		case CONF_LANG_FRENCH:
			return SRAM_FRENCH;
		case CONF_LANG_SPANISH:
			return SRAM_SPANISH;
		case CONF_LANG_ITALIAN:
			return SRAM_ITALIAN;
		case CONF_LANG_DUTCH:
			return SRAM_DUTCH;
		default:
			return SRAM_ENGLISH;
	}
}
bool CSettings::LoadLanguage(const char *path, int lang)
{
	bool ret = false;

	if (path && strlen(path) > 3)
	{
		ret = gettextLoadLanguage(path);
		if (ret)
		{
			strlcpy(language_path, path, sizeof(language_path));
			strlcpy(db_language, GetLangCode(language_path), sizeof(db_language));
		}
		else
			return LoadLanguage(NULL, CONSOLE_DEFAULT);
	}
	else if (lang >= 0)
	{
		char filepath[150];
		char langpath[150];
		strlcpy(langpath, languagefiles_path, sizeof(langpath));
		if (langpath[strlen(langpath) - 1] != '/')
		{
			char * ptr = strrchr(langpath, '/');
			if (ptr)
			{
				ptr++;
				ptr[0] = '\0';
			}
		}

		if (lang == CONSOLE_DEFAULT)
		{
			return LoadLanguage(NULL, CONF_GetLanguage());
		}
		else if (lang == JAPANESE)
		{
			snprintf(filepath, sizeof(filepath), "%s/japanese.lang", langpath);
		}
		else if (lang == ENGLISH)
		{
			snprintf(filepath, sizeof(filepath), "%s/english.lang", langpath);
		}
		else if (lang == GERMAN)
		{
			snprintf(filepath, sizeof(filepath), "%s/german.lang", langpath);
		}
		else if (lang == FRENCH)
		{
			snprintf(filepath, sizeof(filepath), "%s/french.lang", langpath);
		}
		else if (lang == SPANISH)
		{
			snprintf(filepath, sizeof(filepath), "%s/spanish.lang", langpath);
		}
		else if (lang == ITALIAN)
		{
			snprintf(filepath, sizeof(filepath), "%s/italian.lang", langpath);
		}
		else if (lang == DUTCH)
		{
			snprintf(filepath, sizeof(filepath), "%s/dutch.lang", langpath);
		}
		else if (lang == S_CHINESE)
		{
			snprintf(filepath, sizeof(filepath), "%s/schinese.lang", langpath);
		}
		else if (lang == T_CHINESE)
		{
			snprintf(filepath, sizeof(filepath), "%s/tchinese.lang", langpath);
		}
		else if (lang == KOREAN)
		{
			snprintf(filepath, sizeof(filepath), "%s/korean.lang", langpath);
		}

		strlcpy(db_language, GetLangCode(filepath), sizeof(db_language));
		ret = gettextLoadLanguage(filepath);
		if (ret)
			strlcpy(language_path, filepath, sizeof(language_path));
	}

	return ret;
}
Exemple #6
0
/****************************************************************************
 * DefaultSettings
 *
 * Sets all the defaults!
 ***************************************************************************/
void
DefaultSettings ()
{
	memset (&GCSettings, 0, sizeof (GCSettings));
	ResetControls(); // controller button mappings

	GCSettings.LoadMethod = DEVICE_AUTO; // Auto, SD, DVD, USB, Network (SMB)
	GCSettings.SaveMethod = DEVICE_AUTO; // Auto, SD, USB, Network (SMB)
	sprintf (GCSettings.LoadFolder, "%s/roms", APPFOLDER); // Path to game files
	sprintf (GCSettings.SaveFolder, "%s/saves", APPFOLDER); // Path to save files
	sprintf (GCSettings.CheatFolder, "%s/cheats", APPFOLDER); // Path to cheat files
	sprintf (GCSettings.ScreenshotsFolder, "%s/screenshots", APPFOLDER);
	sprintf (GCSettings.BorderFolder, "%s/borders", APPFOLDER);
	sprintf (GCSettings.CoverFolder, "%s/covers", APPFOLDER); // Path to cover files
	sprintf (GCSettings.ArtworkFolder, "%s/artworks", APPFOLDER); // Path to artwork files
	sprintf (GCSettings.ImageFolder, "%s/screenshots", APPFOLDER);

	GCSettings.AutoLoad = 1;
	GCSettings.AutoSave = 1;
	GCSettings.AppendAuto = 1;

	GCSettings.WiimoteOrientation = 0;

	GCSettings.gbaZoomHor = 1.0; // GBA horizontal zoom level
	GCSettings.gbaZoomVert = 1.0; // GBA vertical zoom level
	GCSettings.gbZoomHor = 1.0; // GBA horizontal zoom level
	GCSettings.gbZoomVert = 1.0; // GBA vertical zoom level
	GCSettings.gbFixed = 0; // not fixed - use zoom level
	GCSettings.gbaFixed = 0; // not fixed - use zoom level
	GCSettings.videomode = 0; // automatic video mode detection
	GCSettings.render = 1; // Filtered
	GCSettings.scaling = 1; // partial stretch
	GCSettings.WiiControls = false; // Match Wii Game

	GCSettings.xshift = 0; // horizontal video shift
	GCSettings.yshift = 0; // vertical video shift
	GCSettings.colorize = 0; // Colorize mono gameboy games
	GCSettings.gbaFrameskip = 1; // Turn auto-frameskip on for GBA games

	GCSettings.WiimoteOrientation = 0;
	GCSettings.ExitAction = 0;
	GCSettings.MusicVolume = 40;
	GCSettings.SFXVolume = 40;
	GCSettings.Rumble = 1;
	GCSettings.PreviewImage = 0;
	
	GCSettings.BasicPalette = 0;
	
#ifdef HW_RVL
	GCSettings.language = CONF_GetLanguage();

	if(GCSettings.language == LANG_JAPANESE || 
		GCSettings.language == LANG_SIMP_CHINESE || 
		GCSettings.language == LANG_TRAD_CHINESE || 
		GCSettings.language == LANG_KOREAN)
		GCSettings.language = LANG_ENGLISH;
#else
	GCSettings.language = LANG_ENGLISH;
#endif
	GCSettings.OffsetMinutesUTC = 0;
	GCSettings.GBHardware = 0;
	GCSettings.SGBBorder = 0;
}
Exemple #7
0
u8 * GetImageData(void)
{
	u8 * data = NULL;

	int ret;

	if (CONF_GetAspectRatio()) {
		switch (CONF_GetLanguage()) {
			case CONF_LANG_FRENCH:
				ctx = PNGU_SelectImageFromBuffer(bk169fr_png);
				break;
			case CONF_LANG_JAPANESE:
				ctx = PNGU_SelectImageFromBuffer(bk169jp_png);
				break;
			case CONF_LANG_SPANISH:
				ctx = PNGU_SelectImageFromBuffer(bk169sp_png);
				break;
			case CONF_LANG_ITALIAN:
				ctx = PNGU_SelectImageFromBuffer(bk169it_png);
				break;
			case CONF_LANG_DUTCH:
				ctx = PNGU_SelectImageFromBuffer(bk169du_png);
				break;
			case CONF_LANG_GERMAN:
				ctx = PNGU_SelectImageFromBuffer(bk169ge_png);
				break;
			default:
				ctx = PNGU_SelectImageFromBuffer(bk169en_png);
				break;
		}
	} else {
		switch (CONF_GetLanguage()) {
			case CONF_LANG_FRENCH:
				ctx = PNGU_SelectImageFromBuffer(bkfr_png);
				break;
			case CONF_LANG_JAPANESE:
				ctx = PNGU_SelectImageFromBuffer(bkjp_png);
				break;
			case CONF_LANG_SPANISH:
				ctx = PNGU_SelectImageFromBuffer(bksp_png);
				break;
			case CONF_LANG_ITALIAN:
				ctx = PNGU_SelectImageFromBuffer(bkit_png);
				break;
			case CONF_LANG_DUTCH:
				ctx = PNGU_SelectImageFromBuffer(bkdu_png);
				break;
			case CONF_LANG_GERMAN:
				ctx = PNGU_SelectImageFromBuffer(bkge_png);
				break;
			default:
				ctx = PNGU_SelectImageFromBuffer(bken_png);
				break;
		}
	}
	if (!ctx)
		return NULL;

	ret = PNGU_GetImageProperties(ctx, &imgProp);
	if (ret != PNGU_OK)
		return NULL;

    int len = imgProp.imgWidth * imgProp.imgHeight * 4;

    if(len%32) len += (32-len%32);
    data = (u8 *)memalign (32, len);
    ret = PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
	DCFlushRange(data, len);

	PNGU_ReleaseImageContext(ctx);

    return data;
}
Exemple #8
0
void Download_Cover(char* id, int v, int max)
{
	char imgPath[100];

	if (!id)
		return;
		
	//struct block file;

	char region[5];
	
	switch(id[3]){

		case 'E':
			sprintf(region,"ntsc");
			break;
		case 'J':
			sprintf(region,"ntscj");
			break;
		case 'P':
			sprintf(region,"pal");
			break;
	}
	
	char country[3];
	
	switch(id[3]){
		case 'J':
			sprintf(country, "JA");
			break;
		case 'K':
			sprintf(country, "KO");
			break;
		case 'P':
		case 'D':
		case 'F':
		case 'I':
		case 'S':
		case 'H':
		case 'X':
		case 'Y':
			switch(CONF_GetLanguage()){
				case CONF_LANG_ENGLISH:
					sprintf(country, "EN");
					break;
				case CONF_LANG_GERMAN:
					sprintf(country, "DE");
					break;
				case CONF_LANG_FRENCH:
					sprintf(country, "FR");
					break;		
				case CONF_LANG_SPANISH:
					sprintf(country, "ES");
					break;
				case CONF_LANG_ITALIAN:
					sprintf(country, "IT");
					break;
				case CONF_LANG_DUTCH:
					sprintf(country, "NL");
					break;
				default:
					sprintf(country, "EN");
					break;
			}
			break;
		case 'E':
			sprintf(country, "US");
			break;
		default:
			sprintf(country, "EN");
	}

	if(!(settings.covers3d))
		snprintf(imgPath, sizeof(imgPath), "%s/%s.png", dynPath.dir_covers, id);
	else if(settings.covers3d && settings.hq==1)
	    snprintf(imgPath, sizeof(imgPath), "%s/%s.png", dynPath.dir_HQcovers, id);
	else
	    snprintf(imgPath, sizeof(imgPath), "%s/%s.png", dynPath.dir_3dcovers, id);
	sprintf(self.debugMsg, TX.checkPresence, imgPath);
	Paint_Progress_Generic(v, max, self.debugMsg);
	
	//
	// COVER
	//
	
	FILE *fp=NULL;
	if (!BUFFER_IsCoverMissing(v)) // don't try and read the file if the cover is bad
		fp = fopen(imgPath, "rb");
		char * parsedUrl;
		
	if (fp)
	{
		fclose (fp);
		sprintf(self.debugMsg, TX.noDownload, imgPath);
		Paint_Progress_Generic(v, max, self.debugMsg);
	}
		
	else{ // cover not found, we try to download it

		if(!(settings.covers3d)) //2d mode
		{
			parsedUrl=ParseTokenedUrl(SITE_BASE,COVER,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword",country,region,id);
		}
                else if(settings.covers3d && settings.hq==1) //3D HQ mode
		{
			parsedUrl=ParseTokenedUrl(SITE_BASE,COVERFULLHQ,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword",country,region,id);
		}
                else //3D mode
		{
			parsedUrl=ParseTokenedUrl(SITE_BASE,COVERFULL,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword",country,region,id);
		}
                //if that fails try other coversite
                if(!getCoverFromServer(parsedUrl, imgPath, v, max)){
                    if(!(settings.covers3d)) //2d mode
                    {
                            parsedUrl=ParseTokenedUrl(ALT_SITE_BASE,ALT_COVER,ALT_PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword",country,region,id);
                    }
                    //else if(settings.covers3d && settings.hq==1) //3D HQ mode
                    //{
                    //	parsedUrl=ParseTokenedUrl(ALT_SITE_BASE,COVERFULLHQ,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword",country,region,id);
                    //}
                    else //3D mode
                    {
                            parsedUrl=ParseTokenedUrl(ALT_SITE_BASE,ALT_COVERFULL,ALT_PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword",country,region,id);
                    }

                }
		if(!getCoverFromServer(parsedUrl, imgPath, v, max)){
			
			//FALLBACK (ugly code)
			if(id[3] != 'E' && id[3] != 'J'){ //PAL default to EN
				if(!(settings.covers3d))
				{
					parsedUrl=ParseTokenedUrl(SITE_BASE,COVER,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword","EN",region,id);
				}
				else if(settings.covers3d && settings.hq==1) //3D HQ mode
				{
					parsedUrl=ParseTokenedUrl(SITE_BASE,COVERFULLHQ,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword","EN",region,id);
				}
                                else
				{
					parsedUrl=ParseTokenedUrl(SITE_BASE,COVERFULL,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword","EN",region,id);
				}
			}
			else{
				if(!(settings.covers3d))
				{
					parsedUrl=ParseTokenedUrl(SITE_BASE,COVER,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword","US",region,id);
				}
				else if(settings.covers3d && settings.hq==1) //3D HQ mode
				{
					parsedUrl=ParseTokenedUrl(SITE_BASE,COVERFULLHQ,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword","US",region,id);
				}
                                else
				{
					parsedUrl=ParseTokenedUrl(SITE_BASE,COVERFULL,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword","US",region,id);
				}
			}
                        getCoverFromServer(parsedUrl, imgPath, v, max);
/*
			if(!getCoverFromServer(parsedUrl, imgPath, v, max)){ //HQ failed so try normal 3D
                            if(settings.covers3d)
                            {
                                    parsedUrl=ParseTokenedUrl(SITE_BASE,COVERFULL,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword",country,region,id);
                            
                                    getCoverFromServer(parsedUrl, imgPath, v, max);
                            }
                        }
*/
                }
	}
	
	//
	// DISC ART
	//
	
	//snprintf(imgPath, sizeof(imgPath), "%s/disks/%s.png", USBLOADER_PATH, id);
	snprintf(imgPath, sizeof(imgPath), "%s/%s.png", dynPath.dir_disks, id);
	sprintf(self.debugMsg, TX.checkPresence, imgPath);
	Paint_Progress_Generic(v, max,self.debugMsg);
	
	fp = fopen(imgPath, "rb");
	if(fp)
	{
		fclose (fp);
		sprintf(self.debugMsg, TX.noDownload, imgPath);
		Paint_Progress_Generic(v, max,self.debugMsg);
	}
	else
	{
		parsedUrl=ParseTokenedUrl(SITE_BASE,DISK,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword",country,region,id);
		
		if(!getCoverFromServer(parsedUrl, imgPath, v, max))
		{

			//FALLBACK (ugly code)
			if(id[3] != 'E' && id[3] != 'J') //PAL default to EN
				parsedUrl=ParseTokenedUrl(SITE_BASE,DISK,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword","EN",region,id);
			else
				parsedUrl=ParseTokenedUrl(SITE_BASE,DISK,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword","US",region,id);
			

			if(!getCoverFromServer(parsedUrl, imgPath, v, max)) //first supplier failed so try second
                        {
                            parsedUrl=ParseTokenedUrl(ALT_SITE_BASE,ALT_DISK,ALT_PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword",country,region,id);
                        }
                        if(!getCoverFromServer(parsedUrl, imgPath, v, max)) //try custom disc image
                        {
                            parsedUrl=ParseTokenedUrl(SITE_BASE,CUSTOMDISK,PARAMTERISED_ARTWORK_LOCATION,"testUsername","testPassword",country,region,id);
                            getCoverFromServer(parsedUrl, imgPath, v, max);
                        }

		}
	}
} /* end download */
Exemple #9
0
/****************************************************************************
 * DefaultSettings
 *
 * Sets all the defaults!
 ***************************************************************************/
void
DefaultSettings ()
{
	memset (&GCSettings, 0, sizeof (GCSettings));

	ResetControls(); // controller button mappings

	GCSettings.LoadMethod = DEVICE_AUTO; // Auto, SD, DVD, USB, Network (SMB)
	GCSettings.SaveMethod = DEVICE_AUTO; // Auto, SD, USB, Network (SMB)
	sprintf (GCSettings.LoadFolder, "%s/roms", APPFOLDER); // Path to game files
	sprintf (GCSettings.SaveFolder, "%s/saves", APPFOLDER); // Path to save files
	sprintf (GCSettings.CheatFolder, "%s/cheats", APPFOLDER); // Path to cheat files
	sprintf (GCSettings.ScreenshotsFolder, "%s/screenshots", APPFOLDER); // Path to cheat files
	GCSettings.AutoLoad = 1;
	GCSettings.AutoSave = 1;

	GCSettings.Controller = CTRL_PAD2;

	GCSettings.videomode = 0; // automatic video mode detection
	GCSettings.render = 2; // Unfiltered
	GCSettings.FilterMethod = FILTER_NONE;	// no hq2x

	GCSettings.widescreen = 0; // no aspect ratio correction
	GCSettings.zoomHor = 1.0; // horizontal zoom level
	GCSettings.zoomVert = 1.0; // vertical zoom level
	GCSettings.xshift = 0; // horizontal video shift
	GCSettings.yshift = 0; // vertical video shift
	GCSettings.crosshair = 1;

	GCSettings.WiimoteOrientation = 0;
	GCSettings.ExitAction = 0;
	GCSettings.MusicVolume = 40;
	GCSettings.SFXVolume = 40;
	GCSettings.Rumble = 1;
#ifdef HW_RVL
	GCSettings.language = CONF_GetLanguage();

	if(GCSettings.language == LANG_JAPANESE || 
		GCSettings.language == LANG_SIMP_CHINESE || 
		GCSettings.language == LANG_TRAD_CHINESE || 
		GCSettings.language == LANG_KOREAN)
		GCSettings.language = LANG_ENGLISH;
#else
	GCSettings.language = LANG_ENGLISH;
#endif

	/****************** SNES9x Settings ***********************/

	// Default ALL to false
	memset (&Settings, 0, sizeof (Settings));

	// General

	Settings.MouseMaster = true;
	Settings.SuperScopeMaster = true;
	Settings.JustifierMaster = true;
	Settings.MultiPlayer5Master = true;
	Settings.DontSaveOopsSnapshot = true;
	Settings.ApplyCheats = true;

	Settings.BlockInvalidVRAMAccess = false;
	Settings.HDMATimingHack = 100;

	// Sound defaults. On Wii this is 32Khz/16bit/Stereo
	//Settings.SoundSync = true;
	Settings.SixteenBitSound = true;
	Settings.Stereo = true;
	Settings.ReverseStereo = true;
	Settings.SoundPlaybackRate = 32000;
	Settings.SoundInputRate = 31953;

	// Graphics
	Settings.Transparency = true;
	Settings.SupportHiRes = true;
	Settings.SkipFrames = AUTO_FRAMERATE;
	Settings.TurboSkipFrames = 19;
	Settings.DisplayFrameRate = false;
	Settings.AutoDisplayMessages = 0;
	Settings.InitialInfoStringTimeout = 200; // # frames to display messages for

	// Frame timings in 50hz and 60hz cpu mode
	Settings.FrameTimePAL = 20000;
	Settings.FrameTimeNTSC = 16667;
}
Exemple #10
0
int main(int argc, char **argv) {
	jobs = new RSS_Job[0];
	ijobs = 0;
	// Initialise the video system
	VIDEO_Init();
		
	//Get Language
	lang = CONF_GetLanguage();

	// This function initialises the attached controllers
	WPAD_Init();
	
	// Obtain the preferred video mode from the system
	// This will correspond to the settings in the Wii menu
	rmode = VIDEO_GetPreferredMode(NULL);

	// Allocate memory for the display in the uncached region
	xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
	
	// Initialise the console, required for printf
	console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
	
	// Set up the video registers with the chosen mode
	VIDEO_Configure(rmode);
	
	// Tell the video hardware where our display memory is
	VIDEO_SetNextFramebuffer(xfb);
	
	// Make the display visible
	VIDEO_SetBlack(FALSE);

	// Flush the video register changes to the hardware
	VIDEO_Flush();

	// Wait for Video setup to complete
	VIDEO_WaitVSync();
	if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

	printf("\x1b[2;0H");
	if (LANG_GER) printf("Willkommen bei rssmii!\n\n");
	else printf("Welcome to rssmii!\n\n");

	int retval = load_feeds();
	if (retval != 0)
	{
		fail(retval);
	}

	if(LANG_GER) printf("Die folgenden RSS-Feeds wurden von der SD-Karte gelesen und werden abonniert und alle vorherigen Abonnements werden geloescht:\n");
	else printf("The following RSS-Feeds were read from the SD-Card and you will subscribe to them while all previous subscriptions will be deleted:\n");
	for (int i = 0; i < ijobs; i++)
	{
		printf("   %s\n", jobs[i].name);
	}

	if (LANG_GER) printf("\n\nSind sie sicher? (A: Fortsetzen; HOME: Abbrechen)");
	else printf("\n\nAre you sure? (A: Continue; HOME: Abort");

	while (1)
	{
		WPAD_ScanPads();
		if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) end();
		if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) break;
	}

	AddJobs();

	//printf("\n\nDone.");
	if (LANG_GER) printf("\nMit HOME zurueck zum Loader.");
	else printf("\nGet back to the Loader with the HOME-Button.");

	while (1)
	{
		WPAD_ScanPads();
		if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break;
	}
	end();
	//return 0;
}
Exemple #11
0
void InitializeLanguage()
{
	switch(CONF_GetLanguage())
	{
		default:
		case CONF_LANG_ENGLISH:
			TEXT_InitializingNetwork = L"Initializing network";
			TEXT_CouldNotConnect = L"Could not connect to network";
			TEXT_ConnectingTo = L"Connecting to:";
			TEXT_ConnectionFailed = L"Connection failed";
			TEXT_EnterPassword = L"Enter Password";
			TEXT_Cancel = L"Cancel";
			TEXT_Connect = L"Connect";
			TEXT_Exit = L"Exit";
			TEXT_Enter = L"Enter";
			TEXT_Up = L"Up";
			TEXT_Down = L"Down";
			TEXT_Left = L"Left";
			TEXT_Right = L"Right";
			break;

		case CONF_LANG_DUTCH:
			TEXT_InitializingNetwork = L"Netwerk initialiseren";
			TEXT_CouldNotConnect = L"Kon geen verbinding maken met netwerk";
			TEXT_ConnectingTo = L"Verbinding maken met:";
			TEXT_ConnectionFailed = L"Verbinding mislukt";
			TEXT_EnterPassword = L"Voer wachtwoord in";
			TEXT_Cancel = L"Annuleren";
			TEXT_Connect = L"Maak verbinding";
			TEXT_Exit = L"Afsluiten";
			TEXT_Enter = L"OK";
			TEXT_Up = L"Omhoog";
			TEXT_Down = L"Omlaag";
			TEXT_Left = L"Links";
			TEXT_Right = L"Rechts";
			break;
			
		case CONF_LANG_GERMAN:
			TEXT_InitializingNetwork = L"Netzwerk initialisieren";
			TEXT_CouldNotConnect = L"Konnte keine verbindung machen zum netzwerk";
			TEXT_ConnectingTo = L"Verbindung machen mit:";
			TEXT_ConnectionFailed = L"Verbindung fehler";
			TEXT_EnterPassword = L"Passwort eingeben:";
			TEXT_Cancel = L"Abbrechen";
			TEXT_Connect = L"Verbindung machen";
			TEXT_Exit = L"Beënden";
			TEXT_Enter = L"OK";
			TEXT_Up = L"Oben";
			TEXT_Down = L"Rünter";
			TEXT_Left = L"Links";
			TEXT_Right = L"Rechts";
			break;
			
		case CONF_LANG_SPANISH:
			TEXT_InitializingNetwork = L"Inciando la Conexión";
			TEXT_CouldNotConnect = L"No Se Pudo Conectar a la Red";
			TEXT_ConnectingTo = L"Conectándose a:";
			TEXT_ConnectionFailed = L"Falló la Conexión";
			TEXT_EnterPassword = L"Introducir Clave";
			TEXT_Cancel = L"Cancelar";
			TEXT_Connect = L"Conectar";
			TEXT_Exit = L"Salir";
			TEXT_Enter = L"Entrar";
			TEXT_Up = L"Arriba";
			TEXT_Down = L"Abajo";
			TEXT_Left = L"Izquierda";
			TEXT_Right = L"Derecha";
			break;
			
		case CONF_LANG_ITALIAN:
			TEXT_InitializingNetwork = L"Inizializzando la rete";
			TEXT_CouldNotConnect = L"Impossibile connettersi";
			TEXT_ConnectingTo = L"Connessione a:";
			TEXT_ConnectionFailed = L"Connessione fallita";
			TEXT_EnterPassword = L"Inserire la password";
			TEXT_Cancel = L"Annulla";
			TEXT_Connect = L"Connetti";
			TEXT_Exit = L"Esci";
			TEXT_Enter = L"Invio";
			TEXT_Up = L"Su";
			TEXT_Down = L"Giu";
			TEXT_Left = L"Sinistra";
			TEXT_Right = L"Destra";
			break;
			
		case CONF_LANG_FRENCH:
			TEXT_InitializingNetwork = L"Initialisation du réseau";
			TEXT_CouldNotConnect = L"Impossible de se connecter au réseau";
			TEXT_ConnectingTo = L"Connexion à:";
			TEXT_ConnectionFailed = L"Connexion échouée";
			TEXT_EnterPassword = L"Entrer le mot de passe";
			TEXT_Cancel = L"Annuler";
			TEXT_Connect = L"Connexion";
			TEXT_Exit = L"Quitter";
			TEXT_Enter = L"Entrer";
			TEXT_Up = L"Haut";
			TEXT_Down = L"Bas";
			TEXT_Left = L"Gauche";
			TEXT_Right = L"Droite";
			break;
			
			/* Need a helvetica font that supports japanese
		case CONF_LANG_JAPANESE:
			TEXT_InitializingNetwork = L"ネットワークの初期化";
			TEXT_CouldNotConnect = L"ネットワークに接続できませんでした。";
			TEXT_ConnectingTo = L"への接続:";
			TEXT_ConnectionFailed = L"接続に失敗しました";
			TEXT_EnterPassword = L"パスワードを入力します";
			TEXT_Cancel = L"キャンセル";
			TEXT_Connect = L"接続";
			TEXT_Exit = L"終了";
			TEXT_Enter = L"入る";
			TEXT_Up = L"上";
			TEXT_Down = L"下";
			TEXT_Left = L"左";
			TEXT_Right = L"右";
			break;
			*/
			
		//TODO:
		//	CONF_LANG_SIMP_CHINESE,
		//	CONF_LANG_TRAD_CHINESE,
		//	CONF_LANG_KOREAN
	}
}
Exemple #12
0
Common::String OSystem_Wii::getSystemLanguage() const {
	const char *wiiCountries[] = {
		"JP", // CONF_AREA_JPN Japan
		"US", // CONF_AREA_USA United States of America
		"",   // CONF_AREA_EUR Europe?
		"AU", // CONF_AREA_AUS Australia, Commonwealth of
		"BR", // CONF_AREA_BRA Brazil, Federative Republic of
		"TW", // CONF_AREA_TWN Taiwan, Province of China
		"",   // CONF_AREA_ROC Republic of China (Taiwan)
		"KR", // CONF_AREA_KOR Korea, Republic of
		"HK", // CONF_AREA_HKG Hong Kong, Special Administrative Region of China
		"",   // CONF_AREA_ASI Asia?
		"",   // CONF_AREA_LTN Lithuania?
		"",   // CONF_AREA_SAF South-Africa?
		"CN"  // CONF_AREA_CHN China, People's Republic of
	};

	// Start by detecting the country, since we can deduce some languages not
	// supported on the Wii from it.
	Common::String country;
	// TODO: Can we get more fine-grained country setting?
	int32 areaID = CONF_GetArea();
	if ((areaID >= CONF_AREA_JPN) && (areaID <= CONF_AREA_CHN)) {
		// It's a known area.
		if (areaID == CONF_AREA_BRA) {
			// Portuguese isn't available on the Wii, but we know it's the
			// official language in Brazil, so we handle it separately.
			return "pt_BR";
		} else {
			// Let's use our manual area to country mapping.
			country = wiiCountries[areaID];
		}
	} else {
		// This will only happen when new areas are added to the API.
		warning("WII: Unknown system area: %d", areaID);
	}


	const char *wiiLanguages[] = {
		"ja", // CONF_LANG_JAPANESE     Japanese
		"en", // CONF_LANG_ENGLISH      English
		"de", // CONF_LANG_GERMAN       German
		"fr", // CONF_LANG_FRENCH       French
		"es", // CONF_LANG_SPANISH      Spanish
		"it", // CONF_LANG_ITALIAN      Italian
		"nl", // CONF_LANG_DUTCH        Dutch
		"zh", // CONF_LANG_SIMP_CHINESE Simplified Chinese
		"zh", // CONF_LANG_TRAD_CHINESE Traditional Chinese
		"ko"  // CONF_LANG_KOREAN       Korean
	};

	// Now let's read the system language.
	Common::String lang;
	int32 langID = CONF_GetLanguage();
	if ((langID >= CONF_LANG_JAPANESE) && (langID <= CONF_LANG_KOREAN)) {
		// It's a known language, let's use our manual language mapping.
		lang = wiiLanguages[langID];

		if (country.empty()) {
			// We don't know how to improve the detection,
			// let's return the language alone.
			return lang;
		} else {
			// Return the complete language_country string.
			return lang + "_" + country;
		}
	} else {
		// This will only happen when new languages are added to the API.
		warning("WII: Unknown system language: %d", langID);
		return BaseBackend::getSystemLanguage();
	}
}
Exemple #13
0
/********************************************************************************
* TitleBrowser- opens a browser with a list of installed Titles
* relies on code from any title deleter.
*********************************************************************************/
int TitleBrowser(u32 type) {

	u32 num_titles;
	u32 titles[100] ATTRIBUTE_ALIGN(32);
	u32 num_sys_titles;
	u32 sys_titles[10] ATTRIBUTE_ALIGN(32);
	s32 ret = -1;
	int numtitle;//to get rid of a stupid compile wrning
	//open the database file
	FILE *f;
	char path[100];

	ISFS_Initialize();

	sprintf(path,"%s/config/database.txt",bootDevice);
	f = fopen(path, "r");

	// Get count of titles of our requested type
	ret = getTitles_TypeCount(type, &num_titles);
	if (ret < 0) {
		//printf("\tError! Can't get count of titles! (ret = %d)\n", ret);
		//exit(1);
	}

	// Get titles of our requested type
	ret = getTitles_Type(type, titles, num_titles);
	if (ret < 0) {
		//printf("\tError! Can't get list of titles! (ret = %d)\n", ret);
		//exit(1);
	}

	// Get count of system titles
	ret = getTitles_TypeCount(0x00010002, &num_sys_titles);
	if (ret < 0) {
		//printf("\tError! Can't get count of titles! (ret = %d)\n", ret);
		//exit(1);
	}

	// Get system titles
	ret = getTitles_Type(0x00010002, sys_titles, num_sys_titles);
	if (ret < 0) {
		//printf("\tError! Can't get list of titles! (ret = %d)\n", ret);
		//exit(1);
	}


	//this array will hold all the names for the titles so we only have to get them one time
	char name[num_titles+num_sys_titles][50];

	customOptionList options3(num_titles+num_sys_titles+1);
	//write the titles on the option browser
	u32 i = 0;



	//first add the good stuff
	while (i < num_titles) {
		//start from the beginning of the file each loop
		if (f)rewind(f);
		//char name[50];
		char text[15];
		strcpy(name[i],"");//make sure name is empty
		u8 found=0;
		//set the title's name, number, ID to text
		sprintf(text, "%s", titleText(type, titles[i]));

		//get name from database cause i dont like the ADT function
		char line[200];
		char tmp[50];
		snprintf(tmp,50," ");
		
		//check if the content.bin is on the SD card for that game
		//if there is content.bin,then the game is on the SDmenu and not the wii
		sprintf(line,"SD:/private/wii/title/%s/content.bin",text);
		if (!checkfile(line))
			{
				if (f) {
					while (fgets(line, sizeof(line), f)) {
						if (line[0]== text[0]&&
								line[1]== text[1]&&
								line[2]== text[2]) {
							int j=0;
							found=1;
							for (j=0;(line[j+4]!='\0' || j<51);j++)

								tmp[j]=line[j+4];
							snprintf(name[i],sizeof(name[i]),"%s",tmp);
							//break;
						}
					}
				}
				if (!found) {
					if (getName00(name[i], TITLE_ID(type, titles[i]),CONF_GetLanguage()*2)>=0)
						found=2;

					if (!found) {
						if (getNameBN(name[i], TITLE_ID(type, titles[i]))>=0)
							found=3;

						if (!found)
							snprintf(name[i],sizeof(name[i]),"Unknown Title (%08x)",titles[i]);
					}
				}

				//set the text to the option browser
				options3.SetName(i, "%s",text);
				options3.SetValue(i, "%s",name[i]);
				//options3.SetValue(i, " (%08x) %s",titles[i],name[i]);//use this line to show the number to call to launch the channel
				//move on to the next title
			}
        i++;
    }

    // now add the crappy system titles
    while (i < num_titles+num_sys_titles) {
        //start from the beginning of the file each loop
        if (f)rewind(f);
        //char name[50];
        char text[15];
        strcpy(name[i],"");//make sure name is empty
        u8 found=0;
        //set the title's name, number, ID to text
        sprintf(text, "%s", titleText(0x00010002, sys_titles[i-num_titles]));

        //get name from database cause i dont like the ADT function
        char line[200];
        char tmp[50];
        snprintf(tmp,50," ");
        //snprintf(name[i],sizeof(name[i]),"Unknown Title");
        if (f) {
            while (fgets(line, sizeof(line), f)) {
                if (line[0]== text[0]&&
                        line[1]== text[1]&&
                        line[2]== text[2]) {
                    int j=0;
                    found=1;
                    for (j=0;(line[j+4]!='\0' || j<51);j++)

                        tmp[j]=line[j+4];
                    snprintf(name[i],sizeof(name[i]),"%s",tmp);
                    break;
                }
            }
        }
        if (!found) {
            if (getName00(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
                found=2;

            if (!found) {
                if (getNameBN(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
                    found=3;

                if (!found)
                    snprintf(name[i],sizeof(name[i]),"Unknown Title (%08x)",sys_titles[i-num_titles]);
            }
        }

        //set the text to the option browser
        options3.SetName(i, "%s",text);
        options3.SetValue(i, "%s",name[i]);
        //options3.SetValue(i, " (%08x) %s",titles[i],name[i]);//use this line to show the number to call to launch the channel
        //move on to the next title
        i++;
    }
    if (i == num_titles+num_sys_titles) {
        options3.SetName(i, " ");
        options3.SetValue(i, "%s",tr("Wii Settings"));
    }
    //we have all the titles we need so close the database and stop poking around in the wii
    fclose(f);

    //get rid of our footprints in there
    Uninstall_FromTitle(TITLE_ID(1, 0));
    ISFS_Deinitialize();
    bool exit = false;

    if (IsNetworkInit())
        ResumeNetworkWait();

    GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
	// because destroy GuiSound must wait while sound playing is finished, we use a global sound
	if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
	//	GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);

    char imgPath[100];

    snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
    GuiImageData btnOutline(imgPath, button_dialogue_box_png);
    snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", CFG.theme_path);
    GuiImageData settingsbg(imgPath, settings_background_png);

    GuiTrigger trigA;
    trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
    GuiTrigger trigHome;
    trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
    GuiTrigger trigB;
    trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

    GuiText titleTxt(tr("Title Launcher"), 28, (GXColor) {0, 0, 0, 255});
    titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
    titleTxt.SetPosition(12,40);
    titleTxt.SetMaxWidth(356, GuiText::SCROLL);

    GuiImage settingsbackground(&settingsbg);
    GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
    settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
    settingsbackgroundbtn.SetPosition(0, 0);
    settingsbackgroundbtn.SetImage(&settingsbackground);

    GuiText cancelBtnTxt(tr("Back"), 22, THEME.prompttext);
    cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
    GuiImage cancelBtnImg(&btnOutline);
    if (Settings.wsprompt == yes) {
        cancelBtnTxt.SetWidescreen(CFG.widescreen);
        cancelBtnImg.SetWidescreen(CFG.widescreen);
    }
    GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, btnClick2,1);
    cancelBtn.SetScale(0.9);
    cancelBtn.SetLabel(&cancelBtnTxt);
    cancelBtn.SetTrigger(&trigB);

    u8 scrollbaron = 0;
    if (num_titles > 9)
        scrollbaron = 1;

    GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, num_titles+num_sys_titles>9?1:0, 200);
    optionBrowser3.SetPosition(0, 90);
    optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);

    snprintf(imgPath, sizeof(imgPath), "%sWifi_btn.png", CFG.theme_path);
    GuiImageData wifiImgData(imgPath, Wifi_btn_png);
    GuiImage wifiImg(&wifiImgData);
    if (Settings.wsprompt == yes) {
        wifiImg.SetWidescreen(CFG.widescreen);
    }
    GuiButton wifiBtn(wifiImg.GetWidth(), wifiImg.GetHeight());
    wifiBtn.SetImage(&wifiImg);
    wifiBtn.SetPosition(100, 400);
    wifiBtn.SetEffectGrow();
    wifiBtn.SetAlpha(80);
    wifiBtn.SetTrigger(&trigA);

    GuiTrigger trigZ;
    trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);

    GuiButton screenShotBtn(0,0);
    screenShotBtn.SetPosition(0,0);
    screenShotBtn.SetTrigger(&trigZ);

    HaltGui();
    GuiWindow w(screenwidth, screenheight);
    w.Append(&screenShotBtn);
    w.Append(&settingsbackgroundbtn);
    w.Append(&titleTxt);
    w.Append(&cancelBtn);
    w.Append(&wifiBtn);
    w.Append(&optionBrowser3);

    mainWindow->Append(&w);


    int tmp=num_titles+num_sys_titles;
    ResumeGui();
    numtitle=num_titles;
    while (!exit) {
        VIDEO_WaitVSync();

        if (shutdown == 1)
            Sys_Shutdown();
        if (reset == 1)
            Sys_Reboot();

        else if (wifiBtn.GetState() == STATE_CLICKED) {

                ResumeNetworkWait();
                wifiBtn.ResetState();
        }

        if (IsNetworkInit()) {
                wifiBtn.SetAlpha(255);
        }

        ret = optionBrowser3.GetClickedOption();

        if (ret > -1) {//if a click happened

            //char name[50];
            char text[15];
            if (f)rewind(f);
            //strcpy(name,"");//make sure name is empty

            if (ret<numtitle) {
                //set the title's name, number, ID to text
                sprintf(text, "%s", titleText(type, titles[ret]));

                char temp[100];
                //prompt to boot selected title
                snprintf(temp, sizeof(temp), "%s : %s",text,name[ret]);
                int  choice = WindowPrompt(tr("Boot?"), temp, tr("OK"), tr("Cancel"));
                if (choice) {//if they say yes


                    //stop all this stuff before starting the channel

                    CloseXMLDatabase();
                    ExitGUIThreads();
                    ShutdownAudio();
                    StopGX();
                    WII_Initialize();
                    WII_LaunchTitle(TITLE_ID(type,titles[ret]));
                    //this really shouldn't be needed because the title will be booted
                    exit = true;
                    break;
                } else {
                    //if they said no to booting the title
                    ret = -1;
                    optionBrowser3.ResetState();
                }

            } else { //if they clicked a system title
                if (ret == tmp) {
                    CloseXMLDatabase();
                    ExitGUIThreads();
                    ShutdownAudio();
                    StopGX();
                    WII_Initialize();
                    WII_ReturnToSettings();

                } else {
                    //set the title's name, number, ID to text
                    sprintf(text, "%s", titleText(0x00010002, sys_titles[ret-num_titles]));

                    char temp[112];
                    //prompt to boot selected title
					snprintf(temp, sizeof(temp), tr("%s : %s May not boot correctly if your System Menu is not up to date."),text,name[ret]);
                    int  choice = WindowPrompt(tr("Boot?"), temp, tr("OK"), tr("Cancel"));
                    if (choice) {//if they say yes


                        //stop all this stuff before starting the channel

                        CloseXMLDatabase();
                        ExitGUIThreads();
                        ShutdownAudio();
                        StopGX();
                        WII_Initialize();
                        WII_LaunchTitle(TITLE_ID(0x00010002,sys_titles[ret-num_titles]));
                        //this really shouldn't be needed because the title will be booted
                        exit = true;
                        break;
                    } else {
                        //if they said no to booting the title
                        ret = -1;
                        optionBrowser3.ResetState();
                    }
                }
            }
        }

        if(infilesize > 0) {

                char filesizetxt[50];
                char temp[50];
                char filepath[100];
//				u32 read = 0;
				
				//make sure there is a folder for this to be saved in
				struct stat st;
                snprintf(filepath, sizeof(filepath), "%s/wad/", bootDevice);
				if (stat(filepath, &st) != 0) {
						if (subfoldercreate(filepath) != 1) {
							WindowPrompt(tr("Error !"),tr("Can't create directory"),tr("OK"));
						}
					}
				snprintf(filepath, sizeof(filepath), "%s/wad/tmp.tmp", bootDevice);
				

                if (infilesize < MB_SIZE)
                    snprintf(filesizetxt, sizeof(filesizetxt), tr("Incoming file %0.2fKB"), infilesize/KB_SIZE);
                else
                    snprintf(filesizetxt, sizeof(filesizetxt), tr("Incoming file %0.2fMB"), infilesize/MB_SIZE);

                snprintf(temp, sizeof(temp), tr("Load file from: %s ?"), GetIncommingIP());

                int choice = WindowPrompt(filesizetxt, temp, tr("OK"), tr("Cancel"));
		gprintf("\nchoice:%d",choice);

		if (choice == 1) {

			u32 read = 0;
			u8 *temp = NULL;
			int len = NETWORKBLOCKSIZE;
			temp = (u8 *) malloc(infilesize);

						bool error = false;
						u8 *ptr = temp;
						gprintf("\nrecieving shit");
			while (read < infilesize) {

			    ShowProgress(tr("Receiving file from:"), GetIncommingIP(), NULL, read, infilesize, true);

			    if (infilesize - read < (u32) len)
				len = infilesize-read;
			    else
				len = NETWORKBLOCKSIZE;

			    int result = network_read(ptr, len);

			    if (result < 0) {
				WindowPrompt(tr("Error while transfering data."), 0, tr("OK"));
				error = true;
				break;
			    }
			    if (!result) {
				gprintf("\n!RESULT");
				break;
							}
			    ptr += result;
			    read += result;
			}
			ProgressStop();

						char filename[101];
						char tmptxt[200];



						//bool installWad=0;
						if (!error) {
						    gprintf("\nno error yet");

							network_read((u8*) &filename, 100);
							gprintf("\nfilename: %s",filename);

							// Do we need to unzip this thing?
							if (wiiloadVersion[0] > 0 || wiiloadVersion[1] > 4) {
							    gprintf("\nusing newer wiiload version");

								if (uncfilesize != 0) { // if uncfilesize == 0, it's not compressed
								    gprintf("\ntrying to uncompress");
									// It's compressed, uncompress
									u8 *unc = (u8 *) malloc(uncfilesize);
									uLongf f = uncfilesize;
									error = uncompress(unc, &f, temp, infilesize) != Z_OK;
									uncfilesize = f;

									free(temp);
									temp = unc;
								}
							}

							if (!error) {
								sprintf(tmptxt,"%s",filename);
								//if we got a wad
								if (strcasestr(tmptxt,".wad")) {
								    FILE *file = fopen(filepath, "wb");
								    fwrite(temp, 1, (uncfilesize>0?uncfilesize:infilesize), file);
								    fclose(file);

								    sprintf(tmptxt,"%s/wad/%s",bootDevice,filename);
								    if (checkfile(tmptxt))remove(tmptxt);
								    rename(filepath, tmptxt);

								    //check and make sure the wad we just saved is the correct size
								    u32 lSize;
								    file = fopen(tmptxt, "rb");

								    // obtain file size:
								    fseek (file , 0 , SEEK_END);
								    lSize = ftell (file);

								    rewind (file);
								    if (lSize==(uncfilesize>0?uncfilesize:infilesize)) {
									gprintf("\nsize is ok");
									int pick = WindowPrompt(tr(" Wad Saved as:"), tmptxt, tr("Install"),tr("Uninstall"),tr("Cancel"));
									//install or uninstall it
									if (pick==1)
										{
											HaltGui();
											w.Remove(&titleTxt);
											w.Remove(&cancelBtn);
											w.Remove(&wifiBtn);
											w.Remove(&optionBrowser3);
											ResumeGui();

											Wad_Install(file);

											HaltGui();
											w.Append(&titleTxt);
											w.Append(&cancelBtn);
											w.Append(&wifiBtn);
											w.Append(&optionBrowser3);
											ResumeGui();

										}
									if (pick==2)Wad_Uninstall(file);
								    }
								    else gprintf("\nBad size");
								    //close that beast, we're done with it
								    fclose (file);

								    //do we want to keep the file in the wad folder
								    if (WindowPrompt(tr("Delete ?"), tmptxt, tr("Delete"),tr("Keep"))!=0)
									remove(tmptxt);
								    }
								else {
								    WindowPrompt(tr("ERROR:"), tr("Not a WAD file."), tr("OK"));
								    }
							}
						}



			if (error || read != infilesize) {
			    WindowPrompt(tr("Error:"), tr("No data could be read."), tr("OK"));


			}
			if(temp)free(temp);
		}



		CloseConnection();
                ResumeNetworkWait();
        }

        if (cancelBtn.GetState() == STATE_CLICKED) {
            //break the loop and end the function
            exit = true;
            ret = -10;
        }
	else if (screenShotBtn.GetState() == STATE_CLICKED) {
			gprintf("\n\tscreenShotBtn clicked");
			screenShotBtn.ResetState();
			ScreenShot();
			gprintf("...It's easy, mmmmmmKay");
		    }
    }

    CloseConnection();
    if (IsNetworkInit())
        HaltNetworkThread();

    fclose(f);
    HaltGui();
    mainWindow->Remove(&w);
    ResumeGui();

    return ret;
}