dolphinwx and debuggerwx can now be compiled with unicode

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3906 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2009-07-30 07:09:26 +00:00
parent 90d2d95c72
commit 8302ac84de
15 changed files with 84 additions and 63 deletions

View File

@ -115,16 +115,17 @@
// Shorts - dirs
// User dirs
#define FULL_USERDATA_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP
#define T_FULLUSERDATA_DIR _T(ROOT_DIR) _T(DIR_SEP) _T(USERDATA_DIR) _T(DIR_SEP)
#define FULL_GC_USER_DIR FULL_USERDATA_DIR GC_USER_DIR DIR_SEP
//#define GC_USER_EUR_DIR FULL_GC_USER_DIR EUR_DIR
//#define GC_USER_USA_DIR FULL_GC_USER_DIR USA_DIR
//#define GC_USER_JAP_DIR FULL_GC_USER_DIR JAP_DIR
#define T_FULL_GC_USER_DIR T_FULLUSERDATA_DIR _T(GC_USER_DIR) _T(DIR_SEP)
#define FULL_WII_USER_DIR FULL_USERDATA_DIR WII_USER_DIR DIR_SEP
#define FULL_WII_ROOT_DIR FULL_USERDATA_DIR WII_USER_DIR // This is the "root" for Wii fs, so that it may be used with created devices
#define FULL_GAMECONFIG_DIR FULL_USERDATA_DIR GAMECONFIG_DIR DIR_SEP
#define T_FULL_GAMECONFIG_DIR T_FULLUSERDATA_DIR _T(GAMECONFIG_DIR) _T(DIR_SEP)
#define FULL_CONFIG_DIR FULL_USERDATA_DIR CONFIG_DIR DIR_SEP
#define FULL_CACHE_DIR FULL_USERDATA_DIR CACHE_DIR DIR_SEP
#define FULL_STATESAVES_DIR FULL_USERDATA_DIR STATESAVES_DIR DIR_SEP

View File

@ -351,6 +351,18 @@ void StackTrace( HANDLE hThread, LPCTSTR lpszMessage, FILE *file )
ResumeThread( hThread );
}
void StackTrace( HANDLE hThread, wchar_t const*lpszMessage, FILE *file, DWORD eip, DWORD esp, DWORD ebp )
{
// TODO: remove when Common builds as unicode
size_t origsize = wcslen(lpszMessage) + 1;
const size_t newsize = 100;
size_t convertedChars = 0;
char nstring[newsize];
wcstombs_s(&convertedChars, nstring, origsize, lpszMessage, _TRUNCATE);
StackTrace(hThread, nstring, file, eip, esp, ebp );
}
void StackTrace( HANDLE hThread, LPCTSTR lpszMessage, FILE *file, DWORD eip, DWORD esp, DWORD ebp )
{
STACKFRAME callStack;

View File

@ -34,6 +34,7 @@ BOOL InitSymInfo( PCSTR );
BOOL UninitSymInfo();
void StackTrace( HANDLE, LPCTSTR, FILE *file);
void StackTrace( HANDLE, LPCTSTR, FILE *file, DWORD eip, DWORD esp, DWORD ebp);
void StackTrace( HANDLE hThread, wchar_t const* lpszMessage, FILE *file, DWORD eip, DWORD esp, DWORD ebp);
// functions by Masken
void etfprintf(FILE *file, const char *format, ...);

View File

@ -488,7 +488,7 @@ bool DeleteDirRecursively(const char *directory)
}
// Returns the current directory, caller should free
const char *GetCurrentDirectory()
const char *GetCurrentDir()
{
const char *dir;
// Get the current working directory (getcwd uses malloc)
@ -502,7 +502,7 @@ const char *GetCurrentDirectory()
}
// Sets the current directory to the given directory
bool SetCurrentDirectory(const char *_rDirectory)
bool SetCurrentDir(const char *_rDirectory)
{
return __chdir(_rDirectory) == 0;
}

View File

@ -76,10 +76,10 @@ u32 ScanDirectoryTree(const char *directory, FSTEntry& parentEntry);
bool DeleteDirRecursively(const char *directory);
// Returns the current directory, caller should free
const char *GetCurrentDirectory();
const char *GetCurrentDir();
// Set the current directory to given directory
bool SetCurrentDirectory(const char *directory);
bool SetCurrentDir(const char *directory);
// Returns a pointer to a string with a Dolphin data dir in the user's home

View File

@ -354,7 +354,7 @@ CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
}
else
{
wxMessageBox(_T("You have no " FULL_GAMECONFIG_DIR "MemoryChecks.ini file"));
wxMessageBox(_T("You have no ") T_FULL_GAMECONFIG_DIR _T("MemoryChecks.ini file"));
}
}
// =================

View File

@ -460,9 +460,9 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
), wxITEM_CHECK);
jitunlimited = pCoreMenu->Append(IDM_JITUNLIMITED, _T("&Unlimited JIT Cache"),
_T("Avoid any involuntary JIT cache clearing, this may prevent Zelda TP from crashing."
" [This option must be selected before a game is started.]"
), wxITEM_CHECK);
_T("Avoid any involuntary JIT cache clearing, this may prevent Zelda TP from crashing.")
_T(" [This option must be selected before a game is started.]"),
wxITEM_CHECK);
#ifdef JIT_OFF_OPTIONS

View File

@ -272,25 +272,24 @@ void CConfigMain::CreateGUIControls()
Theme->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme);
// ToolTips
UseDynaRec->SetToolTip(wxT("Disabling this will cause Dolphin to run in interpreter mode,"
"\nwhich can be more accurate, but is MUCH slower"));
UseDynaRec->SetToolTip(wxT("Disabling this will cause Dolphin to run in interpreter mode,")
wxT("\nwhich can be more accurate, but is MUCH slower"));
ConfirmStop->SetToolTip(wxT("Show a confirmation box before stopping a game."));
UsePanicHandlers->SetToolTip(wxT("Show a message box when a potentially serious error has occured."
" Disabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin"
" suddenly crashes without any explanation at all."
));
UsePanicHandlers->SetToolTip(wxT("Show a message box when a potentially serious error has occured.")
wxT(" Disabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin")
wxT(" suddenly crashes without any explanation at all."));
AutoHideCursor->SetToolTip(wxT("This will auto hide the cursor in fullscreen mode."));
HideCursor->SetToolTip(wxT("This will always hide the cursor when it's over the rendering window."
"\nIt can be convenient in a Wii game that already has a cursor."));
HideCursor->SetToolTip(wxT("This will always hide the cursor when it's over the rendering window.")
wxT("\nIt can be convenient in a Wii game that already has a cursor."));
WiimoteStatusLEDs->SetToolTip(wxT("Show which wiimotes are connected in the statusbar."));
WiimoteStatusSpeakers->SetToolTip(wxT("Show wiimote speaker status in the statusbar."));
DSPThread->SetToolTip(wxT("This should be on when using HLE and off when using LLE."));
UseDualCore->SetToolTip(wxT("This splits the Video and CPU threads, so they can be run on separate cores."
"\nCauses major speed improvements on PCs with more than one core,"
"\nbut can also cause occasional crashes/glitches."));
UseDualCore->SetToolTip(wxT("This splits the Video and CPU threads, so they can be run on separate cores.")
wxT("\nCauses major speed improvements on PCs with more than one core,")
wxT("\nbut can also cause occasional crashes/glitches."));
InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in"
"\nthe game list of PAL GC games."));
InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in")
wxT("\nthe game list of PAL GC games."));
// Copyright notice
Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]"));
Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com"));
@ -728,7 +727,7 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
{
std::string filename = std::string(wxFileSelector(
wxT("Choose a file to open"),
wxT(FULL_GC_USER_DIR),
T_FULL_GC_USER_DIR,
isSlotA ? wxT(GC_MEMCARDA) : wxT(GC_MEMCARDB),
wxEmptyString,
wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp")).mb_str());

View File

@ -431,7 +431,7 @@ void CFrame::OnOpen(wxCommandEvent& WXUNUSED (event))
void CFrame::DoOpen(bool Boot)
{
std::string currentDir = File::GetCurrentDirectory();
std::string currentDir = File::GetCurrentDir();
wxString path = wxFileSelector(
_T("Select the file to load"),
@ -447,12 +447,12 @@ void CFrame::DoOpen(bool Boot)
bool fileChosen = !path.IsEmpty();
std::string currentDir2 = File::GetCurrentDirectory();
std::string currentDir2 = File::GetCurrentDir();
if (currentDir != currentDir2)
{
PanicAlert("Current dir changed from %s to %s after wxFileSelector!",currentDir.c_str(),currentDir2.c_str());
File::SetCurrentDirectory(currentDir.c_str());
File::SetCurrentDir(currentDir.c_str());
}

View File

@ -330,18 +330,17 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
SetItem(_Index, COLUMN_TITLE, name, -1);
if (CopySJISToString(description, rISOFile.GetDescription(0).c_str()))
SetItem(_Index, COLUMN_NOTES, description, -1);
m_gameList.append(std::string(name.mb_str()) + " (J)\n");
m_gameList.append(StringFromFormat("%s (J)\n", (const char*)name.mb_str(wxConvUTF8)));
break;
case DiscIO::IVolume::COUNTRY_USA:
if (CopySJISToString(name, rISOFile.GetName(0).c_str()))
SetItem(_Index, COLUMN_TITLE, name, -1);
if (CopySJISToString(description, rISOFile.GetDescription(0).c_str()))
SetItem(_Index, COLUMN_NOTES, description, -1);
m_gameList.append(std::string(name.mb_str()) + " (U)\n");
m_gameList.append(StringFromFormat("%s (U)\n", (const char*)name.mb_str(wxConvUTF8)));
break;
default:
m_gameList.append(std::string(
wxString::From8BitData(rISOFile.GetName((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()).mb_str()) + " (E)\n");
m_gameList.append(StringFromFormat("%s (E)\n", rISOFile.GetName((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()));
SetItem(_Index, COLUMN_TITLE,
wxString::From8BitData(rISOFile.GetName((int)SConfig::GetInstance().m_InterfaceLanguage).c_str()), -1);
SetItem(_Index, COLUMN_NOTES,
@ -1081,6 +1080,11 @@ bool CGameListCtrl::CopySJISToString( wxString& _rDestination, const char* _src
_src, (int)strlen(_src),
(LPWSTR)pUnicodeStrBuffer, unicodeNameSize))
{
#ifdef _UNICODE
_rDestination = (LPWSTR)pUnicodeStrBuffer;
returnCode = true;
#else
u32 ansiNameSize = WideCharToMultiByte(CP_ACP, 0,
(LPCWSTR)pUnicodeStrBuffer, unicodeNameSize,
NULL, NULL, NULL, NULL);
@ -1100,6 +1104,7 @@ bool CGameListCtrl::CopySJISToString( wxString& _rDestination, const char* _src
delete pAnsiStrBuffer;
}
}
#endif
}
delete pUnicodeStrBuffer;
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -23,6 +23,7 @@
#include "PatchAddEdit.h"
#include "ARCodeAddEdit.h"
#include "ConfigManager.h"
#include "StringUtil.h"
struct WiiPartition
{
@ -190,7 +191,9 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
wxString name;
CopySJISToString(name, OpenGameListItem->GetName(0).c_str());
SetTitle(wxString::Format(_("%s%s: %s - %s"), filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str(), name.c_str()));
SetTitle(wxString::Format(wxT("%s%s"),
wxString::FromAscii(StringFromFormat("%s%s: %s - ", filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str()).c_str()),
name.c_str()).c_str());
}
CISOProperties::~CISOProperties()
@ -792,7 +795,7 @@ bool CISOProperties::SaveGameConfig()
else
GameIni.Set("EmuState", "EmulationStateId", EmuState->GetSelection());
GameIni.Set("EmuState", "EmulationIssues", EmuIssues->GetValue());
GameIni.Set("EmuState", "EmulationIssues", (const char*)EmuIssues->GetValue().mb_str(wxConvUTF8));
PatchList_Save();
ActionReplayList_Save();
@ -1032,6 +1035,10 @@ bool CISOProperties::CopySJISToString( wxString& _rDestination, const char* _src
_src, (int)strlen(_src),
(LPWSTR)pUnicodeStrBuffer, unicodeNameSize))
{
#ifdef _UNICODE
_rDestination = (LPWSTR)pUnicodeStrBuffer;
returnCode = true;
#else
u32 ansiNameSize = WideCharToMultiByte(CP_ACP, 0,
(LPCWSTR)pUnicodeStrBuffer, unicodeNameSize,
NULL, NULL, NULL, NULL);
@ -1051,6 +1058,7 @@ bool CISOProperties::CopySJISToString( wxString& _rDestination, const char* _src
delete pAnsiStrBuffer;
}
}
#endif
}
delete pUnicodeStrBuffer;
}

View File

@ -241,7 +241,7 @@ void CMemcardManager::CreateGUIControls()
sPages[slot]->Add(0, 0, 1, wxEXPAND|wxALL, 0);
sPages[slot]->Add(m_NextPage[slot], 0, wxEXPAND|wxALL, 1);
m_MemcardPath[slot] = new wxFilePickerCtrl(this, ID_MEMCARDPATH_A + slot, wxT(FULL_GC_USER_DIR), wxT("Choose a memory card:"),
m_MemcardPath[slot] = new wxFilePickerCtrl(this, ID_MEMCARDPATH_A + slot, T_FULL_GC_USER_DIR, wxT("Choose a memory card:"),
wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp"), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN);
m_MemcardList[slot] = new CMemcardListCtrl(this, ID_MEMCARDLIST_A + slot, wxDefaultPosition, wxSize(350,400),
@ -553,13 +553,13 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
slot = SLOT_A;
case ID_SAVEIMPORT_B:
{
wxString temp = wxFileSelector(_T("Select a save file to import"),
wxString temp = wxFileSelector(wxT("Select a save file to import"),
(strcmp(DefaultIOPath.c_str(), "/Users/GC") == 0) ? wxString::FromAscii(""): wxString::FromAscii(DefaultIOPath.c_str()), wxEmptyString, wxEmptyString, wxString::Format
(
_T("Gamecube save files(*.gci,*.gcs,*.sav)|*.gci;*.gcs;*.sav|"
"Native GCI files (*.gci)|*.gci|"
"MadCatz Gameshark files(*.gcs)|*.gcs|"
"Datel MaxDrive/Pro files(*.sav)|*.sav"),
wxT("Gamecube save files(*.gci,*.gcs,*.sav)|*.gci;*.gcs;*.sav|")
wxT("Native GCI files (*.gci)|*.gci|")
wxT("MadCatz Gameshark files(*.gcs)|*.gcs|")
wxT("Datel MaxDrive/Pro files(*.sav)|*.sav"),
wxFileSelectorDefaultWildcardStr,
wxFileSelectorDefaultWildcardStr
),
@ -567,10 +567,10 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
const char * fileName = temp.ToAscii();
if (!temp.empty() && !fileName2.empty())
{
wxString temp2 = wxFileSelector(_T("Save GCI as.."),
wxEmptyString, wxEmptyString, _T(".gci"), wxString::Format
wxString temp2 = wxFileSelector(wxT("Save GCI as.."),
wxEmptyString, wxEmptyString, wxT(".gci"), wxString::Format
(
_T("GCI File(*.gci)|*.gci"),
wxT("GCI File(*.gci)|*.gci"),
wxFileSelectorDefaultWildcardStr,
wxFileSelectorDefaultWildcardStr
),
@ -595,12 +595,12 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
memoryCard[slot]->DEntry_GameCode(index,tempC);
memoryCard[slot]->DEntry_FileName(index,tempC2);
sprintf(tempC, "%s_%s.gci", tempC, tempC2);
wxString temp = wxFileSelector(_T("Export save as.."), wxString::FromAscii(DefaultIOPath.c_str()),
wxString::FromAscii(tempC), _T(".gci"), wxString::Format
wxString temp = wxFileSelector(wxT("Export save as.."), wxString::FromAscii(DefaultIOPath.c_str()),
wxString::FromAscii(tempC), wxT(".gci"), wxString::Format
(
_T("Native GCI files (*.gci)|*.gci|"
"MadCatz Gameshark files(*.gcs)|*.gcs|"
"Datel MaxDrive/Pro files(*.sav)|*.sav"),
wxT("Native GCI files (*.gci)|*.gci|")
wxT("MadCatz Gameshark files(*.gcs)|*.gcs|")
wxT("Datel MaxDrive/Pro files(*.sav)|*.sav"),
wxFileSelectorDefaultWildcardStr,
wxFileSelectorDefaultWildcardStr
),

View File

@ -55,8 +55,8 @@ void NetPlay::OnNetEvent(wxCommandEvent& event)
else
{
m_numClients--;
AppendText( wxString::Format(wxT("ERROR : Network Error !\n"
"*Player : %s has been dropped from the game.\n\n"),
AppendText( wxString::Format(wxT("ERROR : Network Error !\n")
wxT("*Player : %s has been dropped from the game.\n\n"),
(const char *)event.GetString().mb_str()) );
}
}
@ -154,8 +154,8 @@ void NetPlay::LoadGame()
// Sleep a bit to start the game at more or less the same time than the peer
wxMilliSleep(fping/2);
m_Logging->AppendText(wxString::Format(wxT("** Everyone is ready... Loading Game ! **\n"
"** Ping to client(s) is : %f ms\n"), fping));
m_Logging->AppendText(wxString::Format(wxT("** Everyone is ready... Loading Game ! **\n")
wxT("** Ping to client(s) is : %f ms\n"), fping));
}
else
m_Logging->AppendText(_("** Everyone is ready... Loading Game ! **\n"));
@ -200,9 +200,7 @@ bool NetPlay::GetNetPads(u8 padnb, SPADStatus PadStatus, u32 *netValues)
{
if (m_numClients < 1)
{
m_Logging->AppendText(_("** WARNING : "
"Ping too high (>2000ms) or connection lost ! \n"
"** WARNING : Stopping Netplay... \n"));
m_Logging->AppendText(_("** WARNING : Ping too high (>2000ms) or connection lost ! \n** WARNING : Stopping Netplay... \n"));
NetClass_ptr = NULL;
return false;
}
@ -302,9 +300,7 @@ bool NetPlay::GetNetPads(u8 padnb, SPADStatus PadStatus, u32 *netValues)
else {
if (m_loopframe > 126)
{
m_Logging->AppendText(_("** WARNING : "
"Ping too high (>2000ms) or connection lost ! \n"
"** WARNING : Stopping Netplay... \n"));
m_Logging->AppendText(_("** WARNING : Ping too high (>2000ms) or connection lost ! \n** WARNING : Stopping Netplay... \n"));
NetClass_ptr = NULL;
}

View File

@ -414,8 +414,7 @@ void *ClientSide::Entry()
}
else
{
Event->AppendText(_("UDP Connection FAILED !\n"
"ERROR : Unable to establish UDP Connection, please Check UDP Port forwarding !"));
Event->AppendText(_("UDP Connection FAILED !\nERROR : Unable to establish UDP Connection, please Check UDP Port forwarding !"));
m_socket.Close();
Event->SendEvent(HOST_ERROR);
return NULL;

View File

@ -143,8 +143,8 @@ void NetPlay::OnHost(wxCommandEvent& WXUNUSED(event))
// Create the GUI
m_isHosting = true;
DrawNetWindow();
m_Logging->AppendText(wxString::Format(wxT("WARNING : Hosting requires port to be forwarded in firewall!\n"
"*Creation Successful on port %d : Waiting for peers...\n"), m_port));
m_Logging->AppendText(wxString::Format(wxT("WARNING : Hosting requires port to be forwarded in firewall!\n")
wxT("*Creation Successful on port %d : Waiting for peers...\n"), m_port));
}
else
{