diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-05-23 02:46:22 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-05-23 02:46:22 +0000 |
| commit | 7c4427cb435c50b2772d69521b34c4979a950ea8 (patch) | |
| tree | 52c0e0fc9623660319910d224cdd5fccbea519b4 | |
| parent | e5644f52a124e136027a0bc4c2359579b3ded432 (diff) | |
| download | pcsxr-7c4427cb435c50b2772d69521b34c4979a950ea8.tar.gz | |
show japanese titles properly in memcard manager
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@48556 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | AUTHORS | 2 | ||||
| -rw-r--r-- | ChangeLog | 8 | ||||
| -rw-r--r-- | gui/AboutDlg.c | 2 | ||||
| -rw-r--r-- | gui/MemcardDlg.c | 14 | ||||
| -rw-r--r-- | libpcsxcore/sio.c | 27 | ||||
| -rw-r--r-- | libpcsxcore/sio.h | 10 |
6 files changed, 40 insertions, 23 deletions
@@ -20,7 +20,7 @@ df Copyright: (c) 2005 Ryan Schultz (c) 2006 Marcus Comstedt PCSX-Reloaded Authors/Contributors: avlex (Help on xcode project) - dario86 (Various bugfixes) + Dario (Various bugfixes) edgbla (Root counters, various core/plugin fixes) Firnis (GTE code from PCSX-Revolution Project) Gabriele Gorla (MDEC decoder) @@ -1,3 +1,11 @@ +May 23, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> + + * AUTHORS: Updated on request. + * gui/AboutDlg.c: Likewise. + * gui/MemcardDlg.c: Show Japanese titles properly. + * libpcsxcore/sio.h: Likewise. + * libpcsxcore/sio.c: Likewise. + May 22, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> * plugins/dfsound/pulseaudio.c: Use Native Endian instead of Little Endian. diff --git a/gui/AboutDlg.c b/gui/AboutDlg.c index 1c602105..03b62580 100644 --- a/gui/AboutDlg.c +++ b/gui/AboutDlg.c @@ -30,7 +30,7 @@ void RunAboutDialog(void) { "Wei Mingzhi <whistler_wmz@users.sf.net>", "", "Contributors:", - "dario86", + "Dario", "Firnis", "Gabriele Gorla", "Peter Collingbourne", diff --git a/gui/MemcardDlg.c b/gui/MemcardDlg.c index c9f7e3d6..b700dc20 100644 --- a/gui/MemcardDlg.c +++ b/gui/MemcardDlg.c @@ -229,6 +229,7 @@ static void UpdateListItems(int mcd, GtkWidget *widget) { GdkPixbuf *pixbuf; short *pIcon; int i; + gchar *title; xml = glade_get_widget_tree(widget); dialog = glade_xml_get_widget(xml, "McdsDlg"); @@ -258,21 +259,24 @@ static void UpdateListItems(int mcd, GtkWidget *widget) { state = _("Free"); pIcon = Info->Icon; - if( Info->IconCount > 1 && currentIcon <= Info->IconCount ) - { - pIcon = &Info->Icon[currentIcon*16*16]; + if (Info->IconCount > 1 && currentIcon <= Info->IconCount) { + pIcon = &Info->Icon[currentIcon * 16 * 16]; } pixbuf = SetIcon(dialog, pIcon, i + 1); + title = g_convert(Info->sTitle, strlen(Info->sTitle), "UTF-8", + "Shift-JIS", NULL, NULL, NULL); gtk_list_store_set(store, &iter, CL_ICON, pixbuf, - CL_TITLE, Info->Title, + CL_TITLE, title, CL_STAT, state, CL_NAME, Info->Name, CL_ID, Info->ID, -1); - + + g_free(title); + g_object_unref(pixbuf); gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter); } diff --git a/libpcsxcore/sio.c b/libpcsxcore/sio.c index 3b2c3d6f..f0655cd9 100644 --- a/libpcsxcore/sio.c +++ b/libpcsxcore/sio.c @@ -670,15 +670,13 @@ void ConvertMcd(char *mcd, char *data) { } void GetMcdBlockInfo(int mcd, int block, McdBlock *Info) { - unsigned char *data = NULL, *ptr, *str; + unsigned char *data = NULL, *ptr, *str, *sstr; unsigned short clut[16]; unsigned short c; int i, x; memset(Info, 0, sizeof(McdBlock)); - str = Info->Title; - if (mcd == 1) data = Mcd1Data; if (mcd == 2) data = Mcd2Data; @@ -688,34 +686,42 @@ void GetMcdBlockInfo(int mcd, int block, McdBlock *Info) { ptr += 2; - i = 0; - memcpy(Info->sTitle, ptr, 48*2); + x = 0; + + str = Info->Title; + sstr = Info->sTitle; for (i = 0; i < 48; i++) { c = *(ptr) << 8; - c|= *(ptr + 1); + c |= *(ptr + 1); if (!c) break; + // Convert ASCII characters to half-width if (c >= 0x8281 && c <= 0x8298) c = (c - 0x8281) + 'a'; else if (c >= 0x824F && c <= 0x827A) c = (c - 0x824F) + '0'; + else if (c == 0x8140) c = ' '; else if (c == 0x8144) c = '.'; else if (c == 0x8146) c = ':'; + else if (c == 0x815E) c = '/'; else if (c == 0x8168) c = '"'; else if (c == 0x8169) c = '('; else if (c == 0x816A) c = ')'; else if (c == 0x816D) c = '['; else if (c == 0x816E) c = ']'; else if (c == 0x817C) c = '-'; - else c = ' '; + else { + str[i] = ' '; + sstr[x++] = *ptr++; sstr[x++] = *ptr++; + continue; + } - str[i] = c; + str[i] = sstr[x++] = c; ptr += 2; } - str[i] = 0; - ptr = data + block * 8192 + 0x60; // icon palete data + ptr = data + block * 8192 + 0x60; // icon palette data for (i = 0; i < 16; i++) { clut[i] = *((unsigned short *)ptr); @@ -740,7 +746,6 @@ void GetMcdBlockInfo(int mcd, int block, McdBlock *Info) { ptr += 0xa; strncpy(Info->ID, ptr, 12); - Info->ID[12] = 0; ptr += 12; strncpy(Info->Name, ptr, 16); } diff --git a/libpcsxcore/sio.h b/libpcsxcore/sio.h index 8e4476c0..cc8d925b 100644 --- a/libpcsxcore/sio.h +++ b/libpcsxcore/sio.h @@ -59,12 +59,12 @@ void CreateMcd(char *mcd); void ConvertMcd(char *mcd, char *data); typedef struct { - char Title[48]; - short sTitle[48]; - char ID[14]; - char Name[16]; + char Title[48 + 1]; // Title in ASCII + char sTitle[48 * 2 + 1]; // Title in Shift-JIS + char ID[12 + 1]; + char Name[16 + 1]; int IconCount; - short Icon[16*16*3]; + short Icon[16 * 16 * 3]; unsigned char Flags; } McdBlock; |
