mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-05 21:38:17 +01:00
more changes for multilanguage support
This commit is contained in:
parent
5102f60d81
commit
c0c74ce8a5
@ -1,100 +0,0 @@
|
||||
/****************************************************************************
|
||||
* FCE Ultra
|
||||
* Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* Tantric 2008-2009
|
||||
*
|
||||
* fceuconfig.cpp
|
||||
*
|
||||
* Configuration parameters
|
||||
****************************************************************************/
|
||||
|
||||
#include <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fceusupport.h"
|
||||
#include "fceugx.h"
|
||||
#include "videofilter.h"
|
||||
#include "pad.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_ZAPPER)
|
||||
GCSettings.Controller = CTRL_PAD2;
|
||||
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
|
||||
GCSettings.render = 2;
|
||||
if(GCSettings.timing != 0 && GCSettings.timing != 1)
|
||||
GCSettings.timing = 0;
|
||||
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.currpal = 1; // color palette
|
||||
GCSettings.timing = 0; // 0 - NTSC, 1 - PAL
|
||||
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.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.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
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/****************************************************************************
|
||||
* FCE Ultra
|
||||
* Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* Tantric 2008-2009
|
||||
*
|
||||
* fceuconfig.h
|
||||
*
|
||||
* Configuration parameters
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _FCEUCONFIG_H_
|
||||
#define _FCEUCONFIG_H_
|
||||
|
||||
void FixInvalidSettings();
|
||||
void DefaultSettings();
|
||||
|
||||
#endif
|
@ -21,7 +21,6 @@
|
||||
#include <sys/iosupport.h>
|
||||
|
||||
#include "fceugx.h"
|
||||
#include "fceuconfig.h"
|
||||
#include "fceuload.h"
|
||||
#include "fceustate.h"
|
||||
#include "fceuram.h"
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include "fceusupport.h"
|
||||
#include "fceugx.h"
|
||||
#include "fceuconfig.h"
|
||||
#include "videofilter.h"
|
||||
#include "pad.h"
|
||||
#include "gcvideo.h"
|
||||
@ -35,6 +34,7 @@
|
||||
#include "fceustate.h"
|
||||
#include "preferences.h"
|
||||
#include "button_mapping.h"
|
||||
#include "gettext.h"
|
||||
#include "filelist.h"
|
||||
#include "gui/gui.h"
|
||||
#include "menu.h"
|
||||
@ -116,6 +116,14 @@ HaltGui()
|
||||
usleep(THREAD_SLEEP);
|
||||
}
|
||||
|
||||
void ResetText()
|
||||
{
|
||||
LoadLanguage();
|
||||
|
||||
if(mainWindow)
|
||||
mainWindow->ResetText();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* WindowPrompt
|
||||
*
|
||||
@ -3530,6 +3538,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++)
|
||||
@ -3606,6 +3615,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)
|
||||
@ -3655,6 +3669,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();
|
||||
}
|
||||
|
||||
@ -3667,6 +3695,7 @@ static int MenuSettingsMenu()
|
||||
mainWindow->Remove(&optionBrowser);
|
||||
mainWindow->Remove(&w);
|
||||
mainWindow->Remove(&titleTxt);
|
||||
ResetText();
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
@ -16,14 +16,16 @@
|
||||
#include <ogcsys.h>
|
||||
#include <mxml.h>
|
||||
|
||||
#include "fceuconfig.h"
|
||||
#include "button_mapping.h"
|
||||
#include "filebrowser.h"
|
||||
#include "menu.h"
|
||||
#include "fileop.h"
|
||||
#include "fceugx.h"
|
||||
#include "videofilter.h"
|
||||
#include "pad.h"
|
||||
|
||||
struct SGCSettings GCSettings;
|
||||
|
||||
/****************************************************************************
|
||||
* Prepare Preferences Data
|
||||
*
|
||||
@ -156,6 +158,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");
|
||||
|
||||
@ -328,6 +331,7 @@ decodePrefsData ()
|
||||
loadXMLSetting(&GCSettings.MusicVolume, "MusicVolume");
|
||||
loadXMLSetting(&GCSettings.SFXVolume, "SFXVolume");
|
||||
loadXMLSetting(&GCSettings.Rumble, "Rumble");
|
||||
loadXMLSetting(&GCSettings.language, "language");
|
||||
|
||||
// Controller Settings
|
||||
|
||||
@ -346,6 +350,87 @@ 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_ZAPPER)
|
||||
GCSettings.Controller = CTRL_PAD2;
|
||||
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
|
||||
GCSettings.render = 2;
|
||||
if(GCSettings.timing != 0 && GCSettings.timing != 1)
|
||||
GCSettings.timing = 0;
|
||||
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.currpal = 1; // color palette
|
||||
GCSettings.timing = 0; // 0 - NTSC, 1 - PAL
|
||||
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.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();
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Save Preferences
|
||||
***************************************************************************/
|
||||
|
@ -9,5 +9,7 @@
|
||||
* Preferences save/load preferences utilities
|
||||
****************************************************************************/
|
||||
|
||||
void FixInvalidSettings();
|
||||
void DefaultSettings();
|
||||
bool SavePrefs (bool silent);
|
||||
bool LoadPrefs ();
|
||||
|
Loading…
Reference in New Issue
Block a user