This patch tries to fixup typedef defined in types.h in order to help x86-64 people:

- convert [us]32 to be unsigned /signed  int on both 32 and 64 bit platforms like is uint32_t in stdint.h.
- remove pointer typedef, likely cause of 32 bit / 64 bit issues but currently not used.

Please be patient if something is broken :)
This commit is contained in:
riccardom 2009-04-14 16:30:16 +00:00
parent 1704c79067
commit 813a3bbbff
6 changed files with 17 additions and 19 deletions

View File

@ -159,7 +159,7 @@ BOOL cheatsSave()
{ {
for (int t = 0; t < cheats[i].num; t++) for (int t = 0; t < cheats[i].num; t++)
{ {
fprintf(fcheat, "Data=%08lX%08lX", cheats[i].hi[t], cheats[i].lo[t]); fprintf(fcheat, "Data=%08X%08X", cheats[i].hi[t], cheats[i].lo[t]);
if (t < (cheats[i].num - 1)) fputs(",", fcheat); if (t < (cheats[i].num - 1)) fputs(",", fcheat);
} }
fputs("\n", fcheat); fputs("\n", fcheat);
@ -226,10 +226,10 @@ BOOL cheatsLoad()
for (int j=0; j<cheats[last].num; j++) for (int j=0; j<cheats[last].num; j++)
{ {
strncpy(tmp_buf, (char *)buf+offs, 8); strncpy(tmp_buf, (char *)buf+offs, 8);
sscanf_s(tmp_buf, "%lx", &cheats[last].hi[j]); sscanf_s(tmp_buf, "%x", &cheats[last].hi[j]);
offs+=8; offs+=8;
strncpy(tmp_buf, (char *)buf+offs, 8); strncpy(tmp_buf, (char *)buf+offs, 8);
sscanf_s(tmp_buf, "%lx", &cheats[last].lo[j]); sscanf_s(tmp_buf, "%x", &cheats[last].lo[j]);
offs++; // skip comma offs++; // skip comma
} }
} }

View File

@ -80,9 +80,9 @@ static void update_regs_fast(){
if (w == m) continue; if (w == m) continue;
if ( Reg_Names_Addr[i].trunc ) if ( Reg_Names_Addr[i].trunc )
sprintf(text, " 0x%04lX", w); sprintf(text, " 0x%04X", w);
else else
sprintf(text, "0x%08lX", w); sprintf(text, "0x%08X", w);
dTools_display_select_attr(&dsp, 2); dTools_display_select_attr(&dsp, 2);
dTools_display_clear_char(&dsp, size_+3, i, 10); dTools_display_clear_char(&dsp, size_+3, i, 10);
@ -116,9 +116,9 @@ static void update_regs()
{ {
mem[i] = MMU_read32(cpu,Reg_Names_Addr[i].addr); mem[i] = MMU_read32(cpu,Reg_Names_Addr[i].addr);
if ( Reg_Names_Addr[i].trunc ) if ( Reg_Names_Addr[i].trunc )
sprintf(text, " 0x%04lX", mem[i]); sprintf(text, " 0x%04X", mem[i]);
else else
sprintf(text, "0x%08lX", mem[i]); sprintf(text, "0x%08X", mem[i]);
dTools_display_select_attr(&dsp, 0); dTools_display_select_attr(&dsp, 0);
dTools_display_draw_text(&dsp, 0, i, Reg_Names_Addr[i].name); dTools_display_draw_text(&dsp, 0, i, Reg_Names_Addr[i].name);

View File

@ -89,7 +89,7 @@ static void wtools_2_update() {
for (j=0; j<16; j+=4, addr+=4,mem32++) { for (j=0; j<16; j+=4, addr+=4,mem32++) {
m32 = *mem32; *mem32 = MMU_read32(cpu, addr); m32 = *mem32; *mem32 = MMU_read32(cpu, addr);
if (m32 != *mem32) { if (m32 != *mem32) {
sprintf(txt, " %08lX", *mem32); sprintf(txt, " %08X", *mem32);
dTools_display_clear_char(&dsp, 12+3*j, i, 12); dTools_display_clear_char(&dsp, 12+3*j, i, 12);
dTools_display_draw_text(&dsp, 12+3*j, i, txt); dTools_display_draw_text(&dsp, 12+3*j, i, txt);
} }
@ -273,7 +273,7 @@ static void refresh() {
break; break;
case Bit32: case Bit32:
for (j=0; j<16; j+=4,ptxt+=12, mem32++) for (j=0; j<16; j+=4,ptxt+=12, mem32++)
sprintf(ptxt, " %08lX ", *mem32); sprintf(ptxt, " %08X ", *mem32);
break; break;
} }
sprintf(ptxt, "| "); ptxt +=2; sprintf(ptxt, "| "); ptxt +=2;

View File

@ -376,13 +376,13 @@ static void selected_reg(GtkWidget* widget, gpointer data)
switch (current_reg[c]->size) { switch (current_reg[c]->size) {
case BITS_8: case BITS_8:
regInfosBuffer = g_strdup_printf("0x%02lX", current_reg[c]->value(c)); regInfosBuffer = g_strdup_printf("0x%02X", current_reg[c]->value(c));
break; break;
case BITS_16: case BITS_16:
regInfosBuffer = g_strdup_printf("0x%04lX", current_reg[c]->value(c)); regInfosBuffer = g_strdup_printf("0x%04X", current_reg[c]->value(c));
break; break;
default: default:
regInfosBuffer = g_strdup_printf("0x%08lX", current_reg[c]->value(c)); regInfosBuffer = g_strdup_printf("0x%08X", current_reg[c]->value(c));
} }
// gtk_box_pack_start(GTK_BOX(mVbox0[c]), mRegInfos[c], FALSE, FALSE, 0); // gtk_box_pack_start(GTK_BOX(mVbox0[c]), mRegInfos[c], FALSE, FALSE, 0);
gtk_label_set_label(GTK_LABEL(mRegInfos[c]), regInfosBuffer); gtk_label_set_label(GTK_LABEL(mRegInfos[c]), regInfosBuffer);
@ -450,7 +450,7 @@ static void open(int ID)
for(i = 0; i < GET_REG_LIST_SIZE(c); i++) for(i = 0; i < GET_REG_LIST_SIZE(c); i++)
{ {
gchar *reg_name_buffer; gchar *reg_name_buffer;
reg_name_buffer = g_strdup_printf("0x%08lX : %s (%s)", GET_REG_LIST(c)[i].adress, GET_REG_LIST(c)[i].name, bits_strings[GET_REG_LIST(c)[i].size]); reg_name_buffer = g_strdup_printf("0x%08X : %s (%s)", GET_REG_LIST(c)[i].adress, GET_REG_LIST(c)[i].name, bits_strings[GET_REG_LIST(c)[i].size]);
gtk_combo_box_append_text(GTK_COMBO_BOX(mIoRegCombo[c]), reg_name_buffer); gtk_combo_box_append_text(GTK_COMBO_BOX(mIoRegCombo[c]), reg_name_buffer);
g_free(reg_name_buffer); g_free(reg_name_buffer);
} }

View File

@ -133,26 +133,24 @@ typedef unsigned char u8;
typedef unsigned short u16; typedef unsigned short u16;
typedef unsigned int u32; typedef unsigned int u32;
typedef unsigned long u64; typedef unsigned long u64;
typedef unsigned long pointer;
typedef signed char s8; typedef signed char s8;
typedef signed short s16; typedef signed short s16;
typedef signed int s32; typedef signed int s32;
typedef signed long s64; typedef signed long long s64;
#else #else
typedef unsigned char u8; typedef unsigned char u8;
typedef unsigned short u16; typedef unsigned short u16;
typedef unsigned long u32; typedef unsigned int u32;
#if defined(_MSC_VER) || defined(__INTEL_COMPILER) #if defined(_MSC_VER) || defined(__INTEL_COMPILER)
typedef unsigned __int64 u64; typedef unsigned __int64 u64;
#else #else
typedef unsigned long long u64; typedef unsigned long long u64;
#endif #endif
typedef unsigned long pointer;
typedef signed char s8; typedef signed char s8;
typedef signed short s16; typedef signed short s16;
typedef signed long s32; typedef signed int s32;
#if defined(_MSC_VER) || defined(__INTEL_COMPILER) #if defined(_MSC_VER) || defined(__INTEL_COMPILER)
typedef __int64 s64; typedef __int64 s64;
#else #else

View File

@ -32,7 +32,7 @@ void Desmume_Guid::newGuid()
std::string Desmume_Guid::toString() std::string Desmume_Guid::toString()
{ {
char buf[37]; char buf[37];
sprintf(buf,"%08lX-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X", sprintf(buf,"%08X-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X",
de32lsb(data),de16lsb(data+4),de16lsb(data+6),de16lsb(data+8),data[10],data[11],data[12],data[13],data[14],data[15]); de32lsb(data),de16lsb(data+4),de16lsb(data+6),de16lsb(data+8),data[10],data[11],data[12],data[13],data[14],data[15]);
return std::string(buf); return std::string(buf);
} }