mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-15 16:05:10 +01:00
*Reverted cyrex changes to the settings
*Added Japanese UnicodeFix made by Rudolph (thanks) (you still need to compile with a japanese font.ttf to have it work) *Added missing languagevariables issue 517, issue 515, issue 519
This commit is contained in:
parent
d7c3bea35c
commit
940fa4b441
2
Makefile
2
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 ..)"'
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
2
gui.pnps
2
gui.pnps
@ -1 +1 @@
|
||||
<pd><ViewState><e p="gui" x="true"></e><e p="gui\source\unzip" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="true"></e><e p="gui\source\sounds" x="false"></e></ViewState></pd>
|
||||
<pd><ViewState><e p="gui" x="true"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="true"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\unzip" x="false"></e></ViewState></pd>
|
@ -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);
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <ogcsys.h>
|
||||
#include <mxml.h>
|
||||
#include "cfg.h"
|
||||
#include "language.h"
|
||||
#include "language/language.h"
|
||||
#include "xml.h" /* XML - Lustar*/
|
||||
|
||||
|
||||
|
@ -11,12 +11,6 @@
|
||||
|
||||
#include <gccore.h>
|
||||
|
||||
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;
|
||||
|
||||
|
@ -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"
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.6 KiB |
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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];
|
49
source/language/sjis2unicode.h
Normal file
49
source/language/sjis2unicode.h
Normal file
@ -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Šg’£•¶Žš (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;
|
||||
}
|
BIN
source/language/sjis2unicode.tbl
Normal file
BIN
source/language/sjis2unicode.tbl
Normal file
Binary file not shown.
11
source/language/sjis2unicode_tbl.s
Normal file
11
source/language/sjis2unicode_tbl.s
Normal file
@ -0,0 +1,11 @@
|
||||
# SJIS(CP932) -> UNICODE 変換テーブル指定 by Rudolph
|
||||
|
||||
.rodata
|
||||
|
||||
.globl sjis2unicode_tbl
|
||||
|
||||
.balign 32
|
||||
|
||||
sjis2unicode_tbl:
|
||||
.incbin "../source/language/sjis2unicode.tbl"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user