diff --git a/desmume/src/firmware.cpp b/desmume/src/firmware.cpp index 55d68d0b0..e6f260ced 100644 --- a/desmume/src/firmware.cpp +++ b/desmume/src/firmware.cpp @@ -249,7 +249,7 @@ bool CFIRMWARE::load() if (CommonSettings.UseExtFirmware == false) return false; - if (CommonSettings.Firmware[0] == 0) + if (strlen(CommonSettings.Firmware) == 0) return false; FILE *fp = fopen(CommonSettings.Firmware, "rb"); diff --git a/desmume/src/path.h b/desmume/src/path.h index bdd4ffcbe..3494d2956 100644 --- a/desmume/src/path.h +++ b/desmume/src/path.h @@ -193,7 +193,7 @@ public: void ReadPathSettings() { - if (pathToModule[0] == 0) + if( ( strcmp(pathToModule, "") == 0) || !pathToModule) LoadModulePath(); ReadKey(pathToRoms, ROMKEY); diff --git a/desmume/src/texcache.cpp b/desmume/src/texcache.cpp index 2ecdc7f7e..fdb577743 100644 --- a/desmume/src/texcache.cpp +++ b/desmume/src/texcache.cpp @@ -645,7 +645,7 @@ public: { u16 c = map[x]; int alpha = ((c&0x8000)?opaqueColor:0); - *dwdst++ = CONVERT(c,alpha); + *dwdst++ = CONVERT(c&0x7FFF,alpha); } } break; diff --git a/desmume/src/windows/cheatsWin.cpp b/desmume/src/windows/cheatsWin.cpp index cfa21540e..68da029db 100644 --- a/desmume/src/windows/cheatsWin.cpp +++ b/desmume/src/windows/cheatsWin.cpp @@ -48,7 +48,7 @@ static u8 searchAddSize = 0; static const char* searchAddDesc = 0; static char editBuf[3][75] = { 0 }; static u32 cheatEditPos = 0; -static bool cheatAddPasteCheck = false; +static u8 cheatAddPasteCheck = 0; static u8 cheatXXtype = 0; static u8 cheatXXaction = 0; @@ -267,7 +267,7 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam if(cheatAddPasteCheck) { - cheatAddPasteCheck = false; + cheatAddPasteCheck = 0; char temp [12]; sprintf(temp, "%06X", val); if(strcmp(editBuf[0], temp)) @@ -297,7 +297,7 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam if(cheatAddPasteCheck || parseOffset) { - cheatAddPasteCheck = false; + cheatAddPasteCheck = 0; val &= searchRange[searchAddSize][1]; char temp [12]; sprintf(temp, "%u", val); @@ -374,8 +374,8 @@ INT_PTR CALLBACK CheatsEditProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpara cheats->get(&tempCheat, cheatEditPos); - memset(&buf[0], 0, sizeof(buf)); - memset(&buf2[0], 0, sizeof(buf2)); + memset(buf, 0, 100); + memset(buf2, 0, 100); tempCheat.code[0][0] &= 0x00FFFFFF; wsprintf(buf, "%06X", tempCheat.code[0][0]); SetWindowText(GetDlgItem(dialog, IDC_EDIT1), buf); @@ -443,7 +443,7 @@ INT_PTR CALLBACK CheatsEditProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpara if(cheatAddPasteCheck || parseOffset) { - cheatAddPasteCheck = false; + cheatAddPasteCheck = 0; val &= searchRange[tempCheat.size][1]; char temp [12]; sprintf(temp, "%u", val); @@ -1151,8 +1151,8 @@ INT_PTR CALLBACK CheatsSearchViewWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM while (cheatSearch->getList(&address, &val)) { char buf[256]; - sprintf(buf, "0x02%06X", address); - lvi.pszText = buf; + wsprintf(buf, "0x02%06X", address); + lvi.pszText= buf; u32 row = SendMessage(searchListView, LVM_INSERTITEM, 0, (LPARAM)&lvi); _ltoa(val, buf, 10); ListView_SetItemText(searchListView, row, 1, buf); @@ -1379,7 +1379,7 @@ INT_PTR CALLBACK CheatsExportProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpa case WM_INITDIALOG: { SetWindowText(GetDlgItem(dialog, IDC_CDATE), (LPCSTR)cheatsExport->date); - if (cheatsExport->gametitle[0] != 0) + if ((char*)cheatsExport->gametitle != "") { char buf[512] = {0}; GetWindowText(dialog, &buf[0], sizeof(buf)); diff --git a/desmume/src/windows/gbaslot_config.cpp b/desmume/src/windows/gbaslot_config.cpp index 18c65d133..1ffd78a02 100644 --- a/desmume/src/windows/gbaslot_config.cpp +++ b/desmume/src/windows/gbaslot_config.cpp @@ -248,7 +248,7 @@ INT_PTR CALLBACK GbaSlotGBAgame(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpara case WM_INITDIALOG: { SetWindowText(GetDlgItem(dialog, IDC_PATHGAME), tmp_gbagame_filename); - _OKbutton = (tmp_gbagame_filename[0] != 0)?true:false; + if (strlen(tmp_gbagame_filename) > 0) _OKbutton = true; return TRUE; } case WM_COMMAND: @@ -349,7 +349,7 @@ INT_PTR CALLBACK GbaSlotGuitarGrip(HWND dialog, UINT msg,WPARAM wparam,LPARAM lp SendDlgItemMessage(dialog,IDC_GYELLOW,WM_USER+44,tmp_Guitar.YELLOW,0); SendDlgItemMessage(dialog,IDC_GBLUE,WM_USER+44,tmp_Guitar.BLUE,0); PostMessage(dialog,WM_NEXTDLGCTL,0,0); - return TRUE; + return true; } return FALSE; } @@ -435,7 +435,7 @@ INT_PTR CALLBACK GbaSlotPiano(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) SendDlgItemMessage(dialog,IDC_PIANO_B,WM_USER+44,tmp_Piano.B,0); SendDlgItemMessage(dialog,IDC_PIANO_HIC,WM_USER+44,tmp_Piano.HIC,0); PostMessage(dialog,WM_NEXTDLGCTL,0,0); - return TRUE; + return true; } return FALSE; } diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 902ff6c3a..e823cfdcc 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -556,7 +556,7 @@ static void InputTimer() bool S9xGetState (WORD KeyIdent); static DWORD lastTime = timeGetTime(); - DWORD currentTime = lastTime; + DWORD currentTime = timeGetTime(); static struct JoyState { bool wasPressed; @@ -4196,7 +4196,7 @@ void ScreenshotToClipboard(bool extraInfo) else TextOut(hMemDC, 0, 384 + 14, nameandver, strlen(nameandver)); - char str[38]; + char str[32]; memcpy(&str[0], &MMU.CART_ROM[0], 12); str[12] = '\0'; int titlelen = strlen(str); str[titlelen] = ' '; diff --git a/desmume/src/windows/slot1_config.cpp b/desmume/src/windows/slot1_config.cpp index 8aad08642..f36cbe066 100644 --- a/desmume/src/windows/slot1_config.cpp +++ b/desmume/src/windows/slot1_config.cpp @@ -105,7 +105,7 @@ INT_PTR CALLBACK Slot1R4(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) case WM_INITDIALOG: { SetWindowText(GetDlgItem(dialog, IDC_PATH), tmp_fat_path); - _OKbutton_slot1 = (tmp_fat_path[0] != 0); + _OKbutton_slot1 = (tmp_fat_path!=""); return TRUE; }