more changes for multilanguage support

This commit is contained in:
dborth 2010-01-25 21:06:27 +00:00
parent bbd50f86a3
commit f4b7bd3907
6 changed files with 114 additions and 114 deletions

View File

@ -27,9 +27,9 @@
#include "gcunzip.h"
#include "networkop.h"
#include "fileop.h"
#include "vbaconfig.h"
#include "preferences.h"
#include "button_mapping.h"
#include "gettext.h"
#include "input.h"
#include "filelist.h"
#include "gui/gui.h"
@ -102,6 +102,14 @@ HaltGui()
usleep(THREAD_SLEEP);
}
void ResetText()
{
LoadLanguage();
if(mainWindow)
mainWindow->ResetText();
}
/****************************************************************************
* WindowPrompt
*
@ -3290,6 +3298,7 @@ static int MenuSettingsMenu()
sprintf(options.name[i++], "Music Volume");
sprintf(options.name[i++], "Sound Effects Volume");
sprintf(options.name[i++], "Rumble");
sprintf(options.name[i++], "Language");
options.length = i;
for(i=0; i < options.length; i++)
@ -3366,6 +3375,11 @@ static int MenuSettingsMenu()
case 4:
GCSettings.Rumble ^= 1;
break;
case 5:
GCSettings.language++;
if(GCSettings.language > LANG_KOREAN)
GCSettings.language = 0;
break;
}
if(ret >= 0 || firstRun)
@ -3415,6 +3429,20 @@ static int MenuSettingsMenu()
else
sprintf (options.value[4], "Disabled");
switch(GCSettings.language)
{
case LANG_JAPANESE: sprintf(options.value[5], "Japanese"); break;
case LANG_ENGLISH: sprintf(options.value[5], "English"); break;
case LANG_GERMAN: sprintf(options.value[5], "German"); break;
case LANG_FRENCH: sprintf(options.value[5], "French"); break;
case LANG_SPANISH: sprintf(options.value[5], "Spanish"); break;
case LANG_ITALIAN: sprintf(options.value[5], "Italian"); break;
case LANG_DUTCH: sprintf(options.value[5], "Dutch"); break;
case LANG_SIMP_CHINESE: sprintf(options.value[5], "Chinese (Simplified)"); break;
case LANG_TRAD_CHINESE: sprintf(options.value[5], "Chinese (Traditional)"); break;
case LANG_KOREAN: sprintf(options.value[5], "Korean"); break;
}
optionBrowser.TriggerUpdate();
}
@ -3427,6 +3455,7 @@ static int MenuSettingsMenu()
mainWindow->Remove(&optionBrowser);
mainWindow->Remove(&w);
mainWindow->Remove(&titleTxt);
ResetText();
return menu;
}

View File

@ -16,7 +16,6 @@
#include <mxml.h>
#include "vba.h"
#include "vbaconfig.h"
#include "menu.h"
#include "fileop.h"
#include "filebrowser.h"
@ -24,6 +23,7 @@
#include "button_mapping.h"
#include "gamesettings.h"
struct SGCSettings GCSettings;
static gamePalette *palettes = NULL;
static int loadedPalettes = 0;
@ -196,6 +196,7 @@ preparePrefsData ()
createXMLSetting("MusicVolume", "Music Volume", toStr(GCSettings.MusicVolume));
createXMLSetting("SFXVolume", "Sound Effects Volume", toStr(GCSettings.SFXVolume));
createXMLSetting("Rumble", "Rumble", toStr(GCSettings.Rumble));
createXMLSetting("language", "Language", toStr(GCSettings.language));
createXMLSection("Controller", "Controller Settings");
@ -495,6 +496,7 @@ decodePrefsData ()
loadXMLSetting(&GCSettings.MusicVolume, "MusicVolume");
loadXMLSetting(&GCSettings.SFXVolume, "SFXVolume");
loadXMLSetting(&GCSettings.Rumble, "Rumble");
loadXMLSetting(&GCSettings.language, "language");
// Controller Settings
@ -548,6 +550,85 @@ decodePalsData ()
return result;
}
/****************************************************************************
* FixInvalidSettings
*
* Attempts to correct at least some invalid settings - the ones that
* might cause crashes
***************************************************************************/
void FixInvalidSettings()
{
if(GCSettings.LoadMethod > 4)
GCSettings.LoadMethod = DEVICE_AUTO;
if(GCSettings.SaveMethod > 4)
GCSettings.SaveMethod = DEVICE_AUTO;
if(!(GCSettings.gbaZoomHor > 0.5 && GCSettings.gbaZoomHor < 1.5))
GCSettings.gbaZoomHor = 1.0;
if(!(GCSettings.gbaZoomVert > 0.5 && GCSettings.gbaZoomVert < 1.5))
GCSettings.gbaZoomVert = 1.0;
if(!(GCSettings.gbZoomHor > 0.5 && GCSettings.gbZoomHor < 1.5))
GCSettings.gbZoomHor = 1.0;
if(!(GCSettings.gbZoomVert > 0.5 && GCSettings.gbZoomVert < 1.5))
GCSettings.gbZoomVert = 1.0;
if(!(GCSettings.xshift > -50 && GCSettings.xshift < 50))
GCSettings.xshift = 0;
if(!(GCSettings.yshift > -50 && GCSettings.yshift < 50))
GCSettings.yshift = 0;
if(!(GCSettings.MusicVolume >= 0 && GCSettings.MusicVolume <= 100))
GCSettings.MusicVolume = 40;
if(!(GCSettings.SFXVolume >= 0 && GCSettings.SFXVolume <= 100))
GCSettings.SFXVolume = 40;
if(GCSettings.language < 0 || GCSettings.language > LANG_KOREAN)
GCSettings.language = LANG_ENGLISH;
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
GCSettings.render = 1;
if(!(GCSettings.videomode >= 0 && GCSettings.videomode < 5))
GCSettings.videomode = 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
GCSettings.AutoLoad = 1;
GCSettings.AutoSave = 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.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.WiimoteOrientation = 0;
GCSettings.ExitAction = 0;
GCSettings.MusicVolume = 40;
GCSettings.SFXVolume = 40;
GCSettings.Rumble = 1;
GCSettings.language = CONF_GetLanguage();
}
/****************************************************************************
* Save Preferences
***************************************************************************/

View File

@ -10,8 +10,9 @@
bool SavePrefs (bool silent);
bool LoadPrefs ();
void FixInvalidSettings();
void DefaultSettings ();
bool SavePalettes (bool silent);
bool LoadPalettes();
void SetPalette(const char *gameName);
bool SavePaletteAs(bool silent, const char *name);

View File

@ -35,7 +35,6 @@
#include "menu.h"
#include "input.h"
#include "video.h"
#include "vbaconfig.h"
#include "gamesettings.h"
#include "wiiusbsupport.h"

View File

@ -1,92 +0,0 @@
/****************************************************************************
* Visual Boy Advance GX
*
* Tantric September 2008
*
* vbaconfig.cpp
*
* Configuration parameters are here for easy maintenance
***************************************************************************/
#include <gccore.h>
#include <string.h>
#include <stdio.h>
#include "vba.h"
#include "input.h"
struct SGCSettings GCSettings;
/****************************************************************************
* FixInvalidSettings
*
* Attempts to correct at least some invalid settings - the ones that
* might cause crashes
***************************************************************************/
void FixInvalidSettings()
{
if(GCSettings.LoadMethod > 4)
GCSettings.LoadMethod = DEVICE_AUTO;
if(GCSettings.SaveMethod > 4)
GCSettings.SaveMethod = DEVICE_AUTO;
if(!(GCSettings.gbaZoomHor > 0.5 && GCSettings.gbaZoomHor < 1.5))
GCSettings.gbaZoomHor = 1.0;
if(!(GCSettings.gbaZoomVert > 0.5 && GCSettings.gbaZoomVert < 1.5))
GCSettings.gbaZoomVert = 1.0;
if(!(GCSettings.gbZoomHor > 0.5 && GCSettings.gbZoomHor < 1.5))
GCSettings.gbZoomHor = 1.0;
if(!(GCSettings.gbZoomVert > 0.5 && GCSettings.gbZoomVert < 1.5))
GCSettings.gbZoomVert = 1.0;
if(!(GCSettings.xshift > -50 && GCSettings.xshift < 50))
GCSettings.xshift = 0;
if(!(GCSettings.yshift > -50 && GCSettings.yshift < 50))
GCSettings.yshift = 0;
if(!(GCSettings.MusicVolume >= 0 && GCSettings.MusicVolume <= 100))
GCSettings.MusicVolume = 40;
if(!(GCSettings.SFXVolume >= 0 && GCSettings.SFXVolume <= 100))
GCSettings.SFXVolume = 40;
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
GCSettings.render = 1;
if(!(GCSettings.videomode >= 0 && GCSettings.videomode < 5))
GCSettings.videomode = 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
GCSettings.AutoLoad = 1;
GCSettings.AutoSave = 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.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.WiimoteOrientation = 0;
GCSettings.ExitAction = 0;
GCSettings.MusicVolume = 40;
GCSettings.SFXVolume = 40;
GCSettings.Rumble = 1;
}

View File

@ -1,18 +0,0 @@
/****************************************************************************
* Visual Boy Advance GX
*
* Tantric September 2008
*
* vbaconfig.h
*
* Configuration parameters are here for easy maintenance
***************************************************************************/
#ifndef _VBACONFIG_
#define _VBACONFIG_
void FixInvalidSettings();
void DefaultSettings ();
#endif