show japanese titles properly in memcard manager

git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@48556 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
SND\weimingzhi_cp 2010-05-23 02:46:22 +00:00
parent e5644f52a1
commit 7c4427cb43
6 changed files with 40 additions and 23 deletions

View File

@ -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)

View File

@ -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.

View File

@ -30,7 +30,7 @@ void RunAboutDialog(void) {
"Wei Mingzhi <whistler_wmz@users.sf.net>",
"",
"Contributors:",
"dario86",
"Dario",
"Firnis",
"Gabriele Gorla",
"Peter Collingbourne",

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;