more changes for multilanguage support

This commit is contained in:
dborth 2010-01-25 21:05:38 +00:00
parent 96763c6e19
commit 85641d69b1
6 changed files with 172 additions and 180 deletions

View File

@ -27,7 +27,6 @@
#include "snes9xGX.h"
#include "button_mapping.h"
#include "s9xconfig.h"
#include "menu.h"
#include "video.h"
#include "input.h"

View File

@ -30,11 +30,11 @@
#include "gcunzip.h"
#include "networkop.h"
#include "fileop.h"
#include "s9xconfig.h"
#include "sram.h"
#include "freeze.h"
#include "preferences.h"
#include "button_mapping.h"
#include "gettext.h"
#include "input.h"
#include "filter.h"
#include "filelist.h"
@ -109,6 +109,14 @@ HaltGui()
usleep(THREAD_SLEEP);
}
void ResetText()
{
LoadLanguage();
if(mainWindow)
mainWindow->ResetText();
}
/****************************************************************************
* WindowPrompt
*
@ -3489,6 +3497,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++)
@ -3565,6 +3574,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)
@ -3614,6 +3628,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();
}
@ -3626,6 +3654,7 @@ static int MenuSettingsMenu()
mainWindow->Remove(&optionBrowser);
mainWindow->Remove(&w);
mainWindow->Remove(&titleTxt);
ResetText();
return menu;
}

View File

@ -16,13 +16,14 @@
#include <mxml.h>
#include "snes9xGX.h"
#include "s9xconfig.h"
#include "menu.h"
#include "fileop.h"
#include "filebrowser.h"
#include "input.h"
#include "button_mapping.h"
struct SGCSettings GCSettings;
/****************************************************************************
* Prepare Preferences Data
*
@ -150,6 +151,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");
@ -322,6 +324,7 @@ decodePrefsData ()
loadXMLSetting(&GCSettings.MusicVolume, "MusicVolume");
loadXMLSetting(&GCSettings.SFXVolume, "SFXVolume");
loadXMLSetting(&GCSettings.Rumble, "Rumble");
loadXMLSetting(&GCSettings.language, "language");
// Controller Settings
@ -343,6 +346,142 @@ decodePrefsData ()
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.zoomHor > 0.5 && GCSettings.zoomHor < 1.5))
GCSettings.zoomHor = 1.0;
if(!(GCSettings.zoomVert > 0.5 && GCSettings.zoomVert < 1.5))
GCSettings.zoomVert = 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.Controller > CTRL_PAD4 || GCSettings.Controller < CTRL_MOUSE)
GCSettings.Controller = CTRL_PAD2;
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
GCSettings.render = 2;
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.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.WiimoteOrientation = 0;
GCSettings.ExitAction = 0;
GCSettings.MusicVolume = 40;
GCSettings.SFXVolume = 40;
GCSettings.Rumble = 1;
GCSettings.language = CONF_GetLanguage();
/****************** SNES9x Settings ***********************/
// Default ALL to false
memset (&Settings, 0, sizeof (Settings));
// General
Settings.MouseMaster = false;
Settings.SuperScopeMaster = false;
Settings.MultiPlayer5Master = false;
Settings.JustifierMaster = false;
Settings.ShutdownMaster = true; // needs to be on for ActRaiser 2
Settings.ApplyCheats = true;
Settings.BlockInvalidVRAMAccess = false;
Settings.HDMATimingHack = 100;
// Sound defaults. On GC this is 32Khz/16bit/Stereo/InterpolatedSound
Settings.APUEnabled = true;
Settings.NextAPUEnabled = true;
Settings.SoundPlaybackRate = 32000;
Settings.Stereo = true;
Settings.SixteenBitSound = true;
Settings.SoundEnvelopeHeightReading = true;
Settings.SoundSync = true;
Settings.FixFrequency = false;
Settings.DisableSampleCaching = true;
Settings.InterpolatedSound = true;
Settings.ReverseStereo = true;
// 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;
// SDD1 - Star Ocean Returns
Settings.SDD1Pack = true;
Settings.ForceNTSC = 0;
Settings.ForcePAL = 0;
Settings.ForceHiROM = 0;
Settings.ForceLoROM = 0;
Settings.ForceHeader = 0;
Settings.ForceNoHeader = 0;
Settings.ForceTransparency = 0;
Settings.ForceInterleaved = 0;
Settings.ForceInterleaved2 = 0;
Settings.ForceInterleaveGD24 = 0;
Settings.ForceNotInterleaved = 0;
Settings.ForceNoSuperFX = 0;
Settings.ForceSuperFX = 0;
Settings.ForceDSP1 = 0;
Settings.ForceNoDSP1 = 0;
}
/****************************************************************************
* Save Preferences
***************************************************************************/

View File

@ -8,5 +8,7 @@
* Preferences save/load to XML file
***************************************************************************/
void FixInvalidSettings();
void DefaultSettings();
bool SavePrefs (bool silent);
bool LoadPrefs ();

View File

@ -1,155 +0,0 @@
/****************************************************************************
* Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* softdev July 2006
* crunchy2 May 2007
* Michniewski 2008
* Tantric 2008-2009
*
* s9xconfig.cpp
*
* Configuration parameters are here for easy maintenance.
* Refer to Snes9x.h for all combinations.
* The defaults used here are taken directly from porting.html
***************************************************************************/
#include <gccore.h>
#include "snes9x.h"
#include "snes9xGX.h"
#include "input.h"
#include "filter.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.zoomHor > 0.5 && GCSettings.zoomHor < 1.5))
GCSettings.zoomHor = 1.0;
if(!(GCSettings.zoomVert > 0.5 && GCSettings.zoomVert < 1.5))
GCSettings.zoomVert = 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.Controller > CTRL_PAD4 || GCSettings.Controller < CTRL_MOUSE)
GCSettings.Controller = CTRL_PAD2;
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
GCSettings.render = 2;
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.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.WiimoteOrientation = 0;
GCSettings.ExitAction = 0;
GCSettings.MusicVolume = 40;
GCSettings.SFXVolume = 40;
GCSettings.Rumble = 1;
/****************** SNES9x Settings ***********************/
// Default ALL to false
memset (&Settings, 0, sizeof (Settings));
// General
Settings.MouseMaster = false;
Settings.SuperScopeMaster = false;
Settings.MultiPlayer5Master = false;
Settings.JustifierMaster = false;
Settings.ShutdownMaster = true; // needs to be on for ActRaiser 2
Settings.ApplyCheats = true;
Settings.BlockInvalidVRAMAccess = false;
Settings.HDMATimingHack = 100;
// Sound defaults. On GC this is 32Khz/16bit/Stereo/InterpolatedSound
Settings.APUEnabled = true;
Settings.NextAPUEnabled = true;
Settings.SoundPlaybackRate = 32000;
Settings.Stereo = true;
Settings.SixteenBitSound = true;
Settings.SoundEnvelopeHeightReading = true;
Settings.SoundSync = true;
Settings.FixFrequency = false;
Settings.DisableSampleCaching = true;
Settings.InterpolatedSound = true;
Settings.ReverseStereo = true;
// 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;
// SDD1 - Star Ocean Returns
Settings.SDD1Pack = true;
Settings.ForceNTSC = 0;
Settings.ForcePAL = 0;
Settings.ForceHiROM = 0;
Settings.ForceLoROM = 0;
Settings.ForceHeader = 0;
Settings.ForceNoHeader = 0;
Settings.ForceTransparency = 0;
Settings.ForceInterleaved = 0;
Settings.ForceInterleaved2 = 0;
Settings.ForceInterleaveGD24 = 0;
Settings.ForceNotInterleaved = 0;
Settings.ForceNoSuperFX = 0;
Settings.ForceSuperFX = 0;
Settings.ForceDSP1 = 0;
Settings.ForceNoDSP1 = 0;
}

View File

@ -1,22 +0,0 @@
/****************************************************************************
* Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* softdev July 2006
* crunchy2 May 2007
* Michniewski 2008
* Tantric 2008-2009
*
* s9xconfig.h
*
* Configuration parameters are here for easy maintenance.
* Refer to Snes9x.h for all combinations.
* The defaults used here are taken directly from porting.html
***************************************************************************/
#ifndef _S9XCONFIG_
#define _S9XCONFIG_
void FixInvalidSettings();
void DefaultSettings();
#endif