Add UNICODE to Project64 project

This commit is contained in:
zilmar 2020-05-12 21:49:05 +09:30
parent 0429c207e6
commit 0462f637c4
73 changed files with 1047 additions and 1061 deletions

View File

@ -2521,15 +2521,6 @@ public:
return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat);
} }
int DrawTextW(LPCWSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat)
{
ATLASSERT(m_hDC != NULL);
#ifndef _WIN32_WCE
ATLASSERT((uFormat & DT_MODIFYSTRING) == 0);
#endif // !_WIN32_WCE
return ::DrawTextW(m_hDC, lpstrText, cchText, lpRect, uFormat);
}
int DrawText(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat) int DrawText(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat)
{ {
ATLASSERT(m_hDC != NULL); ATLASSERT(m_hDC != NULL);

View File

@ -230,7 +230,7 @@ stdstr & stdstr::FromUTF16(const wchar_t * UTF16Source, bool * bSuccess)
return *this; return *this;
} }
std::wstring stdstr::ToUTF16(unsigned int CodePage, bool * bSuccess) std::wstring stdstr::ToUTF16(unsigned int CodePage, bool * bSuccess) const
{ {
bool bConverted = false; bool bConverted = false;
std::wstring res; std::wstring res;

View File

@ -40,7 +40,7 @@ public:
#ifdef _WIN32 #ifdef _WIN32
stdstr & FromUTF16(const wchar_t * UTF16Source, bool * bSuccess = NULL); stdstr & FromUTF16(const wchar_t * UTF16Source, bool * bSuccess = NULL);
std::wstring ToUTF16(unsigned int CodePage = CODEPAGE_UTF8, bool * bSuccess = NULL); std::wstring ToUTF16(unsigned int CodePage = CODEPAGE_UTF8, bool * bSuccess = NULL) const;
#endif #endif
void ArgFormat(const char * strFormat, va_list & args); void ArgFormat(const char * strFormat, va_list & args);

View File

@ -292,7 +292,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
char InternalName[22]; char InternalName[22];
memcpy(InternalName, (void *)(RomData + 0x20), 20); memcpy(InternalName, (void *)(RomData + 0x20), 20);
CN64Rom::CleanRomName(InternalName); CN64Rom::CleanRomName(InternalName);
strcpy(RomInfo.InternalName, InternalName); strcpy(RomInfo.InternalName, stdstr(InternalName).c_str());
} }
RomInfo.RomSize = (int32_t)f->Size; RomInfo.RomSize = (int32_t)f->Size;

View File

@ -60,7 +60,7 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc(HWND hDlg, UINT uMsg, WPARAM
BITMAP bmTL; BITMAP bmTL;
GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL); GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL);
hTextFont = ::CreateFont(18, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial"); hTextFont = ::CreateFont(18, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial");
SendDlgItemMessage(hDlg, IDC_SELECT_LANG, WM_SETFONT, (WPARAM)hTextFont, TRUE); SendDlgItemMessage(hDlg, IDC_SELECT_LANG, WM_SETFONT, (WPARAM)hTextFont, TRUE);
} }
break; break;

View File

@ -75,7 +75,7 @@ void CPluginList::AddPluginFromDir(CPath Dir)
//UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS ); //UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS );
WriteTrace(TraceUserInterface, TraceDebug, "loading %s", (LPCSTR)Dir); WriteTrace(TraceUserInterface, TraceDebug, "loading %s", (LPCSTR)Dir);
hLib = LoadLibrary(Dir); hLib = LoadLibrary(stdstr((LPCSTR)Dir).ToUTF16().c_str());
//SetErrorMode(LastErrorMode); //SetErrorMode(LastErrorMode);
if (hLib == NULL) if (hLib == NULL)

View File

@ -46,6 +46,9 @@
<Manifest Condition="'$(PlatformToolset)'!='v90'"> <Manifest Condition="'$(PlatformToolset)'!='v90'">
<EnableDPIAwareness>true</EnableDPIAwareness> <EnableDPIAwareness>true</EnableDPIAwareness>
</Manifest> </Manifest>
<ClCompile>
<PreprocessorDefinitions>UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="UserInterface\Debugger\CPULog.cpp" /> <ClCompile Include="UserInterface\Debugger\CPULog.cpp" />

View File

@ -43,10 +43,10 @@ void CCheatsUI::AddCodeLayers(int CheatNumber, const stdstr &CheatName, HWND hPa
TV_INSERTSTRUCT tv; TV_INSERTSTRUCT tv;
//Work out text to add //Work out text to add
char Text[500], Item[500]; wchar_t Text[500], Item[500];
if (CheatName.length() > (sizeof(Text) - 5)) { g_Notify->BreakPoint(__FILE__, __LINE__); } if (CheatName.length() > (sizeof(Text) - 5)) { g_Notify->BreakPoint(__FILE__, __LINE__); }
strcpy(Text, CheatName.c_str()); wcscpy(Text, CheatName.ToUTF16().c_str());
if (strchr(Text, '\\') > 0) { *strchr(Text, '\\') = 0; } if (wcschr(Text, L'\\') > 0) { *wcschr(Text, L'\\') = 0; }
//See if text is already added //See if text is already added
tv.item.mask = TVIF_TEXT; tv.item.mask = TVIF_TEXT;
@ -56,7 +56,7 @@ void CCheatsUI::AddCodeLayers(int CheatNumber, const stdstr &CheatName, HWND hPa
while (tv.item.hItem) while (tv.item.hItem)
{ {
TreeView_GetItem(m_hCheatTree, &tv.item); TreeView_GetItem(m_hCheatTree, &tv.item);
if (strcmp(Text, Item) == 0) if (wcscmp(Text, Item) == 0)
{ {
//If already exists then just use existing one //If already exists then just use existing one
int State = TV_GetCheckState(m_hCheatTree, (HWND)tv.item.hItem); int State = TV_GetCheckState(m_hCheatTree, (HWND)tv.item.hItem);
@ -64,7 +64,7 @@ void CCheatsUI::AddCodeLayers(int CheatNumber, const stdstr &CheatName, HWND hPa
{ {
TV_SetCheckState(m_hCheatTree, (HWND)tv.item.hItem, TV_STATE_INDETERMINATE); TV_SetCheckState(m_hCheatTree, (HWND)tv.item.hItem, TV_STATE_INDETERMINATE);
} }
size_t StartPos = strlen(Text) + 1; size_t StartPos = wcslen(Text) + 1;
stdstr TempCheatName; stdstr TempCheatName;
if (StartPos < CheatName.length()) if (StartPos < CheatName.length())
{ {
@ -85,8 +85,8 @@ void CCheatsUI::AddCodeLayers(int CheatNumber, const stdstr &CheatName, HWND hPa
hParent = (HWND)TreeView_InsertItem(m_hCheatTree, &tv); hParent = (HWND)TreeView_InsertItem(m_hCheatTree, &tv);
TV_SetCheckState(m_hCheatTree, hParent, CheatActive ? TV_STATE_CHECKED : TV_STATE_CLEAR); TV_SetCheckState(m_hCheatTree, hParent, CheatActive ? TV_STATE_CHECKED : TV_STATE_CLEAR);
if (strcmp(Text, CheatName.c_str()) == 0) { return; } if (wcscmp(Text, CheatName.ToUTF16().c_str()) == 0) { return; }
AddCodeLayers(CheatNumber, (stdstr)(CheatName.substr(strlen(Text) + 1)), hParent, CheatActive); AddCodeLayers(CheatNumber, (stdstr)(CheatName.substr(wcslen(Text) + 1)), hParent, CheatActive);
} }
void CCheatsUI::RefreshCheatManager() void CCheatsUI::RefreshCheatManager()
@ -114,11 +114,11 @@ stdstr CCheatsUI::GetDlgItemStr(HWND hDlg, int nIDDlgItem)
return ""; return "";
} }
stdstr Result; std::wstring Result;
Result.resize(length + 1); Result.resize(length + 1);
GetWindowText(hDlgItem, (char *)Result.c_str(), Result.length()); GetWindowText(hDlgItem, (wchar_t *)Result.c_str(), Result.length());
return Result; return stdstr().FromUTF16(Result.c_str());
} }
void CCheatsUI::SelectCheats(HWND hParent, bool BlockExecution) void CCheatsUI::SelectCheats(HWND hParent, bool BlockExecution)
@ -186,7 +186,7 @@ int CALLBACK CCheatsUI::CheatAddProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
CCheatsUI * _this = (CCheatsUI *)lParam; CCheatsUI * _this = (CCheatsUI *)lParam;
SetProp(hDlg, "Class", _this); SetProp(hDlg, L"Class", _this);
SetWindowTextW(GetDlgItem(hDlg, IDC_NAME), wGS(CHEAT_ADDCHEAT_NAME).c_str()); SetWindowTextW(GetDlgItem(hDlg, IDC_NAME), wGS(CHEAT_ADDCHEAT_NAME).c_str());
SetWindowTextW(GetDlgItem(hDlg, IDC_CODE), wGS(CHEAT_ADDCHEAT_CODE).c_str()); SetWindowTextW(GetDlgItem(hDlg, IDC_CODE), wGS(CHEAT_ADDCHEAT_CODE).c_str());
@ -196,7 +196,7 @@ int CALLBACK CCheatsUI::CheatAddProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
SetWindowTextW(GetDlgItem(hDlg, IDC_CHEATNOTES), wGS(CHEAT_ADDCHEAT_NOTES).c_str()); SetWindowTextW(GetDlgItem(hDlg, IDC_CHEATNOTES), wGS(CHEAT_ADDCHEAT_NOTES).c_str());
SetWindowTextW(GetDlgItem(hDlg, IDC_NEWCHEAT), wGS(CHEAT_ADDCHEAT_NEW).c_str()); SetWindowTextW(GetDlgItem(hDlg, IDC_NEWCHEAT), wGS(CHEAT_ADDCHEAT_NEW).c_str());
SetWindowTextW(GetDlgItem(hDlg, IDC_ADD), wGS(CHEAT_ADDCHEAT_ADD).c_str()); SetWindowTextW(GetDlgItem(hDlg, IDC_ADD), wGS(CHEAT_ADDCHEAT_ADD).c_str());
SetProp(hDlg, "validcodes", false); SetProp(hDlg, L"validcodes", false);
_this->RecordCheatValues(hDlg); _this->RecordCheatValues(hDlg);
} }
break; break;
@ -279,7 +279,7 @@ int CALLBACK CCheatsUI::CheatAddProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
break; break;
case IDC_ADD: case IDC_ADD:
{ {
CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, "Class"); CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, L"Class");
stdstr NewCheatName = GetDlgItemStr(hDlg, IDC_CODE_NAME); stdstr NewCheatName = GetDlgItemStr(hDlg, IDC_CODE_NAME);
int i = 0; int i = 0;
@ -327,17 +327,17 @@ int CALLBACK CCheatsUI::CheatAddProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
break; break;
case IDC_NEWCHEAT: case IDC_NEWCHEAT:
{ {
CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, "Class"); CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, L"Class");
if (_this->CheatChanged(hDlg)) if (_this->CheatChanged(hDlg))
{ {
break; break;
} }
_this->m_EditCheat = -1; _this->m_EditCheat = -1;
SetDlgItemText(hDlg, IDC_CODE_NAME, ""); SetDlgItemText(hDlg, IDC_CODE_NAME, L"");
SetDlgItemText(hDlg, IDC_CHEAT_CODES, ""); SetDlgItemText(hDlg, IDC_CHEAT_CODES, L"");
SetDlgItemText(hDlg, IDC_CHEAT_OPTIONS, ""); SetDlgItemText(hDlg, IDC_CHEAT_OPTIONS, L"");
SetDlgItemText(hDlg, IDC_NOTES, ""); SetDlgItemText(hDlg, IDC_NOTES, L"");
EnableWindow(GetDlgItem(hDlg, IDC_ADD), false); EnableWindow(GetDlgItem(hDlg, IDC_ADD), false);
EnableWindow(GetDlgItem(hDlg, IDC_CHEAT_OPTIONS), false); EnableWindow(GetDlgItem(hDlg, IDC_CHEAT_OPTIONS), false);
SetDlgItemTextW(hDlg, IDC_ADD, wGS(CHEAT_ADDNEW).c_str()); SetDlgItemTextW(hDlg, IDC_ADD, wGS(CHEAT_ADDNEW).c_str());
@ -349,7 +349,7 @@ int CALLBACK CCheatsUI::CheatAddProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
break; break;
case WM_EDITCHEAT: case WM_EDITCHEAT:
{ {
CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, "Class"); CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, L"Class");
_this->m_EditCheat = wParam; _this->m_EditCheat = wParam;
if (_this->m_EditCheat < 0) if (_this->m_EditCheat < 0)
{ {
@ -368,7 +368,7 @@ int CALLBACK CCheatsUI::CheatAddProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
int len = strrchr(String, '"') - strchr(String, '"') - 1; int len = strrchr(String, '"') - strchr(String, '"') - 1;
stdstr CheatName(strchr(String, '"') + 1); stdstr CheatName(strchr(String, '"') + 1);
CheatName.resize(len); CheatName.resize(len);
SetDlgItemText(hDlg, IDC_CODE_NAME, CheatName.c_str()); SetDlgItemText(hDlg, IDC_CODE_NAME, CheatName.ToUTF16().c_str());
//Add Gameshark codes to screen //Add Gameshark codes to screen
const char * ReadPos = strrchr(String, '"') + 2; const char * ReadPos = strrchr(String, '"') + 2;
@ -392,7 +392,7 @@ int CALLBACK CCheatsUI::CheatAddProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
ReadPos += 1; ReadPos += 1;
} }
} while (ReadPos); } while (ReadPos);
SetDlgItemText(hDlg, IDC_CHEAT_CODES, Buffer.c_str()); SetDlgItemText(hDlg, IDC_CHEAT_CODES, Buffer.ToUTF16().c_str());
//Add option values to screen //Add option values to screen
stdstr CheatOptionStr = g_Settings->LoadStringIndex(Cheat_Options, _this->m_EditCheat); stdstr CheatOptionStr = g_Settings->LoadStringIndex(Cheat_Options, _this->m_EditCheat);
@ -420,11 +420,11 @@ int CALLBACK CCheatsUI::CheatAddProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
} }
} while (ReadPos); } while (ReadPos);
} }
SetDlgItemText(hDlg, IDC_CHEAT_OPTIONS, Buffer.c_str()); SetDlgItemText(hDlg, IDC_CHEAT_OPTIONS, Buffer.ToUTF16().c_str());
//Add cheat Notes //Add cheat Notes
stdstr CheatNotesStr = g_Settings->LoadStringIndex(Cheat_Notes, _this->m_EditCheat); stdstr CheatNotesStr = g_Settings->LoadStringIndex(Cheat_Notes, _this->m_EditCheat);
SetDlgItemText(hDlg, IDC_NOTES, CheatNotesStr.c_str()); SetDlgItemText(hDlg, IDC_NOTES, CheatNotesStr.ToUTF16().c_str());
SendMessage(hDlg, WM_COMMAND, MAKELPARAM(IDC_CHEAT_CODES, EN_CHANGE), (LPARAM)GetDlgItem(hDlg, IDC_CHEAT_CODES)); SendMessage(hDlg, WM_COMMAND, MAKELPARAM(IDC_CHEAT_CODES, EN_CHANGE), (LPARAM)GetDlgItem(hDlg, IDC_CHEAT_CODES));
SetDlgItemTextW(hDlg, IDC_ADD, wGS(CHEAT_EDITCHEAT_UPDATE).c_str()); SetDlgItemTextW(hDlg, IDC_ADD, wGS(CHEAT_EDITCHEAT_UPDATE).c_str());
@ -445,7 +445,7 @@ int CALLBACK CCheatsUI::CheatListProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
CCheatsUI * _this = (CCheatsUI *)lParam; CCheatsUI * _this = (CCheatsUI *)lParam;
SetProp(hDlg, "Class", _this); SetProp(hDlg, L"Class", _this);
uint32_t Style; uint32_t Style;
RECT rcList; RECT rcList;
@ -457,7 +457,7 @@ int CALLBACK CCheatsUI::CheatListProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
GetWindowRect(hDlg, &rcList); GetWindowRect(hDlg, &rcList);
GetWindowRect(GetDlgItem(hDlg, IDC_UNMARK), &rcButton); GetWindowRect(GetDlgItem(hDlg, IDC_UNMARK), &rcButton);
_this->m_hCheatTree = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, "", _this->m_hCheatTree = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, L"",
WS_CHILD | WS_VISIBLE | WS_VSCROLL | TVS_HASLINES | WS_CHILD | WS_VISIBLE | WS_VSCROLL | TVS_HASLINES |
TVS_HASBUTTONS | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | WS_TABSTOP | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | WS_TABSTOP |
TVS_FULLROWSELECT, 6, 4, rcList.right - rcList.left - 13, TVS_FULLROWSELECT, 6, 4, rcList.right - rcList.left - 13,
@ -481,7 +481,7 @@ int CALLBACK CCheatsUI::CheatListProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
break; break;
case WM_COMMAND: case WM_COMMAND:
{ {
CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, "Class"); CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, L"Class");
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
@ -514,7 +514,7 @@ int CALLBACK CCheatsUI::CheatListProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
break; break;
case WM_NOTIFY: case WM_NOTIFY:
{ {
CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, "Class"); CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, L"Class");
if (_this->m_DeleteingEntries) if (_this->m_DeleteingEntries)
{ {
@ -646,7 +646,7 @@ int CALLBACK CCheatsUI::CheatListProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
TreeView_GetItem(_this->m_hCheatTree, &item); TreeView_GetItem(_this->m_hCheatTree, &item);
stdstr Notes(g_Settings->LoadStringIndex(Cheat_Notes, item.lParam)); stdstr Notes(g_Settings->LoadStringIndex(Cheat_Notes, item.lParam));
SetDlgItemText(hDlg, IDC_NOTES, Notes.c_str()); SetDlgItemText(hDlg, IDC_NOTES, Notes.ToUTF16().c_str());
if (_this->m_AddCheat) if (_this->m_AddCheat)
{ {
SendMessage(_this->m_AddCheat, WM_EDITCHEAT, item.lParam, 0); //edit cheat SendMessage(_this->m_AddCheat, WM_EDITCHEAT, item.lParam, 0); //edit cheat
@ -654,15 +654,15 @@ int CALLBACK CCheatsUI::CheatListProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
} }
else else
{ {
SetDlgItemText(hDlg, IDC_NOTES, ""); SetDlgItemText(hDlg, IDC_NOTES, L"");
} }
} }
} }
break; break;
case UM_CHANGECODEEXTENSION: case UM_CHANGECODEEXTENSION:
{ {
CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, "Class"); CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, L"Class");
;
//Get the selected item //Get the selected item
_this->m_hSelectedItem = (HWND)lParam; _this->m_hSelectedItem = (HWND)lParam;
TVITEM item; TVITEM item;
@ -702,8 +702,9 @@ int CALLBACK CCheatsUI::CheatListProc(HWND hDlg, uint32_t uMsg, uint32_t wParam,
{ {
Cheat += 1; Cheat += 1;
} }
std::wstring wcCheat = stdstr(Cheat).ToUTF16();
item.mask = TVIF_TEXT; item.mask = TVIF_TEXT;
item.pszText = Cheat; item.pszText = (LPWSTR)wcCheat.c_str();
item.cchTextMax = CheatName.length(); item.cchTextMax = CheatName.length();
TreeView_SetItem(_this->m_hCheatTree, &item); TreeView_SetItem(_this->m_hCheatTree, &item);
} }
@ -721,7 +722,7 @@ int CALLBACK CCheatsUI::CheatsCodeExProc(HWND hDlg, uint32_t uMsg, uint32_t wPar
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
CCheatsUI * _this = (CCheatsUI *)lParam; CCheatsUI * _this = (CCheatsUI *)lParam;
SetProp(hDlg, "Class", _this); SetProp(hDlg, L"Class", _this);
//Find the cheat Number of the option being selected //Find the cheat Number of the option being selected
TVITEM item; TVITEM item;
@ -735,7 +736,7 @@ int CALLBACK CCheatsUI::CheatsCodeExProc(HWND hDlg, uint32_t uMsg, uint32_t wPar
SetDlgItemTextW(hDlg, IDC_NOTE, wGS(CHEAT_CODE_EXT_TXT).c_str()); SetDlgItemTextW(hDlg, IDC_NOTE, wGS(CHEAT_CODE_EXT_TXT).c_str());
SetDlgItemTextW(hDlg, IDOK, wGS(CHEAT_OK).c_str()); SetDlgItemTextW(hDlg, IDOK, wGS(CHEAT_OK).c_str());
SetDlgItemTextW(hDlg, IDCANCEL, wGS(CHEAT_CANCEL).c_str()); SetDlgItemTextW(hDlg, IDCANCEL, wGS(CHEAT_CANCEL).c_str());
SetDlgItemText(hDlg, IDC_CHEAT_NAME, CheatName.c_str()); SetDlgItemText(hDlg, IDC_CHEAT_NAME, CheatName.ToUTF16().c_str());
//Read through and add all options to the list box //Read through and add all options to the list box
stdstr Options(g_Settings->LoadStringIndex(Cheat_Options, item.lParam)); stdstr Options(g_Settings->LoadStringIndex(Cheat_Options, item.lParam));
@ -765,7 +766,7 @@ int CALLBACK CCheatsUI::CheatsCodeExProc(HWND hDlg, uint32_t uMsg, uint32_t wPar
break; break;
case IDOK: case IDOK:
{ {
CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, "Class"); CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, L"Class");
//Find the cheat Number of the option being selected //Find the cheat Number of the option being selected
TVITEM item; TVITEM item;
@ -785,11 +786,11 @@ int CALLBACK CCheatsUI::CheatsCodeExProc(HWND hDlg, uint32_t uMsg, uint32_t wPar
g_BaseSystem->SetCheatsSlectionChanged(true); g_BaseSystem->SetCheatsSlectionChanged(true);
} }
} }
RemoveProp(hDlg, "Class"); RemoveProp(hDlg, L"Class");
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
break; break;
case IDCANCEL: case IDCANCEL:
RemoveProp(hDlg, "Class"); RemoveProp(hDlg, L"Class");
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
break; break;
} }
@ -808,7 +809,7 @@ int CALLBACK CCheatsUI::CheatsCodeQuantProc(HWND hDlg, uint32_t uMsg, uint32_t w
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
CCheatsUI * _this = (CCheatsUI *)lParam; CCheatsUI * _this = (CCheatsUI *)lParam;
SetProp(hDlg, "Class", _this); SetProp(hDlg, L"Class", _this);
//Find the cheat Number of the option being selected //Find the cheat Number of the option being selected
TVITEM item; TVITEM item;
@ -825,9 +826,9 @@ int CALLBACK CCheatsUI::CheatsCodeQuantProc(HWND hDlg, uint32_t uMsg, uint32_t w
SetDlgItemTextW(hDlg, IDC_DIGITAL_TEXT, wGS(CHEAT_CHOOSE_VALUE).c_str()); SetDlgItemTextW(hDlg, IDC_DIGITAL_TEXT, wGS(CHEAT_CHOOSE_VALUE).c_str());
SetDlgItemTextW(hDlg, IDC_VALUE_TEXT, wGS(CHEAT_VALUE).c_str()); SetDlgItemTextW(hDlg, IDC_VALUE_TEXT, wGS(CHEAT_VALUE).c_str());
SetDlgItemTextW(hDlg, IDC_NOTES_TEXT, wGS(CHEAT_NOTES).c_str()); SetDlgItemTextW(hDlg, IDC_NOTES_TEXT, wGS(CHEAT_NOTES).c_str());
SetDlgItemText(hDlg, IDC_NOTES, RangeNote.c_str()); SetDlgItemText(hDlg, IDC_NOTES, RangeNote.ToUTF16().c_str());
SetDlgItemText(hDlg, IDC_CHEAT_NAME, CheatName.c_str()); SetDlgItemText(hDlg, IDC_CHEAT_NAME, CheatName.ToUTF16().c_str());
SetDlgItemText(hDlg, IDC_VALUE, Value.c_str()); SetDlgItemText(hDlg, IDC_VALUE, Value.ToUTF16().c_str());
Start = (uint16_t)(Range.c_str()[0] == '$' ? strtoul(&Range.c_str()[1], 0, 16) : atol(Range.c_str())); Start = (uint16_t)(Range.c_str()[0] == '$' ? strtoul(&Range.c_str()[1], 0, 16) : atol(Range.c_str()));
const char * ReadPos = strrchr(Range.c_str(), '-'); const char * ReadPos = strrchr(Range.c_str(), '-');
@ -842,7 +843,7 @@ int CALLBACK CCheatsUI::CheatsCodeQuantProc(HWND hDlg, uint32_t uMsg, uint32_t w
char Text[500]; char Text[500];
sprintf(Text, "%s $%X %s $%X", GS(CHEAT_FROM), Start, GS(CHEAT_TO), Stop); sprintf(Text, "%s $%X %s $%X", GS(CHEAT_FROM), Start, GS(CHEAT_TO), Stop);
SetDlgItemText(hDlg, IDC_RANGE, Text); SetDlgItemText(hDlg, IDC_RANGE, stdstr(Text).ToUTF16().c_str());
} }
break; break;
case WM_COMMAND: case WM_COMMAND:
@ -854,14 +855,14 @@ int CALLBACK CCheatsUI::CheatsCodeQuantProc(HWND hDlg, uint32_t uMsg, uint32_t w
TCHAR szTmp[10], szTmp2[10]; TCHAR szTmp[10], szTmp2[10];
uint32_t Value; uint32_t Value;
GetDlgItemText(hDlg, IDC_VALUE, szTmp, sizeof(szTmp)); GetDlgItemText(hDlg, IDC_VALUE, szTmp, sizeof(szTmp));
Value = szTmp[0] == '$' ? strtoul(&szTmp[1], 0, 16) : strtoul(&szTmp[0], 0, 16); Value = szTmp[0] == '$' ? wcstoul(&szTmp[1], 0, 16) : wcstoul(&szTmp[0], 0, 16);
if (Value > Stop) { Value = Stop; } if (Value > Stop) { Value = Stop; }
if (Value < Start) { Value = Start; } if (Value < Start) { Value = Start; }
sprintf(szTmp2, "$%X", Value); wsprintf(szTmp2, L"$%X", Value);
if (strcmp(szTmp, szTmp2) != 0) if (wcscmp(szTmp, szTmp2) != 0)
{ {
SetDlgItemText(hDlg, IDC_VALUE, szTmp2); SetDlgItemText(hDlg, IDC_VALUE, szTmp2);
if (SelStop == 0) { SelStop = (uint16_t)strlen(szTmp2); SelStart = SelStop; } if (SelStop == 0) { SelStop = (uint16_t)wcslen(szTmp2); SelStart = SelStop; }
SendDlgItemMessage(hDlg, IDC_VALUE, EM_SETSEL, (WPARAM)SelStart, (LPARAM)SelStop); SendDlgItemMessage(hDlg, IDC_VALUE, EM_SETSEL, (WPARAM)SelStart, (LPARAM)SelStop);
} }
else else
@ -874,7 +875,7 @@ int CALLBACK CCheatsUI::CheatsCodeQuantProc(HWND hDlg, uint32_t uMsg, uint32_t w
break; break;
case IDOK: case IDOK:
{ {
CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, "Class"); CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, L"Class");
//Find the cheat Number of the option being selected //Find the cheat Number of the option being selected
TVITEM item; TVITEM item;
@ -887,22 +888,22 @@ int CALLBACK CCheatsUI::CheatsCodeQuantProc(HWND hDlg, uint32_t uMsg, uint32_t w
uint32_t Value; uint32_t Value;
GetDlgItemText(hDlg, IDC_VALUE, szTmp, sizeof(szTmp)); GetDlgItemText(hDlg, IDC_VALUE, szTmp, sizeof(szTmp));
Value = szTmp[0] == '$' ? strtol(&szTmp[1], 0, 16) : strtol(&szTmp[0], 0, 16); Value = szTmp[0] == L'$' ? wcstol(&szTmp[1], 0, 16) : wcstol(&szTmp[0], 0, 16);
if (Value > Stop) { Value = Stop; } if (Value > Stop) { Value = Stop; }
if (Value < Start) { Value = Start; } if (Value < Start) { Value = Start; }
sprintf(CheatExten, "$%X", Value); wsprintf(CheatExten, L"$%X", Value);
g_Settings->SaveStringIndex(Cheat_Extension, item.lParam, CheatExten); g_Settings->SaveStringIndex(Cheat_Extension, item.lParam, stdstr().FromUTF16(CheatExten).c_str());
if (g_BaseSystem) if (g_BaseSystem)
{ {
g_BaseSystem->SetCheatsSlectionChanged(true); g_BaseSystem->SetCheatsSlectionChanged(true);
} }
} }
RemoveProp(hDlg, "Class"); RemoveProp(hDlg, L"Class");
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
break; break;
case IDCANCEL: case IDCANCEL:
RemoveProp(hDlg, "Class"); RemoveProp(hDlg, L"Class");
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
break; break;
} }
@ -928,7 +929,7 @@ int CALLBACK CCheatsUI::ManageCheatsProc(HWND hDlg, uint32_t uMsg, uint32_t wPar
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
CCheatsUI * _this = (CCheatsUI *)lParam; CCheatsUI * _this = (CCheatsUI *)lParam;
SetProp(hDlg, "Class", _this); SetProp(hDlg, L"Class", _this);
_this->m_Window = hDlg; _this->m_Window = hDlg;
WINDOWPLACEMENT WndPlac; WINDOWPLACEMENT WndPlac;
@ -998,14 +999,14 @@ int CALLBACK CCheatsUI::ManageCheatsProc(HWND hDlg, uint32_t uMsg, uint32_t wPar
{ {
case IDCANCEL: case IDCANCEL:
{ {
CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, "Class"); CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, L"Class");
if (_this->m_AddCheat) if (_this->m_AddCheat)
{ {
DestroyWindow(_this->m_AddCheat); DestroyWindow(_this->m_AddCheat);
_this->m_AddCheat = NULL; _this->m_AddCheat = NULL;
} }
_this->m_Window = NULL; _this->m_Window = NULL;
RemoveProp(hDlg, "Class"); RemoveProp(hDlg, L"Class");
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
if (g_BaseSystem) if (g_BaseSystem)
{ {
@ -1020,7 +1021,7 @@ int CALLBACK CCheatsUI::ManageCheatsProc(HWND hDlg, uint32_t uMsg, uint32_t wPar
break; break;
case IDC_STATE: case IDC_STATE:
{ {
CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, "Class"); CCheatsUI * _this = (CCheatsUI *)GetProp(hDlg, L"Class");
WINDOWPLACEMENT WndPlac; WINDOWPLACEMENT WndPlac;
WndPlac.length = sizeof(WndPlac); WndPlac.length = sizeof(WndPlac);
GetWindowPlacement(hDlg, &WndPlac); GetWindowPlacement(hDlg, &WndPlac);

View File

@ -23,7 +23,7 @@ uint32_t CAssembler::m_Address = 0;
char* CAssembler::m_TokContext = NULL; char* CAssembler::m_TokContext = NULL;
bool CAssembler::AssembleLine(char* line, uint32_t* opcode, uint32_t address) bool CAssembler::AssembleLine(const char* line, uint32_t* opcode, uint32_t address)
{ {
m_ParseError = ERR_NONE; m_ParseError = ERR_NONE;
m_Address = address; m_Address = address;

View File

@ -42,7 +42,7 @@ private:
static ASM_PARSE_ERROR m_ParseError; static ASM_PARSE_ERROR m_ParseError;
public: public:
static bool AssembleLine(char* line, uint32_t* opcode, uint32_t address = 0x00000000); static bool AssembleLine(const char* line, uint32_t* opcode, uint32_t address = 0x00000000);
private: private:

View File

@ -29,9 +29,9 @@ LRESULT CAddBreakpointDlg::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL&
{ {
case IDOK: case IDOK:
{ {
char addrStr[9]; wchar_t addrStr[9];
m_AddressEdit.GetWindowTextA(addrStr, 9); m_AddressEdit.GetWindowText(addrStr, 9);
uint32_t address = strtoul(addrStr, NULL, 16); uint32_t address = wcstoul(addrStr, NULL, 16);
CBreakpoints* breakpoints = m_Debugger->Breakpoints(); CBreakpoints* breakpoints = m_Debugger->Breakpoints();

View File

@ -31,10 +31,10 @@ LRESULT CAddSymbolDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l
{ {
break; break;
} }
m_TypeComboBox.AddString(typeName); m_TypeComboBox.AddString(stdstr(typeName).ToUTF16().c_str());
} }
m_AddressEdit.SetWindowTextA(""); m_AddressEdit.SetWindowText(L"");
m_AddressEdit.SetFocus(); m_AddressEdit.SetFocus();
if (m_bHaveAddress) if (m_bHaveAddress)
@ -64,33 +64,33 @@ LRESULT CAddSymbolDlg::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*
EndDialog(0); EndDialog(0);
break; break;
case IDOK: case IDOK:
int addrLen = m_AddressEdit.GetWindowTextLengthA(); int addrLen = m_AddressEdit.GetWindowTextLength();
if (!addrLen) if (!addrLen)
{ {
MessageBox("Address required", "Error", MB_OK); MessageBox(L"Address required", L"Error", MB_OK);
return 0; return 0;
} }
uint32_t address = m_AddressEdit.GetValue(); uint32_t address = m_AddressEdit.GetValue();
int type = m_TypeComboBox.GetCurSel(); int type = m_TypeComboBox.GetCurSel();
int nameLen = m_NameEdit.GetWindowTextLengthA(); int nameLen = m_NameEdit.GetWindowTextLength();
int descLen = m_DescriptionEdit.GetWindowTextLengthA(); int descLen = m_DescriptionEdit.GetWindowTextLength();
if (!nameLen && !descLen) if (!nameLen && !descLen)
{ {
MessageBox("Name and/or description required", "Error", MB_OK); MessageBox(L"Name and/or description required", L"Error", MB_OK);
return 0; return 0;
} }
char name[128]; wchar_t name[128];
char description[256]; wchar_t description[256];
m_NameEdit.GetWindowTextA(name, nameLen + 1); m_NameEdit.GetWindowText(name, nameLen + 1);
m_DescriptionEdit.GetWindowTextA(description, descLen + 1); m_DescriptionEdit.GetWindowText(description, descLen + 1);
m_Debugger->SymbolTable()->AddSymbol(type, address, name, description); m_Debugger->SymbolTable()->AddSymbol(type, address, stdstr().FromUTF16(name).c_str(), stdstr().FromUTF16(description).c_str());
m_Debugger->SymbolTable()->Save(); m_Debugger->SymbolTable()->Save();
m_Debugger->Debug_RefreshSymbolsWindow(); m_Debugger->Debug_RefreshSymbolsWindow();

View File

@ -50,9 +50,9 @@ LRESULT CDebugCPULogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
m_CPUListView.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); m_CPUListView.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
m_CPUListView.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0); m_CPUListView.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
m_CPUListView.AddColumn("PC", 0); m_CPUListView.AddColumn(L"PC", 0);
m_CPUListView.AddColumn("Command", 1); m_CPUListView.AddColumn(L"Command", 1);
m_CPUListView.AddColumn("Parameters", 2); m_CPUListView.AddColumn(L"Parameters", 2);
m_CPUListView.SetColumnWidth(0, 65); m_CPUListView.SetColumnWidth(0, 65);
m_CPUListView.SetColumnWidth(1, 60); m_CPUListView.SetColumnWidth(1, 60);
m_CPUListView.SetColumnWidth(2, 120); m_CPUListView.SetColumnWidth(2, 120);
@ -345,9 +345,9 @@ void CDebugCPULogView::RefreshList(bool bUpdateBuffer)
char* szCmdName = strtok_s((char*)szCommand, "\t", &tokctx); char* szCmdName = strtok_s((char*)szCommand, "\t", &tokctx);
char* szCmdArgs = strtok_s(NULL, "\t", &tokctx); char* szCmdArgs = strtok_s(NULL, "\t", &tokctx);
m_CPUListView.AddItem(nItem, 0, szPC); m_CPUListView.AddItem(nItem, 0, stdstr(szPC).ToUTF16().c_str());
m_CPUListView.AddItem(nItem, 1, szCmdName); m_CPUListView.AddItem(nItem, 1, stdstr(szCmdName).ToUTF16().c_str());
m_CPUListView.AddItem(nItem, 2, szCmdArgs); m_CPUListView.AddItem(nItem, 2, stdstr(szCmdArgs).ToUTF16().c_str());
nItem++; nItem++;
} }
@ -391,7 +391,7 @@ void CDebugCPULogView::ShowRegStates(size_t stateIndex)
out += sprintf(out, "FPCR: %08X\r\n", state->fpcr); out += sprintf(out, "FPCR: %08X\r\n", state->fpcr);
m_StateInfoEdit.SetWindowTextA(szRegStates); m_StateInfoEdit.SetWindowText(stdstr(szRegStates).ToUTF16().c_str());
} }
void CDebugCPULogView::Export(void) void CDebugCPULogView::Export(void)
@ -401,7 +401,7 @@ void CDebugCPULogView::Export(void)
return; return;
} }
OPENFILENAME openfilename; OPENFILENAMEA openfilename;
char filePath[255]; char filePath[255];
memset(&filePath, 0, sizeof(filePath)); memset(&filePath, 0, sizeof(filePath));
@ -417,7 +417,7 @@ void CDebugCPULogView::Export(void)
openfilename.nMaxFile = MAX_PATH; openfilename.nMaxFile = MAX_PATH;
openfilename.Flags = OFN_HIDEREADONLY; openfilename.Flags = OFN_HIDEREADONLY;
if (GetSaveFileName(&openfilename)) if (GetSaveFileNameA(&openfilename))
{ {
m_CPULogCopy->DumpToFile(filePath); m_CPULogCopy->DumpToFile(filePath);
} }

View File

@ -26,19 +26,19 @@ void CCommandList::Attach(HWND hWndNew)
ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0); ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP); SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP);
AddColumn("", COL_ARROWS); AddColumn(L"", COL_ARROWS);
SetColumnWidth(COL_ARROWS, 30); SetColumnWidth(COL_ARROWS, 30);
AddColumn("Address", COL_ADDRESS); AddColumn(L"Address", COL_ADDRESS);
SetColumnWidth(COL_ADDRESS, 70); SetColumnWidth(COL_ADDRESS, 70);
AddColumn("Command", COL_COMMAND); AddColumn(L"Command", COL_COMMAND);
SetColumnWidth(COL_COMMAND, 65); SetColumnWidth(COL_COMMAND, 65);
AddColumn("Parameters", COL_PARAMETERS); AddColumn(L"Parameters", COL_PARAMETERS);
SetColumnWidth(COL_PARAMETERS, 130); SetColumnWidth(COL_PARAMETERS, 130);
AddColumn("Symbol", COL_SYMBOL); AddColumn(L"Symbol", COL_SYMBOL);
SetColumnWidth(COL_SYMBOL, 180); SetColumnWidth(COL_SYMBOL, 180);
} }
@ -173,10 +173,10 @@ void CDebugCommandsView::RecompilerCheck(void)
!g_Settings->LoadBool(Setting_ForceInterpreterCPU) && !g_Settings->LoadBool(Setting_ForceInterpreterCPU) &&
(CPU_TYPE)g_Settings->LoadDword(Game_CpuType) != CPU_Interpreter) (CPU_TYPE)g_Settings->LoadDword(Game_CpuType) != CPU_Interpreter)
{ {
MessageBox("Debugger support for the recompiler core is experimental.\n\n" MessageBox(L"Debugger support for the recompiler core is experimental.\n\n"
"For optimal experience, enable \"Always use interpreter core\" " L"For optimal experience, enable \"Always use interpreter core\" "
"in advanced settings and restart the emulator.", L"in advanced settings and restart the emulator.",
"Warning", MB_ICONWARNING | MB_OK); L"Warning", MB_ICONWARNING | MB_OK);
} }
} }
@ -271,13 +271,13 @@ LRESULT CDebugCommandsView::OnOpKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*l
} }
else if (wParam == VK_RETURN) else if (wParam == VK_RETURN)
{ {
char text[256] = { 0 }; wchar_t text[256] = { 0 };
m_OpEdit.GetWindowTextA(text, sizeof(text) - 1); m_OpEdit.GetWindowText(text, (sizeof(text) / sizeof(text[0])) - 1);
uint32_t op; uint32_t op;
bool bValid = CAssembler::AssembleLine(text, &op, m_SelectedAddress); bool bValid = CAssembler::AssembleLine(stdstr().FromUTF16(text).c_str(), &op, m_SelectedAddress);
if (bValid) if (bValid)
{ {
m_OpEdit.SetWindowTextA(""); m_OpEdit.SetWindowText(L"");
EditOp(m_SelectedAddress, op); EditOp(m_SelectedAddress, op);
m_SelectedAddress += 4; m_SelectedAddress += 4;
BeginOpEdit(m_SelectedAddress); BeginOpEdit(m_SelectedAddress);
@ -568,19 +568,19 @@ void CDebugCommandsView::ShowAddress(uint32_t address, bool top, bool bUserInput
{ {
uint32_t opAddr = m_StartAddress + i * 4; uint32_t opAddr = m_StartAddress + i * 4;
m_CommandList.AddItem(i, CCommandList::COL_ARROWS, " "); m_CommandList.AddItem(i, CCommandList::COL_ARROWS, L" ");
char addrStr[9]; char addrStr[9];
sprintf(addrStr, "%08X", opAddr); sprintf(addrStr, "%08X", opAddr);
m_CommandList.AddItem(i, CCommandList::COL_ADDRESS, addrStr); m_CommandList.AddItem(i, CCommandList::COL_ADDRESS, stdstr(addrStr).ToUTF16().c_str());
COpInfo OpInfo; COpInfo OpInfo;
OPCODE& OpCode = OpInfo.m_OpCode; OPCODE& OpCode = OpInfo.m_OpCode;
if (!m_Debugger->DebugLoad_VAddr(opAddr, OpCode.Hex)) if (!m_Debugger->DebugLoad_VAddr(opAddr, OpCode.Hex))
{ {
m_CommandList.AddItem(i, CCommandList::COL_COMMAND, "***"); m_CommandList.AddItem(i, CCommandList::COL_COMMAND, L"***");
m_bvAnnotatedLines.push_back(false); m_bvAnnotatedLines.push_back(false);
continue; continue;
} }
@ -652,20 +652,20 @@ void CDebugCommandsView::ShowAddress(uint32_t address, bool top, bool bUserInput
bLoadStoreAnnotation = true; bLoadStoreAnnotation = true;
} }
m_CommandList.AddItem(i, CCommandList::COL_COMMAND, cmdName); m_CommandList.AddItem(i, CCommandList::COL_COMMAND, stdstr(cmdName).ToUTF16().c_str());
m_CommandList.AddItem(i, CCommandList::COL_PARAMETERS, cmdArgs); m_CommandList.AddItem(i, CCommandList::COL_PARAMETERS, stdstr(cmdArgs).ToUTF16().c_str());
// Show routine symbol name for this address // Show routine symbol name for this address
CSymbol pcSymbol; CSymbol pcSymbol;
if (m_Debugger->SymbolTable()->GetSymbolByAddress(opAddr, &pcSymbol)) if (m_Debugger->SymbolTable()->GetSymbolByAddress(opAddr, &pcSymbol))
{ {
m_CommandList.AddItem(i, CCommandList::COL_SYMBOL, pcSymbol.m_Name); m_CommandList.AddItem(i, CCommandList::COL_SYMBOL, stdstr(pcSymbol.m_Name).ToUTF16().c_str());
m_bvAnnotatedLines.push_back(false); m_bvAnnotatedLines.push_back(false);
} }
else if (annotation != NULL) else if (annotation != NULL)
{ {
const char* annotationFormat = bLoadStoreAnnotation ? "// (%s)" : "// %s"; const char* annotationFormat = bLoadStoreAnnotation ? "// (%s)" : "// %s";
m_CommandList.AddItem(i, CCommandList::COL_SYMBOL, stdstr_f(annotationFormat, annotation).c_str()); m_CommandList.AddItem(i, CCommandList::COL_SYMBOL, stdstr_f(annotationFormat, annotation).ToUTF16().c_str());
m_bvAnnotatedLines.push_back(true); m_bvAnnotatedLines.push_back(true);
} }
else else
@ -1030,7 +1030,7 @@ void CDebugCommandsView::RefreshBreakpointList()
for (CBreakpoints::breakpoints_t::iterator itr = ReadBreakPoints.begin(); itr != ReadBreakPoints.end(); itr++) for (CBreakpoints::breakpoints_t::iterator itr = ReadBreakPoints.begin(); itr != ReadBreakPoints.end(); itr++)
{ {
sprintf(rowStr, "R %s%08X", itr->second ? "T " : "", itr->first); sprintf(rowStr, "R %s%08X", itr->second ? "T " : "", itr->first);
int index = m_BreakpointList.AddString(rowStr); int index = m_BreakpointList.AddString(stdstr(rowStr).ToUTF16().c_str());
m_BreakpointList.SetItemData(index, itr->first); m_BreakpointList.SetItemData(index, itr->first);
} }
@ -1038,7 +1038,7 @@ void CDebugCommandsView::RefreshBreakpointList()
for (CBreakpoints::breakpoints_t::iterator itr = WriteBreakPoints.begin(); itr != WriteBreakPoints.end(); itr++) for (CBreakpoints::breakpoints_t::iterator itr = WriteBreakPoints.begin(); itr != WriteBreakPoints.end(); itr++)
{ {
sprintf(rowStr, "W %s%08X", itr->second ? "T " : "", itr->first); sprintf(rowStr, "W %s%08X", itr->second ? "T " : "", itr->first);
int index = m_BreakpointList.AddString(rowStr); int index = m_BreakpointList.AddString(stdstr(rowStr).ToUTF16().c_str());
m_BreakpointList.SetItemData(index, itr->first); m_BreakpointList.SetItemData(index, itr->first);
} }
@ -1046,7 +1046,7 @@ void CDebugCommandsView::RefreshBreakpointList()
for (CBreakpoints::breakpoints_t::iterator itr = ExecutionBreakPoints.begin(); itr != ExecutionBreakPoints.end(); itr++) for (CBreakpoints::breakpoints_t::iterator itr = ExecutionBreakPoints.begin(); itr != ExecutionBreakPoints.end(); itr++)
{ {
sprintf(rowStr, "E %s%08X", itr->second ? "T " : "", itr->first); sprintf(rowStr, "E %s%08X", itr->second ? "T " : "", itr->first);
int index = m_BreakpointList.AddString(rowStr); int index = m_BreakpointList.AddString(stdstr(rowStr).ToUTF16().c_str());
m_BreakpointList.SetItemData(index, itr->first); m_BreakpointList.SetItemData(index, itr->first);
} }
} }
@ -1060,20 +1060,20 @@ void CDebugCommandsView::RemoveSelectedBreakpoints()
return; return;
} }
char itemText[32]; wchar_t itemText[32];
m_BreakpointList.GetText(nItem, itemText); m_BreakpointList.GetText(nItem, itemText);
uint32_t address = m_BreakpointList.GetItemData(nItem); uint32_t address = m_BreakpointList.GetItemData(nItem);
switch (itemText[0]) switch (itemText[0])
{ {
case 'E': case L'E':
m_Breakpoints->RemoveExecution(address); m_Breakpoints->RemoveExecution(address);
break; break;
case 'W': case L'W':
m_Breakpoints->WBPRemove(address); m_Breakpoints->WBPRemove(address);
break; break;
case 'R': case L'R':
m_Breakpoints->RBPRemove(address); m_Breakpoints->RBPRemove(address);
break; break;
} }
@ -1325,7 +1325,7 @@ void CDebugCommandsView::BeginOpEdit(uint32_t address)
m_OpEdit.ShowWindow(SW_SHOW); m_OpEdit.ShowWindow(SW_SHOW);
m_OpEdit.MoveWindow(&itemRect); m_OpEdit.MoveWindow(&itemRect);
m_OpEdit.BringWindowToTop(); m_OpEdit.BringWindowToTop();
m_OpEdit.SetWindowTextA(command); m_OpEdit.SetWindowText(stdstr(command).ToUTF16().c_str());
m_OpEdit.SetFocus(); m_OpEdit.SetFocus();
m_OpEdit.SetSelAll(); m_OpEdit.SetSelAll();
@ -1336,7 +1336,7 @@ void CDebugCommandsView::BeginOpEdit(uint32_t address)
void CDebugCommandsView::EndOpEdit() void CDebugCommandsView::EndOpEdit()
{ {
m_bEditing = false; m_bEditing = false;
m_OpEdit.SetWindowTextA(""); m_OpEdit.SetWindowText(L"");
m_OpEdit.ShowWindow(SW_HIDE); m_OpEdit.ShowWindow(SW_HIDE);
} }
@ -1481,10 +1481,10 @@ LRESULT CDebugCommandsView::OnListBoxClicked(WORD /*wNotifyCode*/, WORD wID, HWN
int index = m_BreakpointList.GetCaretIndex(); int index = m_BreakpointList.GetCaretIndex();
uint32_t address = m_BreakpointList.GetItemData(index); uint32_t address = m_BreakpointList.GetItemData(index);
int len = m_BreakpointList.GetTextLen(index); int len = m_BreakpointList.GetTextLen(index);
char* rowText = (char*)malloc(len + 1); wchar_t* rowText = (wchar_t*)malloc((len + 1) * sizeof(wchar_t));
rowText[len] = '\0'; rowText[len] = '\0';
m_BreakpointList.GetText(index, rowText); m_BreakpointList.GetText(index, rowText);
if (*rowText == 'E') if (*rowText == L'E')
{ {
ShowAddress(address, true); ShowAddress(address, true);
} }

View File

@ -96,9 +96,9 @@ void CDebugDMALogView::RefreshList()
// continue; // continue;
//} //}
m_DMAList.AddItem(itemIndex, 0, stdstr_f("%08X", lpEntry->romAddr).c_str()); m_DMAList.AddItem(itemIndex, 0, stdstr_f("%08X", lpEntry->romAddr).ToUTF16().c_str());
m_DMAList.AddItem(itemIndex, 1, stdstr_f("%08X", lpEntry->ramAddr).c_str()); m_DMAList.AddItem(itemIndex, 1, stdstr_f("%08X", lpEntry->ramAddr).ToUTF16().c_str());
m_DMAList.AddItem(itemIndex, 2, stdstr_f("%08X (%d)", lpEntry->length, lpEntry->length).c_str()); m_DMAList.AddItem(itemIndex, 2, stdstr_f("%08X (%d)", lpEntry->length, lpEntry->length).ToUTF16().c_str());
union union
{ {
@ -114,7 +114,7 @@ void CDebugDMALogView::RefreshList()
// Todo checkbox to display all in hex // Todo checkbox to display all in hex
if (isalnum(sig.sz[0]) && isalnum(sig.sz[1]) && isalnum(sig.sz[2]) && isalnum(sig.sz[3])) if (isalnum(sig.sz[0]) && isalnum(sig.sz[1]) && isalnum(sig.sz[2]) && isalnum(sig.sz[3]))
{ {
m_DMAList.AddItem(itemIndex, 4, (char*)sig.sz); m_DMAList.AddItem(itemIndex, 4, stdstr((char*)sig.sz).ToUTF16().c_str());
} }
itemIndex++; itemIndex++;
@ -151,11 +151,11 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
m_DMAList.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0); m_DMAList.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
m_DMAList.AddColumn("ROM", 0); m_DMAList.AddColumn(L"ROM", 0);
m_DMAList.AddColumn("RAM", 1); m_DMAList.AddColumn(L"RAM", 1);
m_DMAList.AddColumn("Length", 2); m_DMAList.AddColumn(L"Length", 2);
m_DMAList.AddColumn("Symbol (RAM)", 3); m_DMAList.AddColumn(L"Symbol (RAM)", 3);
m_DMAList.AddColumn("Signature", 4); m_DMAList.AddColumn(L"Signature", 4);
m_DMAList.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); m_DMAList.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
@ -244,11 +244,11 @@ LRESULT CDebugDMALogView::OnRamAddrChanged(WORD /*wNotifyCode*/, WORD /*wID*/, H
return FALSE; return FALSE;
} }
char szRamAddr[9]; wchar_t szRamAddr[9];
char szRomAddr[9]; char szRomAddr[9];
m_DMARamEdit.GetWindowTextA(szRamAddr, 9); m_DMARamEdit.GetWindowText(szRamAddr, 9);
uint32_t ramAddr = strtoul(szRamAddr, NULL, 16); uint32_t ramAddr = wcstoul(szRamAddr, NULL, 16);
uint32_t romAddr, offset; uint32_t romAddr, offset;
DMALOGENTRY* lpEntry = m_DMALog->GetEntryByRamAddress(ramAddr, &romAddr, &offset); DMALOGENTRY* lpEntry = m_DMALog->GetEntryByRamAddress(ramAddr, &romAddr, &offset);
@ -256,17 +256,17 @@ LRESULT CDebugDMALogView::OnRamAddrChanged(WORD /*wNotifyCode*/, WORD /*wID*/, H
if (lpEntry != NULL) if (lpEntry != NULL)
{ {
sprintf(szRomAddr, "%08X", romAddr); sprintf(szRomAddr, "%08X", romAddr);
stdstr blockInfo = stdstr_f("Block: %08X -> %08X [%X] +%X", romAddr, ramAddr, lpEntry->length, offset); stdstr_f blockInfo("Block: %08X -> %08X [%X] +%X", romAddr, ramAddr, lpEntry->length, offset);
m_BlockInfo.SetWindowTextA(blockInfo.c_str()); m_BlockInfo.SetWindowText(blockInfo.ToUTF16().c_str());
} }
else else
{ {
sprintf(szRomAddr, "????????"); sprintf(szRomAddr, "????????");
m_BlockInfo.SetWindowTextA("Block: ?"); m_BlockInfo.SetWindowText(L"Block: ?");
} }
m_bConvertingAddress = true; m_bConvertingAddress = true;
m_DMARomEdit.SetWindowTextA(szRomAddr); m_DMARomEdit.SetWindowText(stdstr(szRomAddr).ToUTF16().c_str());
m_bConvertingAddress = false; m_bConvertingAddress = false;
return FALSE; return FALSE;
} }
@ -278,29 +278,29 @@ LRESULT CDebugDMALogView::OnRomAddrChanged(WORD /*wNotifyCode*/, WORD /*wID*/, H
return FALSE; return FALSE;
} }
char szRamAddr[9]; wchar_t szRamAddr[9];
char szRomAddr[9]; wchar_t szRomAddr[9];
m_DMARomEdit.GetWindowTextA(szRomAddr, 9); m_DMARomEdit.GetWindowText(szRomAddr, 9);
uint32_t romAddr = strtoul(szRomAddr, NULL, 16); uint32_t romAddr = wcstoul(szRomAddr, NULL, 16);
uint32_t ramAddr, offset; uint32_t ramAddr, offset;
DMALOGENTRY* lpEntry = m_DMALog->GetEntryByRomAddress(romAddr, &ramAddr, &offset); DMALOGENTRY* lpEntry = m_DMALog->GetEntryByRomAddress(romAddr, &ramAddr, &offset);
if (lpEntry != NULL) if (lpEntry != NULL)
{ {
sprintf(szRamAddr, "%08X", ramAddr); wsprintf(szRamAddr, L"%08X", ramAddr);
stdstr blockInfo = stdstr_f("Block: %08X -> %08X [%X] +%X", romAddr, ramAddr, lpEntry->length, offset); stdstr blockInfo = stdstr_f("Block: %08X -> %08X [%X] +%X", romAddr, ramAddr, lpEntry->length, offset);
m_BlockInfo.SetWindowTextA(blockInfo.c_str()); m_BlockInfo.SetWindowText(blockInfo.ToUTF16().c_str());
} }
else else
{ {
sprintf(szRamAddr, "????????"); wsprintf(szRamAddr, L"????????");
m_BlockInfo.SetWindowTextA("Block: ?"); m_BlockInfo.SetWindowText(L"Block: ?");
} }
m_bConvertingAddress = true; m_bConvertingAddress = true;
m_DMARamEdit.SetWindowTextA(szRamAddr); m_DMARamEdit.SetWindowText(szRamAddr);
m_bConvertingAddress = false; m_bConvertingAddress = false;
return FALSE; return FALSE;
} }

View File

@ -44,10 +44,10 @@ LRESULT CDumpMemory::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPa
m_EndAddress.SetValue(endAddress, DisplayMode::AllHex); m_EndAddress.SetValue(endAddress, DisplayMode::AllHex);
m_PC.SetValue(startAddress); m_PC.SetValue(startAddress);
int nIndex = m_FormatList.AddString("TEXT - Disassembly + PC"); int nIndex = m_FormatList.AddString(L"TEXT - Disassembly + PC");
m_FormatList.SetItemData(nIndex, (DWORD_PTR)DisassemblyWithPC); m_FormatList.SetItemData(nIndex, (DWORD_PTR)DisassemblyWithPC);
nIndex = m_FormatList.AddString("RAW - Big Endian (N64)"); nIndex = m_FormatList.AddString(L"RAW - Big Endian (N64)");
m_FormatList.SetItemData(nIndex, (LPARAM)RawBigEndian); m_FormatList.SetItemData(nIndex, (LPARAM)RawBigEndian);
m_FormatList.SetCurSel(0); m_FormatList.SetCurSel(0);
@ -94,7 +94,7 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl
if (FileName.GetExtension().length() == 0) if (FileName.GetExtension().length() == 0)
{ {
FileName.SetExtension(Format == RawBigEndian ? "bin" : "txt"); FileName.SetExtension(Format == RawBigEndian ? "bin" : "txt");
m_FileName.SetWindowTextA(FileName); m_FileName.SetWindowText(stdstr((const char *)FileName).ToUTF16().c_str());
} }
} }
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory); g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
@ -110,7 +110,7 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl
DWORD EndPC = m_EndAddress.GetValue(); DWORD EndPC = m_EndAddress.GetValue();
DWORD DumpPC = m_PC.GetValue(); DWORD DumpPC = m_PC.GetValue();
GetDlgItemText(IDC_FILENAME, FileName, sizeof(FileName)); GetDlgItemText(IDC_FILENAME, FileName, sizeof(FileName));
if (strlen(FileName) == 0) if (wcslen(FileName) == 0)
{ {
g_Notify->DisplayWarning("Please Choose target file"); g_Notify->DisplayWarning("Please Choose target file");
::SetFocus(GetDlgItem(IDC_FILENAME)); ::SetFocus(GetDlgItem(IDC_FILENAME));
@ -145,14 +145,16 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl
return FALSE; return FALSE;
} }
bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC) bool CDumpMemory::DumpMemory(LPCTSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC)
{ {
stdstr strFile = stdstr().FromUTF16(FileName);
if (Format == DisassemblyWithPC) if (Format == DisassemblyWithPC)
{ {
CLog LogFile; CLog LogFile;
if (!LogFile.Open(FileName)) if (!LogFile.Open(strFile.c_str()))
{ {
g_Notify->DisplayError(stdstr_f("Failed to open\n%s", FileName).c_str()); g_Notify->DisplayError(stdstr_f("Failed to open\n%s", strFile.c_str()).c_str());
return false; return false;
} }
LogFile.SetFlush(false); LogFile.SetFlush(false);
@ -181,9 +183,9 @@ bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC,
{ {
CFile dumpFile; CFile dumpFile;
if (!dumpFile.Open(FileName, CFile::modeCreate | CFile::modeWrite)) if (!dumpFile.Open(strFile.c_str(), CFile::modeCreate | CFile::modeWrite))
{ {
g_Notify->DisplayError(stdstr_f("Failed to open\n%s", FileName).c_str()); g_Notify->DisplayError(stdstr_f("Failed to open\n%s", strFile.c_str()).c_str());
return false; return false;
} }
@ -197,7 +199,7 @@ bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC,
if (!bReadable) if (!bReadable)
{ {
g_Notify->DisplayError(stdstr_f("Address error\n%s", FileName).c_str()); g_Notify->DisplayError(stdstr_f("Address error\n%s", strFile.c_str()).c_str());
dumpFile.Close(); dumpFile.Close();
free(dumpBuf); free(dumpBuf);
return false; return false;

View File

@ -40,7 +40,7 @@ private:
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled); LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
void OnExitSizeMove(void); void OnExitSizeMove(void);
bool DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC); bool DumpMemory(LPCTSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC);
CComboBox m_FormatList; CComboBox m_FormatList;
CEdit m_FileName; CEdit m_FileName;

View File

@ -66,32 +66,32 @@ LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
UpdateOptions(); // setup search type combobox UpdateOptions(); // setup search type combobox
CComboBox & vtcb = m_ValueTypeOptions; CComboBox & vtcb = m_ValueTypeOptions;
vtcb.SetItemData(vtcb.AddString("int8"), ValueType_int8); vtcb.SetItemData(vtcb.AddString(L"int8"), ValueType_int8);
vtcb.SetItemData(vtcb.AddString("int16"), ValueType_int16); vtcb.SetItemData(vtcb.AddString(L"int16"), ValueType_int16);
vtcb.SetItemData(vtcb.AddString("int32"), ValueType_int32); vtcb.SetItemData(vtcb.AddString(L"int32"), ValueType_int32);
vtcb.SetItemData(vtcb.AddString("int64"), ValueType_int64); vtcb.SetItemData(vtcb.AddString(L"int64"), ValueType_int64);
vtcb.SetItemData(vtcb.AddString("float"), ValueType_float); vtcb.SetItemData(vtcb.AddString(L"float"), ValueType_float);
vtcb.SetItemData(vtcb.AddString("double"), ValueType_double); vtcb.SetItemData(vtcb.AddString(L"double"), ValueType_double);
vtcb.SetItemData(vtcb.AddString("string"), ValueType_string); vtcb.SetItemData(vtcb.AddString(L"string"), ValueType_string);
vtcb.SetCurSel(0); vtcb.SetCurSel(0);
m_ResultsListCtrl.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); m_ResultsListCtrl.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
m_ResultsListCtrl.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0); m_ResultsListCtrl.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
m_ResultsListCtrl.AddColumn("Address", ResultsListCtrl_Col_Address); m_ResultsListCtrl.AddColumn(L"Address", ResultsListCtrl_Col_Address);
m_ResultsListCtrl.AddColumn("Value", ResultsListCtrl_Col_Value); m_ResultsListCtrl.AddColumn(L"Value", ResultsListCtrl_Col_Value);
m_ResultsListCtrl.AddColumn("Previous", ResultsListCtrl_Col_Previous); m_ResultsListCtrl.AddColumn(L"Previous", ResultsListCtrl_Col_Previous);
m_ResultsListCtrl.SetColumnWidth(ResultsListCtrl_Col_Address, 80); m_ResultsListCtrl.SetColumnWidth(ResultsListCtrl_Col_Address, 80);
m_ResultsListCtrl.SetColumnWidth(ResultsListCtrl_Col_Value, 80); m_ResultsListCtrl.SetColumnWidth(ResultsListCtrl_Col_Value, 80);
m_ResultsListCtrl.SetColumnWidth(ResultsListCtrl_Col_Previous, 80); m_ResultsListCtrl.SetColumnWidth(ResultsListCtrl_Col_Previous, 80);
m_WatchListCtrl.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); m_WatchListCtrl.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
m_WatchListCtrl.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0); m_WatchListCtrl.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
m_WatchListCtrl.AddColumn("Lock", WatchListCtrl_Col_Lock); m_WatchListCtrl.AddColumn(L"Lock", WatchListCtrl_Col_Lock);
m_WatchListCtrl.AddColumn("BP", WatchListCtrl_Col_BP); m_WatchListCtrl.AddColumn(L"BP", WatchListCtrl_Col_BP);
m_WatchListCtrl.AddColumn("Address", WatchListCtrl_Col_Address); m_WatchListCtrl.AddColumn(L"Address", WatchListCtrl_Col_Address);
m_WatchListCtrl.AddColumn("Description", WatchListCtrl_Col_Description); m_WatchListCtrl.AddColumn(L"Description", WatchListCtrl_Col_Description);
m_WatchListCtrl.AddColumn("Type", WatchListCtrl_Col_Type); m_WatchListCtrl.AddColumn(L"Type", WatchListCtrl_Col_Type);
m_WatchListCtrl.AddColumn("Value", WatchListCtrl_Col_Value); m_WatchListCtrl.AddColumn(L"Value", WatchListCtrl_Col_Value);
m_WatchListCtrl.SetColumnWidth(WatchListCtrl_Col_Lock, 35); m_WatchListCtrl.SetColumnWidth(WatchListCtrl_Col_Lock, 35);
m_WatchListCtrl.SetColumnWidth(WatchListCtrl_Col_BP, 35); m_WatchListCtrl.SetColumnWidth(WatchListCtrl_Col_BP, 35);
m_WatchListCtrl.SetColumnWidth(WatchListCtrl_Col_Address, 80); m_WatchListCtrl.SetColumnWidth(WatchListCtrl_Col_Address, 80);
@ -533,8 +533,8 @@ LRESULT CDebugMemorySearch::OnResultsPopupSetValue(WORD /*wNotifyCode*/, WORD /*
{ {
int index = m_ResultsListCtrl.GetItemData(iItem); int index = m_ResultsListCtrl.GetItemData(iItem);
CScanResult* presult = m_MemoryScanner.GetResult(index); CScanResult* presult = m_MemoryScanner.GetResult(index);
char* enteredString = m_SetValueDlg.GetEnteredString(); wchar_t* enteredString = m_SetValueDlg.GetEnteredString();
presult->SetMemoryValueFromString(enteredString); presult->SetMemoryValueFromString(stdstr().FromUTF16(enteredString).c_str());
m_ResultsListCtrl.SetItemText(iItem, ResultsListCtrl_Col_Value, enteredString); m_ResultsListCtrl.SetItemText(iItem, ResultsListCtrl_Col_Value, enteredString);
} }
} }
@ -672,11 +672,11 @@ LRESULT CDebugMemorySearch::OnWatchListDblClick(LPNMHDR /*lpnmh*/)
{ {
if (m_SetValueDlg.DoModal("Change address", "New address:", stdstr_f("0x%08X", presult->m_Address).c_str())) if (m_SetValueDlg.DoModal("Change address", "New address:", stdstr_f("0x%08X", presult->m_Address).c_str()))
{ {
char* szEnteredString = m_SetValueDlg.GetEnteredString(); std::string szEnteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString());
uint32_t newAddr = strtoul(szEnteredString, NULL, 0); uint32_t newAddr = strtoul(szEnteredString.c_str(), NULL, 0);
if (presult->SetAddressSafe(newAddr)) if (presult->SetAddressSafe(newAddr))
{ {
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Address, stdstr_f("0x%08X", newAddr).c_str()); m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Address, stdstr_f("0x%08X", newAddr).ToUTF16().c_str());
} }
} }
} }
@ -687,7 +687,7 @@ LRESULT CDebugMemorySearch::OnWatchListDblClick(LPNMHDR /*lpnmh*/)
presult->GetMemoryValueString(szInitialValue, 1024); presult->GetMemoryValueString(szInitialValue, 1024);
if (m_SetValueDlg.DoModal("Change value", "New value:", szInitialValue)) if (m_SetValueDlg.DoModal("Change value", "New value:", szInitialValue))
{ {
presult->SetMemoryValueFromString(m_SetValueDlg.GetEnteredString()); presult->SetMemoryValueFromString(stdstr().FromUTF16(m_SetValueDlg.GetEnteredString()).c_str());
} }
} }
break; break;
@ -695,9 +695,9 @@ LRESULT CDebugMemorySearch::OnWatchListDblClick(LPNMHDR /*lpnmh*/)
{ {
if (m_SetValueDlg.DoModal("Set description", "New description:", presult->GetDescription())) if (m_SetValueDlg.DoModal("Set description", "New description:", presult->GetDescription()))
{ {
char* szEnteredString = m_SetValueDlg.GetEnteredString(); stdstr szEnteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString());
presult->SetDescription(szEnteredString); presult->SetDescription(szEnteredString.c_str());
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Description, szEnteredString); m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Description, stdstr(szEnteredString).ToUTF16().c_str());
} }
} }
break; break;
@ -712,16 +712,16 @@ LRESULT CDebugMemorySearch::OnWatchListDblClick(LPNMHDR /*lpnmh*/)
{ {
if (m_SetValueDlg.DoModal("String length", "New string length:", stdstr_f("%d", presult->GetStrLength()).c_str())) if (m_SetValueDlg.DoModal("String length", "New string length:", stdstr_f("%d", presult->GetStrLength()).c_str()))
{ {
const char* enteredString = m_SetValueDlg.GetEnteredString(); stdstr enteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString());
int length = atoi(enteredString); int length = atoi(enteredString.c_str());
presult->SetStrLengthSafe(length); presult->SetStrLengthSafe(length);
} }
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Type, stdstr_f("char[%d]", presult->GetStrLength()).c_str()); m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Type, stdstr_f("char[%d]", presult->GetStrLength()).ToUTF16().c_str());
} }
else else
{ {
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Type, presult->GetTypeName()); m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Type, stdstr(presult->GetTypeName()).ToUTF16().c_str());
} }
} }
} }
@ -906,10 +906,10 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeValue(WORD /*wNotifyCode*/, WO
{ {
int index = m_WatchListCtrl.GetItemData(iItem); int index = m_WatchListCtrl.GetItemData(iItem);
CScanResult* presult = &m_WatchList[index]; CScanResult* presult = &m_WatchList[index];
char* enteredString = m_SetValueDlg.GetEnteredString(); stdstr enteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString());
// todo prompt for size change if string is too long // todo prompt for size change if string is too long
presult->SetMemoryValueFromString(enteredString); presult->SetMemoryValueFromString(enteredString.c_str());
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Value, enteredString); m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Value, stdstr(enteredString).ToUTF16().c_str());
} }
} }
} }
@ -937,9 +937,9 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeDescription(WORD /*wNotifyCode
{ {
int index = m_WatchListCtrl.GetItemData(iItem); int index = m_WatchListCtrl.GetItemData(iItem);
CScanResult* presult = &m_WatchList[index]; CScanResult* presult = &m_WatchList[index];
char* description = m_SetValueDlg.GetEnteredString(); stdstr description = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString());
presult->SetDescription(description); presult->SetDescription(description.c_str());
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Description, description); m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Description, description.ToUTF16().c_str());
} }
} }
} }
@ -966,8 +966,8 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeType(WORD /*wNotifyCode*/, WOR
if (m_SetValueDlg.DoModal("String length", "New string length:", if (m_SetValueDlg.DoModal("String length", "New string length:",
stdstr_f("%d", pFirstResult->GetStrLength()).c_str())) stdstr_f("%d", pFirstResult->GetStrLength()).c_str()))
{ {
const char* enteredString = m_SetValueDlg.GetEnteredString(); stdstr enteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString());
length = atoi(enteredString); length = atoi(enteredString.c_str());
if (length <= 0) if (length <= 0)
{ {
@ -991,11 +991,11 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeType(WORD /*wNotifyCode*/, WOR
presult->SetStrLengthSafe(length); presult->SetStrLengthSafe(length);
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Type, m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Type,
stdstr_f("char[%d]", presult->GetStrLength()).c_str()); stdstr_f("char[%d]", presult->GetStrLength()).ToUTF16().c_str());
} }
else else
{ {
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Type, presult->GetTypeName()); m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Type, stdstr(presult->GetTypeName()).ToUTF16().c_str());
} }
} }
} }
@ -1015,8 +1015,8 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeAddress(WORD /*wNotifyCode*/,
if (m_SetValueDlg.DoModal("Change address", "New address:", stdstr_f("0x%08X", pFirstResult->m_Address).c_str())) if (m_SetValueDlg.DoModal("Change address", "New address:", stdstr_f("0x%08X", pFirstResult->m_Address).c_str()))
{ {
char* enteredString = m_SetValueDlg.GetEnteredString(); stdstr enteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString());
uint32_t newAddr = strtoul(enteredString, NULL, 0); uint32_t newAddr = strtoul(enteredString.c_str(), NULL, 0);
stdstr newAddrStr = stdstr_f("0x%08X", newAddr); stdstr newAddrStr = stdstr_f("0x%08X", newAddr);
int nItems = m_WatchListCtrl.GetItemCount(); int nItems = m_WatchListCtrl.GetItemCount();
@ -1029,7 +1029,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeAddress(WORD /*wNotifyCode*/,
int index = m_WatchListCtrl.GetItemData(iItem); int index = m_WatchListCtrl.GetItemData(iItem);
CScanResult* presult = &m_WatchList[index]; CScanResult* presult = &m_WatchList[index];
presult->SetAddressSafe(newAddr); presult->SetAddressSafe(newAddr);
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Address, newAddrStr.c_str()); m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Address, newAddrStr.ToUTF16().c_str());
} }
} }
} }
@ -1048,8 +1048,8 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeAddressBy(WORD /*wNotifyCode*/
if (m_SetValueDlg.DoModal("Adjust address", "Address offset (+/-):", "0")) if (m_SetValueDlg.DoModal("Adjust address", "Address offset (+/-):", "0"))
{ {
char* szEnteredString = m_SetValueDlg.GetEnteredString(); stdstr szEnteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString());
int offset = atoi(szEnteredString); int offset = atoi(szEnteredString.c_str());
int nItems = m_WatchListCtrl.GetItemCount(); int nItems = m_WatchListCtrl.GetItemCount();
for (int iItem = 0; iItem < nItems; iItem++) for (int iItem = 0; iItem < nItems; iItem++)
@ -1064,7 +1064,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeAddressBy(WORD /*wNotifyCode*/
if (presult->SetAddressSafe(newAddr)) if (presult->SetAddressSafe(newAddr))
{ {
stdstr newAddrStr = stdstr_f("0x%08X", presult->m_Address); stdstr newAddrStr = stdstr_f("0x%08X", presult->m_Address);
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Address, newAddrStr.c_str()); m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Address, newAddrStr.ToUTF16().c_str());
} }
} }
} }
@ -1666,7 +1666,7 @@ void CDebugMemorySearch::Search(void)
m_MemoryScanner.SetStringValueLength(stringValueLength); m_MemoryScanner.SetStringValueLength(stringValueLength);
break; break;
default: default:
MessageBox("Unimplemented value type", "Unimplemented", MB_OK); MessageBox(L"Unimplemented value type", L"Unimplemented", MB_OK);
return; return;
} }
} }
@ -1678,7 +1678,7 @@ void CDebugMemorySearch::Search(void)
if (!bAddressRangeValid) if (!bAddressRangeValid)
{ {
MessageBox("Invalid address range", "Invalid address range"); MessageBox(L"Invalid address range", L"Invalid address range");
return; return;
} }
@ -1699,7 +1699,7 @@ void CDebugMemorySearch::Search(void)
return; return;
value_parse_error: value_parse_error:
MessageBox("Invalid value", "Invalid value", MB_OK); MessageBox(L"Invalid value", L"Invalid value", MB_OK);
return; return;
} }
@ -1730,11 +1730,11 @@ void CDebugMemorySearch::UpdateOptions(void)
CComboBox & cb = m_SearchTypeOptions; CComboBox & cb = m_SearchTypeOptions;
cb.ResetContent(); cb.ResetContent();
cb.SetItemData(cb.AddString("Exact value"), SearchType_ExactValue); cb.SetItemData(cb.AddString(L"Exact value"), SearchType_ExactValue);
cb.SetItemData(cb.AddString("Unknown initial value"), SearchType_UnknownValue); cb.SetItemData(cb.AddString(L"Unknown initial value"), SearchType_UnknownValue);
cb.SetItemData(cb.AddString("Greater than..."), SearchType_GreaterThanValue); cb.SetItemData(cb.AddString(L"Greater than..."), SearchType_GreaterThanValue);
cb.SetItemData(cb.AddString("Less than..."), SearchType_LessThanValue); cb.SetItemData(cb.AddString(L"Less than..."), SearchType_LessThanValue);
cb.SetItemData(cb.AddString("JAL to..."), SearchType_JalTo); cb.SetItemData(cb.AddString(L"JAL to..."), SearchType_JalTo);
cb.SetCurSel(0); cb.SetCurSel(0);
if (valueType == ValueType_string) if (valueType == ValueType_string)
@ -1750,13 +1750,13 @@ void CDebugMemorySearch::UpdateOptions(void)
{ {
CComboBox & cb = m_SearchTypeOptions; CComboBox & cb = m_SearchTypeOptions;
cb.ResetContent(); cb.ResetContent();
cb.SetItemData(cb.AddString("Exact value"), SearchType_ExactValue); cb.SetItemData(cb.AddString(L"Exact value"), SearchType_ExactValue);
cb.SetItemData(cb.AddString("Changed value"), SearchType_ChangedValue); cb.SetItemData(cb.AddString(L"Changed value"), SearchType_ChangedValue);
cb.SetItemData(cb.AddString("Unchanged value"), SearchType_UnchangedValue); cb.SetItemData(cb.AddString(L"Unchanged value"), SearchType_UnchangedValue);
cb.SetItemData(cb.AddString("Greater than..."), SearchType_GreaterThanValue); cb.SetItemData(cb.AddString(L"Greater than..."), SearchType_GreaterThanValue);
cb.SetItemData(cb.AddString("Less than..."), SearchType_LessThanValue); cb.SetItemData(cb.AddString(L"Less than..."), SearchType_LessThanValue);
cb.SetItemData(cb.AddString("Increased value"), SearchType_IncreasedValue); cb.SetItemData(cb.AddString(L"Increased value"), SearchType_IncreasedValue);
cb.SetItemData(cb.AddString("Decreased value"), SearchType_DecreasedValue); cb.SetItemData(cb.AddString(L"Decreased value"), SearchType_DecreasedValue);
cb.SetCurSel(0); cb.SetCurSel(0);
if (m_bJalSelected) if (m_bJalSelected)
@ -1835,9 +1835,9 @@ void CDebugMemorySearch::UpdateResultsList(bool bUpdateScrollbar, bool bResetScr
presult->GetMemoryValueString(szCurrentValue, 1024); presult->GetMemoryValueString(szCurrentValue, 1024);
presult->GetValueString(szValue, 1024); presult->GetValueString(szValue, 1024);
m_ResultsListCtrl.AddItem(nItem, ResultsListCtrl_Col_Address, szAddress); m_ResultsListCtrl.AddItem(nItem, ResultsListCtrl_Col_Address, stdstr(szAddress).ToUTF16().c_str());
m_ResultsListCtrl.SetItemText(nItem, ResultsListCtrl_Col_Value, szCurrentValue); m_ResultsListCtrl.SetItemText(nItem, ResultsListCtrl_Col_Value, stdstr(szCurrentValue).ToUTF16().c_str());
m_ResultsListCtrl.SetItemText(nItem, ResultsListCtrl_Col_Previous, szValue); m_ResultsListCtrl.SetItemText(nItem, ResultsListCtrl_Col_Previous, stdstr(szValue).ToUTF16().c_str());
m_ResultsListCtrl.SetItemData(nItem, index); m_ResultsListCtrl.SetItemData(nItem, index);
nItem++; nItem++;
@ -1902,12 +1902,12 @@ void CDebugMemorySearch::UpdateWatchList(bool bUpdateScrollbar)
break; break;
} }
m_WatchListCtrl.AddItem(nItem, WatchListCtrl_Col_Lock, ""); m_WatchListCtrl.AddItem(nItem, WatchListCtrl_Col_Lock, L"");
m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_BP, ""); m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_BP, L"");
m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Address, szAddress); m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Address, stdstr(szAddress).ToUTF16().c_str());
m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Description, pSzDescription); m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Description, stdstr(pSzDescription).ToUTF16().c_str());
m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Type, pSzValueType); m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Type, stdstr(pSzValueType).ToUTF16().c_str());
m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Value, szValue); m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Value, stdstr(szValue).ToUTF16().c_str());
m_WatchListCtrl.SetItemData(nItem, index); m_WatchListCtrl.SetItemData(nItem, index);
//if (presult->IsSelected()) //if (presult->IsSelected())
@ -1948,7 +1948,7 @@ void CDebugMemorySearch::RefreshResultsListValues(void)
char szCurrentValue[1024]; char szCurrentValue[1024];
presult->GetMemoryValueString(szCurrentValue, 1024); presult->GetMemoryValueString(szCurrentValue, 1024);
m_ResultsListCtrl.SetItemText(nItem, ResultsListCtrl_Col_Value, szCurrentValue); m_ResultsListCtrl.SetItemText(nItem, ResultsListCtrl_Col_Value, stdstr(szCurrentValue).ToUTF16().c_str());
} }
m_ResultsListCtrl.SetRedraw(TRUE); m_ResultsListCtrl.SetRedraw(TRUE);
@ -1989,9 +1989,9 @@ void CDebugMemorySearch::RefreshWatchListValues(void)
char szCurrentValue[1024]; char szCurrentValue[1024];
presult->GetMemoryValueString(szCurrentValue, 1024); presult->GetMemoryValueString(szCurrentValue, 1024);
m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Lock, (bHaveLock ? "X" : "")); m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Lock, (bHaveLock ? L"X" : L""));
m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_BP, szBPStates); m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_BP, stdstr(szBPStates).ToUTF16().c_str());
m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Value, szCurrentValue); m_WatchListCtrl.SetItemText(nItem, WatchListCtrl_Col_Value, stdstr(szCurrentValue).ToUTF16().c_str());
} }
m_WatchListCtrl.SetRedraw(TRUE); m_WatchListCtrl.SetRedraw(TRUE);
@ -2198,7 +2198,7 @@ INT_PTR CSetValueDlg::DoModal(const char* caption, const char* label, DWORD_PTR
return CDialogImpl<CSetValueDlg>::DoModal(); return CDialogImpl<CSetValueDlg>::DoModal();
} }
char* CSetValueDlg::GetEnteredString(void) wchar_t* CSetValueDlg::GetEnteredString(void)
{ {
return m_EnteredString; return m_EnteredString;
} }
@ -2215,18 +2215,18 @@ DWORD_PTR CSetValueDlg::GetEnteredData(void)
LRESULT CSetValueDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) LRESULT CSetValueDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{ {
SetWindowText(m_Caption); SetWindowText(stdstr(m_Caption).ToUTF16().c_str());
CenterWindow(); CenterWindow();
m_Value.Attach(GetDlgItem(IDC_EDIT_VALUE)); m_Value.Attach(GetDlgItem(IDC_EDIT_VALUE));
m_CmbValue.Attach(GetDlgItem(IDC_CMB_VALUE)); m_CmbValue.Attach(GetDlgItem(IDC_CMB_VALUE));
m_Prompt.Attach(GetDlgItem(IDC_LBL_PROMPT)); m_Prompt.Attach(GetDlgItem(IDC_LBL_PROMPT));
m_Prompt.SetWindowText(m_Label); m_Prompt.SetWindowText(stdstr(m_Label).ToUTF16().c_str());
if (m_Mode == Mode_TextBox) if (m_Mode == Mode_TextBox)
{ {
m_CmbValue.ShowWindow(SW_HIDE); m_CmbValue.ShowWindow(SW_HIDE);
m_Value.SetWindowTextA(m_InitialText); m_Value.SetWindowText(stdstr(m_InitialText).ToUTF16().c_str());
m_Value.SetFocus(); m_Value.SetFocus();
m_Value.SetSelAll(); m_Value.SetSelAll();
} }
@ -2236,7 +2236,7 @@ LRESULT CSetValueDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lP
for (int i = 0; m_ComboItems[i].str != NULL; i++) for (int i = 0; m_ComboItems[i].str != NULL; i++)
{ {
int idx = m_CmbValue.AddString(m_ComboItems[i].str); int idx = m_CmbValue.AddString(stdstr(m_ComboItems[i].str).ToUTF16().c_str());
m_CmbValue.SetItemData(idx, m_ComboItems[i].data); m_CmbValue.SetItemData(idx, m_ComboItems[i].data);
if (m_ComboItems[i].data == m_InitialData) if (m_ComboItems[i].data == m_InitialData)
{ {
@ -2267,13 +2267,13 @@ LRESULT CSetValueDlg::OnOK(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hwnd*/, BO
if (m_Mode == Mode_TextBox) if (m_Mode == Mode_TextBox)
{ {
int length = m_Value.GetWindowTextLength(); int length = m_Value.GetWindowTextLength();
m_EnteredString = new char[length + 1]; m_EnteredString = new wchar_t[length + 1];
m_Value.GetWindowText(m_EnteredString, length + 1); m_Value.GetWindowText(m_EnteredString, length + 1);
} }
else if (m_Mode == Mode_ComboBox) else if (m_Mode == Mode_ComboBox)
{ {
int length = m_CmbValue.GetWindowTextLength(); int length = m_CmbValue.GetWindowTextLength();
m_EnteredString = new char[length + 1]; m_EnteredString = new wchar_t[length + 1];
m_CmbValue.GetWindowText(m_EnteredString, length + 1); m_CmbValue.GetWindowText(m_EnteredString, length + 1);
m_EnteredData = m_CmbValue.GetItemData(m_CmbValue.GetCurSel()); m_EnteredData = m_CmbValue.GetItemData(m_CmbValue.GetCurSel());
@ -2335,7 +2335,7 @@ void CEditMixed::ReloadString(void)
} }
m_StringLength = GetWindowTextLength(); m_StringLength = GetWindowTextLength();
m_String = (char*) malloc(m_StringLength + 1); m_String = (wchar_t*) malloc(m_StringLength + 1);
GetWindowText(m_String, m_StringLength + 1); GetWindowText(m_String, m_StringLength + 1);
} }
@ -2448,7 +2448,7 @@ bool CEditMixed::GetValue(uint64_t& value)
ReloadString(); ReloadString();
char *end; char *end;
uint64_t res = strtoull(m_String, &end, m_DisplayFormat == DisplayHex ? 16 : 10); uint64_t res = strtoull(stdstr().FromUTF16(m_String).c_str(), &end, m_DisplayFormat == DisplayHex ? 16 : 10);
if (*end != '\0') if (*end != '\0')
{ {
@ -2469,7 +2469,7 @@ bool CEditMixed::GetValue(int64_t& value)
ReloadString(); ReloadString();
char *end; char *end;
uint64_t res = strtoll(m_String, &end, m_DisplayFormat == DisplayHex ? 16 : 10); uint64_t res = strtoll(stdstr().FromUTF16(m_String).c_str(), &end, m_DisplayFormat == DisplayHex ? 16 : 10);
if (*end != '\0') if (*end != '\0')
{ {
@ -2492,7 +2492,7 @@ bool CEditMixed::GetValue(float& value)
float valueF32; float valueF32;
char *end; char *end;
valueF32 = strtof(m_String, &end); valueF32 = strtof(stdstr().FromUTF16(m_String).c_str(), &end);
if (*end != '\0') if (*end != '\0')
{ {
@ -2515,7 +2515,7 @@ bool CEditMixed::GetValue(double& value)
double valueF64; double valueF64;
char *end; char *end;
valueF64 = strtod(m_String, &end); valueF64 = strtod(stdstr().FromUTF16(m_String).c_str(), &end);
if (*end != '\0') if (*end != '\0')
{ {
@ -2549,19 +2549,24 @@ bool CEditMixed::GetValueHexString(const char*& value, int& length)
return false; return false;
} }
int numBytes = CMemoryScanner::ParseHexString(NULL, m_String); stdstr string = stdstr().FromUTF16(m_String);
int numBytes = CMemoryScanner::ParseHexString(NULL, string.c_str());
if (numBytes == 0) if (numBytes == 0)
{ {
return false; return false;
} }
char *hexString = (char*) malloc(numBytes);
CMemoryScanner::ParseHexString(hexString, m_String);
char *hexString = (char*)malloc(numBytes);
CMemoryScanner::ParseHexString(hexString, string.c_str());
wchar_t *wchexString = (wchar_t*)malloc(numBytes * sizeof(wchar_t));
wcscpy(wchexString, stdstr(hexString).ToUTF16().c_str());
free(hexString);
free(m_String); free(m_String);
m_String = hexString; m_String = wchexString;
m_StringLength = numBytes; m_StringLength = numBytes;
value = (const char*)m_String; value = (const char*)m_String;

View File

@ -20,7 +20,7 @@ class CEditMixed :
private: private:
ValueType m_Type; ValueType m_Type;
DisplayFormat m_DisplayFormat; DisplayFormat m_DisplayFormat;
char *m_String; wchar_t *m_String;
int m_StringLength; int m_StringLength;
void ReloadString(void); void ReloadString(void);
@ -68,7 +68,7 @@ public:
INT_PTR DoModal(const char* caption, const char* label, const char* initialText); INT_PTR DoModal(const char* caption, const char* label, const char* initialText);
INT_PTR DoModal(const char* caption, const char* label, DWORD_PTR initialData, const ComboItem items[]); INT_PTR DoModal(const char* caption, const char* label, DWORD_PTR initialData, const ComboItem items[]);
char* GetEnteredString(void); wchar_t* GetEnteredString(void);
DWORD_PTR GetEnteredData(void); DWORD_PTR GetEnteredData(void);
CSetValueDlg(void); CSetValueDlg(void);
@ -88,7 +88,7 @@ private:
const ComboItem* m_ComboItems; const ComboItem* m_ComboItems;
const char* m_InitialText; const char* m_InitialText;
char *m_EnteredString; wchar_t *m_EnteredString;
DWORD_PTR m_InitialData; DWORD_PTR m_InitialData;
DWORD_PTR m_EnteredData; DWORD_PTR m_EnteredData;

View File

@ -166,7 +166,7 @@ void CRegisterTabs::RefreshEdits()
cause.intval = g_Reg->CAUSE_REGISTER; cause.intval = g_Reg->CAUSE_REGISTER;
const char* szExceptionCode = ExceptionCodes[cause.exceptionCode]; const char* szExceptionCode = ExceptionCodes[cause.exceptionCode];
m_CauseTip.SetWindowTextA(szExceptionCode); m_CauseTip.SetWindowText(stdstr(szExceptionCode).ToUTF16().c_str());
m_RDRAMEdits[0].SetValue(g_Reg->RDRAM_CONFIG_REG, DisplayMode::ZeroExtend); // or device type m_RDRAMEdits[0].SetValue(g_Reg->RDRAM_CONFIG_REG, DisplayMode::ZeroExtend); // or device type
m_RDRAMEdits[1].SetValue(g_Reg->RDRAM_DEVICE_ID_REG, DisplayMode::ZeroExtend); m_RDRAMEdits[1].SetValue(g_Reg->RDRAM_DEVICE_ID_REG, DisplayMode::ZeroExtend);
@ -284,12 +284,12 @@ void CRegisterTabs::RegisterChanged(HWND hDlg, TAB_ID srcTabId, WPARAM wParam)
WORD ctrlId = LOWORD(wParam); WORD ctrlId = LOWORD(wParam);
CWindow editCtrl = ::GetDlgItem(hDlg, ctrlId); CWindow editCtrl = ::GetDlgItem(hDlg, ctrlId);
char text[20]; wchar_t text[20];
editCtrl.GetWindowText(text, 20); editCtrl.GetWindowText(text, 20);
if (srcTabId == TabGPR) if (srcTabId == TabGPR)
{ {
uint64_t value = CEditReg64::ParseValue(text); uint64_t value = CEditReg64::ParseValue(stdstr().FromUTF16(text).c_str());
if (ctrlId == IDC_HI_EDIT) if (ctrlId == IDC_HI_EDIT)
{ {
g_Reg->m_HI.UDW = value; g_Reg->m_HI.UDW = value;
@ -306,8 +306,8 @@ void CRegisterTabs::RegisterChanged(HWND hDlg, TAB_ID srcTabId, WPARAM wParam)
return; return;
} }
uint32_t value = strtoul(text, NULL, 16); uint32_t value = wcstoul(text, NULL, 16);
sprintf(text, "%08X", value); wsprintf(text, L"%08X", value);
editCtrl.SetWindowText(text); // reformat text editCtrl.SetWindowText(text); // reformat text
if (srcTabId == TabFPR) if (srcTabId == TabFPR)
@ -456,12 +456,12 @@ INT_PTR CALLBACK CRegisterTabs::TabProcDefault(HWND hDlg, UINT msg, WPARAM wPara
{ {
if (msg == WM_INITDIALOG) if (msg == WM_INITDIALOG)
{ {
SetProp(hDlg, "attached", (HANDLE)lParam); SetProp(hDlg, L"attached", (HANDLE)lParam);
return TRUE; return TRUE;
} }
if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS) if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS)
{ {
bool * attached = (bool *)GetProp(hDlg, "attached"); bool * attached = (bool *)GetProp(hDlg, L"attached");
if (attached != NULL && *attached) if (attached != NULL && *attached)
{ {
RegisterChanged(hDlg, TabDefault, wParam); RegisterChanged(hDlg, TabDefault, wParam);
@ -475,7 +475,7 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L
{ {
if (msg == WM_INITDIALOG) if (msg == WM_INITDIALOG)
{ {
SetProp(hDlg, "attached", (HANDLE)lParam); SetProp(hDlg, L"attached", (HANDLE)lParam);
return TRUE; return TRUE;
} }
@ -551,7 +551,7 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L
if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS) if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS)
{ {
bool * attached = (bool *)GetProp(hDlg, "attached"); bool * attached = (bool *)GetProp(hDlg, L"attached");
if (attached != NULL && *attached) if (attached != NULL && *attached)
{ {
RegisterChanged(hDlg, TabGPR, wParam); RegisterChanged(hDlg, TabGPR, wParam);
@ -706,12 +706,12 @@ INT_PTR CALLBACK CRegisterTabs::TabProcFPR(HWND hDlg, UINT msg, WPARAM wParam, L
{ {
if (msg == WM_INITDIALOG) if (msg == WM_INITDIALOG)
{ {
SetProp(hDlg, "attached", (HANDLE)lParam); SetProp(hDlg, L"attached", (HANDLE)lParam);
return TRUE; return TRUE;
} }
if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS) if (msg == WM_COMMAND && HIWORD(wParam) == EN_KILLFOCUS)
{ {
bool * attached = (bool *)GetProp(hDlg, "attached"); bool * attached = (bool *)GetProp(hDlg, L"attached");
if (attached != NULL && *attached) if (attached != NULL && *attached)
{ {
RegisterChanged(hDlg, TabFPR, wParam); RegisterChanged(hDlg, TabFPR, wParam);
@ -732,7 +732,7 @@ CRect CRegisterTabs::GetPageRect()
CWindow CRegisterTabs::AddTab(char* caption, int dialogId, DLGPROC dlgProc) CWindow CRegisterTabs::AddTab(char* caption, int dialogId, DLGPROC dlgProc)
{ {
AddItem(caption); AddItem(stdstr(caption).ToUTF16().c_str());
CWindow parentWin = GetParent(); CWindow parentWin = GetParent();
CWindow tabWin = ::CreateDialogParam(NULL, MAKEINTRESOURCE(dialogId), parentWin, dlgProc, (LPARAM)&m_attached); CWindow tabWin = ::CreateDialogParam(NULL, MAKEINTRESOURCE(dialogId), parentWin, dlgProc, (LPARAM)&m_attached);
@ -882,7 +882,7 @@ stdstr CRegisterTabs::CopyTabRegisters(int id)
item.pszText = buffer; item.pszText = buffer;
GetItem(id, &item); GetItem(id, &item);
str += item.pszText; str += stdstr().FromUTF16(item.pszText);
const TabRecord *record = nullptr; const TabRecord *record = nullptr;
switch (id) switch (id)
@ -959,15 +959,16 @@ stdstr CRegisterTabs::CopyTabRegisters(int id)
} }
// CEditReg64 for GPR // CEditReg64 for GPR
uint64_t CEditReg64::ParseValue(char* wordPair) uint64_t CEditReg64::ParseValue(const char* wordPair)
{ {
uint32_t a, b; uint32_t a, b;
uint64_t ret; uint64_t ret;
a = strtoul(wordPair, &wordPair, 16); char * end = NULL;
if (*wordPair == ' ') a = strtoul(wordPair, &end, 16);
if (*end == ' ')
{ {
wordPair++; end++;
b = strtoul(wordPair, NULL, 16); b = strtoul(end, NULL, 16);
ret = (uint64_t)a << 32; ret = (uint64_t)a << 32;
ret |= b; ret |= b;
return ret; return ret;
@ -1004,9 +1005,9 @@ LRESULT CEditReg64::OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandl
goto canceled; goto canceled;
} }
char text[20]; wchar_t text[20];
GetWindowText(text, 20); GetWindowText(text, 20);
int textLen = strlen(text); int textLen = wcslen(text);
if (textLen >= 17) if (textLen >= 17)
{ {
@ -1018,7 +1019,7 @@ LRESULT CEditReg64::OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandl
} }
} }
if (charCode == ' ' && strchr(text, ' ') != NULL) if (charCode == ' ' && wcschr(text, ' ') != NULL)
{ {
goto canceled; goto canceled;
} }
@ -1034,9 +1035,9 @@ canceled:
uint64_t CEditReg64::GetValue() uint64_t CEditReg64::GetValue()
{ {
char text[20]; wchar_t text[20];
GetWindowText(text, 20); GetWindowText(text, 20);
return ParseValue(text); return ParseValue(stdstr().FromUTF16(text).c_str());
} }
stdstr CEditReg64::GetValueText() stdstr CEditReg64::GetValueText()
@ -1053,9 +1054,9 @@ LRESULT CEditReg64::OnLostFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPara
void CEditReg64::SetValue(uint32_t h, uint32_t l) void CEditReg64::SetValue(uint32_t h, uint32_t l)
{ {
char text[20]; stdstr text;
sprintf(text, "%08X %08X", h, l); text.Format("%08X %08X", h, l);
SetWindowText(text); SetWindowText(text.ToUTF16().c_str());
} }
void CEditReg64::SetValue(uint64_t value) void CEditReg64::SetValue(uint64_t value)

View File

@ -17,7 +17,7 @@ class CEditReg64 :
private CDebugSettings private CDebugSettings
{ {
public: public:
static uint64_t ParseValue(char* wordPair); static uint64_t ParseValue(const char* wordPair);
BOOL Attach(HWND hWndNew); BOOL Attach(HWND hWndNew);
LRESULT OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLostFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnLostFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

View File

@ -35,13 +35,13 @@ LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l
HFONT monoFont = CreateFont(-11, 0, 0, 0, HFONT monoFont = CreateFont(-11, 0, 0, 0,
FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
CLEARTYPE_QUALITY, FF_DONTCARE, "Consolas" CLEARTYPE_QUALITY, FF_DONTCARE, L"Consolas"
); );
m_InstanceInfoEdit.Attach(GetDlgItem(IDC_CTX_INFO_EDIT)); m_InstanceInfoEdit.Attach(GetDlgItem(IDC_CTX_INFO_EDIT));
m_ScriptList.Attach(GetDlgItem(IDC_SCRIPT_LIST)); m_ScriptList.Attach(GetDlgItem(IDC_SCRIPT_LIST));
m_ScriptList.AddColumn("Script", 0, 0); m_ScriptList.AddColumn(L"Script", 0, 0);
m_ScriptList.SetColumnWidth(0, 100); m_ScriptList.SetColumnWidth(0, 100);
m_ScriptList.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); m_ScriptList.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
m_ScriptList.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0); m_ScriptList.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
@ -79,7 +79,7 @@ void CDebugScripts::ConsolePrint(const char* text)
m_ConsoleEdit.SetRedraw(FALSE); m_ConsoleEdit.SetRedraw(FALSE);
m_ConsoleEdit.AppendText(text); m_ConsoleEdit.AppendText(stdstr(text).ToUTF16().c_str());
m_ConsoleEdit.SetRedraw(TRUE); m_ConsoleEdit.SetRedraw(TRUE);
@ -107,7 +107,7 @@ void CDebugScripts::RefreshConsole()
void CDebugScripts::ConsoleClear() void CDebugScripts::ConsoleClear()
{ {
m_ConsoleEdit.SetWindowTextA(""); m_ConsoleEdit.SetWindowText(L"");
} }
void CDebugScripts::ConsoleCopy() void CDebugScripts::ConsoleCopy()
@ -119,12 +119,12 @@ void CDebugScripts::ConsoleCopy()
EmptyClipboard(); EmptyClipboard();
size_t nChars = m_ConsoleEdit.GetWindowTextLengthA() + 1; size_t nChars = m_ConsoleEdit.GetWindowTextLength() + 1;
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, nChars); HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, nChars * sizeof(wchar_t));
char* memBuf = (char*)GlobalLock(hMem); wchar_t* memBuf = (wchar_t*)GlobalLock(hMem);
m_ConsoleEdit.GetWindowTextA(memBuf, nChars); m_ConsoleEdit.GetWindowText(memBuf, nChars);
GlobalUnlock(hMem); GlobalUnlock(hMem);
SetClipboardData(CF_TEXT, hMem); SetClipboardData(CF_TEXT, hMem);
@ -152,7 +152,7 @@ void CDebugScripts::RefreshList()
do do
{ {
stdstr scriptFileName = SearchPath.GetNameExtension(); stdstr scriptFileName = SearchPath.GetNameExtension();
m_ScriptList.AddItem(0, 0, scriptFileName.c_str()); m_ScriptList.AddItem(0, 0, scriptFileName.ToUTF16().c_str());
} while (SearchPath.FindNext()); } while (SearchPath.FindNext());
m_ScriptList.SetRedraw(true); m_ScriptList.SetRedraw(true);
@ -220,7 +220,7 @@ void CDebugScripts::RefreshStatus()
stdstr instanceInfo = stdstr_f("%s (%s)", m_SelectedScriptName, szState); stdstr instanceInfo = stdstr_f("%s (%s)", m_SelectedScriptName, szState);
m_InstanceInfoEdit.SetWindowTextA(instanceInfo.c_str()); m_InstanceInfoEdit.SetWindowText(instanceInfo.ToUTF16().c_str());
if (state == STATE_RUNNING) if (state == STATE_RUNNING)
{ {
@ -238,7 +238,9 @@ LRESULT CDebugScripts::OnScriptListClicked(NMHDR* pNMHDR)
NMITEMACTIVATE* pIA = reinterpret_cast<NMITEMACTIVATE*>(pNMHDR); NMITEMACTIVATE* pIA = reinterpret_cast<NMITEMACTIVATE*>(pNMHDR);
int nItem = pIA->iItem; int nItem = pIA->iItem;
m_ScriptList.GetItemText(nItem, 0, m_SelectedScriptName, MAX_PATH); wchar_t ScriptName[MAX_PATH];
m_ScriptList.GetItemText(nItem, 0, ScriptName, MAX_PATH);
strcpy(m_SelectedScriptName, stdstr().FromUTF16(ScriptName).c_str());
RefreshStatus(); RefreshStatus();
@ -288,10 +290,10 @@ LRESULT CDebugScripts::OnScriptListCustomDraw(NMHDR* pNMHDR)
DWORD nItem = pLVCD->nmcd.dwItemSpec; DWORD nItem = pLVCD->nmcd.dwItemSpec;
char scriptName[MAX_PATH]; wchar_t scriptName[MAX_PATH];
m_ScriptList.GetItemText(nItem, 0, scriptName, MAX_PATH); m_ScriptList.GetItemText(nItem, 0, scriptName, MAX_PATH);
INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(scriptName); INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(stdstr("").FromUTF16(scriptName).c_str());
if (state == STATE_STARTED) if (state == STATE_STARTED)
{ {
@ -305,7 +307,7 @@ LRESULT CDebugScripts::OnScriptListCustomDraw(NMHDR* pNMHDR)
return CDRF_DODEFAULT; return CDRF_DODEFAULT;
} }
void CDebugScripts::EvaluateInSelectedInstance(char* code) void CDebugScripts::EvaluateInSelectedInstance(const char* code)
{ {
INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName); INSTANCE_STATE state = m_Debugger->ScriptSystem()->GetInstanceState(m_SelectedScriptName);
@ -324,9 +326,9 @@ LRESULT CEditEval::OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BO
{ {
if (m_HistoryIdx > 0) if (m_HistoryIdx > 0)
{ {
char* code = m_History[--m_HistoryIdx]; wchar_t* code = m_History[--m_HistoryIdx];
SetWindowTextA(code); SetWindowText(code);
int selEnd = strlen(code); int selEnd = wcslen(code);
SetSel(selEnd, selEnd); SetSel(selEnd, selEnd);
} }
} }
@ -335,14 +337,14 @@ LRESULT CEditEval::OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BO
int size = m_History.size(); int size = m_History.size();
if (m_HistoryIdx < size - 1) if (m_HistoryIdx < size - 1)
{ {
char* code = m_History[++m_HistoryIdx]; wchar_t* code = m_History[++m_HistoryIdx];
SetWindowTextA(code); SetWindowText(code);
int selEnd = strlen(code); int selEnd = wcslen(code);
SetSel(selEnd, selEnd); SetSel(selEnd, selEnd);
} }
else if (m_HistoryIdx < size) else if (m_HistoryIdx < size)
{ {
SetWindowTextA(""); SetWindowText(L"");
m_HistoryIdx++; m_HistoryIdx++;
} }
} }
@ -355,18 +357,18 @@ LRESULT CEditEval::OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BO
} }
size_t codeLength = GetWindowTextLength() + 1; size_t codeLength = GetWindowTextLength() + 1;
char* code = (char*)malloc(codeLength); wchar_t* code = (wchar_t*)malloc(codeLength * sizeof(wchar_t));
GetWindowTextA(code, codeLength); GetWindowText(code, codeLength);
m_ScriptWindow->EvaluateInSelectedInstance(code); m_ScriptWindow->EvaluateInSelectedInstance(stdstr().FromUTF16(code).c_str());
SetWindowTextA(""); SetWindowText(L"");
int historySize = m_History.size(); int historySize = m_History.size();
// remove duplicate // remove duplicate
for (int i = 0; i < historySize; i++) for (int i = 0; i < historySize; i++)
{ {
if (strcmp(code, m_History[i]) == 0) if (wcscmp(code, m_History[i]) == 0)
{ {
free(m_History[i]); free(m_History[i]);
m_History.erase(m_History.begin() + i); m_History.erase(m_History.begin() + i);
@ -426,5 +428,5 @@ void CDebugScripts::ToggleSelected()
void CDebugScripts::EditSelected() void CDebugScripts::EditSelected()
{ {
ShellExecute(NULL, "edit", m_SelectedScriptName, NULL, "Scripts", SW_SHOWNORMAL); ShellExecute(NULL, L"edit", stdstr(m_SelectedScriptName).ToUTF16().c_str(), NULL, L"Scripts", SW_SHOWNORMAL);
} }

View File

@ -25,7 +25,7 @@ class CEditEval : public CWindowImpl<CEditEval, CEdit>
private: private:
//static char* m_EvalString; //static char* m_EvalString;
static const int HISTORY_MAX_ENTRIES = 20; static const int HISTORY_MAX_ENTRIES = 20;
vector<char*> m_History; vector<wchar_t*> m_History;
int m_HistoryIdx; int m_HistoryIdx;
CDebugScripts* m_ScriptWindow; CDebugScripts* m_ScriptWindow;
@ -104,7 +104,7 @@ public:
void RefreshList(); void RefreshList();
void RefreshConsole(); void RefreshConsole();
void EvaluateInSelectedInstance(char* code); void EvaluateInSelectedInstance(const char* code);
void RunSelected(); void RunSelected();
void StopSelected(); void StopSelected();
void ToggleSelected(); void ToggleSelected();

View File

@ -30,10 +30,9 @@ LRESULT CDebugStackTrace::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
DlgSavePos_Init(DebuggerUI_StackTracePos); DlgSavePos_Init(DebuggerUI_StackTracePos);
m_List.Attach(GetDlgItem(IDC_STACKTRACE_LIST)); m_List.Attach(GetDlgItem(IDC_STACKTRACE_LIST));
m_List.AddColumn("Caller", 0); m_List.AddColumn(L"Caller", 0);
m_List.AddColumn("Routine", 1); m_List.AddColumn(L"Routine", 1);
m_List.AddColumn("Name", 2); m_List.AddColumn(L"Name", 2);
m_List.SetColumnWidth(0, 70); m_List.SetColumnWidth(0, 70);
m_List.SetColumnWidth(1, 70); m_List.SetColumnWidth(1, 70);
@ -93,7 +92,7 @@ void CDebugStackTrace::Refresh()
return; return;
} }
SetWindowText(stdstr_f("Stack Trace (%d)", m_EntriesIndex).c_str()); SetWindowText(stdstr_f("Stack Trace (%d)", m_EntriesIndex).ToUTF16().c_str());
m_List.SetRedraw(FALSE); m_List.SetRedraw(FALSE);
m_List.DeleteAllItems(); m_List.DeleteAllItems();
@ -103,22 +102,17 @@ void CDebugStackTrace::Refresh()
uint32_t routineAddress = m_Entries[i].routineAddress; uint32_t routineAddress = m_Entries[i].routineAddress;
uint32_t callingAddress = m_Entries[i].callingAddress; uint32_t callingAddress = m_Entries[i].callingAddress;
char szAddress[9]; m_List.AddItem(i, 0, stdstr_f("%08X", callingAddress).ToUTF16().c_str());
sprintf(szAddress, "%08X", callingAddress); m_List.AddItem(i, 1, stdstr_f("%08X", routineAddress).ToUTF16().c_str());
m_List.AddItem(i, 0, szAddress);
sprintf(szAddress, "%08X", routineAddress);
m_List.AddItem(i, 1, szAddress);
CSymbol symbol; CSymbol symbol;
if (m_Debugger->SymbolTable()->GetSymbolByAddress(routineAddress, &symbol)) if (m_Debugger->SymbolTable()->GetSymbolByAddress(routineAddress, &symbol))
{ {
m_List.AddItem(i, 2, symbol.m_Name); m_List.AddItem(i, 2, stdstr(symbol.m_Name).ToUTF16().c_str());
} }
else else
{ {
m_List.AddItem(i, 2, ""); m_List.AddItem(i, 2, L"");
} }
m_List.SetItemData(i, routineAddress); m_List.SetItemData(i, routineAddress);

View File

@ -29,11 +29,11 @@ LRESULT CDebugStackView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /
m_StackList.Attach(GetDlgItem(IDC_STACK_LIST)); m_StackList.Attach(GetDlgItem(IDC_STACK_LIST));
m_StackList.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); m_StackList.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
m_StackList.AddColumn("#", 0); m_StackList.AddColumn(L"#", 0);
m_StackList.AddColumn("00", 1); m_StackList.AddColumn(L"00", 1);
m_StackList.AddColumn("04", 2); m_StackList.AddColumn(L"04", 2);
m_StackList.AddColumn("08", 3); m_StackList.AddColumn(L"08", 3);
m_StackList.AddColumn("0C", 4); m_StackList.AddColumn(L"0C", 4);
m_StackList.SetColumnWidth(0, 22); m_StackList.SetColumnWidth(0, 22);
m_StackList.SetColumnWidth(1, 64); m_StackList.SetColumnWidth(1, 64);
@ -89,12 +89,12 @@ void CDebugStackView::Refresh()
m_StackList.DeleteAllItems(); m_StackList.DeleteAllItems();
uint32_t spBase = g_Reg->m_GPR[29].UW[0]; uint32_t spBase = g_Reg->m_GPR[29].UW[0];
m_SPStatic.SetWindowTextA(stdstr_f("SP: %08X", spBase).c_str()); m_SPStatic.SetWindowText(stdstr_f("SP: %08X", spBase).ToUTF16().c_str());
for (int i = 0; i < 0x10; i++) for (int i = 0; i < 0x10; i++)
{ {
char t[4]; wchar_t t[4];
sprintf(t, "%02X", i * 0x10); swprintf(t, L"%02X", i * 0x10);
m_StackList.AddItem(i, 0, t); m_StackList.AddItem(i, 0, t);
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
@ -104,12 +104,12 @@ void CDebugStackView::Refresh()
if (!m_Debugger->DebugLoad_VAddr(vaddr, val)) if (!m_Debugger->DebugLoad_VAddr(vaddr, val))
{ {
m_StackList.AddItem(i, j + 1, "????????"); m_StackList.AddItem(i, j + 1, L"????????");
continue; continue;
} }
char valStr[9]; wchar_t valStr[9];
sprintf(valStr, "%08X", val); wsprintf(valStr, L"%08X", val);
m_StackList.AddItem(i, j + 1, valStr); m_StackList.AddItem(i, j + 1, valStr);
} }
} }

View File

@ -48,11 +48,11 @@ LRESULT CDebugSymbols::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l
m_SymbolsListView.Attach(GetDlgItem(IDC_SYMBOLS_LIST)); m_SymbolsListView.Attach(GetDlgItem(IDC_SYMBOLS_LIST));
m_SymbolsListView.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); m_SymbolsListView.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
m_SymbolsListView.AddColumn("Address", 0); m_SymbolsListView.AddColumn(L"Address", 0);
m_SymbolsListView.AddColumn("Type", 1); m_SymbolsListView.AddColumn(L"Type", 1);
m_SymbolsListView.AddColumn("Name", 2); m_SymbolsListView.AddColumn(L"Name", 2);
m_SymbolsListView.AddColumn("Value", 3); m_SymbolsListView.AddColumn(L"Value", 3);
m_SymbolsListView.AddColumn("Description", 4); m_SymbolsListView.AddColumn(L"Description", 4);
m_SymbolsListView.SetColumnWidth(0, 70); m_SymbolsListView.SetColumnWidth(0, 70);
m_SymbolsListView.SetColumnWidth(1, 40); m_SymbolsListView.SetColumnWidth(1, 40);
@ -186,52 +186,54 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR)
case SymbolsListView_Col_Name: case SymbolsListView_Col_Name:
if (m_SetValueDlg.DoModal("Set name", "New name:", symbol.m_Name)) if (m_SetValueDlg.DoModal("Set name", "New name:", symbol.m_Name))
{ {
char* szEnteredString = m_SetValueDlg.GetEnteredString(); wchar_t* szEnteredString = m_SetValueDlg.GetEnteredString();
m_Debugger->SymbolTable()->RemoveSymbolById(id); m_Debugger->SymbolTable()->RemoveSymbolById(id);
m_Debugger->SymbolTable()->AddSymbol(symbol.m_Type, symbol.m_Address, szEnteredString, symbol.m_Description); m_Debugger->SymbolTable()->AddSymbol(symbol.m_Type, symbol.m_Address, stdstr().FromUTF16(szEnteredString).c_str(), symbol.m_Description);
} }
break; break;
case SymbolsListView_Col_Value: case SymbolsListView_Col_Value:
char szValue[256]; char szValue[256];
char* x; const char* x;
char* y; const char* y;
m_Debugger->SymbolTable()->GetValueString(szValue, &symbol); m_Debugger->SymbolTable()->GetValueString(szValue, &symbol);
if (m_SetValueDlg.DoModal("Change value", "New value:", szValue)) if (m_SetValueDlg.DoModal("Change value", "New value:", szValue))
{ {
stdstr EnteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString());
switch (symbol.m_Type) switch (symbol.m_Type)
{ {
case SYM_U8: case SYM_U8:
m_Debugger->DebugStore_VAddr<uint8_t>(symbol.m_Address, atoi(m_SetValueDlg.GetEnteredString())); m_Debugger->DebugStore_VAddr<uint8_t>(symbol.m_Address, atoi(EnteredString.c_str()));
break; break;
case SYM_U16: case SYM_U16:
m_Debugger->DebugStore_VAddr<uint16_t>(symbol.m_Address, atoi(m_SetValueDlg.GetEnteredString())); m_Debugger->DebugStore_VAddr<uint16_t>(symbol.m_Address, atoi(EnteredString.c_str()));
break; break;
case SYM_U32: case SYM_U32:
m_Debugger->DebugStore_VAddr<uint32_t>(symbol.m_Address, atoi(m_SetValueDlg.GetEnteredString())); m_Debugger->DebugStore_VAddr<uint32_t>(symbol.m_Address, atoi(EnteredString.c_str()));
break; break;
case SYM_U64: case SYM_U64:
m_Debugger->DebugStore_VAddr<uint64_t>(symbol.m_Address, atoll(m_SetValueDlg.GetEnteredString())); m_Debugger->DebugStore_VAddr<uint64_t>(symbol.m_Address, atoll(EnteredString.c_str()));
break; break;
case SYM_S8: case SYM_S8:
m_Debugger->DebugStore_VAddr<int8_t>(symbol.m_Address, atoi(m_SetValueDlg.GetEnteredString())); m_Debugger->DebugStore_VAddr<int8_t>(symbol.m_Address, atoi(EnteredString.c_str()));
break; break;
case SYM_S16: case SYM_S16:
m_Debugger->DebugStore_VAddr<int16_t>(symbol.m_Address, atoi(m_SetValueDlg.GetEnteredString())); m_Debugger->DebugStore_VAddr<int16_t>(symbol.m_Address, atoi(EnteredString.c_str()));
break; break;
case SYM_S32: case SYM_S32:
m_Debugger->DebugStore_VAddr<int>(symbol.m_Address, atoi(m_SetValueDlg.GetEnteredString())); m_Debugger->DebugStore_VAddr<int>(symbol.m_Address, atoi(EnteredString.c_str()));
break; break;
case SYM_S64: case SYM_S64:
m_Debugger->DebugStore_VAddr<int64_t>(symbol.m_Address, atoll(m_SetValueDlg.GetEnteredString())); m_Debugger->DebugStore_VAddr<int64_t>(symbol.m_Address, atoll(EnteredString.c_str()));
break; break;
case SYM_FLOAT: case SYM_FLOAT:
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(m_SetValueDlg.GetEnteredString())); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(EnteredString.c_str()));
break; break;
case SYM_DOUBLE: case SYM_DOUBLE:
m_Debugger->DebugStore_VAddr<double>(symbol.m_Address, atof(m_SetValueDlg.GetEnteredString())); m_Debugger->DebugStore_VAddr<double>(symbol.m_Address, atof(EnteredString.c_str()));
break; break;
case SYM_VECTOR2: case SYM_VECTOR2:
x = m_SetValueDlg.GetEnteredString(); x = EnteredString.c_str();
y = strchr(x, ','); y = strchr(x, ',');
memcpy(szValue, x, y - x); memcpy(szValue, x, y - x);
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(szValue));
@ -241,7 +243,7 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR)
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + sizeof(float), atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + sizeof(float), atof(szValue));
break; break;
case SYM_VECTOR3: case SYM_VECTOR3:
x = m_SetValueDlg.GetEnteredString(); x = EnteredString.c_str();
y = strchr(x, ','); y = strchr(x, ',');
memcpy(szValue, x, y - x); memcpy(szValue, x, y - x);
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(szValue));
@ -256,7 +258,7 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR)
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + (sizeof(float) * 2), atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address + (sizeof(float) * 2), atof(szValue));
break; break;
case SYM_VECTOR4: case SYM_VECTOR4:
x = m_SetValueDlg.GetEnteredString(); x = EnteredString.c_str();
y = strchr(x, ','); y = strchr(x, ',');
memcpy(szValue, x, y - x); memcpy(szValue, x, y - x);
m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(szValue)); m_Debugger->DebugStore_VAddr<float>(symbol.m_Address, atof(szValue));
@ -281,9 +283,9 @@ LRESULT CDebugSymbols::OnListDblClicked(NMHDR* pNMHDR)
case SymbolsListView_Col_Description: case SymbolsListView_Col_Description:
if (m_SetValueDlg.DoModal("Set description", "New description:", symbol.m_Description)) if (m_SetValueDlg.DoModal("Set description", "New description:", symbol.m_Description))
{ {
char* szEnteredString = m_SetValueDlg.GetEnteredString(); stdstr szEnteredString = stdstr().FromUTF16(m_SetValueDlg.GetEnteredString());
m_Debugger->SymbolTable()->RemoveSymbolById(id); m_Debugger->SymbolTable()->RemoveSymbolById(id);
m_Debugger->SymbolTable()->AddSymbol(symbol.m_Type, symbol.m_Address, symbol.m_Name, szEnteredString); m_Debugger->SymbolTable()->AddSymbol(symbol.m_Type, symbol.m_Address, symbol.m_Name, szEnteredString.c_str());
} }
break; break;
} }
@ -313,11 +315,11 @@ void CDebugSymbols::Refresh()
stdstr strAddr = stdstr_f("%08X", symbol.m_Address); stdstr strAddr = stdstr_f("%08X", symbol.m_Address);
m_SymbolsListView.AddItem(nItem, 0, strAddr.c_str()); m_SymbolsListView.AddItem(nItem, 0, strAddr.ToUTF16().c_str());
m_SymbolsListView.AddItem(nItem, 1, symbol.TypeName()); m_SymbolsListView.AddItem(nItem, 1, stdstr(symbol.TypeName()).ToUTF16().c_str());
m_SymbolsListView.AddItem(nItem, 2, symbol.m_Name); m_SymbolsListView.AddItem(nItem, 2, stdstr(symbol.m_Name).ToUTF16().c_str());
m_SymbolsListView.AddItem(nItem, 4, symbol.m_Description); m_SymbolsListView.AddItem(nItem, 4, stdstr(symbol.m_Description).ToUTF16().c_str());
m_SymbolsListView.AddItem(nItem, 5, szValue); m_SymbolsListView.AddItem(nItem, 5, stdstr(szValue).ToUTF16().c_str());
m_SymbolsListView.SetItemData(nItem, symbol.m_Id); m_SymbolsListView.SetItemData(nItem, symbol.m_Id);
nItem++; nItem++;
@ -349,6 +351,6 @@ void CDebugSymbols::RefreshValues()
char szValue[256]; char szValue[256];
m_Debugger->SymbolTable()->GetValueString(szValue, &symbol); m_Debugger->SymbolTable()->GetValueString(szValue, &symbol);
m_SymbolsListView.SetItemText(i, 3, szValue); m_SymbolsListView.SetItemText(i, 3, stdstr(szValue).ToUTF16().c_str());
} }
} }

View File

@ -31,47 +31,47 @@ LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPara
col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
col.fmt = LVCFMT_LEFT; col.fmt = LVCFMT_LEFT;
col.pszText = "Index"; col.pszText = L"Index";
col.cx = (int)(40 * DPIScale); col.cx = (int)(40 * DPIScale);
col.iSubItem = 0; col.iSubItem = 0;
ListView_InsertColumn(GetDlgItem(IDC_LIST), 0, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST), 0, &col);
col.pszText = "Page Mask"; col.pszText = L"Page Mask";
col.cx = (int)(90 * DPIScale); col.cx = (int)(90 * DPIScale);
col.iSubItem = 1; col.iSubItem = 1;
ListView_InsertColumn(GetDlgItem(IDC_LIST), 1, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST), 1, &col);
col.pszText = "Entry Hi"; col.pszText = L"Entry Hi";
col.cx = (int)(90 * DPIScale); col.cx = (int)(90 * DPIScale);
col.iSubItem = 2; col.iSubItem = 2;
ListView_InsertColumn(GetDlgItem(IDC_LIST), 2, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST), 2, &col);
col.pszText = "Entry Lo0"; col.pszText = L"Entry Lo0";
col.cx = (int)(90 * DPIScale); col.cx = (int)(90 * DPIScale);
col.iSubItem = 3; col.iSubItem = 3;
ListView_InsertColumn(GetDlgItem(IDC_LIST), 3, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST), 3, &col);
col.pszText = "Entry Lo1"; col.pszText = L"Entry Lo1";
col.cx = (int)(90 * DPIScale); col.cx = (int)(90 * DPIScale);
col.iSubItem = 4; col.iSubItem = 4;
ListView_InsertColumn(GetDlgItem(IDC_LIST), 4, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST), 4, &col);
col.pszText = "Index"; col.pszText = L"Index";
col.cx = (int)(40 * DPIScale); col.cx = (int)(40 * DPIScale);
col.iSubItem = 0; col.iSubItem = 0;
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 0, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST2), 0, &col);
col.pszText = "Valid"; col.pszText = L"Valid";
col.cx = (int)(40 * DPIScale); col.cx = (int)(40 * DPIScale);
col.iSubItem = 1; col.iSubItem = 1;
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 1, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST2), 1, &col);
col.pszText = "Dirty"; col.pszText = L"Dirty";
col.cx = (int)(40 * DPIScale); col.cx = (int)(40 * DPIScale);
col.iSubItem = 2; col.iSubItem = 2;
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 2, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST2), 2, &col);
col.pszText = "Rule"; col.pszText = L"Rule";
col.cx = (int)(270 * DPIScale); col.cx = (int)(270 * DPIScale);
col.iSubItem = 3; col.iSubItem = 3;
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 3, &col); ListView_InsertColumn(GetDlgItem(IDC_LIST2), 3, &col);
@ -116,14 +116,14 @@ void CDebugTlb::RefreshTLBWindow(void)
} }
HWND hList = GetDlgItem(IDC_LIST); HWND hList = GetDlgItem(IDC_LIST);
char Output[100], OldText[100]; wchar_t Output[100], OldText[100];
LV_ITEM item, OldItem; LV_ITEM item, OldItem;
int count; int count;
CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb; CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb;
for (count = 0; count < 32; count++) for (count = 0; count < 32; count++)
{ {
sprintf(Output, "0x%02X", count); swprintf(Output, sizeof(Output), L"0x%02X", count);
item.mask = LVIF_TEXT; item.mask = LVIF_TEXT;
item.iItem = count; item.iItem = count;
item.pszText = Output; item.pszText = Output;
@ -142,71 +142,71 @@ void CDebugTlb::RefreshTLBWindow(void)
else else
{ {
ListView_GetItem(hList, &OldItem); ListView_GetItem(hList, &OldItem);
if (strcmp(item.pszText, OldItem.pszText) != 0) if (wcscmp(item.pszText, OldItem.pszText) != 0)
{ {
ListView_SetItem(hList, &item); ListView_SetItem(hList, &item);
} }
} }
if (tlb[count].EntryDefined) if (tlb[count].EntryDefined)
{ {
sprintf(Output, "0x%08X", tlb[count].PageMask.Value); swprintf(Output, sizeof(Output), L"0x%08X", tlb[count].PageMask.Value);
} }
else else
{ {
strcpy(Output, "................"); wcscpy(Output, L"................");
} }
item.iSubItem = 1; item.iSubItem = 1;
OldItem.iSubItem = 1; OldItem.iSubItem = 1;
ListView_GetItem(hList, &OldItem); ListView_GetItem(hList, &OldItem);
if (strcmp(item.pszText, OldItem.pszText) != 0) if (wcscmp(item.pszText, OldItem.pszText) != 0)
{ {
ListView_SetItem(hList, &item); ListView_SetItem(hList, &item);
} }
if (tlb[count].EntryDefined) if (tlb[count].EntryDefined)
{ {
sprintf(Output, "0x%08X", tlb[count].EntryHi.Value); swprintf(Output, sizeof(Output), L"0x%08X", tlb[count].EntryHi.Value);
} }
else else
{ {
strcpy(Output, "................"); wcscpy(Output, L"................");
} }
item.iSubItem = 2; item.iSubItem = 2;
OldItem.iSubItem = 2; OldItem.iSubItem = 2;
ListView_GetItem(hList, &OldItem); ListView_GetItem(hList, &OldItem);
if (strcmp(item.pszText, OldItem.pszText) != 0) if (wcscmp(item.pszText, OldItem.pszText) != 0)
{ {
ListView_SetItem(hList, &item); ListView_SetItem(hList, &item);
} }
if (tlb[count].EntryDefined) if (tlb[count].EntryDefined)
{ {
sprintf(Output, "0x%08X", tlb[count].EntryLo0.Value); swprintf(Output, sizeof(Output), L"0x%08X", tlb[count].EntryLo0.Value);
} }
else else
{ {
strcpy(Output, "................"); wcscpy(Output, L"................");
} }
item.iSubItem = 3; item.iSubItem = 3;
OldItem.iSubItem = 3; OldItem.iSubItem = 3;
ListView_GetItem(hList, &OldItem); ListView_GetItem(hList, &OldItem);
if (strcmp(item.pszText, OldItem.pszText) != 0) if (wcscmp(item.pszText, OldItem.pszText) != 0)
{ {
ListView_SetItem(hList, &item); ListView_SetItem(hList, &item);
} }
if (tlb[count].EntryDefined) if (tlb[count].EntryDefined)
{ {
sprintf(Output, "0x%08X", tlb[count].EntryLo1.Value); swprintf(Output, sizeof(Output), L"0x%08X", tlb[count].EntryLo1.Value);
} }
else else
{ {
strcpy(Output, "................"); wcscpy(Output, L"................");
} }
item.iSubItem = 4; item.iSubItem = 4;
OldItem.iSubItem = 4; OldItem.iSubItem = 4;
ListView_GetItem(hList, &OldItem); ListView_GetItem(hList, &OldItem);
if (strcmp(item.pszText, OldItem.pszText) != 0) if (wcscmp(item.pszText, OldItem.pszText) != 0)
{ {
ListView_SetItem(hList, &item); ListView_SetItem(hList, &item);
} }
@ -216,7 +216,7 @@ void CDebugTlb::RefreshTLBWindow(void)
hList = GetDlgItem(IDC_LIST2); hList = GetDlgItem(IDC_LIST2);
for (count = 0; count < 64; count++) for (count = 0; count < 64; count++)
{ {
sprintf(Output, "0x%02X", count); swprintf(Output, sizeof(Output), L"0x%02X", count);
item.mask = LVIF_TEXT; item.mask = LVIF_TEXT;
item.iItem = count; item.iItem = count;
item.pszText = Output; item.pszText = Output;
@ -235,7 +235,7 @@ void CDebugTlb::RefreshTLBWindow(void)
else else
{ {
ListView_GetItem(hList, &OldItem); ListView_GetItem(hList, &OldItem);
if (strcmp(item.pszText, OldItem.pszText) != 0) if (wcscmp(item.pszText, OldItem.pszText) != 0)
{ {
ListView_SetItem(hList, &item); ListView_SetItem(hList, &item);
} }
@ -243,49 +243,49 @@ void CDebugTlb::RefreshTLBWindow(void)
if (FastTlb[count].ValidEntry) if (FastTlb[count].ValidEntry)
{ {
sprintf(Output, "%s", FastTlb[count].VALID ? "Yes" : "No"); swprintf(Output, sizeof(Output), L"%s", FastTlb[count].VALID ? L"Yes" : L"No");
} }
else else
{ {
strcpy(Output, "................"); wcscpy(Output, L"................");
} }
item.iSubItem = 1; item.iSubItem = 1;
OldItem.iSubItem = 1; OldItem.iSubItem = 1;
ListView_GetItem(hList, &OldItem); ListView_GetItem(hList, &OldItem);
if (strcmp(item.pszText, OldItem.pszText) != 0) if (wcscmp(item.pszText, OldItem.pszText) != 0)
{ {
ListView_SetItem(hList, &item); ListView_SetItem(hList, &item);
} }
if (FastTlb[count].ValidEntry && FastTlb[count].VALID) if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
{ {
sprintf(Output, "%s", FastTlb[count].DIRTY ? "Yes" : "No"); swprintf(Output, sizeof(Output), L"%s", FastTlb[count].DIRTY ? L"Yes" : L"No");
} }
else else
{ {
strcpy(Output, "................"); wcscpy(Output, L"................");
} }
item.iSubItem = 2; item.iSubItem = 2;
OldItem.iSubItem = 2; OldItem.iSubItem = 2;
ListView_GetItem(hList, &OldItem); ListView_GetItem(hList, &OldItem);
if (strcmp(item.pszText, OldItem.pszText) != 0) if (wcscmp(item.pszText, OldItem.pszText) != 0)
{ {
ListView_SetItem(hList, &item); ListView_SetItem(hList, &item);
} }
if (FastTlb[count].ValidEntry && FastTlb[count].VALID) if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
{ {
sprintf(Output, "%08X:%08X -> %08X:%08X", FastTlb[count].VSTART, FastTlb[count].VEND, swprintf(Output, sizeof(Output), L"%08X:%08X -> %08X:%08X", FastTlb[count].VSTART, FastTlb[count].VEND,
FastTlb[count].PHYSSTART, FastTlb[count].PHYSEND); FastTlb[count].PHYSSTART, FastTlb[count].PHYSEND);
} }
else else
{ {
strcpy(Output, "................"); wcscpy(Output, L"................");
} }
item.iSubItem = 3; item.iSubItem = 3;
OldItem.iSubItem = 3; OldItem.iSubItem = 3;
ListView_GetItem(hList, &OldItem); ListView_GetItem(hList, &OldItem);
if (strcmp(item.pszText, OldItem.pszText) != 0) if (wcscmp(item.pszText, OldItem.pszText) != 0)
{ {
ListView_SetItem(hList, &item); ListView_SetItem(hList, &item);
} }

View File

@ -283,7 +283,7 @@ void CDebugMemoryView::SetupJumpMenu(bool bVirtual)
break; break;
} }
m_CmbJump.AddString(stdstr_f("%08X %s", bVirtual ? item->vaddr : item->paddr, item->caption).c_str()); m_CmbJump.AddString(stdstr_f("%08X %s", bVirtual ? item->vaddr : item->paddr, item->caption).ToUTF16().c_str());
} }
m_CmbJump.SetRedraw(TRUE); m_CmbJump.SetRedraw(TRUE);
@ -689,7 +689,7 @@ LRESULT CDebugMemoryView::OnHxInsertModeChanged(LPNMHDR /*lpNMHDR*/)
{ {
m_SafeEditQueue.clear(); m_SafeEditQueue.clear();
m_bSafeEditMode = m_HexEditCtrl.GetInsertMode(); m_bSafeEditMode = m_HexEditCtrl.GetInsertMode();
m_StatusBar.SetText(MEMSB_SAFEMODE, m_bSafeEditMode ? "Safe mode" : ""); m_StatusBar.SetText(MEMSB_SAFEMODE, m_bSafeEditMode ? L"Safe mode" : L"");
return FALSE; return FALSE;
} }
@ -704,19 +704,19 @@ LRESULT CDebugMemoryView::OnHxSelectionChanged(LPNMHDR /*lpNMHDR*/)
{ {
strBlock = stdstr_f("%08X:%08X", startAddress, endAddress); strBlock = stdstr_f("%08X:%08X", startAddress, endAddress);
strLength = stdstr_f("%X", endAddress - startAddress + 1); strLength = stdstr_f("%X", endAddress - startAddress + 1);
m_StatusBar.SetText(MEMSB_BLOCK, strBlock.c_str()); m_StatusBar.SetText(MEMSB_BLOCK, strBlock.ToUTF16().c_str());
m_StatusBar.SetText(MEMSB_BLOCKLEN, strLength.c_str()); m_StatusBar.SetText(MEMSB_BLOCKLEN, strLength.ToUTF16().c_str());
} }
else else
{ {
strBlock = stdstr_f("%08X", startAddress); strBlock = stdstr_f("%08X", startAddress);
m_StatusBar.SetText(MEMSB_BLOCK, strBlock.c_str()); m_StatusBar.SetText(MEMSB_BLOCK, strBlock.ToUTF16().c_str());
m_StatusBar.SetText(MEMSB_BLOCKLEN, ""); m_StatusBar.SetText(MEMSB_BLOCKLEN, L"");
} }
uint32_t romAddr, offset; uint32_t romAddr, offset;
DMALOGENTRY* entry = m_Debugger->DMALog()->GetEntryByRamAddress(startAddress, &romAddr, &offset); DMALOGENTRY* entry = m_Debugger->DMALog()->GetEntryByRamAddress(startAddress, &romAddr, &offset);
m_StatusBar.SetText(MEMSB_DMAINFO, entry != NULL ? "Have DMA" : ""); m_StatusBar.SetText(MEMSB_DMAINFO, entry != NULL ? L"Have DMA" : L"");
return FALSE; return FALSE;
} }
@ -942,7 +942,7 @@ LRESULT CDebugMemoryView::OnHxHotAddrChanged(LPNMHDR /*lpNMHDR*/)
strAddrInfo += stdstr_f("%08X\n", m_HotAddress); strAddrInfo += stdstr_f("%08X\n", m_HotAddress);
} }
m_StatusBar.SetText(MEMSB_HOTADDR, strAddrInfo.c_str()); m_StatusBar.SetText(MEMSB_HOTADDR, strAddrInfo.ToUTF16().c_str());
return FALSE; return FALSE;
} }
@ -1053,10 +1053,10 @@ void CDebugMemoryView::TabSelChanged(void)
int CDebugMemoryView::AddTab(uint32_t address, bool bVirtual, int numBytesPerGroup) int CDebugMemoryView::AddTab(uint32_t address, bool bVirtual, int numBytesPerGroup)
{ {
char szAddress[12]; stdstr szAddress;
sprintf(szAddress, "%08X", address); szAddress.Format("%08X", address);
m_TabData.push_back({ address, bVirtual, numBytesPerGroup }); m_TabData.push_back({ address, bVirtual, numBytesPerGroup });
return m_TabCtrl.AddItem(TCIF_TEXT | TCIF_PARAM, szAddress, 0, (LPARAM)address); return m_TabCtrl.AddItem(TCIF_TEXT | TCIF_PARAM, szAddress.ToUTF16().c_str(), 0, (LPARAM)address);
} }
int CDebugMemoryView::InsertTab(int nItem, uint32_t address, bool bVirtual, int numBytesPerGroup) int CDebugMemoryView::InsertTab(int nItem, uint32_t address, bool bVirtual, int numBytesPerGroup)
@ -1066,7 +1066,7 @@ int CDebugMemoryView::InsertTab(int nItem, uint32_t address, bool bVirtual, int
m_TabCtrl.DeleteAllItems(); m_TabCtrl.DeleteAllItems();
for (size_t i = 0; i < m_TabData.size(); i++) for (size_t i = 0; i < m_TabData.size(); i++)
{ {
m_TabCtrl.AddItem(TCIF_TEXT, stdstr_f("%08X", m_TabData[i].address).c_str(), 0, 0); m_TabCtrl.AddItem(TCIF_TEXT, stdstr_f("%08X", m_TabData[i].address).ToUTF16().c_str(), 0, 0);
} }
m_TabCtrl.SetRedraw(TRUE); m_TabCtrl.SetRedraw(TRUE);
return nItem + 1; return nItem + 1;
@ -1080,9 +1080,7 @@ void CDebugMemoryView::DeleteTab(int nItem)
void CDebugMemoryView::UpdateCurrentTab(uint32_t address) void CDebugMemoryView::UpdateCurrentTab(uint32_t address)
{ {
char szAddress[12]; std::wstring szAddress = stdstr_f("%08X", address).ToUTF16();
sprintf(szAddress, "%08X", address);
int nItem = m_TabCtrl.GetCurSel(); int nItem = m_TabCtrl.GetCurSel();
if (nItem == -1) if (nItem == -1)
@ -1092,7 +1090,7 @@ void CDebugMemoryView::UpdateCurrentTab(uint32_t address)
TCITEM item = { 0 }; TCITEM item = { 0 };
item.mask = TCIF_TEXT; item.mask = TCIF_TEXT;
item.pszText = szAddress; item.pszText = (LPWSTR)szAddress.c_str();
m_TabCtrl.SetRedraw(FALSE); m_TabCtrl.SetRedraw(FALSE);
m_TabCtrl.SetItem(nItem, &item); m_TabCtrl.SetItem(nItem, &item);
@ -1207,7 +1205,7 @@ LRESULT CDebugMemoryView::OnStatusBarClick(LPNMHDR lpNMHDR)
stdstr strDmaTitle = stdstr_f("DMA Information for 0x%08X", startAddress); stdstr strDmaTitle = stdstr_f("DMA Information for 0x%08X", startAddress);
stdstr strDmaInfo = stdstr_f("Block:\nROM 0x%08X -> RAM 0x%08X ( 0x%X bytes )\n\nROM address of byte:\n0x%08X ( 0x%08X + 0x%08X )", stdstr strDmaInfo = stdstr_f("Block:\nROM 0x%08X -> RAM 0x%08X ( 0x%X bytes )\n\nROM address of byte:\n0x%08X ( 0x%08X + 0x%08X )",
entry->romAddr, entry->ramAddr, entry->length, romAddress, entry->romAddr, blockOffset); entry->romAddr, entry->ramAddr, entry->length, romAddress, entry->romAddr, blockOffset);
MessageBox(strDmaInfo.c_str(), strDmaTitle.c_str(), MB_OK); MessageBox(strDmaInfo.ToUTF16().c_str(), strDmaTitle.ToUTF16().c_str(), MB_OK);
} }
else if (nmm->dwItemSpec == MEMSB_BLOCK) else if (nmm->dwItemSpec == MEMSB_BLOCK)
{ {

View File

@ -681,7 +681,7 @@ void CDebuggerUI::FrameDrawn()
static HFONT monoFont = CreateFont(-11, 0, 0, 0, static HFONT monoFont = CreateFont(-11, 0, 0, 0,
FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
PROOF_QUALITY, FF_DONTCARE, "Consolas" PROOF_QUALITY, FF_DONTCARE, L"Consolas"
); );
if (hMainWnd == NULL) if (hMainWnd == NULL)

View File

@ -160,7 +160,7 @@ CScanResult::~CScanResult(void)
{ {
} }
void CScanResult::SetDescription(char* str) void CScanResult::SetDescription(const char* str)
{ {
if (m_Description != NULL) if (m_Description != NULL)
{ {
@ -313,7 +313,7 @@ uint32_t CScanResult::GetVirtualAddress(void)
} }
} }
bool CScanResult::SetMemoryValueFromString(char* str) bool CScanResult::SetMemoryValueFromString(const char* str)
{ {
if (g_MMU == NULL) if (g_MMU == NULL)
{ {
@ -1015,7 +1015,7 @@ int CMemoryScanner::HexDigitVal(char c)
return 0; return 0;
} }
int CMemoryScanner::ParseHexString(char *dst, char* src) int CMemoryScanner::ParseHexString(char *dst, const char* src)
{ {
bool bHiNibble = true; bool bHiNibble = true;
uint8_t curByte = 0; uint8_t curByte = 0;

View File

@ -154,10 +154,10 @@ public:
int GetMemoryValueString(char* buffer, size_t size, bool bIgnoreHex = false); int GetMemoryValueString(char* buffer, size_t size, bool bIgnoreHex = false);
int GetAddressString(char *buffer); int GetAddressString(char *buffer);
uint32_t GetVirtualAddress(void); uint32_t GetVirtualAddress(void);
bool SetMemoryValueFromString(char* str); bool SetMemoryValueFromString(const char* str);
//bool IsSelected(void); //bool IsSelected(void);
//void SetSelected(bool bSelected); //void SetSelected(bool bSelected);
void SetDescription(char* str); void SetDescription(const char* str);
const char* GetDescription(void); const char* GetDescription(void);
void DeleteDescription(void); void DeleteDescription(void);
bool GetMemoryValue(CMixed* v); bool GetMemoryValue(CMixed* v);
@ -176,7 +176,7 @@ public:
bool SetSearchType(SearchType searchType); bool SetSearchType(SearchType searchType);
void SetAddressType(AddressType addressType); void SetAddressType(AddressType addressType);
static int ParseHexString(char* dst, char* src); static int ParseHexString(char* dst, const char* src);
static bool AddrCheck(uint32_t addr, uint32_t rangeStart, uint32_t rangeEnd); static bool AddrCheck(uint32_t addr, uint32_t rangeStart, uint32_t rangeEnd);
static bool RangeCheck(uint32_t addrStart, uint32_t addrEnd, uint32_t rangeStart, uint32_t rangeEnd); static bool RangeCheck(uint32_t addrStart, uint32_t addrEnd, uint32_t rangeStart, uint32_t rangeEnd);

View File

@ -58,7 +58,7 @@ CScriptInstance::CScriptInstance(CDebuggerUI* debugger)
m_NextListenerId = 0; m_NextListenerId = 0;
m_hIOCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0); m_hIOCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
CacheInstance(this); CacheInstance(this);
m_hKernel = LoadLibrary("Kernel32.dll"); m_hKernel = LoadLibraryA("Kernel32.dll");
m_CancelIoEx = NULL; m_CancelIoEx = NULL;
if (m_hKernel != NULL) if (m_hKernel != NULL)
{ {
@ -152,7 +152,7 @@ void CScriptInstance::StartScriptProc()
if (apiresult != 0) if (apiresult != 0)
{ {
MessageBox(NULL, duk_safe_to_string(ctx, -1), "API Script Error", MB_OK | MB_ICONERROR); MessageBox(NULL, stdstr(duk_safe_to_string(ctx, -1)).ToUTF16().c_str(), L"API Script Error", MB_OK | MB_ICONERROR);
return; return;
} }
@ -463,7 +463,7 @@ void CScriptInstance::InvokeListenerCallback(IOLISTENER* lpListener)
if (status != DUK_EXEC_SUCCESS) if (status != DUK_EXEC_SUCCESS)
{ {
const char* msg = duk_safe_to_string(m_Ctx, -1); const char* msg = duk_safe_to_string(m_Ctx, -1);
MessageBox(NULL, msg, "Script error", MB_OK | MB_ICONWARNING); MessageBox(NULL, stdstr(msg).ToUTF16().c_str(), L"Script error", MB_OK | MB_ICONWARNING);
} }
} }
@ -475,7 +475,7 @@ const char* CScriptInstance::Eval(const char* jsCode)
if (result != 0) if (result != 0)
{ {
MessageBox(NULL, msg, "Script error", MB_OK | MB_ICONWARNING); MessageBox(NULL, stdstr(msg).ToUTF16().c_str(), L"Script error", MB_OK | MB_ICONWARNING);
} }
else else
{ {
@ -553,7 +553,7 @@ const char* CScriptInstance::EvalFile(const char* jsPath)
const char* msg = duk_safe_to_string(m_Ctx, -1); const char* msg = duk_safe_to_string(m_Ctx, -1);
if (result != 0) if (result != 0)
{ {
MessageBox(NULL, msg, jsPath, MB_OK | MB_ICONWARNING); MessageBox(NULL, stdstr(msg).ToUTF16().c_str(), stdstr(jsPath).ToUTF16().c_str(), MB_OK | MB_ICONWARNING);
} }
duk_pop(m_Ctx); duk_pop(m_Ctx);
return msg; return msg;
@ -600,7 +600,7 @@ void CScriptInstance::QueueAPC(PAPCFUNC userProc, ULONG_PTR param)
{ {
if (m_hThread != NULL) if (m_hThread != NULL)
{ {
MessageBox(NULL, "apc queued", "", MB_OK); MessageBox(NULL, L"apc queued", L"", MB_OK);
QueueUserAPC(userProc, m_hThread, param); QueueUserAPC(userProc, m_hThread, param);
} }
} }
@ -733,7 +733,7 @@ duk_ret_t CScriptInstance::js_ioRead(duk_context* ctx)
if (status == false && GetLastError() != ERROR_IO_PENDING) if (status == false && GetLastError() != ERROR_IO_PENDING)
{ {
MessageBox(NULL, "readex error", "", MB_OK); MessageBox(NULL, L"readex error", L"", MB_OK);
} }
duk_pop_n(ctx, 3); duk_pop_n(ctx, 3);
@ -1364,7 +1364,7 @@ duk_ret_t CScriptInstance::js_MsgBox(duk_context* ctx)
caption = duk_to_string(ctx, 1); caption = duk_to_string(ctx, 1);
} }
MessageBox(NULL, msg, caption, MB_OK); MessageBox(NULL, stdstr(msg).ToUTF16().c_str(), stdstr(caption).ToUTF16().c_str(), MB_OK);
duk_pop_n(ctx, argc); duk_pop_n(ctx, argc);
duk_push_boolean(ctx, 1); duk_push_boolean(ctx, 1);
@ -1553,7 +1553,7 @@ duk_ret_t CScriptInstance::js_ScreenPrint(duk_context* ctx)
int nChars = strlen(text); int nChars = strlen(text);
TextOut(hdc, x, y, text, nChars); TextOut(hdc, x, y, stdstr(text).ToUTF16().c_str(), nChars);
duk_pop_n(ctx, nargs); duk_pop_n(ctx, nargs);
return 1; return 1;
@ -1840,7 +1840,7 @@ duk_ret_t CScriptInstance::js_FSMkDir(duk_context* ctx)
duk_pop_n(ctx, nargs); duk_pop_n(ctx, nargs);
if (CreateDirectory(path, NULL)) if (CreateDirectoryA(path, NULL))
{ {
duk_push_true(ctx); duk_push_true(ctx);
} }
@ -1866,7 +1866,7 @@ duk_ret_t CScriptInstance::js_FSRmDir(duk_context* ctx)
duk_pop_n(ctx, nargs); duk_pop_n(ctx, nargs);
if (RemoveDirectory(path)) if (RemoveDirectoryA(path))
{ {
duk_push_true(ctx); duk_push_true(ctx);
} }
@ -1918,8 +1918,8 @@ duk_ret_t CScriptInstance::js_FSReadDir(duk_context* ctx)
duk_pop_n(ctx, nargs); duk_pop_n(ctx, nargs);
WIN32_FIND_DATA ffd; WIN32_FIND_DATAA ffd;
HANDLE hFind = FindFirstFile(stdstr_f("%s%s", path, "\\*").c_str(), &ffd); HANDLE hFind = FindFirstFileA(stdstr_f("%s%s", path, "\\*").c_str(), &ffd);
if (hFind == INVALID_HANDLE_VALUE) if (hFind == INVALID_HANDLE_VALUE)
{ {
@ -1944,7 +1944,7 @@ duk_ret_t CScriptInstance::js_FSReadDir(duk_context* ctx)
duk_put_prop_index(ctx, arr_idx, nfile); duk_put_prop_index(ctx, arr_idx, nfile);
nfile++; nfile++;
} while (FindNextFile(hFind, &ffd) != 0); } while (FindNextFileA(hFind, &ffd) != 0);
FindClose(hFind); FindClose(hFind);
return 1; return 1;

View File

@ -40,7 +40,7 @@ CScriptSystem::CScriptSystem(CDebuggerUI* debugger)
RegisterHook("draw", m_HookFrameDrawn); RegisterHook("draw", m_HookFrameDrawn);
HMODULE hInst = GetModuleHandle(NULL); HMODULE hInst = GetModuleHandle(NULL);
HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(IDR_JSAPI_TEXT), "TEXT"); HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(IDR_JSAPI_TEXT), L"TEXT");
HGLOBAL hGlob = LoadResource(hInst, hRes); HGLOBAL hGlob = LoadResource(hInst, hRes);
DWORD resSize = SizeofResource(hInst, hRes); DWORD resSize = SizeofResource(hInst, hRes);
@ -109,7 +109,7 @@ void CScriptSystem::DeleteStoppedInstances()
} }
} }
INSTANCE_STATE CScriptSystem::GetInstanceState(char* path) INSTANCE_STATE CScriptSystem::GetInstanceState(const char* path)
{ {
CGuard guard(m_CS); CGuard guard(m_CS);
@ -125,7 +125,7 @@ INSTANCE_STATE CScriptSystem::GetInstanceState(char* path)
return STATE_INVALID; return STATE_INVALID;
} }
CScriptInstance* CScriptSystem::GetInstance(char* path) CScriptInstance* CScriptSystem::GetInstance(const char* path)
{ {
CGuard guard(m_CS); CGuard guard(m_CS);

View File

@ -112,8 +112,8 @@ public:
} }
void DeleteStoppedInstances(); void DeleteStoppedInstances();
INSTANCE_STATE GetInstanceState(char* scriptName); INSTANCE_STATE GetInstanceState(const char* scriptName);
CScriptInstance* GetInstance(char* scriptName); CScriptInstance* GetInstance(const char* scriptName);
CScriptHook* HookCPUExec() CScriptHook* HookCPUExec()
{ {

View File

@ -138,7 +138,7 @@ void CSymbolTable::Load()
if (g_Settings->LoadStringVal(Game_GameName).length() == 0) if (g_Settings->LoadStringVal(Game_GameName).length() == 0)
{ {
MessageBox(NULL, "Game must be loaded", "Symbols", MB_ICONWARNING | MB_OK); MessageBox(NULL, L"Game must be loaded", L"Symbols", MB_ICONWARNING | MB_OK);
return; return;
} }
@ -390,7 +390,7 @@ void CSymbolTable::GetValueString(char* dst, CSymbol* symbol)
void CSymbolTable::ParseErrorAlert(char* message, int lineNumber) void CSymbolTable::ParseErrorAlert(char* message, int lineNumber)
{ {
stdstr messageFormatted = stdstr_f("%s\nLine %d", message, lineNumber); stdstr messageFormatted = stdstr_f("%s\nLine %d", message, lineNumber);
MessageBox(NULL, messageFormatted.c_str(), "Parse error", MB_OK | MB_ICONWARNING); MessageBox(NULL, messageFormatted.ToUTF16().c_str(), L"Parse error", MB_OK | MB_ICONWARNING);
} }
void CSymbolTable::Reset() void CSymbolTable::Reset()
@ -404,7 +404,7 @@ bool CSymbolTable::CmpSymbolAddresses(CSymbol& a, CSymbol& b)
return (a.m_Address < b.m_Address); return (a.m_Address < b.m_Address);
} }
void CSymbolTable::AddSymbol(int type, uint32_t address, char* name, char* description) void CSymbolTable::AddSymbol(int type, uint32_t address, const char* name, const char* description)
{ {
CGuard guard(m_CS); CGuard guard(m_CS);

View File

@ -88,7 +88,7 @@ public:
void Save(); void Save();
void ParseErrorAlert(char* message, int lineNumber); void ParseErrorAlert(char* message, int lineNumber);
void AddSymbol(int type, uint32_t address, char* name, char* description = NULL); void AddSymbol(int type, uint32_t address, const char* name, const char* description = NULL);
void Reset(); void Reset();
int GetCount(); int GetCount();
bool GetSymbolById(int id, CSymbol* symbol); bool GetSymbolById(int id, CSymbol* symbol);
@ -115,7 +115,7 @@ public:
{ {
} }
CSymbol(int id, int type, uint32_t address, char* name, char* description) : CSymbol(int id, int type, uint32_t address, const char* name, const char* description) :
m_Id(id), m_Id(id),
m_Type(type), m_Type(type),
m_Address(address), m_Address(address),

View File

@ -27,7 +27,7 @@ private:
CEditEnhancement(const CEditEnhancement&); // Disable copy constructor CEditEnhancement(const CEditEnhancement&); // Disable copy constructor
CEditEnhancement& operator=(const CEditEnhancement&); // Disable assignment CEditEnhancement& operator=(const CEditEnhancement&); // Disable assignment
std::string GetDlgItemStr(int nIDDlgItem); std::wstring GetDlgItemStr(int nIDDlgItem);
int m_EditItem; int m_EditItem;
}; };
@ -244,12 +244,12 @@ LRESULT CEnhancementConfig::OnEnhancementListSelChanged(NMHDR * /*pNMHDR*/)
item.hItem = hItem; item.hItem = hItem;
m_TreeList.GetItem(&item); m_TreeList.GetItem(&item);
std::string Notes(g_Settings->LoadStringIndex(Enhancement_Notes, item.lParam)); stdstr Notes(g_Settings->LoadStringIndex(Enhancement_Notes, item.lParam));
SetDlgItemText(IDC_NOTES, Notes.c_str()); SetDlgItemText(IDC_NOTES, Notes.ToUTF16().c_str());
} }
else else
{ {
SetDlgItemText(IDC_NOTES, ""); SetDlgItemText(IDC_NOTES, L"");
} }
return TRUE; return TRUE;
} }
@ -276,7 +276,7 @@ LRESULT CEnhancementConfig::OnDeleteItem(WORD /*wNotifyCode*/, WORD /*wID*/, HWN
{ {
return TRUE; return TRUE;
} }
int Response = MessageBoxW(m_hWnd, wGS(MSG_DEL_SURE).c_str(), wGS(MSG_DEL_TITLE).c_str(), MB_YESNO | MB_ICONQUESTION); int Response = MessageBox(wGS(MSG_DEL_SURE).c_str(), wGS(MSG_DEL_TITLE).c_str(), MB_YESNO | MB_ICONQUESTION);
if (Response != IDYES) { return TRUE; } if (Response != IDYES) { return TRUE; }
TVITEM item; TVITEM item;
@ -389,10 +389,10 @@ void CEnhancementConfig::AddCodeLayers(int index, const std::string & Name, HTRE
TV_INSERTSTRUCT tv; TV_INSERTSTRUCT tv;
//Work out text to add //Work out text to add
char Text[500], Item[500]; wchar_t Text[500], Item[500];
if (Name.length() > (sizeof(Text) - 5)) { g_Notify->BreakPoint(__FILE__, __LINE__); } if (Name.length() > (sizeof(Text) - 5)) { g_Notify->BreakPoint(__FILE__, __LINE__); }
strcpy(Text, Name.c_str()); wcscpy(Text, stdstr(Name).ToUTF16().c_str());
if (strchr(Text, '\\') > 0) { *strchr(Text, '\\') = 0; } if (wcschr(Text, L'\\') > 0) { *wcschr(Text, '\\') = 0; }
//See if text is already added //See if text is already added
tv.item.mask = TVIF_TEXT; tv.item.mask = TVIF_TEXT;
@ -402,7 +402,7 @@ void CEnhancementConfig::AddCodeLayers(int index, const std::string & Name, HTRE
while (tv.item.hItem) while (tv.item.hItem)
{ {
m_TreeList.GetItem(&tv.item); m_TreeList.GetItem(&tv.item);
if (strcmp(Text, Item) == 0) if (wcscmp(Text, Item) == 0)
{ {
//If already exists then just use existing one //If already exists then just use existing one
int State = TV_GetCheckState(tv.item.hItem); int State = TV_GetCheckState(tv.item.hItem);
@ -410,7 +410,7 @@ void CEnhancementConfig::AddCodeLayers(int index, const std::string & Name, HTRE
{ {
TV_SetCheckState(tv.item.hItem, TV_STATE_INDETERMINATE); TV_SetCheckState(tv.item.hItem, TV_STATE_INDETERMINATE);
} }
size_t StartPos = strlen(Text) + 1; size_t StartPos = wcslen(Text) + 1;
stdstr TempCheatName; stdstr TempCheatName;
if (StartPos < Name.length()) if (StartPos < Name.length())
{ {
@ -431,8 +431,8 @@ void CEnhancementConfig::AddCodeLayers(int index, const std::string & Name, HTRE
hParent = m_TreeList.InsertItem(&tv); hParent = m_TreeList.InsertItem(&tv);
TV_SetCheckState(hParent, Active ? TV_STATE_CHECKED : TV_STATE_CLEAR); TV_SetCheckState(hParent, Active ? TV_STATE_CHECKED : TV_STATE_CLEAR);
if (strcmp(Text, Name.c_str()) == 0) { return; } if (wcscmp(Text, stdstr(Name).ToUTF16().c_str()) == 0) { return; }
AddCodeLayers(index, (stdstr)(Name.substr(strlen(Text) + 1)), hParent, Active); AddCodeLayers(index, Name.substr(wcslen(Text) + 1), hParent, Active);
} }
bool CEnhancementConfig::TV_SetCheckState( HTREEITEM hItem, TV_CHECK_STATE state) bool CEnhancementConfig::TV_SetCheckState( HTREEITEM hItem, TV_CHECK_STATE state)
@ -535,12 +535,12 @@ void CEditEnhancement::Display(HWND ParentWindow)
LRESULT CEditEnhancement::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) LRESULT CEditEnhancement::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{ {
GetDlgItem(IDC_CODE_NAME).SetWindowTextA(m_EditItem >= 0 ? g_Settings->LoadStringIndex(Enhancement_Name, m_EditItem).c_str() : ""); GetDlgItem(IDC_CODE_NAME).SetWindowText(stdstr(m_EditItem >= 0 ? g_Settings->LoadStringIndex(Enhancement_Name, m_EditItem) : "").ToUTF16().c_str());
GetDlgItem(IDC_NOTES).SetWindowTextA(m_EditItem >= 0 ? g_Settings->LoadStringIndex(Enhancement_Notes, m_EditItem).c_str() : ""); GetDlgItem(IDC_NOTES).SetWindowText(stdstr(m_EditItem >= 0 ? g_Settings->LoadStringIndex(Enhancement_Notes, m_EditItem).c_str() : "").ToUTF16().c_str());
CButton(GetDlgItem(IDC_AUTOON)).SetCheck(g_Settings->LoadBoolIndex(Enhancement_OnByDefault, m_EditItem) ? BST_CHECKED : BST_UNCHECKED); CButton(GetDlgItem(IDC_AUTOON)).SetCheck(g_Settings->LoadBoolIndex(Enhancement_OnByDefault, m_EditItem) ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_OVERCLOCK)).SetCheck(g_Settings->LoadBoolIndex(Enhancement_Overclock, m_EditItem) ? BST_CHECKED : BST_UNCHECKED); CButton(GetDlgItem(IDC_OVERCLOCK)).SetCheck(g_Settings->LoadBoolIndex(Enhancement_Overclock, m_EditItem) ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_GAMESHARK)).SetCheck(g_Settings->LoadBoolIndex(Enhancement_Gameshark, m_EditItem) ? BST_CHECKED : BST_UNCHECKED); CButton(GetDlgItem(IDC_GAMESHARK)).SetCheck(g_Settings->LoadBoolIndex(Enhancement_Gameshark, m_EditItem) ? BST_CHECKED : BST_UNCHECKED);
GetDlgItem(IDC_OVER_CLOCK_MODIFIER).SetWindowTextA(m_EditItem >= 0 ? stdstr_f("%d", g_Settings->LoadDwordIndex(Enhancement_OverclockValue, m_EditItem)).c_str() : ""); GetDlgItem(IDC_OVER_CLOCK_MODIFIER).SetWindowText(stdstr(m_EditItem >= 0 ? stdstr_f("%d", g_Settings->LoadDwordIndex(Enhancement_OverclockValue, m_EditItem)).c_str() : "").ToUTF16().c_str());
return TRUE; return TRUE;
} }
@ -558,7 +558,7 @@ LRESULT CEditEnhancement::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWnd
LRESULT CEditEnhancement::OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) LRESULT CEditEnhancement::OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ {
std::string NewName = GetDlgItemStr(IDC_CODE_NAME); std::string NewName = stdstr().FromUTF16(GetDlgItemStr(IDC_CODE_NAME).c_str());
for (int i = 0; i < CCheats::MaxCheats; i++) for (int i = 0; i < CCheats::MaxCheats; i++)
{ {
@ -588,29 +588,29 @@ LRESULT CEditEnhancement::OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl
return true; return true;
} }
g_Settings->SaveStringIndex(Enhancement_Name, m_EditItem, NewName); g_Settings->SaveStringIndex(Enhancement_Name, m_EditItem, NewName);
g_Settings->SaveStringIndex(Enhancement_Notes, m_EditItem, GetDlgItemStr(IDC_NOTES)); g_Settings->SaveStringIndex(Enhancement_Notes, m_EditItem, stdstr().FromUTF16(GetDlgItemStr(IDC_NOTES).c_str()).c_str());
g_Settings->SaveBoolIndex(Enhancement_OnByDefault, m_EditItem, CButton(GetDlgItem(IDC_AUTOON)).GetCheck() == 1); g_Settings->SaveBoolIndex(Enhancement_OnByDefault, m_EditItem, CButton(GetDlgItem(IDC_AUTOON)).GetCheck() == 1);
g_Settings->SaveBoolIndex(Enhancement_Overclock, m_EditItem, CButton(GetDlgItem(IDC_OVERCLOCK)).GetCheck() == 1); g_Settings->SaveBoolIndex(Enhancement_Overclock, m_EditItem, CButton(GetDlgItem(IDC_OVERCLOCK)).GetCheck() == 1);
g_Settings->SaveDwordIndex(Enhancement_OverclockValue, m_EditItem, atoi(GetDlgItemStr(IDC_OVER_CLOCK_MODIFIER).c_str())); g_Settings->SaveDwordIndex(Enhancement_OverclockValue, m_EditItem, _wtoi(GetDlgItemStr(IDC_OVER_CLOCK_MODIFIER).c_str()));
g_Settings->SaveBoolIndex(Enhancement_Gameshark, m_EditItem, CButton(GetDlgItem(IDC_GAMESHARK)).GetCheck() == 1); g_Settings->SaveBoolIndex(Enhancement_Gameshark, m_EditItem, CButton(GetDlgItem(IDC_GAMESHARK)).GetCheck() == 1);
CSettingTypeEnhancements::FlushChanges(); CSettingTypeEnhancements::FlushChanges();
EndDialog(wID); EndDialog(wID);
return TRUE; return TRUE;
} }
std::string CEditEnhancement::GetDlgItemStr(int nIDDlgItem) std::wstring CEditEnhancement::GetDlgItemStr(int nIDDlgItem)
{ {
CWindow DlgItem = GetDlgItem(nIDDlgItem); CWindow DlgItem = GetDlgItem(nIDDlgItem);
int length = DlgItem.SendMessage(WM_GETTEXTLENGTH, 0, 0); int length = DlgItem.SendMessage(WM_GETTEXTLENGTH, 0, 0);
if (length == 0) if (length == 0)
{ {
return ""; return L"";
} }
stdstr Result; std::wstring Result;
Result.resize(length + 1); Result.resize(length + 1);
DlgItem.GetWindowText((char *)Result.c_str(), Result.length()); DlgItem.GetWindowText((wchar_t *)Result.c_str(), Result.length());
return Result; return Result;
} }
@ -682,7 +682,7 @@ LRESULT CEditGS::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*
} }
} while (ReadPos); } while (ReadPos);
CWindow Code = GetDlgItem(IDC_CHEAT_CODES); CWindow Code = GetDlgItem(IDC_CHEAT_CODES);
Code.SetWindowText(Buffer.c_str()); Code.SetWindowText(stdstr(Buffer.c_str()).ToUTF16().c_str());
Code.SetFocus(); Code.SetFocus();
Code.PostMessage(EM_SETSEL, (WPARAM)-1, 0); Code.PostMessage(EM_SETSEL, (WPARAM)-1, 0);
return TRUE; return TRUE;

View File

@ -28,7 +28,7 @@ void EnterLogOptions(HWND hwndOwner)
psp[0].hInstance = GetModuleHandle(NULL); psp[0].hInstance = GetModuleHandle(NULL);
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_Logging_Registers); psp[0].pszTemplate = MAKEINTRESOURCE(IDD_Logging_Registers);
psp[0].pfnDlgProc = (DLGPROC)LogRegProc; psp[0].pfnDlgProc = (DLGPROC)LogRegProc;
psp[0].pszTitle = "Registers"; psp[0].pszTitle = L"Registers";
psp[0].lParam = (LPARAM)&logSettings; psp[0].lParam = (LPARAM)&logSettings;
psp[0].pfnCallback = NULL; psp[0].pfnCallback = NULL;
@ -37,7 +37,7 @@ void EnterLogOptions(HWND hwndOwner)
psp[1].hInstance = GetModuleHandle(NULL); psp[1].hInstance = GetModuleHandle(NULL);
psp[1].pszTemplate = MAKEINTRESOURCE(IDD_Logging_PifRam); psp[1].pszTemplate = MAKEINTRESOURCE(IDD_Logging_PifRam);
psp[1].pfnDlgProc = (DLGPROC)LogPifProc; psp[1].pfnDlgProc = (DLGPROC)LogPifProc;
psp[1].pszTitle = "Pif Ram"; psp[1].pszTitle = L"Pif Ram";
psp[1].lParam = (LPARAM)&logSettings; psp[1].lParam = (LPARAM)&logSettings;
psp[1].pfnCallback = NULL; psp[1].pfnCallback = NULL;
@ -46,7 +46,7 @@ void EnterLogOptions(HWND hwndOwner)
psp[2].hInstance = GetModuleHandle(NULL); psp[2].hInstance = GetModuleHandle(NULL);
psp[2].pszTemplate = MAKEINTRESOURCE(IDD_Logging_General); psp[2].pszTemplate = MAKEINTRESOURCE(IDD_Logging_General);
psp[2].pfnDlgProc = (DLGPROC)LogGeneralProc; psp[2].pfnDlgProc = (DLGPROC)LogGeneralProc;
psp[2].pszTitle = "General"; psp[2].pszTitle = L"General";
psp[2].lParam = (LPARAM)&logSettings; psp[2].lParam = (LPARAM)&logSettings;
psp[2].pfnCallback = NULL; psp[2].pfnCallback = NULL;
@ -54,7 +54,7 @@ void EnterLogOptions(HWND hwndOwner)
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
psh.hwndParent = hwndOwner; psh.hwndParent = hwndOwner;
psh.hInstance = GetModuleHandle(NULL); psh.hInstance = GetModuleHandle(NULL);
psh.pszCaption = (LPSTR) "Log Options"; psh.pszCaption = (LPTSTR)L"Log Options";
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0; psh.nStartPage = 0;
psh.ppsp = (LPCPROPSHEETPAGE)&psp; psh.ppsp = (LPCPROPSHEETPAGE)&psp;

View File

@ -212,7 +212,7 @@ void CMainMenu::OnSaveAs(HWND hWnd)
{ {
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
char Directory[255], SaveFile[255]; char Directory[255], SaveFile[255];
OPENFILENAME openfilename; OPENFILENAMEA openfilename;
memset(&SaveFile, 0, sizeof(SaveFile)); memset(&SaveFile, 0, sizeof(SaveFile));
memset(&openfilename, 0, sizeof(openfilename)); memset(&openfilename, 0, sizeof(openfilename));
@ -228,7 +228,7 @@ void CMainMenu::OnSaveAs(HWND hWnd)
openfilename.Flags = OFN_HIDEREADONLY; openfilename.Flags = OFN_HIDEREADONLY;
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame); g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame);
if (GetSaveFileName(&openfilename)) if (GetSaveFileNameA(&openfilename))
{ {
_splitpath(SaveFile, drive, dir, fname, ext); _splitpath(SaveFile, drive, dir, fname, ext);
if (_stricmp(ext, ".pj") == 0 || _stricmp(ext, ".zip") == 0) if (_stricmp(ext, ".pj") == 0 || _stricmp(ext, ".zip") == 0)
@ -418,7 +418,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
WriteTrace(TraceError, TraceDebug, "Exception when going to full screen"); WriteTrace(TraceError, TraceDebug, "Exception when going to full screen");
char Message[600]; char Message[600];
sprintf(Message, "Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__); sprintf(Message, "Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__);
MessageBox(NULL, Message, "Exception", MB_OK); MessageBox(NULL, stdstr(Message).ToUTF16().c_str(), L"Exception", MB_OK);
} }
WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 4"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 4");
m_Gui->MakeWindowOnTop(false); m_Gui->MakeWindowOnTop(false);
@ -572,8 +572,8 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
g_Notify->DisplayMessage(3, stdstr_f(GS(MENU_SLOT_SAVE), GetSaveSlotString((MenuID - ID_CURRENT_SAVE_1) + 1).c_str()).c_str()); g_Notify->DisplayMessage(3, stdstr_f(GS(MENU_SLOT_SAVE), GetSaveSlotString((MenuID - ID_CURRENT_SAVE_1) + 1).c_str()).c_str());
g_Settings->SaveDword(Game_CurrentSaveState, (DWORD)((MenuID - ID_CURRENT_SAVE_1) + 1)); g_Settings->SaveDword(Game_CurrentSaveState, (DWORD)((MenuID - ID_CURRENT_SAVE_1) + 1));
break; break;
case ID_HELP_SUPPORTFORUM: ShellExecute(NULL, "open", "http://forum.pj64-emu.com/", NULL, NULL, SW_SHOWMAXIMIZED); break; case ID_HELP_SUPPORTFORUM: ShellExecute(NULL, L"open", L"http://forum.pj64-emu.com/", NULL, NULL, SW_SHOWMAXIMIZED); break;
case ID_HELP_HOMEPAGE: ShellExecute(NULL, "open", "http://www.pj64-emu.com", NULL, NULL, SW_SHOWMAXIMIZED); break; case ID_HELP_HOMEPAGE: ShellExecute(NULL, L"open", L"http://www.pj64-emu.com", NULL, NULL, SW_SHOWMAXIMIZED); break;
case ID_HELP_ABOUT: m_Gui->AboutBox(); break; case ID_HELP_ABOUT: m_Gui->AboutBox(); break;
case ID_HELP_ABOUTSETTINGFILES: m_Gui->AboutIniBox(); break; case ID_HELP_ABOUTSETTINGFILES: m_Gui->AboutIniBox(); break;
default: default:
@ -627,7 +627,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
stdstr CMainMenu::GetFileLastMod(const CPath & FileName) stdstr CMainMenu::GetFileLastMod(const CPath & FileName)
{ {
HANDLE hFile = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, HANDLE hFile = CreateFileA(FileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {

View File

@ -100,7 +100,7 @@ CMainGui::~CMainGui(void)
bool CMainGui::RegisterWinClass(void) bool CMainGui::RegisterWinClass(void)
{ {
stdstr_f VersionDisplay("Project64 %s", VER_FILE_VERSION_STR); std::wstring VersionDisplay = stdstr_f("Project64 %s", VER_FILE_VERSION_STR).ToUTF16();
WNDCLASS wcl; WNDCLASS wcl;
@ -499,7 +499,7 @@ void CMainGui::Create(const char * WindowTitle)
void CMainGui::CreateStatusBar(void) void CMainGui::CreateStatusBar(void)
{ {
m_hStatusWnd = (HWND)CreateStatusWindow(WS_CHILD | WS_VISIBLE, "", m_hMainWindow, StatusBarID); m_hStatusWnd = (HWND)CreateStatusWindow(WS_CHILD | WS_VISIBLE, L"", m_hMainWindow, StatusBarID);
SendMessage((HWND)m_hStatusWnd, SB_SETTEXT, 0, (LPARAM)""); SendMessage((HWND)m_hStatusWnd, SB_SETTEXT, 0, (LPARAM)"");
} }
@ -700,7 +700,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
//record class for future usage //record class for future usage
LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam; LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
CMainGui * _this = (CMainGui *)lpcs->lpCreateParams; CMainGui * _this = (CMainGui *)lpcs->lpCreateParams;
SetProp(hWnd, "Class", _this); SetProp(hWnd, L"Class", _this);
_this->m_hMainWindow = hWnd; _this->m_hMainWindow = hWnd;
_this->CreateStatusBar(); _this->CreateStatusBar();
@ -722,7 +722,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
case SC_SCREENSAVE: case SC_SCREENSAVE:
case SC_MONITORPOWER: case SC_MONITORPOWER:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this && if (_this &&
_this->bCPURunning() && _this->bCPURunning() &&
!g_Settings->LoadBool(GameRunning_CPU_Paused) && !g_Settings->LoadBool(GameRunning_CPU_Paused) &&
@ -734,7 +734,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case SC_MAXIMIZE: case SC_MAXIMIZE:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this) if (_this)
{ {
if (_this->RomBrowserVisible()) if (_this->RomBrowserVisible())
@ -749,7 +749,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_MOVE: case WM_MOVE:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (!_this->m_bMainWindow || if (!_this->m_bMainWindow ||
!_this->m_Created || !_this->m_Created ||
@ -804,14 +804,14 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
if (wParam == Timer_SetWindowPos) if (wParam == Timer_SetWindowPos)
{ {
KillTimer(hWnd, Timer_SetWindowPos); KillTimer(hWnd, Timer_SetWindowPos);
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
_this->SaveWindowLoc(); _this->SaveWindowLoc();
break; break;
} }
break; break;
case WM_SIZE: case WM_SIZE:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this) { _this->Resize(wParam, LOWORD(lParam), HIWORD(lParam)); } if (_this) { _this->Resize(wParam, LOWORD(lParam), HIWORD(lParam)); }
if (_this) if (_this)
{ {
@ -835,7 +835,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_NOTIFY: case WM_NOTIFY:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this == NULL || !_this->RomBrowserVisible() || !_this->RomListNotify(wParam, lParam)) if (_this == NULL || !_this->RomBrowserVisible() || !_this->RomListNotify(wParam, lParam))
{ {
return DefWindowProc(hWnd, uMsg, wParam, lParam); return DefWindowProc(hWnd, uMsg, wParam, lParam);
@ -844,7 +844,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_DRAWITEM: case WM_DRAWITEM:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this) if (_this)
{ {
if (!_this->RomListDrawItem(wParam, lParam)) if (!_this->RomListDrawItem(wParam, lParam))
@ -870,7 +870,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_KEYUP: case WM_KEYUP:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this->m_bMainWindow && bCPURunning()) if (_this->m_bMainWindow && bCPURunning())
{ {
@ -885,7 +885,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this->m_bMainWindow && bCPURunning()) if (_this->m_bMainWindow && bCPURunning())
{ {
@ -901,7 +901,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_SETFOCUS: case WM_SETFOCUS:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this->RomBrowserVisible()) if (_this->RomBrowserVisible())
{ {
PostMessage(hWnd, WM_BROWSER_TOP, 0, 0); PostMessage(hWnd, WM_BROWSER_TOP, 0, 0);
@ -919,7 +919,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_KILLFOCUS: case WM_KILLFOCUS:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this->RomBrowserVisible()) if (_this->RomBrowserVisible())
{ {
break; break;
@ -936,7 +936,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_ACTIVATEAPP: case WM_ACTIVATEAPP:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
DWORD fActive = (BOOL)wParam; DWORD fActive = (BOOL)wParam;
if (fActive && _this->RomBrowserVisible()) if (fActive && _this->RomBrowserVisible())
@ -976,19 +976,19 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_MAKE_FOCUS: case WM_MAKE_FOCUS:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
_this->BringToTop(); _this->BringToTop();
} }
break; break;
case WM_BROWSER_TOP: case WM_BROWSER_TOP:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
_this->RomBrowserToTop(); _this->RomBrowserToTop();
} }
break; break;
case WM_RESET_PLUGIN: case WM_RESET_PLUGIN:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this->m_ResetInfo != NULL) if (_this->m_ResetInfo != NULL)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
@ -999,7 +999,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_GAME_CLOSED: case WM_GAME_CLOSED:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
Notify().WindowMode(); Notify().WindowMode();
if (UISettingsLoadBool(RomBrowser_Enabled)) if (UISettingsLoadBool(RomBrowser_Enabled))
{ {
@ -1013,7 +1013,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break; break;
case WM_COMMAND: case WM_COMMAND:
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this == NULL) { break; } if (_this == NULL) { break; }
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
@ -1180,7 +1180,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
char filename[MAX_PATH]; char filename[MAX_PATH];
HDROP hDrop = (HDROP)wParam; HDROP hDrop = (HDROP)wParam;
DragQueryFile(hDrop, 0, filename, sizeof(filename)); DragQueryFileA(hDrop, 0, filename, sizeof(filename));
DragFinish(hDrop); DragFinish(hDrop);
stdstr ext = CPath(filename).GetExtension(); stdstr ext = CPath(filename).GetExtension();
@ -1197,7 +1197,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
case WM_DESTROY: case WM_DESTROY:
WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - start"); WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - start");
{ {
CMainGui * _this = (CMainGui *)GetProp(hWnd, "Class"); CMainGui * _this = (CMainGui *)GetProp(hWnd, L"Class");
if (_this->m_bMainWindow) if (_this->m_bMainWindow)
{ {
Notify().WindowMode(); Notify().WindowMode();
@ -1212,7 +1212,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
} }
} }
WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - 3"); WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - 3");
RemoveProp(hWnd, "Class"); RemoveProp(hWnd, L"Class");
WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - 4"); WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - 4");
PostQuitMessage(0); PostQuitMessage(0);
WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - Done"); WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - Done");
@ -1245,10 +1245,10 @@ DWORD CALLBACK AboutBoxProc(HWND hWnd, DWORD uMsg, DWORD wParam, DWORD /*lParam*
BITMAP bmTL; BITMAP bmTL;
GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL); GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL);
hTextFont = ::CreateFont((int)(18 * DPIScale), 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial"); hTextFont = ::CreateFont((int)(18 * DPIScale), 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial");
hAuthorFont = ::CreateFont((int)(18 * DPIScale), 0, 0, 0, FW_BOLD, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial"); hAuthorFont = ::CreateFont((int)(18 * DPIScale), 0, 0, 0, FW_BOLD, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial");
hPageHeadingFont = ::CreateFont((int)(24 * DPIScale), 0, 0, 0, FW_BOLD, 0, FALSE, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial Bold"); hPageHeadingFont = ::CreateFont((int)(24 * DPIScale), 0, 0, 0, FW_BOLD, 0, FALSE, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial Bold");
SendDlgItemMessage(hWnd, IDC_VERSION, WM_SETFONT, (WPARAM)hTextFont, TRUE); SendDlgItemMessage(hWnd, IDC_VERSION, WM_SETFONT, (WPARAM)hTextFont, TRUE);
SendDlgItemMessage(hWnd, IDC_TEAM, WM_SETFONT, (WPARAM)hPageHeadingFont, TRUE); SendDlgItemMessage(hWnd, IDC_TEAM, WM_SETFONT, (WPARAM)hPageHeadingFont, TRUE);
@ -1267,7 +1267,7 @@ DWORD CALLBACK AboutBoxProc(HWND hWnd, DWORD uMsg, DWORD wParam, DWORD /*lParam*
SendDlgItemMessage(hWnd, IDC_THANK_LIST, WM_SETFONT, (WPARAM)hTextFont, TRUE); SendDlgItemMessage(hWnd, IDC_THANK_LIST, WM_SETFONT, (WPARAM)hTextFont, TRUE);
stdstr_f VersionDisplay("Version: %s", VER_FILE_VERSION_STR); stdstr_f VersionDisplay("Version: %s", VER_FILE_VERSION_STR);
SetWindowText(GetDlgItem(hWnd, IDC_VERSION), VersionDisplay.c_str()); SetWindowText(GetDlgItem(hWnd, IDC_VERSION), VersionDisplay.ToUTF16().c_str());
} }
break; break;
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:

View File

@ -1,170 +1,170 @@
#include "stdafx.h" #include "stdafx.h"
VIRTUAL_KEY CMenuShortCutKey::m_VirtualKeyList[] = { VIRTUAL_KEY CMenuShortCutKey::m_VirtualKeyList[] = {
{ "VK_LBUTTON", 0x01, "VK_LBUTTON" }, { L"VK_LBUTTON", 0x01, L"VK_LBUTTON" },
{ "VK_RBUTTON", 0x02, "VK_RBUTTON" }, { L"VK_RBUTTON", 0x02, L"VK_RBUTTON" },
{ "VK_CANCEL", 0x03, "VK_CANCEL" }, { L"VK_CANCEL", 0x03, L"VK_CANCEL" },
{ "VK_MBUTTON", 0x04, "VK_MBUTTON" }, { L"VK_MBUTTON", 0x04, L"VK_MBUTTON" },
{ "VK_XBUTTON1", 0x05, "VK_XBUTTON1" }, { L"VK_XBUTTON1", 0x05, L"VK_XBUTTON1" },
{ "VK_XBUTTON2", 0x06, "VK_XBUTTON2" }, { L"VK_XBUTTON2", 0x06, L"VK_XBUTTON2" },
{ "VK_BACK", 0x08, "VK_BACK" }, { L"VK_BACK", 0x08, L"VK_BACK" },
{ "VK_TAB", 0x09, "VK_TAB" }, { L"VK_TAB", 0x09, L"VK_TAB" },
{ "VK_CLEAR", 0x0C, "VK_CLEAR" }, { L"VK_CLEAR", 0x0C, L"VK_CLEAR" },
{ "VK_RETURN", 0x0D, "Return" }, { L"VK_RETURN", 0x0D, L"Return" },
{ "VK_SHIFT", 0x10, "VK_SHIFT" }, { L"VK_SHIFT", 0x10, L"VK_SHIFT" },
{ "VK_CONTROL", 0x11, "VK_CONTROL" }, { L"VK_CONTROL", 0x11, L"VK_CONTROL" },
{ "VK_MENU", 0x12, "VK_MENU" }, { L"VK_MENU", 0x12, L"VK_MENU" },
{ "VK_PAUSE", 0x13, "Pause" }, { L"VK_PAUSE", 0x13, L"Pause" },
{ "VK_CAPITAL", 0x14, "VK_CAPITAL" }, { L"VK_CAPITAL", 0x14, L"VK_CAPITAL" },
{ "VK_KANA", 0x15, "VK_KANA" }, { L"VK_KANA", 0x15, L"VK_KANA" },
{ "VK_HANGUL", 0x15, "VK_HANGUL" }, { L"VK_HANGUL", 0x15, L"VK_HANGUL" },
{ "VK_JUNJA", 0x17, "VK_JUNJA" }, { L"VK_JUNJA", 0x17, L"VK_JUNJA" },
{ "VK_FINAL", 0x18, "VK_FINAL" }, { L"VK_FINAL", 0x18, L"VK_FINAL" },
{ "VK_HANJA", 0x19, "VK_HANJA" }, { L"VK_HANJA", 0x19, L"VK_HANJA" },
{ "VK_KANJI", 0x19, "VK_KANJI" }, { L"VK_KANJI", 0x19, L"VK_KANJI" },
{ "VK_ESCAPE", 0x1B, "Esc" }, { L"VK_ESCAPE", 0x1B, L"Esc" },
{ "VK_CONVERT", 0x1C, "VK_CONVERT" }, { L"VK_CONVERT", 0x1C, L"VK_CONVERT" },
{ "VK_NONCONVERT", 0x1D, "VK_NONCONVERT" }, { L"VK_NONCONVERT", 0x1D, L"VK_NONCONVERT" },
{ "VK_ACCEPT", 0x1E, "VK_ACCEPT" }, { L"VK_ACCEPT", 0x1E, L"VK_ACCEPT" },
{ "VK_MODECHANGE", 0x1F, "VK_MODECHANGE" }, { L"VK_MODECHANGE", 0x1F, L"VK_MODECHANGE" },
{ "VK_SPACE", 0x20, "Space" }, { L"VK_SPACE", 0x20, L"Space" },
{ "VK_PRIOR", 0x21, "Page Up" }, { L"VK_PRIOR", 0x21, L"Page Up" },
{ "VK_NEXT", 0x22, "Page Down" }, { L"VK_NEXT", 0x22, L"Page Down" },
{ "VK_END", 0x23, "End" }, { L"VK_END", 0x23, L"End" },
{ "VK_HOME", 0x24, "Home" }, { L"VK_HOME", 0x24, L"Home" },
{ "VK_LEFT", 0x25, "Left" }, { L"VK_LEFT", 0x25, L"Left" },
{ "VK_UP", 0x26, "Up" }, { L"VK_UP", 0x26, L"Up" },
{ "VK_RIGHT", 0x27, "Right" }, { L"VK_RIGHT", 0x27, L"Right" },
{ "VK_DOWN", 0x28, "Down" }, { L"VK_DOWN", 0x28, L"Down" },
{ "VK_SELECT", 0x29, "VK_SELECT" }, { L"VK_SELECT", 0x29, L"VK_SELECT" },
{ "VK_PRINT", 0x2A, "VK_PRINT" }, { L"VK_PRINT", 0x2A, L"VK_PRINT" },
{ "VK_EXECUTE", 0x2B, "VK_EXECUTE" }, { L"VK_EXECUTE", 0x2B, L"VK_EXECUTE" },
{ "VK_SNAPSHOT", 0x2C, "VK_SNAPSHOT" }, { L"VK_SNAPSHOT", 0x2C, L"VK_SNAPSHOT" },
{ "VK_INSERT", 0x2D, "Insert" }, { L"VK_INSERT", 0x2D, L"Insert" },
{ "VK_DELETE", 0x2E, "Delete" }, { L"VK_DELETE", 0x2E, L"Delete" },
{ "VK_HELP", 0x2F, "Help" }, { L"VK_HELP", 0x2F, L"Help" },
{ "VK_0", 0x30, "0" }, { L"VK_0", 0x30, L"0" },
{ "VK_1", 0x31, "1" }, { L"VK_1", 0x31, L"1" },
{ "VK_2", 0x32, "2" }, { L"VK_2", 0x32, L"2" },
{ "VK_3", 0x33, "3" }, { L"VK_3", 0x33, L"3" },
{ "VK_4", 0x34, "4" }, { L"VK_4", 0x34, L"4" },
{ "VK_5", 0x35, "5" }, { L"VK_5", 0x35, L"5" },
{ "VK_6", 0x36, "6" }, { L"VK_6", 0x36, L"6" },
{ "VK_7", 0x37, "7" }, { L"VK_7", 0x37, L"7" },
{ "VK_8", 0x38, "8" }, { L"VK_8", 0x38, L"8" },
{ "VK_9", 0x39, "9" }, { L"VK_9", 0x39, L"9" },
{ "VK_A", 0x41, "A" }, { L"VK_A", 0x41, L"A" },
{ "VK_B", 0x42, "B" }, { L"VK_B", 0x42, L"B" },
{ "VK_C", 0x43, "C" }, { L"VK_C", 0x43, L"C" },
{ "VK_D", 0x44, "D" }, { L"VK_D", 0x44, L"D" },
{ "VK_E", 0x45, "E" }, { L"VK_E", 0x45, L"E" },
{ "VK_F", 0x46, "F" }, { L"VK_F", 0x46, L"F" },
{ "VK_G", 0x47, "G" }, { L"VK_G", 0x47, L"G" },
{ "VK_H", 0x48, "H" }, { L"VK_H", 0x48, L"H" },
{ "VK_I", 0x49, "I" }, { L"VK_I", 0x49, L"I" },
{ "VK_J", 0x4A, "J" }, { L"VK_J", 0x4A, L"J" },
{ "VK_K", 0x4B, "K" }, { L"VK_K", 0x4B, L"K" },
{ "VK_L", 0x4C, "L" }, { L"VK_L", 0x4C, L"L" },
{ "VK_M", 0x4D, "M" }, { L"VK_M", 0x4D, L"M" },
{ "VK_N", 0x4E, "N" }, { L"VK_N", 0x4E, L"N" },
{ "VK_O", 0x4F, "O" }, { L"VK_O", 0x4F, L"O" },
{ "VK_P", 0x50, "P" }, { L"VK_P", 0x50, L"P" },
{ "VK_Q", 0x51, "Q" }, { L"VK_Q", 0x51, L"Q" },
{ "VK_R", 0x52, "R" }, { L"VK_R", 0x52, L"R" },
{ "VK_S", 0x53, "S" }, { L"VK_S", 0x53, L"S" },
{ "VK_T", 0x54, "T" }, { L"VK_T", 0x54, L"T" },
{ "VK_U", 0x55, "U" }, { L"VK_U", 0x55, L"U" },
{ "VK_V", 0x56, "V" }, { L"VK_V", 0x56, L"V" },
{ "VK_W", 0x57, "W" }, { L"VK_W", 0x57, L"W" },
{ "VK_X", 0x58, "X" }, { L"VK_X", 0x58, L"X" },
{ "VK_Y", 0x59, "Y" }, { L"VK_Y", 0x59, L"Y" },
{ "VK_Z", 0x5A, "Z" }, { L"VK_Z", 0x5A, L"Z" },
{ "VK_LWIN", 0x5B, "VK_LWIN" }, { L"VK_LWIN", 0x5B, L"VK_LWIN" },
{ "VK_RWIN", 0x5C, "VK_RWIN" }, { L"VK_RWIN", 0x5C, L"VK_RWIN" },
{ "VK_APPS", 0x5D, "VK_APPS" }, { L"VK_APPS", 0x5D, L"VK_APPS" },
{ "VK_SLEEP", 0x5D, "VK_SLEEP" }, { L"VK_SLEEP", 0x5D, L"VK_SLEEP" },
{ "VK_NUMPAD0", 0x60, "Numpad0" }, { L"VK_NUMPAD0", 0x60, L"Numpad0" },
{ "VK_NUMPAD1", 0x61, "Numpad1" }, { L"VK_NUMPAD1", 0x61, L"Numpad1" },
{ "VK_NUMPAD2", 0x62, "Numpad2" }, { L"VK_NUMPAD2", 0x62, L"Numpad2" },
{ "VK_NUMPAD3", 0x63, "Numpad3" }, { L"VK_NUMPAD3", 0x63, L"Numpad3" },
{ "VK_NUMPAD4", 0x64, "Numpad4" }, { L"VK_NUMPAD4", 0x64, L"Numpad4" },
{ "VK_NUMPAD5", 0x65, "Numpad5" }, { L"VK_NUMPAD5", 0x65, L"Numpad5" },
{ "VK_NUMPAD6", 0x66, "Numpad6" }, { L"VK_NUMPAD6", 0x66, L"Numpad6" },
{ "VK_NUMPAD7", 0x67, "Numpad7" }, { L"VK_NUMPAD7", 0x67, L"Numpad7" },
{ "VK_NUMPAD8", 0x68, "Numpad8" }, { L"VK_NUMPAD8", 0x68, L"Numpad8" },
{ "VK_NUMPAD9", 0x69, "Numpad9" }, { L"VK_NUMPAD9", 0x69, L"Numpad9" },
{ "VK_MULTIPLY", 0x6A, "*" }, { L"VK_MULTIPLY", 0x6A, L"*" },
{ "VK_ADD", 0x6B, "+" }, { L"VK_ADD", 0x6B, L"+" },
{ "VK_SEPARATOR", 0x6C, "" }, { L"VK_SEPARATOR", 0x6C, L"" },
{ "VK_SUBTRACT", 0x6D, "-" }, { L"VK_SUBTRACT", 0x6D, L"-" },
{ "VK_DECIMAL", 0x6E, "." }, { L"VK_DECIMAL", 0x6E, L"." },
{ "VK_DIVIDE", 0x6F, "/" }, { L"VK_DIVIDE", 0x6F, L"/" },
{ "VK_F1", 0x70, "F1" }, { L"VK_F1", 0x70, L"F1" },
{ "VK_F2", 0x71, "F2" }, { L"VK_F2", 0x71, L"F2" },
{ "VK_F3", 0x72, "F3" }, { L"VK_F3", 0x72, L"F3" },
{ "VK_F4", 0x73, "F4" }, { L"VK_F4", 0x73, L"F4" },
{ "VK_F5", 0x74, "F5" }, { L"VK_F5", 0x74, L"F5" },
{ "VK_F6", 0x75, "F6" }, { L"VK_F6", 0x75, L"F6" },
{ "VK_F7", 0x76, "F7" }, { L"VK_F7", 0x76, L"F7" },
{ "VK_F8", 0x77, "F8" }, { L"VK_F8", 0x77, L"F8" },
{ "VK_F9", 0x78, "F9" }, { L"VK_F9", 0x78, L"F9" },
{ "VK_F10", 0x79, "F10" }, { L"VK_F10", 0x79, L"F10" },
{ "VK_F11", 0x7A, "F11" }, { L"VK_F11", 0x7A, L"F11" },
{ "VK_F12", 0x7B, "F12" }, { L"VK_F12", 0x7B, L"F12" },
{ "VK_F13", 0x7C, "F13" }, { L"VK_F13", 0x7C, L"F13" },
{ "VK_F14", 0x7D, "F14" }, { L"VK_F14", 0x7D, L"F14" },
{ "VK_F15", 0x7E, "F15" }, { L"VK_F15", 0x7E, L"F15" },
{ "VK_F16", 0x7F, "F16" }, { L"VK_F16", 0x7F, L"F16" },
{ "VK_F17", 0x80, "F17" }, { L"VK_F17", 0x80, L"F17" },
{ "VK_F18", 0x81, "F18" }, { L"VK_F18", 0x81, L"F18" },
{ "VK_F19", 0x82, "F19" }, { L"VK_F19", 0x82, L"F19" },
{ "VK_F20", 0x83, "F20" }, { L"VK_F20", 0x83, L"F20" },
{ "VK_F21", 0x84, "F21" }, { L"VK_F21", 0x84, L"F21" },
{ "VK_F22", 0x85, "F22" }, { L"VK_F22", 0x85, L"F22" },
{ "VK_F23", 0x86, "F23" }, { L"VK_F23", 0x86, L"F23" },
{ "VK_F24", 0x87, "F24" }, { L"VK_F24", 0x87, L"F24" },
{ "VK_NUMLOCK", 0x90, "Numlock" }, { L"VK_NUMLOCK", 0x90, L"Numlock" },
{ "VK_SCROLL", 0x91, "VK_SCROLL" }, { L"VK_SCROLL", 0x91, L"VK_SCROLL" },
{ "VK_LSHIFT", 0xA0, "VK_LSHIFT" }, { L"VK_LSHIFT", 0xA0, L"VK_LSHIFT" },
{ "VK_RSHIFT", 0xA1, "VK_RSHIFT" }, { L"VK_RSHIFT", 0xA1, L"VK_RSHIFT" },
{ "VK_LCONTROL", 0xA2, "VK_LCONTROL" }, { L"VK_LCONTROL", 0xA2, L"VK_LCONTROL" },
{ "VK_RCONTROL", 0xA3, "VK_RCONTROL" }, { L"VK_RCONTROL", 0xA3, L"VK_RCONTROL" },
{ "VK_LMENU", 0xA4, "VK_LMENU" }, { L"VK_LMENU", 0xA4, L"VK_LMENU" },
{ "VK_RMENU", 0xA5, "VK_RMENU" }, { L"VK_RMENU", 0xA5, L"VK_RMENU" },
{ "VK_BROWSER_BACK", 0xA6, "" }, { L"VK_BROWSER_BACK", 0xA6, L"" },
{ "VK_BROWSER_FORWARD", 0xA7, "" }, { L"VK_BROWSER_FORWARD", 0xA7, L"" },
{ "VK_BROWSER_REFRESH", 0xA8, "" }, { L"VK_BROWSER_REFRESH", 0xA8, L"" },
{ "VK_BROWSER_STOP", 0xA9, "" }, { L"VK_BROWSER_STOP", 0xA9, L"" },
{ "VK_BROWSER_SEARCH", 0xAA, "" }, { L"VK_BROWSER_SEARCH", 0xAA, L"" },
{ "VK_BROWSER_FAVORITES", 0xAB, "" }, { L"VK_BROWSER_FAVORITES", 0xAB, L"" },
{ "VK_BROWSER_HOME", 0xAC, "" }, { L"VK_BROWSER_HOME", 0xAC, L"" },
{ "VK_VOLUME_MUTE", 0xAD, "" }, { L"VK_VOLUME_MUTE", 0xAD, L"" },
{ "VK_VOLUME_DOWN", 0xAE, "" }, { L"VK_VOLUME_DOWN", 0xAE, L"" },
{ "VK_VOLUME_UP", 0xAF, "" }, { L"VK_VOLUME_UP", 0xAF, L"" },
{ "VK_MEDIA_NEXT_TRACK", 0xB0, "" }, { L"VK_MEDIA_NEXT_TRACK", 0xB0, L"" },
{ "VK_MEDIA_PREV_TRACK", 0xB1, "" }, { L"VK_MEDIA_PREV_TRACK", 0xB1, L"" },
{ "VK_MEDIA_STOP", 0xB2, "" }, { L"VK_MEDIA_STOP", 0xB2, L"" },
{ "VK_MEDIA_PLAY_PAUSE", 0xB3, "" }, { L"VK_MEDIA_PLAY_PAUSE", 0xB3, L"" },
{ "VK_LAUNCH_MAIL", 0xB4, "" }, { L"VK_LAUNCH_MAIL", 0xB4, L"" },
{ "VK_LAUNCH_MEDIA_SELECT", 0xB5, "" }, { L"VK_LAUNCH_MEDIA_SELECT", 0xB5, L"" },
{ "VK_LAUNCH_APP1", 0xB6, "" }, { L"VK_LAUNCH_APP1", 0xB6, L"" },
{ "VK_LAUNCH_APP2", 0xB7, "" }, { L"VK_LAUNCH_APP2", 0xB7, L"" },
{ "VK_OEM_1 (;:)", 0xBA, "" }, { L"VK_OEM_1 (;:)", 0xBA, L"" },
{ "VK_OEM_PLUS", 0xBB, "+" }, { L"VK_OEM_PLUS", 0xBB, L"+" },
{ "VK_OEM_COMMA", 0xBC, "" }, { L"VK_OEM_COMMA", 0xBC, L"" },
{ "VK_OEM_MINUS", 0xBD, "-" }, { L"VK_OEM_MINUS", 0xBD, L"-" },
{ "VK_OEM_PERIOD", 0xBE, "." }, { L"VK_OEM_PERIOD", 0xBE, L"." },
{ "VK_OEM_2 (/?)", 0xBF, "" }, { L"VK_OEM_2 (/?)", 0xBF, L"" },
{ "VK_OEM_3 (`~)", 0xC0, "~" }, { L"VK_OEM_3 (`~)", 0xC0, L"~" },
{ "VK_ATTN", 0xF6, "" }, { L"VK_ATTN", 0xF6, L"" },
{ "VK_CRSEL", 0xF7, "" }, { L"VK_CRSEL", 0xF7, L"" },
{ "VK_EXSEL", 0xF8, "" }, { L"VK_EXSEL", 0xF8, L"" },
{ "VK_EREOF", 0xF9, "" }, { L"VK_EREOF", 0xF9, L"" },
{ "VK_PLAY", 0xFA, "" }, { L"VK_PLAY", 0xFA, L"" },
{ "VK_ZOOM", 0xFB, "" }, { L"VK_ZOOM", 0xFB, L"" },
{ "VK_NONAME", 0xFC, "" }, { L"VK_NONAME", 0xFC, L"" },
{ "VK_PA1", 0xFD, "" }, { L"VK_PA1", 0xFD, L"" },
{ "VK_OEM_CLEAR", 0xFE } { L"VK_OEM_CLEAR", 0xFE, L"" }
}; };
CMenuShortCutKey::CMenuShortCutKey(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded, bool bInactive) : CMenuShortCutKey::CMenuShortCutKey(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded, bool bInactive) :
@ -176,7 +176,7 @@ CMenuShortCutKey::CMenuShortCutKey(WORD key, bool bCtrl, bool bAlt, bool bShift,
m_bUserAdded(bUserAdded), m_bUserAdded(bUserAdded),
m_bInactive(bInactive) m_bInactive(bInactive)
{ {
m_ShortCutName = ""; m_ShortCutName = L"";
for (int i = 0, n = sizeof(m_VirtualKeyList) / sizeof(m_VirtualKeyList[0]); i < n; i++) for (int i = 0, n = sizeof(m_VirtualKeyList) / sizeof(m_VirtualKeyList[0]); i < n; i++)
{ {
if (key == m_VirtualKeyList[i].Key) if (key == m_VirtualKeyList[i].Key)
@ -185,9 +185,9 @@ CMenuShortCutKey::CMenuShortCutKey(WORD key, bool bCtrl, bool bAlt, bool bShift,
break; break;
} }
} }
if (m_bShift) { m_ShortCutName.Format("Shift+%s", m_ShortCutName.c_str()); } if (m_bShift) { m_ShortCutName = stdstr_f("Shift+%ls", m_ShortCutName.c_str()).ToUTF16(); }
if (m_bCtrl) { m_ShortCutName.Format("Ctrl+%s", m_ShortCutName.c_str()); } if (m_bCtrl) { m_ShortCutName = stdstr_f("Ctrl+%ls", m_ShortCutName.c_str()).ToUTF16(); }
if (m_bAlt) { m_ShortCutName.Format("Alt+%s", m_ShortCutName.c_str()); } if (m_bAlt) { m_ShortCutName = stdstr_f("Alt+%s", m_ShortCutName.c_str()).ToUTF16(); }
} }
VIRTUAL_KEY * CMenuShortCutKey::VirtualKeyList(int &Size) VIRTUAL_KEY * CMenuShortCutKey::VirtualKeyList(int &Size)
@ -344,7 +344,7 @@ std::wstring CShortCuts::ShortCutString(int MenuID, CMenuShortCutKey::RUNNING_ST
{ {
continue; continue;
} }
return item->Name().ToUTF16(); return item->Name();
} }
return L""; return L"";
} }

View File

@ -12,9 +12,9 @@
struct VIRTUAL_KEY struct VIRTUAL_KEY
{ {
LPCSTR Name; LPCTSTR Name;
int Key; int Key;
LPCSTR KeyName; LPCTSTR KeyName;
}; };
class CMenuShortCutKey class CMenuShortCutKey
@ -38,18 +38,6 @@ public:
ACCESS_ANYTIME = 7, ACCESS_ANYTIME = 7,
}; };
private:
static VIRTUAL_KEY m_VirtualKeyList[];
stdstr m_ShortCutName;
WORD m_key;
bool m_bCtrl;
bool m_bAlt;
bool m_bShift;
ACCESS_MODE m_AccessMode;
bool m_bUserAdded;
bool m_bInactive;
public: public:
CMenuShortCutKey(void); CMenuShortCutKey(void);
CMenuShortCutKey(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded, bool bInactive); CMenuShortCutKey(WORD key, bool bCtrl, bool bAlt, bool bShift, ACCESS_MODE AccessMode, bool bUserAdded, bool bInactive);
@ -59,7 +47,7 @@ public:
static VIRTUAL_KEY * VirtualKeyList(int &Size); static VIRTUAL_KEY * VirtualKeyList(int &Size);
static RUNNING_STATE RunningState(void); static RUNNING_STATE RunningState(void);
inline stdstr Name(void) const { return m_ShortCutName; } inline const std::wstring & Name(void) const { return m_ShortCutName; }
inline WORD Key(void) const { return m_key; } inline WORD Key(void) const { return m_key; }
inline bool Ctrl(void) const { return m_bCtrl; } inline bool Ctrl(void) const { return m_bCtrl; }
inline bool Alt(void) const { return m_bAlt; } inline bool Alt(void) const { return m_bAlt; }
@ -69,6 +57,18 @@ public:
inline ACCESS_MODE AccessMode(void) const { return m_AccessMode; } inline ACCESS_MODE AccessMode(void) const { return m_AccessMode; }
inline void SetInactive(bool Inactive) { m_bInactive = Inactive; } inline void SetInactive(bool Inactive) { m_bInactive = Inactive; }
private:
static VIRTUAL_KEY m_VirtualKeyList[];
std::wstring m_ShortCutName;
WORD m_key;
bool m_bCtrl;
bool m_bAlt;
bool m_bShift;
ACCESS_MODE m_AccessMode;
bool m_bUserAdded;
bool m_bInactive;
}; };
class CShortCutItem class CShortCutItem

View File

@ -40,7 +40,7 @@ CRomBrowser::~CRomBrowser(void)
void CRomBrowser::AddField(ROMBROWSER_FIELDS_LIST & Fields, LPCSTR Name, int32_t Pos, int32_t ID, int32_t Width, LanguageStringID LangID, bool UseDefault) void CRomBrowser::AddField(ROMBROWSER_FIELDS_LIST & Fields, LPCSTR Name, int32_t Pos, int32_t ID, int32_t Width, LanguageStringID LangID, bool UseDefault)
{ {
Fields.push_back(ROMBROWSER_FIELDS(Name, Pos, ID, Width * DPIScale(), LangID, UseDefault)); Fields.push_back(ROMBROWSER_FIELDS(Name, Pos, ID, (int)(Width * DPIScale()), LangID, UseDefault));
} }
void CRomBrowser::GetFieldInfo(ROMBROWSER_FIELDS_LIST & Fields, bool UseDefault /* = false */) void CRomBrowser::GetFieldInfo(ROMBROWSER_FIELDS_LIST & Fields, bool UseDefault /* = false */)
@ -659,26 +659,26 @@ int32_t CALLBACK CRomBrowser::RomList_CompareItems(uint32_t lParam1, uint32_t lP
switch (SortFieldInfo->Key) switch (SortFieldInfo->Key)
{ {
case RB_FileName: result = (int32_t)lstrcmpi(pRomInfo1->FileName, pRomInfo2->FileName); break; case RB_FileName: result = (int32_t)lstrcmpiA(pRomInfo1->FileName, pRomInfo2->FileName); break;
case RB_InternalName: result = (int32_t)lstrcmpi(pRomInfo1->InternalName, pRomInfo2->InternalName); break; case RB_InternalName: result = (int32_t)lstrcmpiA(pRomInfo1->InternalName, pRomInfo2->InternalName); break;
case RB_GoodName: result = (int32_t)lstrcmpi(GoodName1, GoodName2); break; case RB_GoodName: result = (int32_t)lstrcmpiA(GoodName1, GoodName2); break;
case RB_Name: result = (int32_t)lstrcmpi(Name1, Name2); break; case RB_Name: result = (int32_t)lstrcmpiA(Name1, Name2); break;
case RB_Status: result = (int32_t)lstrcmpi(pRomInfo1->Status, pRomInfo2->Status); break; case RB_Status: result = (int32_t)lstrcmpiA(pRomInfo1->Status, pRomInfo2->Status); break;
case RB_RomSize: result = (int32_t)pRomInfo1->RomSize - (int32_t)pRomInfo2->RomSize; break; case RB_RomSize: result = (int32_t)pRomInfo1->RomSize - (int32_t)pRomInfo2->RomSize; break;
case RB_CoreNotes: result = (int32_t)lstrcmpi(pRomInfo1->CoreNotes, pRomInfo2->CoreNotes); break; case RB_CoreNotes: result = (int32_t)lstrcmpiA(pRomInfo1->CoreNotes, pRomInfo2->CoreNotes); break;
case RB_PluginNotes: result = (int32_t)lstrcmpi(pRomInfo1->PluginNotes, pRomInfo2->PluginNotes); break; case RB_PluginNotes: result = (int32_t)lstrcmpiA(pRomInfo1->PluginNotes, pRomInfo2->PluginNotes); break;
case RB_UserNotes: result = (int32_t)lstrcmpi(pRomInfo1->UserNotes, pRomInfo2->UserNotes); break; case RB_UserNotes: result = (int32_t)lstrcmpiA(pRomInfo1->UserNotes, pRomInfo2->UserNotes); break;
case RB_CartridgeID: result = (int32_t)lstrcmpi(pRomInfo1->CartID, pRomInfo2->CartID); break; case RB_CartridgeID: result = (int32_t)lstrcmpiA(pRomInfo1->CartID, pRomInfo2->CartID); break;
case RB_Manufacturer: result = (int32_t)pRomInfo1->Manufacturer - (int32_t)pRomInfo2->Manufacturer; break; case RB_Manufacturer: result = (int32_t)pRomInfo1->Manufacturer - (int32_t)pRomInfo2->Manufacturer; break;
case RB_Country: result = (int32_t)pRomInfo1->Country - (int32_t)pRomInfo2->Country; break; case RB_Country: result = (int32_t)pRomInfo1->Country - (int32_t)pRomInfo2->Country; break;
case RB_Developer: result = (int32_t)lstrcmpi(pRomInfo1->Developer, pRomInfo2->Developer); break; case RB_Developer: result = (int32_t)lstrcmpiA(pRomInfo1->Developer, pRomInfo2->Developer); break;
case RB_Crc1: result = (int32_t)pRomInfo1->CRC1 - (int32_t)pRomInfo2->CRC1; break; case RB_Crc1: result = (int32_t)pRomInfo1->CRC1 - (int32_t)pRomInfo2->CRC1; break;
case RB_Crc2: result = (int32_t)pRomInfo1->CRC2 - (int32_t)pRomInfo2->CRC2; break; case RB_Crc2: result = (int32_t)pRomInfo1->CRC2 - (int32_t)pRomInfo2->CRC2; break;
case RB_CICChip: result = (int32_t)pRomInfo1->CicChip - (int32_t)pRomInfo2->CicChip; break; case RB_CICChip: result = (int32_t)pRomInfo1->CicChip - (int32_t)pRomInfo2->CicChip; break;
case RB_ReleaseDate: result = (int32_t)lstrcmpi(pRomInfo1->ReleaseDate, pRomInfo2->ReleaseDate); break; case RB_ReleaseDate: result = (int32_t)lstrcmpiA(pRomInfo1->ReleaseDate, pRomInfo2->ReleaseDate); break;
case RB_Players: result = (int32_t)pRomInfo1->Players - (int32_t)pRomInfo2->Players; break; case RB_Players: result = (int32_t)pRomInfo1->Players - (int32_t)pRomInfo2->Players; break;
case RB_ForceFeedback: result = (int32_t)lstrcmpi(pRomInfo1->ForceFeedback, pRomInfo2->ForceFeedback); break; case RB_ForceFeedback: result = (int32_t)lstrcmpiA(pRomInfo1->ForceFeedback, pRomInfo2->ForceFeedback); break;
case RB_Genre: result = (int32_t)lstrcmpi(pRomInfo1->Genre, pRomInfo2->Genre); break; case RB_Genre: result = (int32_t)lstrcmpiA(pRomInfo1->Genre, pRomInfo2->Genre); break;
case RB_FileFormat: result = (int32_t)pRomInfo1->FileFormat - (int32_t)pRomInfo2->FileFormat; break; case RB_FileFormat: result = (int32_t)pRomInfo1->FileFormat - (int32_t)pRomInfo2->FileFormat; break;
default: result = 0; break; default: result = 0; break;
} }
@ -991,7 +991,7 @@ void CRomBrowser::SelectRomDir(void)
{ {
WriteTrace(TraceUserInterface, TraceDebug, "3"); WriteTrace(TraceUserInterface, TraceDebug, "3");
char Directory[_MAX_PATH]; char Directory[_MAX_PATH];
if (SHGetPathFromIDList(pidl, Directory)) if (SHGetPathFromIDListA(pidl, Directory))
{ {
int32_t len = strlen(Directory); int32_t len = strlen(Directory);
@ -1177,7 +1177,7 @@ void CRomBrowser::WatchRomDirChanged(CRomBrowser * _this)
HANDLE hChange[] = HANDLE hChange[] =
{ {
_this->m_WatchStopEvent, _this->m_WatchStopEvent,
FindFirstChangeNotification(_this->m_WatchRomDir.c_str(), g_Settings->LoadBool(RomList_GameDirRecursive), FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE), FindFirstChangeNotificationA(_this->m_WatchRomDir.c_str(), g_Settings->LoadBool(RomList_GameDirRecursive), FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE),
}; };
WriteTrace(TraceUserInterface, TraceDebug, "4"); WriteTrace(TraceUserInterface, TraceDebug, "4");
for (;;) for (;;)

View File

@ -83,7 +83,7 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
//record class for future usage //record class for future usage
SetProp(hDlg, "this", (RomInformation *)lParam); SetProp(hDlg, L"this", (RomInformation *)lParam);
RomInformation * _this = (RomInformation *)lParam; RomInformation * _this = (RomInformation *)lParam;
if (_this->m_pDiskInfo == NULL) if (_this->m_pDiskInfo == NULL)
@ -240,11 +240,11 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDCANCEL: case IDCANCEL:
RemoveProp(hDlg, "this"); RemoveProp(hDlg, L"this");
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
break; break;
case IDC_CLOSE_BUTTON: case IDC_CLOSE_BUTTON:
RemoveProp(hDlg, "this"); RemoveProp(hDlg, L"this");
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
break; break;
} }

View File

@ -20,13 +20,13 @@ CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay)
} }
//Set the text for all gui Items //Set the text for all gui Items
SetDlgItemTextW(m_hWnd, IDC_START_ON_ROM_OPEN, wGS(ADVANCE_AUTO_START).c_str()); SetDlgItemText(IDC_START_ON_ROM_OPEN, wGS(ADVANCE_AUTO_START).c_str());
SetDlgItemTextW(m_hWnd, IDC_ZIP, wGS(ADVANCE_COMPRESS).c_str()); SetDlgItemText(IDC_ZIP, wGS(ADVANCE_COMPRESS).c_str());
SetDlgItemTextW(m_hWnd, IDC_DEBUGGER, wGS(ADVANCE_DEBUGGER).c_str()); SetDlgItemText(IDC_DEBUGGER, wGS(ADVANCE_DEBUGGER).c_str());
SetDlgItemTextW(m_hWnd, IDC_REMEMBER_CHEAT, wGS(OPTION_REMEMBER_CHEAT).c_str()); SetDlgItemText(IDC_REMEMBER_CHEAT, wGS(OPTION_REMEMBER_CHEAT).c_str());
SetDlgItemTextW(m_hWnd, IDC_UNIQUE_SAVE_DIR, wGS(OPTION_UNIQUE_SAVE_DIR).c_str()); SetDlgItemText(IDC_UNIQUE_SAVE_DIR, wGS(OPTION_UNIQUE_SAVE_DIR).c_str());
SetDlgItemTextW(m_hWnd, IDC_CHECK_RUNNING, wGS(OPTION_CHECK_RUNNING).c_str()); SetDlgItemText(IDC_CHECK_RUNNING, wGS(OPTION_CHECK_RUNNING).c_str());
SetDlgItemTextW(m_hWnd, IDC_DISPLAY_FRAMERATE, wGS(OPTION_CHANGE_FR).c_str()); SetDlgItemText(IDC_DISPLAY_FRAMERATE, wGS(OPTION_CHANGE_FR).c_str());
AddModCheckBox(GetDlgItem(IDC_START_ON_ROM_OPEN), Setting_AutoStart); AddModCheckBox(GetDlgItem(IDC_START_ON_ROM_OPEN), Setting_AutoStart);
AddModCheckBox(GetDlgItem(IDC_ZIP), Setting_AutoZipInstantSave); AddModCheckBox(GetDlgItem(IDC_ZIP), Setting_AutoZipInstantSave);
@ -41,10 +41,10 @@ CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay)
ComboBox = AddModComboBox(GetDlgItem(IDC_FRAME_DISPLAY_TYPE), UserInterface_FrameDisplayType); ComboBox = AddModComboBox(GetDlgItem(IDC_FRAME_DISPLAY_TYPE), UserInterface_FrameDisplayType);
if (ComboBox) if (ComboBox)
{ {
ComboBox->AddItemW(wGS(STR_FR_VIS).c_str(), FR_VIs); ComboBox->AddItem(wGS(STR_FR_VIS).c_str(), FR_VIs);
ComboBox->AddItemW(wGS(STR_FR_DLS).c_str(), FR_DLs); ComboBox->AddItem(wGS(STR_FR_DLS).c_str(), FR_DLs);
ComboBox->AddItemW(wGS(STR_FR_PERCENT).c_str(), FR_PERCENT); ComboBox->AddItem(wGS(STR_FR_PERCENT).c_str(), FR_PERCENT);
ComboBox->AddItemW(wGS(STR_FR_DLS_VIS).c_str(), FR_VIs_DLs); ComboBox->AddItem(wGS(STR_FR_DLS_VIS).c_str(), FR_VIs_DLs);
} }
UpdatePageSettings(); UpdatePageSettings();

View File

@ -19,38 +19,38 @@ CDefaultsOptionsPage::CDefaultsOptionsPage(HWND hParent, const RECT & rcDispay)
} }
UpdatePageSettings(); UpdatePageSettings();
SetDlgItemTextW(m_hWnd, IDC_MEMORY_SIZE_TEXT, wGS(ROM_MEM_SIZE).c_str()); SetDlgItemText(IDC_MEMORY_SIZE_TEXT, wGS(ROM_MEM_SIZE).c_str());
SetDlgItemTextW(m_hWnd, IDC_HLE_GFX, wGS(PLUG_HLE_GFX).c_str()); SetDlgItemText(IDC_HLE_GFX, wGS(PLUG_HLE_GFX).c_str());
SetDlgItemTextW(m_hWnd, IDC_USE_TLB, wGS(ROM_USE_TLB).c_str()); SetDlgItemText(IDC_USE_TLB, wGS(ROM_USE_TLB).c_str());
SetDlgItemTextW(m_hWnd, IDC_VIREFESH_TEXT, wGS(ROM_VIREFRESH).c_str()); SetDlgItemText(IDC_VIREFESH_TEXT, wGS(ROM_VIREFRESH).c_str());
SetDlgItemTextW(m_hWnd, IDC_COUNTPERBYTE_TEXT, wGS(ROM_COUNTPERBYTE).c_str()); SetDlgItemText(IDC_COUNTPERBYTE_TEXT, wGS(ROM_COUNTPERBYTE).c_str());
SetDlgItemTextW(m_hWnd, IDC_COUNTFACT_TEXT, wGS(ROM_COUNTER_FACTOR).c_str()); SetDlgItemText(IDC_COUNTFACT_TEXT, wGS(ROM_COUNTER_FACTOR).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_32BIT, wGS(ROM_32BIT).c_str()); SetDlgItemText(IDC_ROM_32BIT, wGS(ROM_32BIT).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_FIXEDAUDIO, wGS(ROM_FIXED_AUDIO).c_str()); SetDlgItemText(IDC_ROM_FIXEDAUDIO, wGS(ROM_FIXED_AUDIO).c_str());
SetDlgItemTextW(m_hWnd, IDC_SYNC_AUDIO, wGS(ROM_SYNC_AUDIO).c_str()); SetDlgItemText(IDC_SYNC_AUDIO, wGS(ROM_SYNC_AUDIO).c_str());
SetDlgItemTextW(m_hWnd, IDC_UNALIGNED_DMA, wGS(ROM_UNALIGNED_DMA).c_str()); SetDlgItemText(IDC_UNALIGNED_DMA, wGS(ROM_UNALIGNED_DMA).c_str());
SetDlgItemTextW(m_hWnd, IDC_RANDOMIZE_SIPI_INTERRUPTS, wGS(ROM_RANDOMIZE_SIPI_INTERRUPTS).c_str()); SetDlgItemText(IDC_RANDOMIZE_SIPI_INTERRUPTS, wGS(ROM_RANDOMIZE_SIPI_INTERRUPTS).c_str());
SetDlgItemTextW(m_hWnd, IDC_PROTECT_MEMORY, wGS(ADVANCE_SMM_PROTECT).c_str()); SetDlgItemText(IDC_PROTECT_MEMORY, wGS(ADVANCE_SMM_PROTECT).c_str());
CModifiedComboBox * ComboBox; CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE), Default_RDRamSize); ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE), Default_RDRamSize);
if (ComboBox) if (ComboBox)
{ {
ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT)); ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT));
ComboBox->AddItemW(wGS(RDRAM_4MB).c_str(), 0x400000); ComboBox->AddItem(wGS(RDRAM_4MB).c_str(), 0x400000);
ComboBox->AddItemW(wGS(RDRAM_8MB).c_str(), 0x800000); ComboBox->AddItem(wGS(RDRAM_8MB).c_str(), 0x800000);
} }
ComboBox = AddModComboBox(GetDlgItem(IDC_COUNTFACT), Default_CounterFactor); ComboBox = AddModComboBox(GetDlgItem(IDC_COUNTFACT), Default_CounterFactor);
if (ComboBox) if (ComboBox)
{ {
ComboBox->SetTextField(GetDlgItem(IDC_COUNTFACT_TEXT)); ComboBox->SetTextField(GetDlgItem(IDC_COUNTFACT_TEXT));
ComboBox->AddItemW(wGS(NUMBER_1).c_str(), 1); ComboBox->AddItem(wGS(NUMBER_1).c_str(), 1);
ComboBox->AddItemW(wGS(NUMBER_2).c_str(), 2); ComboBox->AddItem(wGS(NUMBER_2).c_str(), 2);
ComboBox->AddItemW(wGS(NUMBER_3).c_str(), 3); ComboBox->AddItem(wGS(NUMBER_3).c_str(), 3);
ComboBox->AddItemW(wGS(NUMBER_4).c_str(), 4); ComboBox->AddItem(wGS(NUMBER_4).c_str(), 4);
ComboBox->AddItemW(wGS(NUMBER_5).c_str(), 5); ComboBox->AddItem(wGS(NUMBER_5).c_str(), 5);
ComboBox->AddItemW(wGS(NUMBER_6).c_str(), 6); ComboBox->AddItem(wGS(NUMBER_6).c_str(), 6);
} }
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH), Default_ViRefreshRate, false); CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH), Default_ViRefreshRate, false);

View File

@ -93,7 +93,7 @@ void COptionsDirectoriesPage::SelectDirectory(LanguageStringID Title, CModifiedE
stdstr path; stdstr path;
CPath SelectedDir(path.FromUTF16(Directory), ""); CPath SelectedDir(path.FromUTF16(Directory), "");
EditBox.SetChanged(true); EditBox.SetChanged(true);
EditBox.SetWindowText(SelectedDir); EditBox.SetWindowText(stdstr((const char *)SelectedDir).ToUTF16().c_str());
Default.SetChanged(true); Default.SetChanged(true);
Default.SetCheck(BST_UNCHECKED); Default.SetCheck(BST_UNCHECKED);
selected.SetCheck(BM_SETCHECK); selected.SetCheck(BM_SETCHECK);
@ -168,15 +168,15 @@ void COptionsDirectoriesPage::UpdatePageSettings()
m_InUpdateSettings = true; m_InUpdateSettings = true;
m_PluginDir.SetChanged(g_Settings->LoadStringVal(Directory_PluginSelected, Directory)); m_PluginDir.SetChanged(g_Settings->LoadStringVal(Directory_PluginSelected, Directory));
m_PluginDir.SetWindowText(Directory.c_str()); m_PluginDir.SetWindowText(Directory.ToUTF16().c_str());
m_AutoSaveDir.SetChanged(g_Settings->LoadStringVal(Directory_NativeSaveSelected, Directory)); m_AutoSaveDir.SetChanged(g_Settings->LoadStringVal(Directory_NativeSaveSelected, Directory));
m_AutoSaveDir.SetWindowText(Directory.c_str()); m_AutoSaveDir.SetWindowText(Directory.ToUTF16().c_str());
m_InstantSaveDir.SetChanged(g_Settings->LoadStringVal(Directory_InstantSaveSelected, Directory)); m_InstantSaveDir.SetChanged(g_Settings->LoadStringVal(Directory_InstantSaveSelected, Directory));
m_InstantSaveDir.SetWindowText(Directory.c_str()); m_InstantSaveDir.SetWindowText(Directory.ToUTF16().c_str());
m_ScreenShotDir.SetChanged(g_Settings->LoadStringVal(Directory_SnapShotSelected, Directory)); m_ScreenShotDir.SetChanged(g_Settings->LoadStringVal(Directory_SnapShotSelected, Directory));
m_ScreenShotDir.SetWindowText(Directory.c_str()); m_ScreenShotDir.SetWindowText(Directory.ToUTF16().c_str());
m_TextureDir.SetChanged(g_Settings->LoadStringVal(Directory_TextureSelected, Directory)); m_TextureDir.SetChanged(g_Settings->LoadStringVal(Directory_TextureSelected, Directory));
m_TextureDir.SetWindowText(Directory.c_str()); m_TextureDir.SetWindowText(Directory.ToUTF16().c_str());
bool UseSelected; bool UseSelected;
m_PluginDefault.SetChanged(g_Settings->LoadBool(Directory_PluginUseSelected, UseSelected)); m_PluginDefault.SetChanged(g_Settings->LoadBool(Directory_PluginUseSelected, UseSelected));
@ -253,7 +253,7 @@ void COptionsDirectoriesPage::ResetDirectory(CModifiedEditBox & EditBox, Setting
} }
stdstr dir; stdstr dir;
g_Settings->LoadDefaultString(Type, dir); g_Settings->LoadDefaultString(Type, dir);
EditBox.SetWindowText(dir.c_str()); EditBox.SetWindowText(dir.ToUTF16().c_str());
EditBox.SetReset(true); EditBox.SetReset(true);
} }

View File

@ -20,10 +20,10 @@ CDiskDrivePage::CDiskDrivePage(HWND hParent, const RECT & rcDispay)
} }
//Set the text for all gui Items //Set the text for all gui Items
SetDlgItemTextW(m_hWnd, IDC_IPLDIR_JP_TXT, wGS(OPTION_IPL_ROM_PATH).c_str()); SetDlgItemText(IDC_IPLDIR_JP_TXT, wGS(OPTION_IPL_ROM_PATH).c_str());
SetDlgItemTextW(m_hWnd, IDC_IPLDIR_US_TXT, wGS(OPTION_IPL_ROM_USA_PATH).c_str()); SetDlgItemText(IDC_IPLDIR_US_TXT, wGS(OPTION_IPL_ROM_USA_PATH).c_str());
SetDlgItemTextW(m_hWnd, IDC_IPLDIR_TL_TXT, wGS(OPTION_IPL_ROM_TOOL_PATH).c_str()); SetDlgItemText(IDC_IPLDIR_TL_TXT, wGS(OPTION_IPL_ROM_TOOL_PATH).c_str());
SetDlgItemTextW(m_hWnd, IDC_DISKSAVETYPE_TXT, wGS(OPTION_DISKSAVETYPE).c_str()); SetDlgItemText(IDC_DISKSAVETYPE_TXT, wGS(OPTION_DISKSAVETYPE).c_str());
m_IplDirJp.Attach(GetDlgItem(IDC_IPL_JP_DIR)); m_IplDirJp.Attach(GetDlgItem(IDC_IPL_JP_DIR));
m_IplDirUs.Attach(GetDlgItem(IDC_IPL_US_DIR)); m_IplDirUs.Attach(GetDlgItem(IDC_IPL_US_DIR));
@ -33,8 +33,8 @@ CDiskDrivePage::CDiskDrivePage(HWND hParent, const RECT & rcDispay)
ComboBox = AddModComboBox(GetDlgItem(IDC_DISKSAVETYPE), Setting_DiskSaveType); ComboBox = AddModComboBox(GetDlgItem(IDC_DISKSAVETYPE), Setting_DiskSaveType);
if (ComboBox) if (ComboBox)
{ {
ComboBox->AddItemW(wGS(DISKSAVE_SHADOW).c_str(), SaveDisk_ShadowFile); ComboBox->AddItem(wGS(DISKSAVE_SHADOW).c_str(), SaveDisk_ShadowFile);
ComboBox->AddItemW(wGS(DISKSAVE_RAM).c_str(), SaveDisk_RAMFile); ComboBox->AddItem(wGS(DISKSAVE_RAM).c_str(), SaveDisk_RAMFile);
} }
UpdatePageSettings(); UpdatePageSettings();
@ -139,11 +139,11 @@ void CDiskDrivePage::UpdatePageSettings(void)
stdstr File; stdstr File;
g_Settings->LoadStringVal(File_DiskIPLPath, File); g_Settings->LoadStringVal(File_DiskIPLPath, File);
m_IplDirJp.SetWindowText(File.c_str()); m_IplDirJp.SetWindowText(File.ToUTF16().c_str());
g_Settings->LoadStringVal(File_DiskIPLUSAPath, File); g_Settings->LoadStringVal(File_DiskIPLUSAPath, File);
m_IplDirUs.SetWindowText(File.c_str()); m_IplDirUs.SetWindowText(File.ToUTF16().c_str());
g_Settings->LoadStringVal(File_DiskIPLTOOLPath, File); g_Settings->LoadStringVal(File_DiskIPLTOOLPath, File);
m_IplDirTl.SetWindowText(File.c_str()); m_IplDirTl.SetWindowText(File.ToUTF16().c_str());
m_InUpdateSettings = false; m_InUpdateSettings = false;
} }
@ -156,7 +156,7 @@ void CDiskDrivePage::SelectFile(LanguageStringID /*Title*/, CModifiedEditBox & E
if (FileName.SelectFile(m_hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true)) if (FileName.SelectFile(m_hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{ {
EditBox.SetChanged(true); EditBox.SetChanged(true);
EditBox.SetWindowText(FileName); EditBox.SetWindowText(stdstr((const char *)FileName).ToUTF16().c_str());
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
} }
} }

View File

@ -21,24 +21,24 @@ CGameGeneralPage::CGameGeneralPage(HWND hParent, const RECT & rcDispay)
} }
//Set the text for all gui Items //Set the text for all gui Items
SetDlgItemTextW(m_hWnd, IDC_GOOD_NAME_TEXT, wGS(RB_GOODNAME).c_str()); SetDlgItemText(IDC_GOOD_NAME_TEXT, wGS(RB_GOODNAME).c_str());
SetDlgItemTextW(m_hWnd, IDC_MEMORY_SIZE_TEXT, wGS(ROM_MEM_SIZE).c_str()); SetDlgItemText(IDC_MEMORY_SIZE_TEXT, wGS(ROM_MEM_SIZE).c_str());
SetDlgItemTextW(m_hWnd, IDC_SAVE_TYPE_TEXT, wGS(ROM_SAVE_TYPE).c_str()); SetDlgItemText(IDC_SAVE_TYPE_TEXT, wGS(ROM_SAVE_TYPE).c_str());
SetDlgItemTextW(m_hWnd, IDC_COUNTFACT_TEXT, wGS(ROM_COUNTER_FACTOR).c_str()); SetDlgItemText(IDC_COUNTFACT_TEXT, wGS(ROM_COUNTER_FACTOR).c_str());
SetDlgItemTextW(m_hWnd, IDC_VIREFESH_TEXT, wGS(ROM_VIREFRESH).c_str()); SetDlgItemText(IDC_VIREFESH_TEXT, wGS(ROM_VIREFRESH).c_str());
SetDlgItemTextW(m_hWnd, IDC_COUNTPERBYTE_TEXT, wGS(ROM_COUNTPERBYTE).c_str()); SetDlgItemText(IDC_COUNTPERBYTE_TEXT, wGS(ROM_COUNTPERBYTE).c_str());
SetDlgItemTextW(m_hWnd, IDC_OVER_CLOCK_MODIFIER_TEXT, wGS(ROM_OVER_CLOCK_MODIFIER).c_str()); SetDlgItemText(IDC_OVER_CLOCK_MODIFIER_TEXT, wGS(ROM_OVER_CLOCK_MODIFIER).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_32BIT, wGS(ROM_32BIT).c_str()); SetDlgItemText(IDC_ROM_32BIT, wGS(ROM_32BIT).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_FIXEDAUDIO, wGS(ROM_FIXED_AUDIO).c_str()); SetDlgItemText(IDC_ROM_FIXEDAUDIO, wGS(ROM_FIXED_AUDIO).c_str());
SetDlgItemTextW(m_hWnd, IDC_DELAY_DP, wGS(ROM_DELAY_DP).c_str()); SetDlgItemText(IDC_DELAY_DP, wGS(ROM_DELAY_DP).c_str());
SetDlgItemTextW(m_hWnd, IDC_SYNC_AUDIO, wGS(ROM_SYNC_AUDIO).c_str()); SetDlgItemText(IDC_SYNC_AUDIO, wGS(ROM_SYNC_AUDIO).c_str());
SetDlgItemTextW(m_hWnd, IDC_USE_TLB, wGS(ROM_USE_TLB).c_str()); SetDlgItemText(IDC_USE_TLB, wGS(ROM_USE_TLB).c_str());
SetDlgItemTextW(m_hWnd, IDC_DELAY_SI, wGS(ROM_DELAY_SI).c_str()); SetDlgItemText(IDC_DELAY_SI, wGS(ROM_DELAY_SI).c_str());
SetDlgItemTextW(m_hWnd, IDC_AUDIO_SIGNAL, wGS(ROM_AUDIO_SIGNAL).c_str()); SetDlgItemText(IDC_AUDIO_SIGNAL, wGS(ROM_AUDIO_SIGNAL).c_str());
SetDlgItemTextW(m_hWnd, IDC_UNALIGNED_DMA, wGS(ROM_UNALIGNED_DMA).c_str()); SetDlgItemText(IDC_UNALIGNED_DMA, wGS(ROM_UNALIGNED_DMA).c_str());
SetDlgItemTextW(m_hWnd, IDC_RANDOMIZE_SIPI_INTERRUPTS, wGS(ROM_RANDOMIZE_SIPI_INTERRUPTS).c_str()); SetDlgItemText(IDC_RANDOMIZE_SIPI_INTERRUPTS, wGS(ROM_RANDOMIZE_SIPI_INTERRUPTS).c_str());
AddModCheckBox(GetDlgItem(IDC_ROM_32BIT), Game_32Bit); AddModCheckBox(GetDlgItem(IDC_ROM_32BIT), Game_32Bit);
AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO), Game_SyncViaAudio); AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO), Game_SyncViaAudio);
@ -55,34 +55,34 @@ CGameGeneralPage::CGameGeneralPage(HWND hParent, const RECT & rcDispay)
if (ComboBox) if (ComboBox)
{ {
ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT)); ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT));
ComboBox->AddItemW(wGS(RDRAM_4MB).c_str(), 0x400000); ComboBox->AddItem(wGS(RDRAM_4MB).c_str(), 0x400000);
ComboBox->AddItemW(wGS(RDRAM_8MB).c_str(), 0x800000); ComboBox->AddItem(wGS(RDRAM_8MB).c_str(), 0x800000);
} }
ComboBox = AddModComboBox(GetDlgItem(IDC_SAVE_TYPE), Game_SaveChip); ComboBox = AddModComboBox(GetDlgItem(IDC_SAVE_TYPE), Game_SaveChip);
if (ComboBox) if (ComboBox)
{ {
ComboBox->SetTextField(GetDlgItem(IDC_SAVE_TYPE_TEXT)); ComboBox->SetTextField(GetDlgItem(IDC_SAVE_TYPE_TEXT));
ComboBox->AddItemW(wGS(SAVE_FIRST_USED).c_str(), (uint32_t)(int64_t)SaveChip_Auto); ComboBox->AddItem(wGS(SAVE_FIRST_USED).c_str(), (uint32_t)(int64_t)SaveChip_Auto);
ComboBox->AddItemW(wGS(SAVE_4K_EEPROM).c_str(), SaveChip_Eeprom_4K); ComboBox->AddItem(wGS(SAVE_4K_EEPROM).c_str(), SaveChip_Eeprom_4K);
ComboBox->AddItemW(wGS(SAVE_16K_EEPROM).c_str(), SaveChip_Eeprom_16K); ComboBox->AddItem(wGS(SAVE_16K_EEPROM).c_str(), SaveChip_Eeprom_16K);
ComboBox->AddItemW(wGS(SAVE_SRAM).c_str(), SaveChip_Sram); ComboBox->AddItem(wGS(SAVE_SRAM).c_str(), SaveChip_Sram);
ComboBox->AddItemW(wGS(SAVE_FLASHRAM).c_str(), SaveChip_FlashRam); ComboBox->AddItem(wGS(SAVE_FLASHRAM).c_str(), SaveChip_FlashRam);
} }
ComboBox = AddModComboBox(GetDlgItem(IDC_COUNTFACT), Game_CounterFactor); ComboBox = AddModComboBox(GetDlgItem(IDC_COUNTFACT), Game_CounterFactor);
if (ComboBox) if (ComboBox)
{ {
ComboBox->SetTextField(GetDlgItem(IDC_COUNTFACT_TEXT)); ComboBox->SetTextField(GetDlgItem(IDC_COUNTFACT_TEXT));
ComboBox->AddItemW(wGS(NUMBER_1).c_str(), 1); ComboBox->AddItem(wGS(NUMBER_1).c_str(), 1);
ComboBox->AddItemW(wGS(NUMBER_2).c_str(), 2); ComboBox->AddItem(wGS(NUMBER_2).c_str(), 2);
ComboBox->AddItemW(wGS(NUMBER_3).c_str(), 3); ComboBox->AddItem(wGS(NUMBER_3).c_str(), 3);
ComboBox->AddItemW(wGS(NUMBER_4).c_str(), 4); ComboBox->AddItem(wGS(NUMBER_4).c_str(), 4);
ComboBox->AddItemW(wGS(NUMBER_5).c_str(), 5); ComboBox->AddItem(wGS(NUMBER_5).c_str(), 5);
ComboBox->AddItemW(wGS(NUMBER_6).c_str(), 6); ComboBox->AddItem(wGS(NUMBER_6).c_str(), 6);
} }
SetDlgItemText(IDC_GOOD_NAME, g_Settings->LoadStringVal(Rdb_GoodName).c_str()); SetDlgItemText(IDC_GOOD_NAME, stdstr(g_Settings->LoadStringVal(Rdb_GoodName)).ToUTF16().c_str());
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH), Game_ViRefreshRate, false); CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH), Game_ViRefreshRate, false);
TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT)); TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT));

View File

@ -21,18 +21,18 @@ CGamePluginPage::CGamePluginPage(HWND hParent, const RECT & rcDispay)
} }
//Set the text for all gui Items //Set the text for all gui Items
SetDlgItemTextW(m_hWnd, RSP_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemText(RSP_ABOUT, wGS(PLUG_ABOUT).c_str());
SetDlgItemTextW(m_hWnd, GFX_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemText(GFX_ABOUT, wGS(PLUG_ABOUT).c_str());
SetDlgItemTextW(m_hWnd, AUDIO_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemText(AUDIO_ABOUT, wGS(PLUG_ABOUT).c_str());
SetDlgItemTextW(m_hWnd, CONT_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemText(CONT_ABOUT, wGS(PLUG_ABOUT).c_str());
SetDlgItemTextW(m_hWnd, IDC_RSP_NAME, wGS(PLUG_RSP).c_str()); SetDlgItemText(IDC_RSP_NAME, wGS(PLUG_RSP).c_str());
SetDlgItemTextW(m_hWnd, IDC_GFX_NAME, wGS(PLUG_GFX).c_str()); SetDlgItemText(IDC_GFX_NAME, wGS(PLUG_GFX).c_str());
SetDlgItemTextW(m_hWnd, IDC_AUDIO_NAME, wGS(PLUG_AUDIO).c_str()); SetDlgItemText(IDC_AUDIO_NAME, wGS(PLUG_AUDIO).c_str());
SetDlgItemTextW(m_hWnd, IDC_CONT_NAME, wGS(PLUG_CTRL).c_str()); SetDlgItemText(IDC_CONT_NAME, wGS(PLUG_CTRL).c_str());
SetDlgItemTextW(m_hWnd, IDC_HLE_GFX, wGS(PLUG_HLE_GFX).c_str()); SetDlgItemText(IDC_HLE_GFX, wGS(PLUG_HLE_GFX).c_str());
SetDlgItemTextW(m_hWnd, IDC_HLE_AUDIO, wGS(PLUG_HLE_AUDIO).c_str()); SetDlgItemText(IDC_HLE_AUDIO, wGS(PLUG_HLE_AUDIO).c_str());
m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME)); m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME));
m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME)); m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME));
@ -61,7 +61,7 @@ void CGamePluginPage::AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE PluginT
{ {
ComboBox->SetDefault(NULL); ComboBox->SetDefault(NULL);
} }
ComboBox->AddItemW(wGS(PLUG_DEFAULT).c_str(), NULL); ComboBox->AddItem(wGS(PLUG_DEFAULT).c_str(), NULL);
for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++) for (int i = 0, n = m_PluginList.GetPluginCount(); i < n; i++)
{ {
@ -78,7 +78,7 @@ void CGamePluginPage::AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE PluginT
{ {
ComboBox->SetDefault((WPARAM)Plugin); ComboBox->SetDefault((WPARAM)Plugin);
} }
ComboBox->AddItem(Plugin->Info.Name, (WPARAM)Plugin); ComboBox->AddItem(stdstr(Plugin->Info.Name).ToUTF16().c_str(), (WPARAM)Plugin);
} }
} }
@ -118,7 +118,7 @@ void CGamePluginPage::ShowAboutButton(int id)
//Load the plugin //Load the plugin
UINT LastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); UINT LastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
HMODULE hLib = LoadLibrary(Plugin->FullPath); HMODULE hLib = LoadLibrary(stdstr((const char *)Plugin->FullPath).ToUTF16().c_str());
SetErrorMode(LastErrorMode); SetErrorMode(LastErrorMode);
if (hLib == NULL) if (hLib == NULL)
{ {

View File

@ -21,19 +21,19 @@ CGameRecompilePage::CGameRecompilePage(HWND hParent, const RECT & rcDispay)
} }
//Set the text for all gui Items //Set the text for all gui Items
SetDlgItemTextW(m_hWnd, IDC_CPU_TYPE_TEXT, wGS(ROM_CPU_STYLE).c_str()); SetDlgItemText(IDC_CPU_TYPE_TEXT, wGS(ROM_CPU_STYLE).c_str());
SetDlgItemTextW(m_hWnd, IDC_FUNCFIND_TEXT, wGS(ROM_FUNC_FIND).c_str()); SetDlgItemText(IDC_FUNCFIND_TEXT, wGS(ROM_FUNC_FIND).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_REGCACHE, wGS(ROM_REG_CACHE).c_str()); SetDlgItemText(IDC_ROM_REGCACHE, wGS(ROM_REG_CACHE).c_str());
SetDlgItemTextW(m_hWnd, IDC_BLOCK_LINKING, wGS(ADVANCE_ABL).c_str()); SetDlgItemText(IDC_BLOCK_LINKING, wGS(ADVANCE_ABL).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_FASTSP, wGS(ROM_FAST_SP).c_str()); SetDlgItemText(IDC_ROM_FASTSP, wGS(ROM_FAST_SP).c_str());
SetDlgItemTextW(m_hWnd, IDC_SMM_FRAME, wGS(ADVANCE_SMCM).c_str()); SetDlgItemText(IDC_SMM_FRAME, wGS(ADVANCE_SMCM).c_str());
SetDlgItemTextW(m_hWnd, IDC_SMM_CACHE, wGS(ADVANCE_SMM_CACHE).c_str()); SetDlgItemText(IDC_SMM_CACHE, wGS(ADVANCE_SMM_CACHE).c_str());
SetDlgItemTextW(m_hWnd, IDC_SMM_DMA, wGS(ADVANCE_SMM_PIDMA).c_str()); SetDlgItemText(IDC_SMM_DMA, wGS(ADVANCE_SMM_PIDMA).c_str());
SetDlgItemTextW(m_hWnd, IDC_SMM_VALIDATE, wGS(ADVANCE_SMM_VALIDATE).c_str()); SetDlgItemText(IDC_SMM_VALIDATE, wGS(ADVANCE_SMM_VALIDATE).c_str());
SetDlgItemTextW(m_hWnd, IDC_SMM_TLB, wGS(ADVANCE_SMM_TLB).c_str()); SetDlgItemText(IDC_SMM_TLB, wGS(ADVANCE_SMM_TLB).c_str());
SetDlgItemTextW(m_hWnd, IDC_SMM_PROTECT, wGS(ADVANCE_SMM_PROTECT).c_str()); SetDlgItemText(IDC_SMM_PROTECT, wGS(ADVANCE_SMM_PROTECT).c_str());
m_SelfModGroup.Attach(GetDlgItem(IDC_SMM_FRAME)); m_SelfModGroup.Attach(GetDlgItem(IDC_SMM_FRAME));
@ -52,19 +52,19 @@ CGameRecompilePage::CGameRecompilePage(HWND hParent, const RECT & rcDispay)
ComboBox = AddModComboBox(GetDlgItem(IDC_CPU_TYPE), Game_CpuType); ComboBox = AddModComboBox(GetDlgItem(IDC_CPU_TYPE), Game_CpuType);
if (ComboBox) if (ComboBox)
{ {
ComboBox->AddItemW(wGS(CORE_RECOMPILER).c_str(), CPU_Recompiler); ComboBox->AddItem(wGS(CORE_RECOMPILER).c_str(), CPU_Recompiler);
ComboBox->AddItemW(wGS(CORE_INTERPTER).c_str(), CPU_Interpreter); ComboBox->AddItem(wGS(CORE_INTERPTER).c_str(), CPU_Interpreter);
if (g_Settings->LoadBool(Debugger_Enabled)) if (g_Settings->LoadBool(Debugger_Enabled))
{ {
ComboBox->AddItemW(wGS(CORE_SYNC).c_str(), CPU_SyncCores); ComboBox->AddItem(wGS(CORE_SYNC).c_str(), CPU_SyncCores);
} }
} }
ComboBox = AddModComboBox(GetDlgItem(IDC_FUNCFIND), Game_FuncLookupMode); ComboBox = AddModComboBox(GetDlgItem(IDC_FUNCFIND), Game_FuncLookupMode);
if (ComboBox) if (ComboBox)
{ {
ComboBox->AddItemW(wGS(FLM_PLOOKUP).c_str(), FuncFind_PhysicalLookup); ComboBox->AddItem(wGS(FLM_PLOOKUP).c_str(), FuncFind_PhysicalLookup);
ComboBox->AddItemW(wGS(FLM_VLOOKUP).c_str(), FuncFind_VirtualLookup); ComboBox->AddItem(wGS(FLM_VLOOKUP).c_str(), FuncFind_VirtualLookup);
//ComboBox->AddItem(wGS(FLM_CHANGEMEM).c_str(), FuncFind_ChangeMemory); //ComboBox->AddItem(wGS(FLM_CHANGEMEM).c_str(), FuncFind_ChangeMemory);
} }
UpdatePageSettings(); UpdatePageSettings();

View File

@ -33,7 +33,7 @@ CGameStatusPage::CGameStatusPage(HWND hParent, const RECT & rcDispay)
{ {
if (strstr(item->c_str(), ".Sel") != NULL) { continue; } if (strstr(item->c_str(), ".Sel") != NULL) { continue; }
if (strstr(item->c_str(), ".Auto") != NULL) { continue; } if (strstr(item->c_str(), ".Auto") != NULL) { continue; }
ComboBox->AddItem(item->c_str(), item->c_str()); ComboBox->AddItem(stdstr(*item).ToUTF16().c_str(), item->c_str());
} }
ComboBox->SetTextField(GetDlgItem(IDC_STATUS_TEXT)); ComboBox->SetTextField(GetDlgItem(IDC_STATUS_TEXT));
} }

View File

@ -21,17 +21,17 @@ COptionsGameBrowserPage::COptionsGameBrowserPage(HWND hParent, const RECT & rcDi
return; return;
} }
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT2, wGS(RB_ROMS).c_str()); SetDlgItemText(IDC_ROMSEL_TEXT2, wGS(RB_ROMS).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4, wGS(RB_DIRS).c_str()); SetDlgItemText(IDC_ROMSEL_TEXT4, wGS(RB_DIRS).c_str());
SetDlgItemTextW(m_hWnd, IDC_USE_ROMBROWSER, wGS(RB_USE).c_str()); SetDlgItemText(IDC_USE_ROMBROWSER, wGS(RB_USE).c_str());
SetDlgItemTextW(m_hWnd, IDC_RECURSION, wGS(RB_DIR_RECURSION).c_str()); SetDlgItemText(IDC_RECURSION, wGS(RB_DIR_RECURSION).c_str());
SetDlgItemTextW(m_hWnd, IDC_SHOW_FILE_EXTENSIONS, wGS(RB_FILEEXT).c_str()); SetDlgItemText(IDC_SHOW_FILE_EXTENSIONS, wGS(RB_FILEEXT).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT5, wGS(RB_AVALIABLE_FIELDS).c_str()); SetDlgItemText(IDC_ROMSEL_TEXT5, wGS(RB_AVALIABLE_FIELDS).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT6, wGS(RB_SHOW_FIELDS).c_str()); SetDlgItemText(IDC_ROMSEL_TEXT6, wGS(RB_SHOW_FIELDS).c_str());
SetDlgItemTextW(m_hWnd, IDC_ADD, wGS(RB_ADD).c_str()); SetDlgItemText(IDC_ADD, wGS(RB_ADD).c_str());
SetDlgItemTextW(m_hWnd, IDC_REMOVE, wGS(RB_REMOVE).c_str()); SetDlgItemText(IDC_REMOVE, wGS(RB_REMOVE).c_str());
SetDlgItemTextW(m_hWnd, IDC_UP, wGS(RB_UP).c_str()); SetDlgItemText(IDC_UP, wGS(RB_UP).c_str());
SetDlgItemTextW(m_hWnd, IDC_DOWN, wGS(RB_DOWN).c_str()); SetDlgItemText(IDC_DOWN, wGS(RB_DOWN).c_str());
AddModCheckBox(GetDlgItem(IDC_USE_ROMBROWSER), RomBrowser_Enabled); AddModCheckBox(GetDlgItem(IDC_USE_ROMBROWSER), RomBrowser_Enabled);
AddModCheckBox(GetDlgItem(IDC_RECURSION), RomList_GameDirRecursive); AddModCheckBox(GetDlgItem(IDC_RECURSION), RomList_GameDirRecursive);

View File

@ -20,14 +20,14 @@ COptionsShortCutsPage::COptionsShortCutsPage(HWND hParent, const RECT & rcDispay
return; return;
} }
SetDlgItemTextW(m_hWnd, IDC_S_CPU_STATE, wGS(ACCEL_CPUSTATE_TITLE).c_str()); SetDlgItemText(IDC_S_CPU_STATE, wGS(ACCEL_CPUSTATE_TITLE).c_str());
SetDlgItemTextW(m_hWnd, IDC_MENU_ITEM_TEXT, wGS(ACCEL_MENUITEM_TITLE).c_str()); SetDlgItemText(IDC_MENU_ITEM_TEXT, wGS(ACCEL_MENUITEM_TITLE).c_str());
SetDlgItemTextW(m_hWnd, IDC_S_CURRENT_KEYS, wGS(ACCEL_CURRENTKEYS_TITLE).c_str()); SetDlgItemText(IDC_S_CURRENT_KEYS, wGS(ACCEL_CURRENTKEYS_TITLE).c_str());
SetDlgItemTextW(m_hWnd, IDC_S_SELECT_SHORT, wGS(ACCEL_SELKEY_TITLE).c_str()); SetDlgItemText(IDC_S_SELECT_SHORT, wGS(ACCEL_SELKEY_TITLE).c_str());
SetDlgItemTextW(m_hWnd, IDC_S_CURRENT_ASSIGN, wGS(ACCEL_ASSIGNEDTO_TITLE).c_str()); SetDlgItemText(IDC_S_CURRENT_ASSIGN, wGS(ACCEL_ASSIGNEDTO_TITLE).c_str());
SetDlgItemTextW(m_hWnd, IDC_ASSIGN, wGS(ACCEL_ASSIGN_BTN).c_str()); SetDlgItemText(IDC_ASSIGN, wGS(ACCEL_ASSIGN_BTN).c_str());
SetDlgItemTextW(m_hWnd, IDC_REMOVE, wGS(ACCEL_REMOVE_BTN).c_str()); SetDlgItemText(IDC_REMOVE, wGS(ACCEL_REMOVE_BTN).c_str());
SetDlgItemTextW(m_hWnd, IDC_KEY_PROMPT, wGS(ACCEL_DETECTKEY).c_str()); SetDlgItemText(IDC_KEY_PROMPT, wGS(ACCEL_DETECTKEY).c_str());
m_CreateNewShortCut.AttachToDlgItem(m_hWnd, IDC_S_SELECT_SHORT); m_CreateNewShortCut.AttachToDlgItem(m_hWnd, IDC_S_SELECT_SHORT);
m_CpuState.Attach(GetDlgItem(IDC_C_CPU_STATE)); m_CpuState.Attach(GetDlgItem(IDC_C_CPU_STATE));
@ -245,7 +245,7 @@ void COptionsShortCutsPage::OnShortCutChanged(UINT /*Code*/, int /*id*/, HWND /*
{ {
str = "None"; str = "None";
} }
SetDlgItemText(IDC_ASSIGNED_MENU_ITEM, str.c_str()); SetDlgItemText(IDC_ASSIGNED_MENU_ITEM, str.ToUTF16().c_str());
} }
LRESULT COptionsShortCutsPage::OnMenuItemChanged(LPNMHDR lpnmh) LRESULT COptionsShortCutsPage::OnMenuItemChanged(LPNMHDR lpnmh)
@ -275,7 +275,7 @@ void COptionsShortCutsPage::RefreshShortCutOptions(HTREEITEM hItem)
continue; continue;
} }
stdstr Name = ShortCut_item->Name(); const std::wstring & Name = ShortCut_item->Name();
m_CurrentKeys.SetItemData(m_CurrentKeys.AddString(Name.c_str()), (DWORD_PTR)&*ShortCut_item); m_CurrentKeys.SetItemData(m_CurrentKeys.AddString(Name.c_str()), (DWORD_PTR)&*ShortCut_item);
} }
} }

View File

@ -21,15 +21,15 @@ m_SettingsConfig(SettingsConfig)
} }
//Set the text for all gui Items //Set the text for all gui Items
SetDlgItemTextW(m_hWnd, IDC_AUTOSLEEP, wGS(OPTION_AUTO_SLEEP).c_str()); SetDlgItemText(IDC_AUTOSLEEP, wGS(OPTION_AUTO_SLEEP).c_str());
SetDlgItemTextW(m_hWnd, IDC_LOAD_FULLSCREEN, wGS(OPTION_AUTO_FULLSCREEN).c_str()); SetDlgItemText(IDC_LOAD_FULLSCREEN, wGS(OPTION_AUTO_FULLSCREEN).c_str());
SetDlgItemTextW(m_hWnd, IDC_SCREEN_SAVER, wGS(OPTION_DISABLE_SS).c_str()); SetDlgItemText(IDC_SCREEN_SAVER, wGS(OPTION_DISABLE_SS).c_str());
SetDlgItemTextW(m_hWnd, IDC_BASIC_MODE, wGS(OPTION_BASIC_MODE).c_str()); SetDlgItemText(IDC_BASIC_MODE, wGS(OPTION_BASIC_MODE).c_str());
SetDlgItemTextW(m_hWnd, IDC_MAXROMS_TXT, wGS(RB_MAX_ROMS).c_str()); SetDlgItemText(IDC_MAXROMS_TXT, wGS(RB_MAX_ROMS).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT2, wGS(RB_ROMS).c_str()); SetDlgItemText(IDC_ROMSEL_TEXT2, wGS(RB_ROMS).c_str());
SetDlgItemTextW(m_hWnd, IDC_MAXROMDIR_TXT, wGS(RB_MAX_DIRS).c_str()); SetDlgItemText(IDC_MAXROMDIR_TXT, wGS(RB_MAX_DIRS).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROMSEL_TEXT4, wGS(RB_DIRS).c_str()); SetDlgItemText(IDC_ROMSEL_TEXT4, wGS(RB_DIRS).c_str());
SetDlgItemTextW(m_hWnd, IDC_IPLDIR_TXT, wGS(OPTION_IPL_ROM_PATH).c_str()); SetDlgItemText(IDC_IPLDIR_TXT, wGS(OPTION_IPL_ROM_PATH).c_str());
AddModCheckBox(GetDlgItem(IDC_AUTOSLEEP), Setting_AutoSleep); AddModCheckBox(GetDlgItem(IDC_AUTOSLEEP), Setting_AutoSleep);
AddModCheckBox(GetDlgItem(IDC_LOAD_FULLSCREEN), Setting_AutoFullscreen); AddModCheckBox(GetDlgItem(IDC_LOAD_FULLSCREEN), Setting_AutoFullscreen);

View File

@ -20,18 +20,18 @@ COptionPluginPage::COptionPluginPage(HWND hParent, const RECT & rcDispay)
} }
//Set the text for all gui Items //Set the text for all gui Items
SetDlgItemTextW(m_hWnd, RSP_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemText(RSP_ABOUT, wGS(PLUG_ABOUT).c_str());
SetDlgItemTextW(m_hWnd, GFX_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemText(GFX_ABOUT, wGS(PLUG_ABOUT).c_str());
SetDlgItemTextW(m_hWnd, AUDIO_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemText(AUDIO_ABOUT, wGS(PLUG_ABOUT).c_str());
SetDlgItemTextW(m_hWnd, CONT_ABOUT, wGS(PLUG_ABOUT).c_str()); SetDlgItemText(CONT_ABOUT, wGS(PLUG_ABOUT).c_str());
SetDlgItemTextW(m_hWnd, IDC_RSP_NAME, wGS(PLUG_RSP).c_str()); SetDlgItemText(IDC_RSP_NAME, wGS(PLUG_RSP).c_str());
SetDlgItemTextW(m_hWnd, IDC_GFX_NAME, wGS(PLUG_GFX).c_str()); SetDlgItemText(IDC_GFX_NAME, wGS(PLUG_GFX).c_str());
SetDlgItemTextW(m_hWnd, IDC_AUDIO_NAME, wGS(PLUG_AUDIO).c_str()); SetDlgItemText(IDC_AUDIO_NAME, wGS(PLUG_AUDIO).c_str());
SetDlgItemTextW(m_hWnd, IDC_CONT_NAME, wGS(PLUG_CTRL).c_str()); SetDlgItemText(IDC_CONT_NAME, wGS(PLUG_CTRL).c_str());
SetDlgItemTextW(m_hWnd, IDC_HLE_GFX, wGS(PLUG_HLE_GFX).c_str()); SetDlgItemText(IDC_HLE_GFX, wGS(PLUG_HLE_GFX).c_str());
SetDlgItemTextW(m_hWnd, IDC_HLE_AUDIO, wGS(PLUG_HLE_AUDIO).c_str()); SetDlgItemText(IDC_HLE_AUDIO, wGS(PLUG_HLE_AUDIO).c_str());
m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME)); m_GfxGroup.Attach(GetDlgItem(IDC_GFX_NAME));
m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME)); m_AudioGroup.Attach(GetDlgItem(IDC_AUDIO_NAME));
@ -70,7 +70,7 @@ void COptionPluginPage::AddPlugins(int ListId, SettingID Type, PLUGIN_TYPE Plugi
{ {
ComboBox->SetDefault((WPARAM)Plugin); ComboBox->SetDefault((WPARAM)Plugin);
} }
ComboBox->AddItem(Plugin->Info.Name, (WPARAM)Plugin); ComboBox->AddItem(stdstr(Plugin->Info.Name).ToUTF16().c_str(), (WPARAM)Plugin);
} }
} }
@ -110,7 +110,7 @@ void COptionPluginPage::ShowAboutButton(int id)
//Load the plugin //Load the plugin
UINT LastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); UINT LastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
HMODULE hLib = LoadLibrary(Plugin->FullPath); HMODULE hLib = LoadLibrary(stdstr((const char *)(Plugin->FullPath)).ToUTF16().c_str());
SetErrorMode(LastErrorMode); SetErrorMode(LastErrorMode);
if (hLib == NULL) if (hLib == NULL)
{ {

View File

@ -154,13 +154,13 @@ protected:
if (EditBox.IsbString()) if (EditBox.IsbString())
{ {
stdstr Value = g_Settings->LoadDefaultString(Type); stdstr Value = g_Settings->LoadDefaultString(Type);
EditBox.SetWindowText(Value.c_str()); EditBox.SetWindowText(Value.ToUTF16().c_str());
EditBox.SetReset(true); EditBox.SetReset(true);
} }
else else
{ {
DWORD Value = g_Settings->LoadDefaultDword(Type); DWORD Value = g_Settings->LoadDefaultDword(Type);
EditBox.SetWindowText(stdstr_f("%d", Value).c_str()); EditBox.SetWindowText(stdstr_f("%d", Value).ToUTF16().c_str());
EditBox.SetReset(true); EditBox.SetReset(true);
} }
return true; return true;
@ -295,13 +295,13 @@ protected:
{ {
stdstr SelectedValue; stdstr SelectedValue;
TextBox->SetChanged(g_Settings->LoadStringVal(iter->first, SelectedValue)); TextBox->SetChanged(g_Settings->LoadStringVal(iter->first, SelectedValue));
TextBox->SetWindowText(SelectedValue.c_str()); TextBox->SetWindowText(SelectedValue.ToUTF16().c_str());
} }
else else
{ {
uint32_t SelectedValue; uint32_t SelectedValue;
TextBox->SetChanged(g_Settings->LoadDword(iter->first, SelectedValue)); TextBox->SetChanged(g_Settings->LoadDword(iter->first, SelectedValue));
TextBox->SetWindowText(stdstr_f("%d", SelectedValue).c_str()); TextBox->SetWindowText(stdstr_f("%d", SelectedValue).ToUTF16().c_str());
} }
m_UpdatingTxt = false; m_UpdatingTxt = false;
} }

View File

@ -93,28 +93,28 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
CConfigSettingSection * SettingsSection; CConfigSettingSection * SettingsSection;
//Set the text for all gui Items //Set the text for all gui Items
SetDlgItemTextW(m_hWnd, IDC_RESET_PAGE, wGS(BOTTOM_RESET_PAGE).c_str()); SetDlgItemText(IDC_RESET_PAGE, wGS(BOTTOM_RESET_PAGE).c_str());
SetDlgItemTextW(m_hWnd, IDC_RESET_ALL, wGS(BOTTOM_RESET_ALL).c_str()); SetDlgItemText(IDC_RESET_ALL, wGS(BOTTOM_RESET_ALL).c_str());
SetDlgItemTextW(m_hWnd, IDOK, wGS(CHEAT_OK).c_str()); SetDlgItemText(IDOK, wGS(CHEAT_OK).c_str());
SetDlgItemTextW(m_hWnd, IDCANCEL, wGS(CHEAT_CANCEL).c_str()); SetDlgItemText(IDCANCEL, wGS(CHEAT_CANCEL).c_str());
SetDlgItemTextW(m_hWnd, IDAPPLY, wGS(BOTTOM_APPLY).c_str()); SetDlgItemText(IDAPPLY, wGS(BOTTOM_APPLY).c_str());
if (m_GameConfig) if (m_GameConfig)
{ {
if (g_Settings->LoadBool(Setting_RdbEditor)) if (g_Settings->LoadBool(Setting_RdbEditor))
{ {
SetWindowText(stdstr_f("%s ** RDB Edit Mode **", ConfigRomTitle.c_str()).c_str()); SetWindowText(stdstr_f("%s ** RDB Edit Mode **", ConfigRomTitle.c_str()).ToUTF16().c_str());
} }
else else
{ {
SetWindowText(ConfigRomTitle.c_str()); SetWindowText(ConfigRomTitle.ToUTF16().c_str());
} }
} }
else else
{ {
if (g_Settings->LoadBool(Setting_RdbEditor)) if (g_Settings->LoadBool(Setting_RdbEditor))
{ {
SetWindowTextW(m_hWnd, stdstr_f("%s ** RDB Edit Mode **", GS(OPTIONS_TITLE)).ToUTF16().c_str()); SetWindowText(stdstr_f("%s ** RDB Edit Mode **", GS(OPTIONS_TITLE)).ToUTF16().c_str());
} }
else else
{ {

View File

@ -5,10 +5,10 @@
LRESULT CSupportEnterCode::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) LRESULT CSupportEnterCode::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{ {
SetWindowTextW(m_hWnd, wGS(MSG_SUPPORT_ENTER_CODE_TITLE).c_str()); ::SetWindowTextW(m_hWnd, wGS(MSG_SUPPORT_ENTER_CODE_TITLE).c_str());
SetWindowTextW(GetDlgItem(IDOK), wGS(MSG_SUPPORT_OK).c_str()); ::SetWindowTextW(GetDlgItem(IDOK), wGS(MSG_SUPPORT_OK).c_str());
SetWindowTextW(GetDlgItem(IDCANCEL), wGS(MSG_SUPPORT_CANCEL).c_str()); ::SetWindowTextW(GetDlgItem(IDCANCEL), wGS(MSG_SUPPORT_CANCEL).c_str());
SetWindowTextW(GetDlgItem(IDC_DESCRIPTION), wGS(MSG_SUPPORT_ENTER_CODE_DESC).c_str()); ::SetWindowTextW(GetDlgItem(IDC_DESCRIPTION), wGS(MSG_SUPPORT_ENTER_CODE_DESC).c_str());
return TRUE; return TRUE;
} }
@ -42,20 +42,20 @@ LRESULT CSupportEnterCode::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWn
LRESULT CSupportEnterCode::OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) LRESULT CSupportEnterCode::OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ {
char code[50]; wchar_t code[50];
if (!GetDlgItemText(IDC_CODE,code,sizeof(code))) if (!GetDlgItemText(IDC_CODE,code,sizeof(code) /sizeof(code[0])))
{ {
MessageBoxW(m_hWnd, wGS(MSG_SUPPORT_ENTER_SUPPORT_CODE).c_str(), wGS(MSG_SUPPORT_PROJECT64).c_str(), MB_OK); MessageBox(wGS(MSG_SUPPORT_ENTER_SUPPORT_CODE).c_str(), wGS(MSG_SUPPORT_PROJECT64).c_str(), MB_OK);
return false; return false;
} }
if (_stricmp(code,"thank you from project64") != 0) if (_wcsicmp(code,L"thank you from project64") != 0)
{ {
MessageBoxW(m_hWnd, wGS(MSG_SUPPORT_INCORRECT_CODE).c_str(), wGS(MSG_SUPPORT_PROJECT64).c_str(), MB_OK); MessageBox(wGS(MSG_SUPPORT_INCORRECT_CODE).c_str(), wGS(MSG_SUPPORT_PROJECT64).c_str(), MB_OK);
return false; return false;
} }
UISettingsSaveDword(SupportWindows_RunCount, (uint32_t) -1); UISettingsSaveDword(SupportWindows_RunCount, (uint32_t) -1);
CSettingTypeApplication::Flush(); CSettingTypeApplication::Flush();
MessageBoxW(m_hWnd, wGS(MSG_SUPPORT_COMPLETE).c_str(), wGS(MSG_SUPPORT_PROJECT64).c_str(), MB_OK); MessageBox(wGS(MSG_SUPPORT_COMPLETE).c_str(), wGS(MSG_SUPPORT_PROJECT64).c_str(), MB_OK);
EndDialog(wID); EndDialog(wID);
return TRUE; return TRUE;
} }

View File

@ -50,10 +50,10 @@ void CSupportWindow::EnableContinue()
LRESULT CSupportWindow::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) LRESULT CSupportWindow::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{ {
SetWindowTextW(m_hWnd, wGS(MSG_SUPPORT_TITLE).c_str()); ::SetWindowTextW(m_hWnd, wGS(MSG_SUPPORT_TITLE).c_str());
SetWindowTextW(GetDlgItem(IDC_ENTER_CODE), wGS(MSG_SUPPORT_ENTER_CODE).c_str()); ::SetWindowTextW(GetDlgItem(IDC_ENTER_CODE), wGS(MSG_SUPPORT_ENTER_CODE).c_str());
SetWindowTextW(GetDlgItem(ID_SUPPORT_PJ64), wGS(MSG_SUPPORT_PROJECT64).c_str()); ::SetWindowTextW(GetDlgItem(ID_SUPPORT_PJ64), wGS(MSG_SUPPORT_PROJECT64).c_str());
SetWindowTextW(GetDlgItem(IDCANCEL), wGS(MSG_SUPPORT_CONTINUE).c_str()); ::SetWindowTextW(GetDlgItem(IDCANCEL), wGS(MSG_SUPPORT_CONTINUE).c_str());
{ {
HWND hInfo = GetDlgItem(IDC_INFO); HWND hInfo = GetDlgItem(IDC_INFO);
@ -73,7 +73,7 @@ LRESULT CSupportWindow::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
{ {
::SetWindowPos(hInfo,NULL,0,0,rcWin.right, rcWin.bottom,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER); ::SetWindowPos(hInfo,NULL,0,0,rcWin.right, rcWin.bottom,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER);
} }
SetWindowTextW(hInfo, InfoText.c_str()); ::SetWindowTextW(hInfo, InfoText.c_str());
::GetWindowRect(hInfo,&rcWin); ::GetWindowRect(hInfo,&rcWin);
::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rcWin, 2);
@ -128,7 +128,7 @@ LRESULT CSupportWindow::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/,
EnableContinue(); EnableContinue();
} }
stdstr_f continue_txt(m_TimeOutTime > 0 ? "%s (%d)" : "%s", GS(MSG_SUPPORT_CONTINUE), m_TimeOutTime); stdstr_f continue_txt(m_TimeOutTime > 0 ? "%s (%d)" : "%s", GS(MSG_SUPPORT_CONTINUE), m_TimeOutTime);
SetWindowTextW(GetDlgItem(IDCANCEL), continue_txt.ToUTF16().c_str()); ::SetWindowTextW(GetDlgItem(IDCANCEL), continue_txt.ToUTF16().c_str());
return true; return true;
} }
@ -140,8 +140,8 @@ LRESULT CSupportWindow::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCt
LRESULT CSupportWindow::OnSupportProject64(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) LRESULT CSupportWindow::OnSupportProject64(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ {
std::string SupportURL = stdstr_f("http://www.pj64-emu.com/support-project64.html?ver=%s", VER_FILE_VERSION_STR); stdstr SupportURL = stdstr_f("http://www.pj64-emu.com/support-project64.html?ver=%s", VER_FILE_VERSION_STR);
ShellExecute(NULL, "open", SupportURL.c_str(), NULL, NULL, SW_SHOWMAXIMIZED); ShellExecute(NULL, L"open", SupportURL.ToUTF16().c_str(), NULL, NULL, SW_SHOWMAXIMIZED);
return TRUE; return TRUE;
} }

View File

@ -37,7 +37,7 @@ protected:
CContainedWindowT< CEdit > m_wndEditCtrl; CContainedWindowT< CEdit > m_wndEditCtrl;
public: public:
BOOL Create( HWND hWndParent, int nItem, int nSubItem, CRect& rcRect, UINT nFlags, LPCTSTR lpszItemText, CListArray < stdstr >& aComboList ) BOOL Create( HWND hWndParent, int nItem, int nSubItem, CRect& rcRect, UINT nFlags, LPCTSTR lpszItemText, CListArray < std::wstring >& aComboList )
{ {
m_nItem = nItem; m_nItem = nItem;
m_nSubItem = nSubItem; m_nSubItem = nSubItem;
@ -127,10 +127,10 @@ public:
if ( !( m_nFlags & ( ITEM_FLAGS_EDIT_NUMBER | ITEM_FLAGS_EDIT_FLOAT ) ) || nChar == VK_BACK ) if ( !( m_nFlags & ( ITEM_FLAGS_EDIT_NUMBER | ITEM_FLAGS_EDIT_FLOAT ) ) || nChar == VK_BACK )
return TRUE; return TRUE;
stdstr strValue; std::wstring strValue;
int nValueLength = GetWindowTextLength() + 1; int nValueLength = GetWindowTextLength() + 1;
strValue.reserve(nValueLength); strValue.reserve(nValueLength);
GetWindowText( (char *)strValue.c_str(), nValueLength ); GetWindowText( (wchar_t *)strValue.c_str(), nValueLength );
// get selected positions // get selected positions
DWORD dwSelection = GetEditSel(); DWORD dwSelection = GetEditSel();
@ -143,15 +143,15 @@ public:
BOOL bNegative = FALSE; BOOL bNegative = FALSE;
if ( m_nFlags & ITEM_FLAGS_EDIT_FLOAT ) if ( m_nFlags & ITEM_FLAGS_EDIT_FLOAT )
{ {
double dblValue = atof( strValue.c_str() ); double dblValue = _wtof( strValue.c_str() );
bNegative = ( dblValue < 0 ); bNegative = ( dblValue < 0 );
strValue.Format( _T( "%lf" ), -dblValue ); strValue = stdstr_f("%lf", -dblValue).ToUTF16();
} }
else else
{ {
long lValue = _ttol( strValue.c_str() ); long lValue = _wtol( strValue.c_str() );
bNegative = ( lValue < 0 ); bNegative = ( lValue < 0 );
strValue.Format( _T( "%ld" ), -lValue ); strValue = stdstr_f("%ld", -lValue).ToUTF16();
} }
SetWindowText( strValue.c_str() ); SetWindowText( strValue.c_str() );
@ -162,7 +162,7 @@ public:
} }
// construct new value string using entered character // construct new value string using entered character
stdstr strNewValue = strValue.substr(0, nStartChar ) + nChar + strValue.substr(nEndChar, strValue.length() - nEndChar ); std::wstring strNewValue = strValue.substr(0, nStartChar ) + nChar + strValue.substr(nEndChar, strValue.length() - nEndChar );
int nGreaterThan = 0; int nGreaterThan = 0;
int nLessThan = 0; int nLessThan = 0;
@ -333,7 +333,7 @@ public:
int nIndex = GetCurSel(); int nIndex = GetCurSel();
if ( nIndex != CB_ERR ) if ( nIndex != CB_ERR )
{ {
stdstr strText; std::wstring strText;
int cchLen = GetLBTextLen(nIndex); int cchLen = GetLBTextLen(nIndex);
if(cchLen != CB_ERR) if(cchLen != CB_ERR)
{ {
@ -366,7 +366,7 @@ public:
CWindow wndParent( GetParent() ); CWindow wndParent( GetParent() );
if ( wndParent.IsWindow() ) if ( wndParent.IsWindow() )
{ {
stdstr strValue; std::wstring strValue;
if ( ( GetStyle() & CBS_DROPDOWNLIST ) == CBS_DROPDOWNLIST ) if ( ( GetStyle() & CBS_DROPDOWNLIST ) == CBS_DROPDOWNLIST )
{ {
@ -381,7 +381,7 @@ public:
} }
else else
{ {
strValue = ""; strValue = L"";
} }
} }
} }

View File

@ -76,7 +76,7 @@ public:
else if ( nFlags & ITEM_FLAGS_TIME_ONLY ) else if ( nFlags & ITEM_FLAGS_TIME_ONLY )
SetFormat( szTimeFormat ); SetFormat( szTimeFormat );
else else
SetFormat( stdstr_f("%s %s",szDateFormat,szTimeFormat ).c_str() ); SetFormat(stdstr_f("%s %s",szDateFormat,szTimeFormat ).ToUTF16().c_str());
// get current date if setting time-only // get current date if setting time-only
if ( nFlags & ITEM_FLAGS_TIME_ONLY ) if ( nFlags & ITEM_FLAGS_TIME_ONLY )

View File

@ -22,7 +22,7 @@ protected:
int m_nItem; int m_nItem;
int m_nSubItem; int m_nSubItem;
UINT m_nFlags; UINT m_nFlags;
UINT m_nMaxLen; int m_nMaxLen;
TCHAR m_nExitChar; TCHAR m_nExitChar;
CFont m_fntEditFont; CFont m_fntEditFont;
@ -80,12 +80,14 @@ public:
if ( !( m_nFlags & ( ITEM_FLAGS_EDIT_HEX | ITEM_FLAGS_EDIT_NUMBER | ITEM_FLAGS_EDIT_FLOAT ) ) || nChar == VK_BACK ) if ( !( m_nFlags & ( ITEM_FLAGS_EDIT_HEX | ITEM_FLAGS_EDIT_NUMBER | ITEM_FLAGS_EDIT_FLOAT ) ) || nChar == VK_BACK )
return TRUE; return TRUE;
stdstr strValue; std::wstring WindowText;
UINT nValueLength = GetWindowTextLength(); int nValueLength = GetWindowTextLengthW();
strValue.reserve(nValueLength + 1); if (nValueLength > 0)
strValue.resize(nValueLength); {
GetWindowText( (LPTSTR)strValue.c_str(), nValueLength + 1); WindowText.reserve(nValueLength + 1);
WindowText.resize(nValueLength);
GetWindowTextW((wchar_t *)WindowText.c_str(), nValueLength + 1);
}
// get selected positions // get selected positions
int nStartChar; int nStartChar;
int nEndChar; int nEndChar;
@ -104,18 +106,18 @@ public:
BOOL bNegative = FALSE; BOOL bNegative = FALSE;
if ( m_nFlags & ITEM_FLAGS_EDIT_FLOAT ) if ( m_nFlags & ITEM_FLAGS_EDIT_FLOAT )
{ {
double dblValue = atof( strValue.c_str() ); double dblValue = _wtof(WindowText.c_str());
bNegative = ( dblValue < 0 ); bNegative = ( dblValue < 0 );
strValue.Format( _T( "%lf" ), -dblValue ); WindowText = stdstr_f("%lf", -dblValue).ToUTF16();
} }
else else
{ {
long lValue = _ttol( strValue.c_str() ); long lValue = _wtol(WindowText.c_str() );
bNegative = ( lValue < 0 ); bNegative = ( lValue < 0 );
strValue.Format( _T( "%ld" ), -lValue ); WindowText = stdstr_f("%ld", -lValue).ToUTF16();
} }
SetWindowText( strValue.c_str() ); SetWindowText(WindowText.c_str());
// restore select position // restore select position
SetSel( bNegative ? nStartChar - 1 : nStartChar + 1, bNegative ? nEndChar - 1 : nEndChar + 1 ); SetSel( bNegative ? nStartChar - 1 : nStartChar + 1, bNegative ? nEndChar - 1 : nEndChar + 1 );
@ -123,7 +125,7 @@ public:
} }
// construct new value string using entered character // construct new value string using entered character
stdstr strNewValue = strValue.substr(0, nStartChar ) + nChar + strValue.substr( strValue.length() - nEndChar ); std::wstring strNewValue = WindowText.substr(0, nStartChar ) + nChar + WindowText.substr(WindowText.length() - nEndChar );
int nGreaterThan = 0; int nGreaterThan = 0;
int nLessThan = 0; int nLessThan = 0;
@ -216,7 +218,7 @@ public:
CWindow wndParent( GetParent() ); CWindow wndParent( GetParent() );
if ( wndParent.IsWindow() ) if ( wndParent.IsWindow() )
{ {
stdstr strValue; std::wstring strValue;
int nValueLength = GetWindowTextLength(); int nValueLength = GetWindowTextLength();
strValue.reserve(nValueLength + 1); strValue.reserve(nValueLength + 1);
strValue.resize(nValueLength); strValue.resize(nValueLength);

View File

@ -60,13 +60,14 @@ public:
BOOL Show( CRect& rcRect, LPCTSTR lpszItemText, LPCTSTR lpszToolTip ) BOOL Show( CRect& rcRect, LPCTSTR lpszItemText, LPCTSTR lpszToolTip )
{ {
stdstr strItemText = lpszItemText; stdstr strItemText;
strItemText.FromUTF16(lpszItemText);
if ( !IsWindow() || strItemText.empty() ) if ( !IsWindow() || strItemText.empty() )
return FALSE; return FALSE;
m_strToolTip = lpszToolTip; m_strToolTip.FromUTF16(lpszToolTip);
SetWindowText( strItemText.c_str() ); SetWindowText(strItemText.ToUTF16().c_str() );
CClientDC dcClient( m_hWnd ); CClientDC dcClient( m_hWnd );
@ -75,7 +76,7 @@ public:
CRect rcTextExtent( rcRect ); CRect rcTextExtent( rcRect );
// calculate item text extent... // calculate item text extent...
dcClient.DrawText( strItemText.c_str(), (int)strItemText.length(), rcTextExtent, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_CALCRECT ); dcClient.DrawTextW( strItemText.ToUTF16().c_str(), (int)strItemText.length(), rcTextExtent, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_CALCRECT );
dcClient.SelectFont( hOldFont ); dcClient.SelectFont( hOldFont );
@ -216,7 +217,7 @@ public:
CRect rcItemText( rcClient ); CRect rcItemText( rcClient );
rcItemText.OffsetRect( 4, 0 ); rcItemText.OffsetRect( 4, 0 );
dcPaint.DrawText( strItemText.c_str(), (int)strItemText.length(), rcItemText, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER ); dcPaint.DrawTextW( strItemText.ToUTF16().c_str(), (int)strItemText.length(), rcItemText, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER );
dcPaint.RestoreDC( nContextState ); dcPaint.RestoreDC( nContextState );
} }

View File

@ -25,13 +25,13 @@ bool CEditNumber32::IsHexConvertableText(LPTSTR _text)
int start, end; int start, end;
GetSel(start, end); GetSel(start, end);
char WindowText[200]; wchar_t WindowText[200];
GetWindowText(WindowText, sizeof(WindowText)); GetWindowText(WindowText, sizeof(WindowText) / sizeof(WindowText[0]));
bool bPaste = true; bool bPaste = true;
size_t Len = strlen(WindowText); size_t Len = wcslen(WindowText);
char head = Len > 0 ? WindowText[0] : 0; wchar_t head = Len > 0 ? WindowText[0] : 0;
char second = Len > 1 ? WindowText[1] : 0; wchar_t second = Len > 1 ? WindowText[1] : 0;
if (second == 'X' || second == 'x') if (second == 'X' || second == 'x')
{ {
@ -43,11 +43,11 @@ bool CEditNumber32::IsHexConvertableText(LPTSTR _text)
if (!bPaste) { return bPaste; } if (!bPaste) { return bPaste; }
//Check //Check
unsigned int i = 0; unsigned int i = 0;
if (strlen(_text) >= 2) if (wcslen(_text) >= 2)
{ {
if (_text[0] == '0' && (_text[1] == 'x' || _text[1] == 'X')) if (_text[0] == L'0' && (_text[1] == L'x' || _text[1] == L'X'))
{ {
if ((second == 'x' || second == 'X') && (!(start == 0 && end >= 2))) if ((second == L'x' || second == L'X') && (!(start == 0 && end >= 2)))
{ {
bPaste = false; bPaste = false;
} }
@ -62,29 +62,29 @@ bool CEditNumber32::IsHexConvertableText(LPTSTR _text)
} }
} }
if (!bPaste) return bPaste; if (!bPaste) return bPaste;
if (strlen(_text) >= 1) if (wcslen(_text) >= 1)
{ {
if (head == '0' && (_text[0] == 'x' || _text[0] == 'X')) if (head == L'0' && (_text[0] == L'x' || _text[0] == L'X'))
{ {
i++; i++;
} }
if ((_text[0] == 'x' || _text[0] == 'X')) if ((_text[0] == L'x' || _text[0] == L'X'))
{ {
if (head != '0'&&start == 0) if (head != L'0' && start == 0)
{ {
bPaste = false; bPaste = false;
} }
else if (!(start == 1 && end >= 1 && head == '0')) else if (!(start == 1 && end >= 1 && head == L'0'))
{ {
bPaste = false; bPaste = false;
} }
} }
} }
if (!bPaste) return bPaste; if (!bPaste) return bPaste;
for (; i < strlen(_text); i++) for (; i < wcslen(_text); i++)
{ {
char c = _text[i]; wchar_t c = _text[i];
if (!(c >= 48 && c <= 57 || c >= 'A'&&c <= 'F' || c >= 'a'&&c <= 'f' || c == ' ')) if (!(c >= 48 && c <= 57 || c >= L'A'&&c <= L'F' || c >= L'a'&&c <= L'f' || c == L' '))
{ {
bPaste = false; bPaste = false;
break; break;
@ -105,29 +105,29 @@ void CEditNumber32::FormatClipboard()
if (hglb != NULL) if (hglb != NULL)
{ {
lptstr = (LPTSTR)GlobalLock(hglb); lptstr = (LPTSTR)GlobalLock(hglb);
for (unsigned int i = 0; i < strlen(lptstr); i++) for (unsigned int i = 0; i < wcslen(lptstr); i++)
{ {
if (lptstr[i] != 'X'&&lptstr[i] != 'x') if (lptstr[i] != L'X'&&lptstr[i] != L'x')
{ {
lptstr[i] = (char)toupper(lptstr[i]); lptstr[i] = (char)toupper(lptstr[i]);
} }
if (lptstr[i] == 'X') if (lptstr[i] == L'X')
{ {
lptstr[i] = 'x'; lptstr[i] = L'x';
} }
if (lptstr[i] == ' ' && (i < strlen(lptstr))) if (lptstr[i] == ' ' && (i < wcslen(lptstr)))
{ {
strcpy(&lptstr[i], &lptstr[i + 1]); wcscpy(&lptstr[i], &lptstr[i + 1]);
} }
} }
hglb = GlobalAlloc(GMEM_MOVEABLE, (strlen(lptstr) + 1) * sizeof(TCHAR)); hglb = GlobalAlloc(GMEM_MOVEABLE, (wcslen(lptstr) + 1) * sizeof(TCHAR));
if (hglb == NULL) if (hglb == NULL)
{ {
CloseClipboard(); CloseClipboard();
return; return;
} }
lptstrCopy = (LPTSTR)GlobalLock(hglb); lptstrCopy = (LPTSTR)GlobalLock(hglb);
memcpy(lptstrCopy, lptstr, strlen(lptstr) + 1); memcpy(lptstrCopy, lptstr, wcslen(lptstr) + 1);
GlobalUnlock(lptstr); GlobalUnlock(lptstr);
GlobalUnlock(hglb); GlobalUnlock(hglb);
SetClipboardData(CF_TEXT, hglb); SetClipboardData(CF_TEXT, hglb);
@ -180,13 +180,12 @@ LRESULT CEditNumber32::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
{ {
int start, end; int start, end;
GetSel(start, end); GetSel(start, end);
//CString text; wchar_t WindowText[200];
char WindowText[200];
GetWindowText(WindowText, sizeof(WindowText)); GetWindowText(WindowText, sizeof(WindowText));
size_t Len = strlen(WindowText); size_t Len = wcslen(WindowText);
char head = Len > 0 ? WindowText[0] : 0; wchar_t head = Len > 0 ? WindowText[0] : 0;
char second = Len > 1 ? WindowText[1] : 0; wchar_t second = Len > 1 ? WindowText[1] : 0;
if (uMsg == WM_CHAR) if (uMsg == WM_CHAR)
{ {
@ -195,15 +194,15 @@ LRESULT CEditNumber32::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
if (m_DisplayType == DisplayHex) if (m_DisplayType == DisplayHex)
{ {
MaxLen = 8; MaxLen = 8;
if (second == 'x' || second == 'X') if (second == L'x' || second == L'X')
{ {
MaxLen += 2; MaxLen += 2;
} }
} }
int c = (int)wParam; wchar_t c = (wchar_t)wParam;
if (wParam < 32) if (wParam < 32)
{ {
if (wParam == 8 && (second == 'x' || second == 'X') && head == '0' && end == 1) if (wParam == 8 && (second == L'x' || second == L'X') && head == L'0' && end == 1)
{ {
//does not allow to delete '0' before x //does not allow to delete '0' before x
bHandled = true; bHandled = true;
@ -214,7 +213,7 @@ LRESULT CEditNumber32::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
return TRUE; return TRUE;
} }
if (second == 'x' || second == 'X') if (second == L'x' || second == L'X')
{ {
//does not allow to change head except select includes first and second //does not allow to change head except select includes first and second
if (start <= 1 && end <= 1) if (start <= 1 && end <= 1)
@ -223,11 +222,11 @@ LRESULT CEditNumber32::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
return TRUE; return TRUE;
} }
} }
if (start == 1 && (c == 'X' || c == 'x') && head == '0') if (start == 1 && (c == L'X' || c == L'x') && head == L'0')
{ {
if (c == 'X') if (c == L'X')
{ {
SendMessage(uMsg, 'x', lParam); SendMessage(uMsg, L'x', lParam);
bHandled = true; bHandled = true;
} }
else { else {
@ -235,7 +234,7 @@ LRESULT CEditNumber32::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
} }
return true; return true;
} }
else if (c >= '0' && c <= '9' || c >= 'A' && c <= 'F') else if (c >= L'0' && c <= L'9' || c >= L'A' && c <= L'F')
{ {
if (Len >= MaxLen && start == end) if (Len >= MaxLen && start == end)
{ {
@ -245,7 +244,7 @@ LRESULT CEditNumber32::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled = false; bHandled = false;
return true; return true;
} }
else if (c >= 'a' && c <= 'f') else if (c >= L'a' && c <= L'f')
{ {
if (Len >= MaxLen && start == end) if (Len >= MaxLen && start == end)
{ {
@ -283,16 +282,16 @@ void CEditNumber32::SetDisplayType(DisplayType Type)
uint32_t CEditNumber32::GetValue(void) uint32_t CEditNumber32::GetValue(void)
{ {
char text[200]; wchar_t text[200];
GetWindowText(text, sizeof(text)); GetWindowText(text, sizeof(text));
if (m_DisplayType == DisplayDec) if (m_DisplayType == DisplayDec)
{ {
return atoi(text); return _wtoi(text);
} }
size_t Finish = strlen(text); size_t Finish = wcslen(text);
char second = Finish > 1 ? text[1] : 0; wchar_t second = Finish > 1 ? text[1] : 0;
size_t Start = (second == 'x' || second == 'X') ? 2 : 0; size_t Start = (second == L'x' || second == L'X') ? 2 : 0;
if (Finish > 8 + Start) { Finish = 8 + Start; } if (Finish > 8 + Start) { Finish = 8 + Start; }
@ -302,28 +301,28 @@ uint32_t CEditNumber32::GetValue(void)
Value = (Value << 4); Value = (Value << 4);
switch (text[i]) switch (text[i])
{ {
case '0': break; case L'0': break;
case '1': Value += 1; break; case L'1': Value += 1; break;
case '2': Value += 2; break; case L'2': Value += 2; break;
case '3': Value += 3; break; case L'3': Value += 3; break;
case '4': Value += 4; break; case L'4': Value += 4; break;
case '5': Value += 5; break; case L'5': Value += 5; break;
case '6': Value += 6; break; case L'6': Value += 6; break;
case '7': Value += 7; break; case L'7': Value += 7; break;
case '8': Value += 8; break; case L'8': Value += 8; break;
case '9': Value += 9; break; case L'9': Value += 9; break;
case 'A': Value += 10; break; case L'A': Value += 10; break;
case 'a': Value += 10; break; case L'a': Value += 10; break;
case 'B': Value += 11; break; case L'B': Value += 11; break;
case 'b': Value += 11; break; case L'b': Value += 11; break;
case 'C': Value += 12; break; case L'C': Value += 12; break;
case 'c': Value += 12; break; case L'c': Value += 12; break;
case 'D': Value += 13; break; case L'D': Value += 13; break;
case 'd': Value += 13; break; case L'd': Value += 13; break;
case 'E': Value += 14; break; case L'E': Value += 14; break;
case 'e': Value += 14; break; case L'e': Value += 14; break;
case 'F': Value += 15; break; case L'F': Value += 15; break;
case 'f': Value += 15; break; case L'f': Value += 15; break;
default: default:
Value = (Value >> 4); Value = (Value >> 4);
i = Finish; i = Finish;
@ -339,19 +338,14 @@ stdstr CEditNumber32::GetValueText(void)
void CEditNumber32::SetValue(uint32_t Value, DisplayMode Display) void CEditNumber32::SetValue(uint32_t Value, DisplayMode Display)
{ {
char text[200]; stdstr text;
if (m_DisplayType == DisplayDec) if (m_DisplayType == DisplayDec)
{ {
sprintf(text, "%d", Value); text.Format("%d", Value);
} }
else else
{ {
sprintf( text.Format("%s%0*X",(Display & DisplayMode::ShowHexIdent) == DisplayMode::ShowHexIdent ? "0x" : "", (Display & DisplayMode::ZeroExtend) == DisplayMode::ZeroExtend ? 8 : 0, Value);
text,
"%s%0*X",
(Display & DisplayMode::ShowHexIdent) == DisplayMode::ShowHexIdent ? "0x" : "",
(Display & DisplayMode::ZeroExtend) == DisplayMode::ZeroExtend ? 8 : 0,
Value);
} }
SetWindowText(text); SetWindowText(text.ToUTF16().c_str());
} }

View File

@ -5,12 +5,13 @@
inline static stdstr GetCWindowText(const CWindow *window) inline static stdstr GetCWindowText(const CWindow *window)
{ {
stdstr Result; stdstr Result;
int nLen = ::GetWindowTextLength(window->m_hWnd); int nLen = ::GetWindowTextLengthW(window->m_hWnd);
if (nLen == 0) if (nLen == 0)
{ {
return Result; return Result;
} }
Result.resize(nLen + 1); std::wstring WindowText;
::GetWindowText(window->m_hWnd, (char *)Result.c_str(), nLen + 1); WindowText.resize(nLen + 1);
return Result; ::GetWindowTextW(window->m_hWnd, (wchar_t *)WindowText.c_str(), nLen + 1);
return Result.FromUTF16(WindowText.c_str());
} }

View File

@ -54,10 +54,10 @@ CHexEditCtrl::~CHexEditCtrl(void)
{ {
} }
int CALLBACK CHexEditCtrl::HaveFontCb(CONST LOGFONTA* lplf, CONST TEXTMETRICA* /*lptm*/, DWORD /*FontType*/, LPARAM lParam) int CALLBACK CHexEditCtrl::HaveFontCb(CONST LOGFONTW* lplf, CONST TEXTMETRICW* /*lptm*/, DWORD /*FontType*/, LPARAM lParam)
{ {
const char* name = (const char*)lParam; const wchar_t * name = (const wchar_t*)lParam;
if (strcmp(lplf->lfFaceName, name) == 0) if (wcscmp(lplf->lfFaceName, name) == 0)
{ {
return 0; return 0;
} }
@ -66,7 +66,7 @@ int CALLBACK CHexEditCtrl::HaveFontCb(CONST LOGFONTA* lplf, CONST TEXTMETRICA* /
bool CHexEditCtrl::HaveFont(HDC hdc, const char* name) bool CHexEditCtrl::HaveFont(HDC hdc, const char* name)
{ {
if (EnumFonts(hdc, name, HaveFontCb, (LPARAM)name) == 0) if (EnumFonts(hdc, stdstr(name).ToUTF16().c_str(), HaveFontCb, (LPARAM)stdstr(name).ToUTF16().c_str()) == 0)
{ {
return true; return true;
} }
@ -117,7 +117,7 @@ BOOL CHexEditCtrl::Attach(HWND hWnd)
CLIP_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_QUALITY,
FF_DONTCARE | FIXED_PITCH, FF_DONTCARE | FIXED_PITCH,
"Consolas"); L"Consolas");
} }
else else
{ {
@ -508,15 +508,16 @@ bool CHexEditCtrl::UpdateCaretUI(bool bEnsureVisible, bool bTop)
void CHexEditCtrl::Text(int x, int y, const char *text, COLORREF bg, COLORREF fg, CRect *rcOut) void CHexEditCtrl::Text(int x, int y, const char *text, COLORREF bg, COLORREF fg, CRect *rcOut)
{ {
size_t length = strlen(text); std::wstring textOuput = stdstr(text).ToUTF16();
size_t length = textOuput.length();
int calcWidth = length * m_CharWidth; int calcWidth = length * m_CharWidth;
CRect rc(x, y, 0, 0); CRect rc(x, y, 0, 0);
COLORREF orgBg = ::SetBkColor(m_BackDC, bg); COLORREF orgBg = ::SetBkColor(m_BackDC, bg);
COLORREF orgFg = ::SetTextColor(m_BackDC, fg); COLORREF orgFg = ::SetTextColor(m_BackDC, fg);
::DrawText(m_BackDC, text, -1, &rc, DT_TOP | DT_NOPREFIX | DT_CALCRECT); ::DrawText(m_BackDC, textOuput.c_str(), -1, &rc, DT_TOP | DT_NOPREFIX | DT_CALCRECT);
rc.right = rc.left + calcWidth; // just in case rc.right = rc.left + calcWidth; // just in case
::DrawText(m_BackDC, text, -1, &rc, DT_TOP | DT_NOPREFIX); ::DrawText(m_BackDC, textOuput.c_str(), -1, &rc, DT_TOP | DT_NOPREFIX);
InvalidateRect(&rc, false); InvalidateRect(&rc, false);
::SetBkColor(m_BackDC, orgBg); ::SetBkColor(m_BackDC, orgBg);
::SetBkColor(m_BackDC, orgFg); ::SetBkColor(m_BackDC, orgFg);

View File

@ -131,7 +131,7 @@ public:
static char ByteAscii(uint8_t value); static char ByteAscii(uint8_t value);
static uint8_t HexCharValue(char c); static uint8_t HexCharValue(char c);
static int CALLBACK HaveFontCb(CONST LOGFONTA *lplf, CONST TEXTMETRICA *lptm, DWORD FontType, LPARAM lParam); static int CALLBACK HaveFontCb(CONST LOGFONTW *lplf, CONST TEXTMETRICW *lptm, DWORD FontType, LPARAM lParam);
static bool HaveFont(HDC hdc, const char* name); static bool HaveFont(HDC hdc, const char* name);
void Draw(void); void Draw(void);

View File

@ -46,7 +46,7 @@ public:
} }
} }
int AddItem (LPCSTR strItem, const TParam & lParam) int AddItem (LPCTSTR strItem, const TParam & lParam)
{ {
int indx = AddString(strItem); int indx = AddString(strItem);
TParam * Value = new TParam(lParam); TParam * Value = new TParam(lParam);
@ -59,19 +59,6 @@ public:
return indx; return indx;
} }
int AddItemW (LPCWSTR strItem, const TParam & lParam)
{
int indx = AddStringW(strItem);
TParam * Value = new TParam(lParam);
SetItemData(indx,(DWORD_PTR)(Value));
m_ParamList.push_back(Value);
if ((m_AllwaysSelected && GetCount() == 1) || m_defaultValue == lParam)
{
SetCurSel(indx);
}
return indx;
}
void SetReset ( bool Reset ) void SetReset ( bool Reset )
{ {
m_Reset = Reset; m_Reset = Reset;

View File

@ -65,7 +65,7 @@ void CPartialGroupBox::OnPaint(HDC /*hDC*/)
dc.SelectBrush(GetSysColorBrush(COLOR_BTNFACE)); dc.SelectBrush(GetSysColorBrush(COLOR_BTNFACE));
wchar_t grptext[500]; wchar_t grptext[500];
GetWindowTextW(m_hWnd, grptext, sizeof(grptext) / sizeof(grptext[0])); ::GetWindowTextW(m_hWnd, grptext, sizeof(grptext) / sizeof(grptext[0]));
CRect fontsizerect(0, 0, 0, 0); CRect fontsizerect(0, 0, 0, 0);
dc.DrawTextW(grptext, -1, fontsizerect, DT_SINGLELINE | DT_LEFT | DT_CALCRECT); dc.DrawTextW(grptext, -1, fontsizerect, DT_SINGLELINE | DT_LEFT | DT_CALCRECT);

View File

@ -23,12 +23,13 @@ public:
{ {
T* pT = static_cast<T*>(this); T* pT = static_cast<T*>(this);
std::wstring wcText = stdstr(lpszText).ToUTF16();
TOOLINFO toolInfo = { 0 }; TOOLINFO toolInfo = { 0 };
toolInfo.cbSize = sizeof(toolInfo); toolInfo.cbSize = sizeof(toolInfo);
toolInfo.hwnd = pT->m_hWnd; toolInfo.hwnd = pT->m_hWnd;
toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS; toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
toolInfo.uId = (UINT_PTR) ::GetDlgItem(pT->m_hWnd, ctrlId); toolInfo.uId = (UINT_PTR) ::GetDlgItem(pT->m_hWnd, ctrlId);
toolInfo.lpszText = lpszText; toolInfo.lpszText = (LPWSTR)wcText.c_str();
SendMessage(m_hWndTooltip, TTM_ADDTOOL, 0, (LPARAM)&toolInfo); SendMessage(m_hWndTooltip, TTM_ADDTOOL, 0, (LPARAM)&toolInfo);
} }

View File

@ -99,7 +99,7 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
catch (...) catch (...)
{ {
WriteTrace(TraceUserInterface, TraceError, "Exception caught (File: \"%s\" Line: %d)", __FILE__, __LINE__); WriteTrace(TraceUserInterface, TraceError, "Exception caught (File: \"%s\" Line: %d)", __FILE__, __LINE__);
MessageBox(NULL, stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).c_str(), "Exception", MB_OK); MessageBox(NULL, stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).ToUTF16().c_str(), L"Exception", MB_OK);
} }
AppCleanup(); AppCleanup();
CoUninitialize(); CoUninitialize();