diff --git a/gui.pnproj b/gui.pnproj index 7d63842a..ae76145e 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/cfg.c b/source/cfg.c index 830d6859..3833fba5 100644 --- a/source/cfg.c +++ b/source/cfg.c @@ -7,7 +7,15 @@ #include #include "cfg.h" #include "language.h" +/*<<<<<<< .mine +//#include "language.c" +extern void language_set(); +extern void lang_default(); +extern void language_set(); +extern char* strcopy(); +======= +>>>>>>> .r348*/ struct SSettings Settings; //struct SSettings2 Settings2; @@ -43,6 +51,7 @@ u8 parentalcontrolChoice = 0; u8 xflip = 0; u8 qboot = 0; u8 wsprompt = 0; +u8 keyset = 0; #define TITLE_MAX 65 @@ -724,6 +733,14 @@ void global_cfg_set(char *name, char *val) } return; } + + else if (strcmp(name, "keyset") == 0) { + int i; + if (sscanf(val, "%d", &i) == 1) { + Settings.keyset = i; + } + return; + } else if (strcmp(name, "hddinfo") == 0) { int i; if (sscanf(val, "%d", &i) == 1) { @@ -963,6 +980,7 @@ bool cfg_save_global()// save global settings fprintf(f, "tooltips = %d\n ", Settings.tooltips); fprintf(f, "password = %s\n ", Settings.unlockCode); fprintf(f, "cios = %d\n ", Settings.cios); + fprintf(f, "keyset = %d\n ", Settings.keyset); fprintf(f, "xflip = %d\n ", Settings.xflip); fprintf(f, "qboot = %d\n ", Settings.qboot); fprintf(f, "wsprompt = %d\n", Settings.wsprompt); @@ -1095,6 +1113,7 @@ bool cfg_load_global() Settings.xflip = off; Settings.qboot = off; Settings.wsprompt = off; + Settings.keyset = us; Settings.hddinfo = HDDInfo; Settings.sinfo = ((THEME.showID) ? GameID : Neither); Settings.rumble = RumbleOn; @@ -1178,7 +1197,46 @@ void CFG_Load() // cfg_parsearg(argc, argv); } +/* +<<<<<<< .mine + //set app path +// chdir_app(argv[0]); + CFG_Default(-1); // set defaults non forced + + snprintf(pathname, sizeof(pathname), "SD:/config/global_settings.cfg"); + + cfg_parsefile(pathname, &widescreen_set); //first set widescreen + cfg_parsefile(pathname, &cfg_set); //then set config and layout options + + snprintf(pathname, sizeof(pathname), "%stheme.txt", CFG.theme_path); + cfg_parsefile(pathname, &theme_set); //finally set console information + + snprintf(pathname, sizeof(pathname), "%slanguage.txt",CFG.language_path); + cfg_parsefile(pathname, &language_set); + + +// if (!ret) +// { +// cfg_parsefile("SD:/config.txt", &widescreen_set); +// cfg_parsefile("SD:/config.txt", &cfg_set); +// cfg_parsefile("SD:/config.txt", &console_set); +// } + + snprintf(pathname, sizeof(pathname), "SD:/config/titles.txt"); + cfg_parsetitlefile(pathname, &title_set); + + // load per-game settings + cfg_load_games(); + lang_default(); + language_set(); + + +// cfg_parsearg(argc, argv); +} + +======= +>>>>>>> .r348*/ void CFG_LoadGlobal(void) { cfg_parsefile("SD:/config/global_settings.cfg", &global_cfg_set); diff --git a/source/cfg.h b/source/cfg.h index ef2384e0..c6445ca5 100644 --- a/source/cfg.h +++ b/source/cfg.h @@ -69,6 +69,7 @@ struct CFG char theme_path[100]; char disc_path[100]; char language_path[100]; + short keyset; }; @@ -145,6 +146,7 @@ extern u8 parentalcontrolChoice; extern u8 xflip; extern u8 qboot; extern u8 wsprompt; +extern u8 keyset; struct Game_CFG { @@ -247,6 +249,11 @@ enum { sysmenu, wtf, }; +enum { + us, + dvorak, + euro, +}; /* enum { ParentalControlOff, @@ -272,6 +279,7 @@ struct SSettings { int cios; int qboot; int wsprompt; + int keyset; }; void CFG_LoadGlobal(void); diff --git a/source/language.c b/source/language.c index 1dab16dc..62140946 100644 --- a/source/language.c +++ b/source/language.c @@ -82,6 +82,7 @@ snprintf(LANGUAGE.FlipX, sizeof(LANGUAGE.FlipX), "Flip-X"); snprintf(LANGUAGE.Force, sizeof(LANGUAGE.Force), "Force"); snprintf(LANGUAGE.Youneedtoformatapartition, sizeof(LANGUAGE.Youneedtoformatapartition), "You need to format a partition"); snprintf(LANGUAGE.Format, sizeof(LANGUAGE.Format), "Format"); +snprintf(LANGUAGE.keyboard, sizeof(LANGUAGE.keyboard), "Keyboard"); snprintf(LANGUAGE.Formattingpleasewait, sizeof(LANGUAGE.Formattingpleasewait), "Formatting, please wait..."); snprintf(LANGUAGE.formated, sizeof(LANGUAGE.formated), "formatted!"); snprintf(LANGUAGE.free, sizeof(LANGUAGE.free), "free"); diff --git a/source/language.h b/source/language.h index 58ef5e0e..74a19d13 100644 --- a/source/language.h +++ b/source/language.h @@ -89,6 +89,7 @@ struct LANGUAGE char GoBack[30]; char GotoPage[30];/////// char HowtoShutdown[30]; + char keyboard[15]; char Language[20]; char Langchange[20]; char Left[30]; diff --git a/source/libwiigui/gui.h b/source/libwiigui/gui.h index 7e1ec2f0..9355512e 100644 --- a/source/libwiigui/gui.h +++ b/source/libwiigui/gui.h @@ -782,14 +782,14 @@ class GuiButton : public GuiElement }; typedef struct _keytype { - char ch, chShift; + char ch, chShift, chalt, chalt2; } Key; //!On-screen keyboard class GuiKeyboard : public GuiWindow { public: - GuiKeyboard(char * t, u32 m, int min); + GuiKeyboard(char * t, u32 m, int min, int lang); ~GuiKeyboard(); void Update(GuiTrigger * t); char kbtextstr[256]; @@ -798,12 +798,22 @@ class GuiKeyboard : public GuiWindow Key keys[4][11]; int shift; int caps; + int alt; + int alt2; GuiText * kbText; GuiImage * keyTextboxImg; GuiText * keyCapsText; GuiImage * keyCapsImg; GuiImage * keyCapsOverImg; GuiButton * keyCaps; + GuiText * keyAltText; + GuiImage * keyAltImg; + GuiImage * keyAltOverImg; + GuiButton * keyAlt; + GuiText * keyAlt2Text; + GuiImage * keyAlt2Img; + GuiImage * keyAlt2OverImg; + GuiButton * keyAlt2; GuiText * keyShiftText; GuiImage * keyShiftImg; GuiImage * keyShiftOverImg; diff --git a/source/libwiigui/gui_keyboard.cpp b/source/libwiigui/gui_keyboard.cpp index c57e111a..237eea29 100644 --- a/source/libwiigui/gui_keyboard.cpp +++ b/source/libwiigui/gui_keyboard.cpp @@ -16,13 +16,17 @@ */ extern const int vol; unsigned int m; -GuiKeyboard::GuiKeyboard(char * t, u32 max, int min) +//const Key thekeys; +GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang) { width = 540; height = 400; shift = 0; caps = 0; + alt = 0; + alt2 = 0; m = min; + int mode = lang; selectable = true; focus = 0; // allow focus alignmentHor = ALIGN_CENTRE; @@ -31,6 +35,8 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min) kbtextstr[max] = 0; kbtextmaxlen = max; + //QWERTY// + if (mode == 0){ Key thekeys[4][11] = { { {'1','!'}, @@ -86,7 +92,123 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min) {'\0','\0'} } }; - memcpy(keys, thekeys, sizeof(thekeys)); + + memcpy(keys, thekeys, sizeof(thekeys));} + //DVORAK// + if (mode == 1){ + Key thekeys[4][11] = { + { + {'1','!','\0'}, + {'2','@','\0'}, + {'3','#','\0'}, + {'4','$','\0'}, + {'5','%','\0'}, + {'6','^','\0'}, + {'7','&','\0'}, + {'8','*','\0'}, + {'9','(','\0'}, + {'0',')','\0'}, + {'\0','\0','\0'} + }, + { + {'\'','"','\0'}, + {',','<','\0'}, + {'.','>','\0'}, + {'p','P','\0'}, + {'y','Y','\0'}, + {'f','F','\0'}, + {'g','G','\0'}, + {'c','C','\0'}, + {'r','R','\0'}, + {'l','L','\0'}, + {'/','?','\0'} + }, + { + {'a','A','m'}, + {'o','O','m'}, + {'e','E','m'}, + {'u','U','m'}, + {'i','I','m'}, + {'d','D','m'}, + {'h','H','m'}, + {'t','T','m'}, + {'n','N','m'}, + {'s','S','m'}, + {'-','_','m'} + }, + + { + {';',':','\0'}, + {'q','Q','\0'}, + {'j','J','\0'}, + {'k','K','\0'}, + {'x','X','\0'}, + {'b','B','\0'}, + {'m','M','\0'}, + {'w','W','\0'}, + {'v','V','\0'}, + {'z','Z','\0'}, + {'\0','\0','\0'} + } + }; + memcpy(keys, thekeys, sizeof(thekeys));} + //QWETRZ// + if (mode == 2){ + Key thekeys[4][11] = { + { + {'1','!','^','À'}, + {'2','"','²','à'}, + {'3','#','³','È'}, + {'4','$','«','è'}, + {'5','%','»','Ì'}, + {'6','&','„','ì'}, + {'7','/','”','Ò'}, + {'8','(','[','ò'}, + {'9',')',']','Ù'}, + {'0','=','§','ù'}, + {'ß','?','\'','Ý'} + }, + { + {'q','Q','@','Á'}, + {'w','W','\0','á'}, + {'e','E','€','É'}, + {'r','R','\0','é'}, + {'t','T','\0','Í'}, + {'z','Z','\0','í'}, + {'u','U','\0','Ó'}, + {'i','I','\0','ó'}, + {'o','O','\0','Ú'}, + {'p','P','\0','ú'}, + {'ü','Ü','\0','ý'} + }, + { + {'a','A','\0','Â'}, + {'s','S','\0','â'}, + {'d','D','\0','Ê'}, + {'f','F','\0','ê'}, + {'g','G','\0','Î'}, + {'h','H','\0','î'}, + {'j','J','\0','Ô'}, + {'k','K','\0','ô'}, + {'l','L','\0','Û'}, + {'ö','Ö','\0','û'}, + {'ä','Ä','\0','Ÿ'} + }, + { + {'<','>','|','Ã'}, + {'y','Y','\0','ã'}, + {'x','X','\0','Ñ'}, + {'c','C','ç','ñ'}, + {'v','V','©','Ï'}, + {'b','B','\0','ï'}, + {'n','N','\0','Õ'}, + {'m','M','\0','õ'}, + {',',';','µ','ÿ'}, + {'.',':','\0','\0'}, + {'-','_','\0','\0'} + } + }; + memcpy(keys, thekeys, sizeof(thekeys));} keyTextbox = new GuiImageData(keyboard_textbox_png); keyTextboxImg = new GuiImage(keyTextbox); @@ -124,7 +246,10 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min) keyBack->SetSoundClick(keySoundClick); keyBack->SetTrigger(trigA); keyBack->SetTrigger(trigB); - keyBack->SetPosition(10*42+40, 0*42+120);//(10*42+40, 0*42+80); + if (mode == 2){ + keyBack->SetPosition(11*42+40, 0*42+120);} + else{ + keyBack->SetPosition(10*42+40, 0*42+120);}//(10*42+40, 0*42+80); keyBack->SetEffectGrow(); this->Append(keyBack); @@ -141,6 +266,34 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min) keyClear->SetPosition(10*42+40, 4*42+120);//(10*42+40, 0*42+80); keyClear->SetEffectGrow(); this->Append(keyClear); + + keyAltImg = new GuiImage(keyMedium); + keyAltOverImg = new GuiImage(keyMediumOver); + keyAltText = new GuiText("Alt Gr", 20, (GXColor){0, 0, 0, 0xff}); + keyAlt = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); + keyAlt->SetImage(keyAltImg); + keyAlt->SetImageOver(keyAltOverImg); + keyAlt->SetLabel(keyAltText); + keyAlt->SetSoundOver(keySoundOver); + keyAlt->SetSoundClick(keySoundClick); + keyAlt->SetTrigger(trigA); + keyAlt->SetPosition(84, 4*42+120);//(10*42+40, 4*42+120); + keyAlt->SetEffectGrow(); + if (mode == 2){this->Append(keyAlt);} + + keyAlt2Img = new GuiImage(keyMedium); + keyAlt2OverImg = new GuiImage(keyMediumOver); + keyAlt2Text = new GuiText("Accent", 20, (GXColor){0, 0, 0, 0xff}); + keyAlt2 = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); + keyAlt2->SetImage(keyAlt2Img); + keyAlt2->SetImageOver(keyAlt2OverImg); + keyAlt2->SetLabel(keyAlt2Text); + keyAlt2->SetSoundOver(keySoundOver); + keyAlt2->SetSoundClick(keySoundClick); + keyAlt2->SetTrigger(trigA); + keyAlt2->SetPosition(8*42+40, 4*42+120);//(10*42+40, 4*42+120); + keyAlt2->SetEffectGrow(); + if (mode == 2){this->Append(keyAlt2);} keyCapsImg = new GuiImage(keyMedium); keyCapsOverImg = new GuiImage(keyMediumOver); @@ -225,6 +378,10 @@ GuiKeyboard::~GuiKeyboard() delete keyShiftImg; delete keyShiftOverImg; delete keyShift; + if (keyAlt) + {delete keyAlt;} + if (keyAlt2) + {delete keyAlt2;} delete keyBackText; delete keyBackImg; delete keyBackOverImg; @@ -297,8 +454,24 @@ void GuiKeyboard::Update(GuiTrigger * t) else if(keyShift->GetState() == STATE_CLICKED) { shift ^= 1; + if(alt) alt ^= 1; + if(alt2) alt2 ^= 1; keyShift->SetState(STATE_SELECTED, t->chan); } + else if(keyAlt->GetState() == STATE_CLICKED) + { + alt ^= 1; + if(shift) shift ^= 1; + if(alt2) alt2 ^= 1; + keyAlt->SetState(STATE_SELECTED, t->chan); + } + else if(keyAlt2->GetState() == STATE_CLICKED) + { + alt2 ^= 1; + if(shift) shift ^= 1; + if(alt) alt ^= 1; + keyAlt2->SetState(STATE_SELECTED, t->chan); + } else if(keyCaps->GetState() == STATE_CLICKED) { caps ^= 1; @@ -315,6 +488,10 @@ void GuiKeyboard::Update(GuiTrigger * t) { if(shift || caps) txt[0] = keys[i][j].chShift; + else if(alt) + txt[0] = keys[i][j].chalt; + else if(alt2) + txt[0] = keys[i][j].chalt2; else txt[0] = keys[i][j].ch; @@ -328,6 +505,22 @@ void GuiKeyboard::Update(GuiTrigger * t) { kbtextstr[strlen(kbtextstr)] = keys[i][j].chShift; if(shift) shift ^= 1; + if(alt) alt ^= 1; + if(alt2) alt2 ^= 1; + } + else if(alt) + { + kbtextstr[strlen(kbtextstr)] = keys[i][j].chalt; + if(shift) shift ^= 1; + if(alt) alt ^= 1; + if(alt2) alt2 ^= 1; + } + else if(alt2) + { + kbtextstr[strlen(kbtextstr)] = keys[i][j].chalt2; + if(shift) shift ^= 1; + if(alt) alt ^= 1; + if(alt2) alt2 ^= 1; } else { diff --git a/source/menu.cpp b/source/menu.cpp index dab76f45..a5e69d64 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -278,11 +278,25 @@ static void WindowCredits(void * ptr) txt[i] = new GuiText("Fishears/Nuke Ocarina & WiiPower Vidpatch"); txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,y); i++; + txt[i] = new GuiText(LANGUAGE.For); txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(-80,y); + char* pch; + char* pch2; + + pch=strrchr((LANGUAGE.For),'_'); + pch2=strrchr((LANGUAGE.For),'p'); + + if ((pch!=NULL)||(pch2!=NULL)){txt[i]->SetPosition(-80, y+5);} + else {txt[i]->SetPosition(-80, y);} i++; txt[i] = new GuiText(LANGUAGE.For); txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(130,y); + pch=strrchr((LANGUAGE.For),'_'); + pch2=strrchr((LANGUAGE.For),'p'); + + if ((pch!=NULL)||(pch2!=NULL)){txt[i]->SetPosition(130, y+5);} + else {txt[i]->SetPosition(130, y);} i++; y+=22; @@ -291,7 +305,9 @@ static void WindowCredits(void * ptr) txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(0,y); i++; txt[i] = new GuiText(LANGUAGE.For); - txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(-3,y); + txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); //txt[i]->SetPosition(-3,y); + if ((pch!=NULL)||(pch2!=NULL)){txt[i]->SetPosition(-3, y+5);} + else {txt[i]->SetPosition(-3, y);} i++; y+=22; @@ -300,6 +316,8 @@ static void WindowCredits(void * ptr) i++; txt[i] = new GuiText(LANGUAGE.For); txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(30,y); + if ((pch!=NULL)||(pch2!=NULL)){txt[i]->SetPosition(30, y+5);} + else {txt[i]->SetPosition(30, y);} i++; y+=22; @@ -1899,8 +1917,12 @@ err: static int OnScreenKeyboard(char * var, u32 maxlen, int min) { int save = -1; - - GuiKeyboard keyboard(var, maxlen, min); + int keyset = 0; + if (Settings.keyset == us) keyset = 0; + else if (Settings.keyset == dvorak) keyset = 1; + else if (Settings.keyset == euro) keyset = 2; + + GuiKeyboard keyboard(var, maxlen, min, keyset); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol); GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol); @@ -3513,10 +3535,13 @@ static int MenuSettings() menu = MENU_NONE; if ( pageToDisplay == 1) { - sprintf(options2.name[0],"%s", LANGUAGE.VideoMode); - sprintf(options2.name[1],"%s", LANGUAGE.VIDTVPatch); - sprintf(options2.name[2],"%s", LANGUAGE.Language); + + sprintf(options2.name[0], "%s",LANGUAGE.VideoMode); + sprintf(options2.name[1], "%s",LANGUAGE.VIDTVPatch); + sprintf(options2.name[2], "%s",LANGUAGE.Language); + sprintf(options2.name[3], "Ocarina"); + sprintf(options2.name[4],"%s", LANGUAGE.Display); sprintf(options2.name[5],"%s", LANGUAGE.Clock); //CLOCK sprintf(options2.name[6],"%s", LANGUAGE.Rumble); //RUMBLE @@ -3579,6 +3604,7 @@ static int MenuSettings() sprintf(options2.name[7],"%s", LANGUAGE.DiscimagePath); sprintf(options2.name[8],"%s", LANGUAGE.ThemePath); + } else if ( pageToDisplay == 3 ) { @@ -3598,9 +3624,10 @@ static int MenuSettings() mainWindow->Append(&page1Btn); mainWindow->Append(&page3Btn); - sprintf(options2.name[0],"%s", LANGUAGE.MP3Menu); - sprintf(options2.name[1],"%s", LANGUAGE.AppLanguage); - sprintf(options2.name[2], " "); + + sprintf(options2.name[0], "%s",LANGUAGE.MP3Menu); + sprintf(options2.name[1], "%s",LANGUAGE.AppLanguage); + sprintf(options2.name[2], "%s", LANGUAGE.keyboard); sprintf(options2.name[3], "Under"); sprintf(options2.name[4], "Construction"); sprintf(options2.name[5], " "); @@ -3643,9 +3670,14 @@ static int MenuSettings() else if (Settings.video == pal60) sprintf (options2.value[0],"%s PAL60",LANGUAGE.Force); else if (Settings.video == ntsc) sprintf (options2.value[0],"%s NTSC",LANGUAGE.Force); + //if (Settings.vpatch == on) sprintf (options2.value[1],"%s",LANGUAGE.ON); + //else if (Settings.vpatch == off) sprintf (options2.value[1],"%s",LANGUAGE.OFF); + if (Settings.vpatch == on) sprintf (options2.value[1],"%s",LANGUAGE.ON); else if (Settings.vpatch == off) sprintf (options2.value[1],"%s",LANGUAGE.OFF); + + if (Settings.language == ConsoleLangDefault) sprintf (options2.value[2],"%s",LANGUAGE.ConsoleDefault); else if (Settings.language == jap) sprintf (options2.value[2],"%s",LANGUAGE.Japanese); else if (Settings.language == ger) sprintf (options2.value[2],"%s",LANGUAGE.German); @@ -3993,6 +4025,12 @@ static int MenuSettings() } } if (pageToDisplay == 3){ + + + if ( Settings.keyset > 2 ) + Settings.keyset = 0; + + sprintf(options2.value[0], " "); if (strlen(CFG.language_path) < (9 + 3)) { @@ -4004,7 +4042,11 @@ static int MenuSettings() } sprintf(options2.value[1], "%s", cfgtext); - sprintf(options2.value[2], " "); + + if (Settings.keyset == us) sprintf (options2.value[2],"QWERTY"); + else if (Settings.keyset == dvorak) sprintf (options2.value[2],"DVORAK"); + else if (Settings.keyset == euro) sprintf (options2.value[2],"QWERTZ"); + sprintf(options2.value[3], " "); sprintf(options2.value[4], " "); sprintf(options2.value[5], " "); @@ -4062,6 +4104,11 @@ static int MenuSettings() WindowPrompt(LANGUAGE.Langchange,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0); } break; + case 2: + Settings.keyset++; + break; + + }