summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorSoren Jorvang <soren.jorvang@gmail.com>2010-06-11 08:39:03 +0000
committerSoren Jorvang <soren.jorvang@gmail.com>2010-06-11 08:39:03 +0000
commitb7c2e523b35bca5ba0a4a361780a58aa74552bbc (patch)
tree9550c71d7b45a1ccc149f74d9494eca594937121 /Source/Core
parent0b00faa378451721301d4b0741fc754b7b281c1d (diff)
Treat strings from external sources as 8-bit so FromAscii doesn't barf.
Ideally we should be more character set aware, but at the moment we use anonymous 7/8-bit strings in too many places. Fix use of AddGrowable{Col,Row}. Any (non-zero) rows/columns must have been created first by adding an item to it. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5648 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp4
-rw-r--r--Source/Core/DolphinWX/Src/ConfigMain.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/ISOProperties.cpp59
-rw-r--r--Source/Core/DolphinWX/Src/Main.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/MemcardManager.cpp10
-rw-r--r--Source/Core/DolphinWX/Src/NetWindow.cpp2
-rw-r--r--Source/Core/DolphinWX/Src/PatchAddEdit.cpp2
7 files changed, 40 insertions, 41 deletions
diff --git a/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp b/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp
index 8d04fe8b56..146324b1f4 100644
--- a/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp
+++ b/Source/Core/DolphinWX/Src/ARCodeAddEdit.cpp
@@ -68,12 +68,12 @@ void CARCodeAddEdit::CreateGUIControls(int _selection)
wxButton* bOK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxButton* bCancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
- sgEntry->AddGrowableCol(1);
- sgEntry->AddGrowableRow(1);
sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER|wxALL, 5);
sgEntry->Add(EditCheatName, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(2, 1), wxEXPAND|wxALL, 5);
sgEntry->Add(EditCheatCode, wxGBPosition(1, 0), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
+ sgEntry->AddGrowableCol(1);
+ sgEntry->AddGrowableRow(1);
sbEntry->Add(sgEntry, 1, wxEXPAND|wxALL);
sEditCheatButtons->AddStretchSpacer();
diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp
index 1f746917d5..07dd66bf1b 100644
--- a/Source/Core/DolphinWX/Src/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp
@@ -938,7 +938,7 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
{
std::string filename = std::string(wxFileSelector(
wxT("Choose a file to open"),
- wxString::FromAscii(File::GetUserPath(D_GCUSER_IDX)),
+ wxString::From8BitData(File::GetUserPath(D_GCUSER_IDX)),
isSlotA ? wxT(GC_MEMCARDA) : wxT(GC_MEMCARDB),
wxEmptyString,
wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp")).mb_str());
diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp
index 0e2cd3d0fb..41c6734b94 100644
--- a/Source/Core/DolphinWX/Src/ISOProperties.cpp
+++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp
@@ -126,7 +126,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
if (GameIni.Load(GameIniFile.c_str()))
LoadGameConfig();
else
- wxMessageBox(wxString::Format(_("Could not create %s"), wxString::FromAscii(GameIniFile.c_str()).c_str()), _("Error"), wxOK|wxICON_ERROR, this);
+ wxMessageBox(wxString::Format(_("Could not create %s"), wxString::From8BitData(GameIniFile.c_str()).c_str()), _("Error"), wxOK|wxICON_ERROR, this);
}
// Disk header and apploader
@@ -168,9 +168,9 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
m_Country->SetValue(wxT("UNKNOWN"));
break;
}
- wxString temp = _T("0x") + wxString::FromAscii(OpenISO->GetMakerID().c_str());
+ wxString temp = _T("0x") + wxString::From8BitData(OpenISO->GetMakerID().c_str());
m_MakerID->SetValue(temp);
- m_Date->SetValue(wxString::FromAscii(OpenISO->GetApploaderDate().c_str()));
+ m_Date->SetValue(wxString::From8BitData(OpenISO->GetApploaderDate().c_str()));
m_FST->SetValue(wxString::Format(_T("%u"), OpenISO->GetFSTSize()));
// Here we set all the info to be shown (be it SJIS or Ascii) + we set the window title
@@ -239,12 +239,12 @@ size_t CISOProperties::CreateDirectoryTree(wxTreeItemId& parent,
// check next index
if (rFileInfo->IsDirectory())
{
- wxTreeItemId item = m_Treectrl->AppendItem(parent, wxString::FromAscii(itemName), 1, 1);
+ wxTreeItemId item = m_Treectrl->AppendItem(parent, wxString::From8BitData(itemName), 1, 1);
CurrentIndex = CreateDirectoryTree(item, fileInfos, CurrentIndex + 1, (size_t)rFileInfo->m_FileSize);
}
else
{
- m_Treectrl->AppendItem(parent, wxString::FromAscii(itemName), 2, 2);
+ m_Treectrl->AppendItem(parent, wxString::From8BitData(itemName), 2, 2);
CurrentIndex++;
}
}
@@ -409,10 +409,6 @@ void CISOProperties::CreateGUIControls(bool IsWad)
sCheatPage->Layout();
- // ISO Details
- sbISODetails = new wxStaticBoxSizer(wxVERTICAL, m_Information, _("ISO Details"));
- sISODetails = new wxGridBagSizer(0, 0);
- // XXX sISODetails->AddGrowableCol(0);
m_NameText = new wxStaticText(m_Information, ID_NAME_TEXT, _("Name:"), wxDefaultPosition, wxDefaultSize);
m_Name = new wxTextCtrl(m_Information, ID_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
m_GameIDText = new wxStaticText(m_Information, ID_GAMEID_TEXT, _("Game ID:"), wxDefaultPosition, wxDefaultSize);
@@ -426,10 +422,6 @@ void CISOProperties::CreateGUIControls(bool IsWad)
m_FSTText = new wxStaticText(m_Information, ID_FST_TEXT, _("FST Size:"), wxDefaultPosition, wxDefaultSize);
m_FST = new wxTextCtrl(m_Information, ID_FST, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
- // Banner Details
- sbBannerDetails = new wxStaticBoxSizer(wxVERTICAL, m_Information, _("Banner Details"));
- sBannerDetails = new wxGridBagSizer(0, 0);
- // XXX sBannerDetails->AddGrowableCol(1); sBannerDetails->AddGrowableCol(2); sBannerDetails->AddGrowableCol(3);
m_LangText = new wxStaticText(m_Information, ID_LANG_TEXT, _("Show Language:"), wxDefaultPosition, wxDefaultSize);
arrayStringFor_Lang.Add(_("English"));
arrayStringFor_Lang.Add(_("German"));
@@ -448,8 +440,8 @@ void CISOProperties::CreateGUIControls(bool IsWad)
m_BannerText = new wxStaticText(m_Information, ID_BANNER_TEXT, _("Banner:"), wxDefaultPosition, wxDefaultSize);
m_Banner = new wxStaticBitmap(m_Information, ID_BANNER, wxNullBitmap, wxDefaultPosition, wxSize(96, 32), 0);
- wxBoxSizer* sInfoPage;
- sInfoPage = new wxBoxSizer(wxVERTICAL);
+ // ISO Details
+ sISODetails = new wxGridBagSizer(0, 0);
sISODetails->Add(m_NameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sISODetails->Add(m_Name, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sISODetails->Add(m_GameIDText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
@@ -462,8 +454,12 @@ void CISOProperties::CreateGUIControls(bool IsWad)
sISODetails->Add(m_Date, wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sISODetails->Add(m_FSTText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sISODetails->Add(m_FST, wxGBPosition(5, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
+ sISODetails->AddGrowableCol(0);
+ sbISODetails = new wxStaticBoxSizer(wxVERTICAL, m_Information, _("ISO Details"));
sbISODetails->Add(sISODetails, 0, wxEXPAND, 5);
+ // Banner Details
+ sBannerDetails = new wxGridBagSizer(0, 0);
sBannerDetails->Add(m_LangText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_Lang, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_ShortText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
@@ -474,19 +470,22 @@ void CISOProperties::CreateGUIControls(bool IsWad)
sBannerDetails->Add(m_Comment, wxGBPosition(3, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_BannerText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_Banner, wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
- sbBannerDetails->Add(sBannerDetails, 0, wxEXPAND, 0);
+ sBannerDetails->AddGrowableCol(1);
+ sbBannerDetails = new wxStaticBoxSizer(wxVERTICAL, m_Information, _("Banner Details"));
+ sbBannerDetails->Add(sBannerDetails, 0, wxEXPAND, 5);
+
+ wxBoxSizer* sInfoPage;
+ sInfoPage = new wxBoxSizer(wxVERTICAL);
sInfoPage->Add(sbISODetails, 0, wxEXPAND|wxALL, 5);
sInfoPage->Add(sbBannerDetails, 0, wxEXPAND|wxALL, 5);
m_Information->SetSizer(sInfoPage);
sInfoPage->Layout();
// Filesystem icons
- wxIcon iconTemp;
m_iconList = new wxImageList(16, 16);
-
- iconTemp.CopyFromBitmap(wxBitmap(disc_xpm)); m_iconList->Add(iconTemp); // 0
- iconTemp.CopyFromBitmap(wxBitmap(folder_xpm)); m_iconList->Add(iconTemp); // 1
- iconTemp.CopyFromBitmap(wxBitmap(file_xpm)); m_iconList->Add(iconTemp); // 2
+ m_iconList->Add(wxBitmap(disc_xpm), wxNullBitmap); // 0
+ m_iconList->Add(wxBitmap(folder_xpm), wxNullBitmap); // 1
+ m_iconList->Add(wxBitmap(file_xpm), wxNullBitmap); // 2
// Filesystem tree
m_Treectrl = new wxTreeCtrl(m_Filesystem, ID_TREECTRL, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE, wxDefaultValidator);
@@ -509,7 +508,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(m_Notebook, 1, wxEXPAND|wxALL, 5);
sMain->Add(sButtons, 0, wxEXPAND, 5);
- sMain->SetMinSize(wxSize(400,500));
+ sMain->SetMinSize(wxSize(400, 600));
SetSizerAndFit(sMain);
}
@@ -946,7 +945,7 @@ bool CISOProperties::SaveGameConfig()
void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED (event))
{
- if (wxFileExists(wxString::FromAscii(GameIniFile.c_str())))
+ if (wxFileExists(wxString::From8BitData(GameIniFile.c_str())))
{
SaveGameConfig();
@@ -961,7 +960,7 @@ void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED (event))
}
}
wxString OpenCommand;
- OpenCommand = filetype->GetOpenCommand(wxString::FromAscii(GameIniFile.c_str()));
+ OpenCommand = filetype->GetOpenCommand(wxString::From8BitData(GameIniFile.c_str()));
if(OpenCommand.IsEmpty())
PanicAlert("Couldn't find open command for extension 'ini'!");
else
@@ -1124,7 +1123,7 @@ void CISOProperties::ActionReplayButtonClicked(wxCommandEvent& event)
CARCodeAddEdit dlg(-1, this, 1, _("Add ActionReplay Code"));
if (dlg.ShowModal() == wxID_OK)
{
- Cheats->Append(wxString::FromAscii(arCodes.back().name.c_str()));
+ Cheats->Append(wxString::From8BitData(arCodes.back().name.c_str()));
Cheats->Check((unsigned int)(arCodes.size() - 1), arCodes.back().active);
}
}
@@ -1174,19 +1173,19 @@ void CISOProperties::ChangeBannerDetails(int lang)
wxString(StringFromFormat("%s%s: %s - ", filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str()).c_str(), *wxConvCurrent).c_str(),
name.c_str()));
}
- else // Do the same for PAL/US Games using Ascii
+ else // Do the same for PAL/US Games (assuming ISO 8859-1)
{
- wxString name = wxString::FromAscii(OpenGameListItem->GetName(lang).c_str());
+ wxString name = wxString::From8BitData(OpenGameListItem->GetName(lang).c_str());
m_ShortName->SetValue(name);
- m_Comment->SetValue(wxString::FromAscii(OpenGameListItem->GetDescription(lang).c_str()));
- m_Maker->SetValue(wxString::FromAscii(OpenGameListItem->GetCompany().c_str()));//dev too
+ m_Comment->SetValue(wxString::From8BitData(OpenGameListItem->GetDescription(lang).c_str()));
+ m_Maker->SetValue(wxString::From8BitData(OpenGameListItem->GetCompany().c_str()));//dev too
std::string filename, extension;
SplitPath(OpenGameListItem->GetFileName(), 0, &filename, &extension);
SetTitle(wxString::Format(wxT("%s%s"),
- wxString::FromAscii(StringFromFormat("%s%s: %s - ", filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str()).c_str()).c_str(),
+ wxString::From8BitData(StringFromFormat("%s%s: %s - ", filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str()).c_str()).c_str(),
name.c_str()));
}
}
diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp
index 09c629b678..4f76194237 100644
--- a/Source/Core/DolphinWX/Src/Main.cpp
+++ b/Source/Core/DolphinWX/Src/Main.cpp
@@ -293,7 +293,7 @@ bool DolphinApp::OnInit()
tmpChar = new char[len];
fread(tmpChar, len, 1, workingDir);
fclose(workingDir);
- if (!wxSetWorkingDirectory(wxString::FromAscii(tmpChar)))
+ if (!wxSetWorkingDirectory(wxString::From8BitData(tmpChar)))
{
INFO_LOG(CONSOLE, "set working directory failed");
}
diff --git a/Source/Core/DolphinWX/Src/MemcardManager.cpp b/Source/Core/DolphinWX/Src/MemcardManager.cpp
index c5833bba61..898d843c0a 100644
--- a/Source/Core/DolphinWX/Src/MemcardManager.cpp
+++ b/Source/Core/DolphinWX/Src/MemcardManager.cpp
@@ -243,7 +243,7 @@ void CMemcardManager::CreateGUIControls()
sPages[slot]->Add(m_NextPage[slot], 0, wxEXPAND|wxALL, 1);
m_MemcardPath[slot] = new wxFilePickerCtrl(this, ID_MEMCARDPATH_A + slot,
- wxString::FromAscii(File::GetUserPath(D_GCUSER_IDX)), wxT("Choose a memory card:"),
+ wxString::From8BitData(File::GetUserPath(D_GCUSER_IDX)), 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),
@@ -294,7 +294,7 @@ void CMemcardManager::CreateGUIControls()
m_Delete[i]->Disable();
if (strcmp(DefaultMemcard[i].c_str(), "."))
{
- m_MemcardPath[i]->SetPath(wxString::FromAscii(DefaultMemcard[i].c_str()));
+ m_MemcardPath[i]->SetPath(wxString::From8BitData(DefaultMemcard[i].c_str()));
ChangePath(ID_MEMCARDPATH_A + i);
}
}
@@ -557,7 +557,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
case ID_SAVEIMPORT_B:
{
wxString fileName = 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
+ (strcmp(DefaultIOPath.c_str(), "/Users/GC") == 0) ? wxString::FromAscii(""): wxString::From8BitData(DefaultIOPath.c_str()), wxEmptyString, wxEmptyString, wxString::Format
(
wxT("Gamecube save files(*.gci,*.gcs,*.sav)|*.gci;*.gcs;*.sav|")
wxT("Native GCI files (*.gci)|*.gci|")
@@ -597,8 +597,8 @@ 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 fileName = wxFileSelector(wxT("Export save as.."), wxString::FromAscii(DefaultIOPath.c_str()),
- wxString::FromAscii(tempC), wxT(".gci"), wxString::Format
+ wxString fileName = wxFileSelector(wxT("Export save as.."), wxString::From8BitData(DefaultIOPath.c_str()),
+ wxString::From8BitData(tempC), wxT(".gci"), wxString::Format
(
wxT("Native GCI files (*.gci)|*.gci|")
wxT("MadCatz Gameshark files(*.gcs)|*.gcs|")
diff --git a/Source/Core/DolphinWX/Src/NetWindow.cpp b/Source/Core/DolphinWX/Src/NetWindow.cpp
index 49e1ecf9f8..042ca18719 100644
--- a/Source/Core/DolphinWX/Src/NetWindow.cpp
+++ b/Source/Core/DolphinWX/Src/NetWindow.cpp
@@ -48,7 +48,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
std::string nickname;
netplay_section.Get("Nickname", &nickname, "Player");
- m_nickname_text = new wxTextCtrl(panel, wxID_ANY, wxString::FromAscii(nickname.c_str()));
+ m_nickname_text = new wxTextCtrl(panel, wxID_ANY, wxString::From8BitData(nickname.c_str()));
wxBoxSizer* const nick_szr = new wxBoxSizer(wxHORIZONTAL);
nick_szr->Add(nick_lbl, 0, wxCENTER);
diff --git a/Source/Core/DolphinWX/Src/PatchAddEdit.cpp b/Source/Core/DolphinWX/Src/PatchAddEdit.cpp
index a8a769218a..d39cf0c3de 100644
--- a/Source/Core/DolphinWX/Src/PatchAddEdit.cpp
+++ b/Source/Core/DolphinWX/Src/PatchAddEdit.cpp
@@ -85,13 +85,13 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, wxString::Format(wxT("Entry 1/%d"), (int)tempEntries.size()));
currentItem = 1;
wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0);
- sgEntry->AddGrowableCol(1);
sgEntry->Add(EditPatchType, wxGBPosition(0, 0), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
sgEntry->Add(EditPatchOffsetText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sgEntry->Add(EditPatchOffset, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sgEntry->Add(EditPatchValueText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sgEntry->Add(EditPatchValue, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(3, 1), wxEXPAND|wxALL, 5);
+ sgEntry->AddGrowableCol(1);
wxBoxSizer* sEntryAddRemove = new wxBoxSizer(wxHORIZONTAL);
sEntryAddRemove->Add(EntryAdd, 0, wxALL, 5);
sEntryAddRemove->Add(EntryRemove, 0, wxALL, 5);