diff --git a/Makefile b/Makefile index ae836047..4859eb3e 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ include $(DEVKITPPC)/wii_rules #--------------------------------------------------------------------------------- TARGET := boot BUILD := build -SOURCES := source source/libwiigui source/images source/fonts source/sounds source/libwbfs source/unzip +SOURCES := source source/libwiigui source/images source/fonts source/sounds source/libwbfs source/unzip source/language INCLUDES := source SVNDEV := -D'SVN_REV="$(shell svnversion -n ..)"' diff --git a/gui.pnproj b/gui.pnproj index 88d9a4a2..bef6d051 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/gui.pnps b/gui.pnps index cab6d274..0538f749 100644 --- a/gui.pnps +++ b/gui.pnps @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/FreeTypeGX.cpp b/source/FreeTypeGX.cpp index a85d25e2..6381aa58 100644 --- a/source/FreeTypeGX.cpp +++ b/source/FreeTypeGX.cpp @@ -21,8 +21,9 @@ */ #include "FreeTypeGX.h" -#include "CH2Unicode.h" -#include "GB2Unicode.h" +#include "language/CH2Unicode.h" +#include "language/GB2Unicode.h" +#include "language/sjis2unicode.h" #include "main.h" #include "cfg.h" @@ -95,6 +96,8 @@ wchar_t* FreeTypeGX::charToWideChar(char* strChar) { CH2Unicode(strChar, strWChar); } else if(Settings.unicodefix == 2) { ConverGB2Unicode(strChar, strWChar); + } else if(Settings.unicodefix == 3) { + _sjis2unicode(strChar, strWChar); } else { char *tempSrc = strChar; wchar_t *tempDest = strWChar; @@ -443,11 +446,11 @@ int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format) { { case FTGX_JUSTIFY_LEFT: return 0; - + default: case FTGX_JUSTIFY_CENTER: return -(width >> 1); - + case FTGX_JUSTIFY_RIGHT: return -width; } @@ -469,23 +472,23 @@ int16_t FreeTypeGX::getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format { case FTGX_ALIGN_TOP: return offset->ascender; - + default: case FTGX_ALIGN_MIDDLE: return (offset->ascender + offset->descender + 1) >> 1; - + case FTGX_ALIGN_BOTTOM: return offset->descender; - + case FTGX_ALIGN_BASELINE: return 0; - + case FTGX_ALIGN_GLYPH_TOP: return offset->max; - + case FTGX_ALIGN_GLYPH_MIDDLE: return (offset->max + offset->min + 1) >> 1; - + case FTGX_ALIGN_GLYPH_BOTTOM: return offset->min; } @@ -679,8 +682,8 @@ uint16_t FreeTypeGX::getHeight(wchar_t const *text) { * pixel height below the font origin line and returns the values in an addressible structure. * * @param text NULL terminated string to calculate. - * @param offset returns the max and min values above and below the font origin line - * + * @param offset returns the max and min values above and below the font origin line + * */ ftgxDataOffset* FreeTypeGX::getOffset(wchar_t *text, ftgxDataOffset* offset) { uint16_t strLength = wcslen(text); diff --git a/source/PromptWindows.cpp b/source/PromptWindows.cpp index 31032e19..41ca7d41 100644 --- a/source/PromptWindows.cpp +++ b/source/PromptWindows.cpp @@ -11,7 +11,7 @@ #include "wpad.h" #include "wbfs.h" #include "wdvd.h" -#include "language.h" +#include "language/language.h" #include "libwiigui/gui.h" #include "libwiigui/gui_diskcover.h" #include "fatmounter.h" diff --git a/source/Settings.cpp b/source/Settings.cpp index 89e9a2a7..e951d68a 100644 --- a/source/Settings.cpp +++ b/source/Settings.cpp @@ -5,7 +5,7 @@ #include "filelist.h" #include "sys.h" #include "wbfs.h" -#include "language.h" +#include "language/language.h" #include "libwiigui/gui.h" #include "libwiigui/gui_customoptionbrowser.h" #include "fatmounter.h" @@ -51,13 +51,6 @@ int MenuSettings() GuiSound btnClick1(button_click_pcm, button_click_pcm_size, SOUND_PCM, Settings.sfxvolume); char imgPath[100]; - - snprintf(imgPath, sizeof(imgPath), "%ssettings_top.png", CFG.theme_path); - GuiImageData settingsTop(imgPath, settings_top_png); - - snprintf(imgPath, sizeof(imgPath), "%ssettings_bottom.png", CFG.theme_path); - GuiImageData settingsBottom(imgPath, settings_bottom_png); - snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path); GuiImageData btnOutline(imgPath, button_dialogue_box_png); @@ -87,14 +80,6 @@ int MenuSettings() GuiImage creditsImg(&creditsImgData); GuiImage creditsImgOver(&creditsOver); - - GuiImage settingsTopImg(&settingsTop); - settingsTopImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP); - settingsTopImg.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 35); - - GuiImage settingsBottomImg(&settingsBottom); - settingsBottomImg.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - settingsBottomImg.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35); GuiTrigger trigA; trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); @@ -114,7 +99,6 @@ int MenuSettings() GuiText titleTxt(LANGUAGE.settings, 28, (GXColor){0, 0, 0, 255}); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,40); - titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 35); GuiImage settingsbackground(&settingsbg); @@ -128,7 +112,6 @@ int MenuSettings() GuiButton backBtn(&backBtnImg,&backBtnImg, 2, 3, -180, 400, &trigA, &btnSoundOver, &btnClick,1); backBtn.SetLabel(&backBtnTxt); backBtn.SetTrigger(&trigB); - backBtn.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35); GuiButton homo(1,1); homo.SetTrigger(&trigHome); @@ -296,8 +279,6 @@ int MenuSettings() mainWindow->Append(&w); w.RemoveAll(); w.Append(&settingsbackground); - w.Append(&settingsTopImg); - w.Append(&settingsBottomImg); w.Append(&PageIndicatorBtn1); w.Append(&PageIndicatorBtn2); w.Append(&titleTxt); @@ -397,8 +378,6 @@ int MenuSettings() mainWindow->Append(&w); w.RemoveAll(); w.Append(&settingsbackground); - w.Append(&settingsTopImg); - w.Append(&settingsBottomImg); w.Append(&PageIndicatorBtn1); w.Append(&PageIndicatorBtn2); w.Append(&titleTxt); @@ -532,7 +511,7 @@ int MenuSettings() Settings.wiilight = 0; if(Settings.rumble >= settings_rumble_max) Settings.rumble = 0; //RUMBLE - if ( Settings.unicodefix > 2 ) + if ( Settings.unicodefix > 3 ) Settings.unicodefix = 0; if(Settings.titlesOverride >= 2) Settings.titlesOverride = 0; @@ -577,6 +556,7 @@ int MenuSettings() if (Settings.unicodefix == 0) options2.SetValue(9,"%s",LANGUAGE.OFF); else if (Settings.unicodefix == 1) options2.SetValue(9,"%s",LANGUAGE.TChinese); else if (Settings.unicodefix == 2) options2.SetValue(9,"%s",LANGUAGE.SChinese); + else if (Settings.unicodefix == 3) options2.SetValue(9,"%s",LANGUAGE.Japanese); if (Settings.titlesOverride == 0) options2.SetValue(10,"%s",LANGUAGE.OFF); else if (Settings.titlesOverride == 1) options2.SetValue(10,"%s",LANGUAGE.ON); @@ -887,8 +867,8 @@ int MenuSettings() titleTxt.SetText(LANGUAGE.Parentalcontrol); exit = false; for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL); - options2.SetName(0, "Console"); - options2.SetName(1, "%s", LANGUAGE.Password); + options2.SetName(0, "%s",LANGUAGE.Console); + options2.SetName(1, "%s",LANGUAGE.Password); options2.SetName(2, "%s",LANGUAGE.Controllevel); for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL); w.Append(&optionBrowser2); @@ -1683,19 +1663,13 @@ int GameSettings(struct discHdr * header) options3.SetName(3, "Ocarina"); options3.SetName(4, "IOS"); options3.SetName(5,"%s", LANGUAGE.Parentalcontrol); - options3.SetName(6,"%s", "Error 002 fix"); + options3.SetName(6,"%s", LANGUAGE.Error002fix); options3.SetName(7,"%s", LANGUAGE.Defaultgamesettings); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume); GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume); char imgPath[100]; - - snprintf(imgPath, sizeof(imgPath), "%ssettings_top.png", CFG.theme_path); - GuiImageData settingsTop(imgPath, settings_top_png); - - snprintf(imgPath, sizeof(imgPath), "%ssettings_bottom.png", CFG.theme_path); - GuiImageData settingsBottom(imgPath, settings_bottom_png); snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path); GuiImageData btnOutline(imgPath, button_dialogue_box_png); @@ -1713,21 +1687,12 @@ int GameSettings(struct discHdr * header) titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(12,40); titleTxt.SetMaxWidth(356, GuiText::SCROLL); - titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 35); GuiImage settingsbackground(&settingsbg); GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight()); settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP); settingsbackgroundbtn.SetPosition(0, 0); settingsbackgroundbtn.SetImage(&settingsbackground); - - GuiImage settingsTopImg(&settingsTop); - settingsTopImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP); - settingsTopImg.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 35); - - GuiImage settingsBottomImg(&settingsBottom); - settingsBottomImg.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - settingsBottomImg.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35); GuiText saveBtnTxt(LANGUAGE.Save, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); saveBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); @@ -1738,7 +1703,6 @@ int GameSettings(struct discHdr * header) GuiButton saveBtn(&saveBtnImg,&saveBtnImg, 2, 3, -180, 400, &trigA, &btnSoundOver, &btnClick,1); saveBtn.SetScale(0.9); saveBtn.SetLabel(&saveBtnTxt); - saveBtn.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35); GuiText cancelBtnTxt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); @@ -1750,7 +1714,6 @@ int GameSettings(struct discHdr * header) cancelBtn.SetScale(0.9); cancelBtn.SetLabel(&cancelBtnTxt); cancelBtn.SetTrigger(&trigB); - cancelBtn.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35); GuiText deleteBtnTxt(LANGUAGE.Uninstall, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); deleteBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); @@ -1761,7 +1724,6 @@ int GameSettings(struct discHdr * header) GuiButton deleteBtn(&deleteBtnImg,&deleteBtnImg, 2, 3, 0, 400, &trigA, &btnSoundOver, &btnClick,1); deleteBtn.SetScale(0.9); deleteBtn.SetLabel(&deleteBtnTxt); - deleteBtn.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 35); GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, 0, 200); optionBrowser3.SetPosition(0, 90); @@ -1770,8 +1732,6 @@ int GameSettings(struct discHdr * header) HaltGui(); GuiWindow w(screenwidth, screenheight); w.Append(&settingsbackgroundbtn); - w.Append(&settingsTopImg); - w.Append(&settingsBottomImg); w.Append(&titleTxt); w.Append(&deleteBtn); w.Append(&saveBtn); diff --git a/source/SettingsPrompts.cpp b/source/SettingsPrompts.cpp index 0637f21d..5d6f2c63 100644 --- a/source/SettingsPrompts.cpp +++ b/source/SettingsPrompts.cpp @@ -4,7 +4,7 @@ #include "filelist.h" #include "sys.h" -#include "language.h" +#include "language/language.h" #include "libwiigui/gui.h" #include "libwiigui/gui_customoptionbrowser.h" #include "listfiles.h" diff --git a/source/cfg.c b/source/cfg.c index 4dec0568..97988b32 100644 --- a/source/cfg.c +++ b/source/cfg.c @@ -7,7 +7,7 @@ #include #include #include "cfg.h" -#include "language.h" +#include "language/language.h" #include "xml.h" /* XML - Lustar*/ diff --git a/source/filelist.h b/source/filelist.h index 9a64b92d..4b057c8e 100644 --- a/source/filelist.h +++ b/source/filelist.h @@ -11,12 +11,6 @@ #include -extern const u8 settings_top_png[]; -extern const u32 settings_top_png_size; - -extern const u8 settings_bottom_png[]; -extern const u32 settings_bottom_png_size; - extern const u8 font_ttf[]; extern const u32 font_ttf_size; diff --git a/source/gameinfo.cpp b/source/gameinfo.cpp index 51075be3..6ebb77c7 100644 --- a/source/gameinfo.cpp +++ b/source/gameinfo.cpp @@ -13,7 +13,7 @@ #include "sys.h" #include "wpad.h" #include "wbfs.h" -#include "language.h" +#include "language/language.h" #include "libwiigui/gui.h" #include "fatmounter.h" #include "listfiles.h" diff --git a/source/images/settings_background.png b/source/images/settings_background.png index b59eaf92..02ed90db 100644 Binary files a/source/images/settings_background.png and b/source/images/settings_background.png differ diff --git a/source/images/settings_bottom.png b/source/images/settings_bottom.png deleted file mode 100644 index 77f21950..00000000 Binary files a/source/images/settings_bottom.png and /dev/null differ diff --git a/source/images/settings_top.png b/source/images/settings_top.png deleted file mode 100644 index b71b2ff4..00000000 Binary files a/source/images/settings_top.png and /dev/null differ diff --git a/source/CH2Unicode.c b/source/language/CH2Unicode.c similarity index 100% rename from source/CH2Unicode.c rename to source/language/CH2Unicode.c diff --git a/source/CH2Unicode.h b/source/language/CH2Unicode.h similarity index 100% rename from source/CH2Unicode.h rename to source/language/CH2Unicode.h diff --git a/source/GB2Unicode.c b/source/language/GB2Unicode.c similarity index 100% rename from source/GB2Unicode.c rename to source/language/GB2Unicode.c diff --git a/source/GB2Unicode.h b/source/language/GB2Unicode.h similarity index 100% rename from source/GB2Unicode.h rename to source/language/GB2Unicode.h diff --git a/source/language.c b/source/language/language.c similarity index 96% rename from source/language.c rename to source/language/language.c index 8b474cc8..8c5ec6dd 100644 --- a/source/language.c +++ b/source/language/language.c @@ -56,6 +56,7 @@ snprintf(LANGUAGE.ClicktoDownloadCovers, sizeof(LANGUAGE.ClicktoDownloadCovers), snprintf(LANGUAGE.Clock, sizeof(LANGUAGE.Clock), "Clock"); snprintf(LANGUAGE.Close, sizeof(LANGUAGE.Close), "Close"); snprintf(LANGUAGE.Continueinstallgame, sizeof(LANGUAGE.Continueinstallgame), "Continue to install game?"); +snprintf(LANGUAGE.Console, sizeof(LANGUAGE.Console), "Console"); snprintf(LANGUAGE.ConsoleDefault, sizeof(LANGUAGE.ConsoleDefault), "Console Default"); snprintf(LANGUAGE.Consoleshouldbeunlockedtomodifyit, sizeof(LANGUAGE.Consoleshouldbeunlockedtomodifyit), "Console should be unlocked to modify it."); snprintf(LANGUAGE.ConsoleLocked, sizeof(LANGUAGE.ConsoleLocked), "Console Locked"); @@ -92,6 +93,7 @@ snprintf(LANGUAGE.Defaultsettings, sizeof(LANGUAGE.Defaultsettings), "Default Se snprintf(LANGUAGE.Default, sizeof(LANGUAGE.Default), "Default"); snprintf(LANGUAGE.diversepatches, sizeof(LANGUAGE.diversepatches), "for diverse patches"); snprintf(LANGUAGE.Error, sizeof(LANGUAGE.Error), "Error !"); +snprintf(LANGUAGE.Error002fix, sizeof(LANGUAGE.Error002fix), "Error 002 fix"); snprintf(LANGUAGE.hour, sizeof(LANGUAGE.hour), "Hour"); snprintf(LANGUAGE.Homemenu, sizeof(LANGUAGE.Homemenu), "HOME Menu"); snprintf(LANGUAGE.BOOTERROR, sizeof(LANGUAGE.BOOTERROR), "BOOT ERROR"); @@ -389,6 +391,10 @@ void language_set(char *name, char *val) strcopy(LANGUAGE.Continueinstallgame, val, sizeof(LANGUAGE.Continueinstallgame)); return; } + if (strcmp(name, "Console") == 0) { + strcopy(LANGUAGE.Console, val, sizeof(LANGUAGE.Console)); + return; + } if (strcmp(name, "ConsoleDefault") == 0) { strcopy(LANGUAGE.ConsoleDefault, val, sizeof(LANGUAGE.ConsoleDefault)); return; @@ -529,6 +535,10 @@ void language_set(char *name, char *val) strcopy(LANGUAGE.Error, val, sizeof(LANGUAGE.Error)); return; } + if (strcmp(name, "Error002fix") == 0) { + strcopy(LANGUAGE.Error002fix, val, sizeof(LANGUAGE.Error002fix)); + return; + } if (strcmp(name, "BOOTERROR") == 0) { strcopy(LANGUAGE.BOOTERROR, val, sizeof(LANGUAGE.BOOTERROR)); return; @@ -1205,6 +1215,10 @@ void language_set(char *name, char *val) strcopy(LANGUAGE.updating, val, sizeof(LANGUAGE.updating)); return; } + if (strcmp(name, "XMLTitles") == 0) { + strcopy(LANGUAGE.XMLTitles, val, sizeof(LANGUAGE.XMLTitles)); + return; + } } diff --git a/source/language.h b/source/language/language.h similarity index 95% rename from source/language.h rename to source/language/language.h index 1c5b8f24..326760e4 100644 --- a/source/language.h +++ b/source/language/language.h @@ -56,6 +56,7 @@ struct LANGUAGE char Clock[20]; char Close[20]; char Continueinstallgame[50]; + char Console[50]; char ConsoleDefault[50]; char Consoleshouldbeunlockedtomodifyit[100]; char ConsoleLocked[50]; @@ -92,6 +93,7 @@ struct LANGUAGE char Default[40]; char diversepatches[60]; char Error[30]; + char Error002fix[50]; char BOOTERROR[50]; char ErrorreadingDisc[50]; char ExitUSBISOLoader[50]; diff --git a/source/language/sjis2unicode.h b/source/language/sjis2unicode.h new file mode 100644 index 00000000..ccc39b23 --- /dev/null +++ b/source/language/sjis2unicode.h @@ -0,0 +1,49 @@ +//////////////////////////////////////////// +// SJIS(CP932)/UTF-8 -> UNICODE +// 2009/05/02 by Rudolph +//////////////////////////////////////////// + +extern const u8 sjis2unicode_tbl[]; + +static bool _isKanji1(wchar_t ch) +{ + if((ch >= (wchar_t)0x81) && (ch <= (wchar_t)0x9F)) + return true; + if((ch >= (wchar_t)0xE0) && (ch <= (wchar_t)0xEF)) + return true; + if((ch >= (wchar_t)0xFA) && (ch <= (wchar_t)0xFB)) // JIS X 0218他 IBM拡張文字 (0xFA40-0xFC4B) + return true; + return false; +} + +static void _sjis2unicode(char *src, wchar_t *dest) +{ + wchar_t lc = 0; + int bt; + + + bt = mbstowcs(dest, src, strlen(src)); // UTF-8 to UTF-16 + if(bt > 0) { + dest[bt] = (wchar_t)'\0'; + return; + } + + while(*src) { + lc = (wchar_t)*src; + src++; + + if(_isKanji1(lc) && *src) { + lc = (lc << 8) + ((wchar_t)*src); + src++; + } + + if(lc < ((wchar_t)(sjis2unicode_tbl[3]) << 8) + (wchar_t)(sjis2unicode_tbl[2])) { + *dest = (((wchar_t)(sjis2unicode_tbl[lc*2+5]) << 8)) + (wchar_t)(sjis2unicode_tbl[lc*2+4]); + if(*dest == (wchar_t)'\0') + *dest = (wchar_t)'?'; + } else *dest = (wchar_t)'?'; + dest++; + } + *dest = (wchar_t)'\0'; + return; +} diff --git a/source/language/sjis2unicode.tbl b/source/language/sjis2unicode.tbl new file mode 100644 index 00000000..434eb7b4 Binary files /dev/null and b/source/language/sjis2unicode.tbl differ diff --git a/source/language/sjis2unicode_tbl.s b/source/language/sjis2unicode_tbl.s new file mode 100644 index 00000000..9adfd181 --- /dev/null +++ b/source/language/sjis2unicode_tbl.s @@ -0,0 +1,11 @@ +# SJIS(CP932) -> UNICODE 変換テーブル指定 by Rudolph + + .rodata + + .globl sjis2unicode_tbl + + .balign 32 + +sjis2unicode_tbl: + .incbin "../source/language/sjis2unicode.tbl" + diff --git a/source/main.cpp b/source/main.cpp index 8fe4ea7d..f4704d73 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -32,7 +32,7 @@ #include "video2.h" #include "wpad.h" #include "cfg.h" -#include "language.h" +#include "language/language.h" #include "fat.h" #include "mload.h" diff --git a/source/menu.cpp b/source/menu.cpp index b5cfc650..0fa48f68 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -25,7 +25,7 @@ #include "sys.h" #include "patchcode.h" #include "wpad.h" -#include "language.h" +#include "language/language.h" #include "listfiles.h" #include "fatmounter.h" #include "getentries.h"