Remove all tab/space mismatches from the DolphinWX project (at least 99%. I promise!)

Also fix up the dangling else's. Shit just looks incredibly ugly in terms of actual structure in the code.

I took the liberty of adding comments in FifoPlayerDlg.cpp, LogConfigWindow.cpp, LogWindow.cpp, and FrameAui.cpp to better explain some things.

If any comments are wrong, don't hesitate to complain.
This commit is contained in:
Lioncash 2013-04-08 01:16:50 -04:00
parent 5b2d9a7d9f
commit 1db10b139c
36 changed files with 584 additions and 295 deletions

View File

@ -170,8 +170,12 @@ void CARCodeAddEdit::UpdateTextCtrl(ActionReplay::ARCode arCode)
EditCheatCode->Clear(); EditCheatCode->Clear();
if (arCode.name != "") if (arCode.name != "")
{
for (u32 i = 0; i < arCode.ops.size(); i++) for (u32 i = 0; i < arCode.ops.size(); i++)
EditCheatCode->AppendText(wxString::Format(wxT("%08X %08X\n"), arCode.ops.at(i).cmd_addr, arCode.ops.at(i).value)); EditCheatCode->AppendText(wxString::Format(wxT("%08X %08X\n"), arCode.ops.at(i).cmd_addr, arCode.ops.at(i).value));
}
else else
{
EditCheatCode->SetValue(_("Insert Encrypted or Decrypted code here...")); EditCheatCode->SetValue(_("Insert Encrypted or Decrypted code here..."));
} }
}

View File

@ -298,6 +298,7 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (e
sprintf(numcodes, "Number of Codes: %lu", (unsigned long)code.ops.size()); sprintf(numcodes, "Number of Codes: %lu", (unsigned long)code.ops.size());
m_Label_NumCodes->SetLabel(StrToWxStr(numcodes)); m_Label_NumCodes->SetLabel(StrToWxStr(numcodes));
m_ListBox_CodesList->Clear(); m_ListBox_CodesList->Clear();
for (size_t j = 0; j < code.ops.size(); j++) for (size_t j = 0; j < code.ops.size(); j++)
{ {
char text2[CHAR_MAX]; char text2[CHAR_MAX];
@ -332,7 +333,7 @@ void wxCheatsWindow::OnEvent_ApplyChanges_Press(wxCommandEvent& ev)
// Apply Gecko Code changes // Apply Gecko Code changes
Gecko::SetActiveCodes(m_geckocode_panel->GetCodes()); Gecko::SetActiveCodes(m_geckocode_panel->GetCodes());
// save gameini, with changed gecko codes // Save gameini, with changed gecko codes
if (m_gameini_path.size()) if (m_gameini_path.size())
{ {
Gecko::SaveCodes(m_gameini, m_geckocode_panel->GetCodes()); Gecko::SaveCodes(m_gameini, m_geckocode_panel->GetCodes());
@ -409,7 +410,7 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
filtered_results.reserve(search_results.size()); filtered_results.reserve(search_results.size());
// determine the selected filter // Determine the selected filter
// 1 : equal // 1 : equal
// 2 : greater-than // 2 : greater-than
// 4 : less-than // 4 : less-than

View File

@ -1235,7 +1235,9 @@ void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event)
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
{ {
if (ISOPaths->FindString(dialog.GetPath()) != -1) if (ISOPaths->FindString(dialog.GetPath()) != -1)
{
wxMessageBox(_("The chosen directory is already in the list"), _("Error"), wxOK); wxMessageBox(_("The chosen directory is already in the list"), _("Error"), wxOK);
}
else else
{ {
bRefreshList = true; bRefreshList = true;

View File

@ -50,7 +50,9 @@ void BreakPointDlg::OnOK(wxCommandEvent& event)
Close(); Close();
} }
else else
{
PanicAlert("The address %s is invalid.", WxStrToStr(AddressString).c_str()); PanicAlert("The address %s is invalid.", WxStrToStr(AddressString).c_str());
}
event.Skip(); event.Skip();
} }

View File

@ -104,7 +104,9 @@ void CCodeView::OnMouseDown(wxMouseEvent& event)
Refresh(); Refresh();
} }
else else
{
ToggleBreakpoint(YToAddress(y)); ToggleBreakpoint(YToAddress(y));
}
event.Skip(true); event.Skip(true);
} }
@ -133,8 +135,10 @@ void CCodeView::OnMouseMove(wxMouseEvent& event)
Refresh(); Refresh();
} }
else else
{
OnMouseDown(event); OnMouseDown(event);
} }
}
event.Skip(true); event.Skip(true);
} }
@ -180,7 +184,10 @@ void CCodeView::InsertBlrNop(int Blr)
for(u32 i = 0; i < BlrList.size(); i++) for(u32 i = 0; i < BlrList.size(); i++)
{ {
if(BlrList.at(i).Address == selection) if(BlrList.at(i).Address == selection)
{ find = i; break; } {
find = i;
break;
}
} }
// Save the old value // Save the old value
@ -507,7 +514,8 @@ void CCodeView::OnPaint(wxPaintEvent& event)
strcpy(desc, debugger->getDescription(address).c_str()); strcpy(desc, debugger->getDescription(address).c_str());
} }
if (!plain) { if (!plain)
{
dc.SetTextForeground(_T("#0000FF")); // blue dc.SetTextForeground(_T("#0000FF")); // blue
//char temp[256]; //char temp[256];

View File

@ -283,7 +283,9 @@ void CCodeWindow::StepOver()
Update(); Update();
} }
else else
{
SingleStep(); SingleStep();
}
UpdateButtonStates(); UpdateButtonStates();
// Update all toolbars in the aui manager // Update all toolbars in the aui manager
@ -307,6 +309,7 @@ void CCodeWindow::UpdateLists()
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(addr); Symbol *symbol = g_symbolDB.GetSymbolFromAddr(addr);
if (!symbol) if (!symbol)
return; return;
for (int i = 0; i < (int)symbol->callers.size(); i++) for (int i = 0; i < (int)symbol->callers.size(); i++)
{ {
u32 caller_addr = symbol->callers[i].callAddress; u32 caller_addr = symbol->callers[i].callAddress;
@ -354,8 +357,7 @@ void CCodeWindow::UpdateCallstack()
} }
// Create CPU Mode menus // Create CPU Mode menus
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar)
wxMenuBar *pMenuBar)
{ {
// CPU Mode // CPU Mode
wxMenu* pCoreMenu = new wxMenu; wxMenu* pCoreMenu = new wxMenu;

View File

@ -79,6 +79,7 @@ void GFXDebuggerPanel::SaveSettings() const
// TODO: make this work when we close the entire program too, currently on total close we get // TODO: make this work when we close the entire program too, currently on total close we get
// weird values, perhaps because of some conflict with the rendering window // weird values, perhaps because of some conflict with the rendering window
//
// TODO: get the screen resolution and make limits from that // TODO: get the screen resolution and make limits from that
if (GetPosition().x < 1000 && GetPosition().y < 1000 if (GetPosition().x < 1000 && GetPosition().y < 1000
&& GetSize().GetWidth() < 1000 && GetSize().GetWidth() < 1000

View File

@ -107,19 +107,24 @@ void CJitWindow::Compare(u32 em_address)
int block_num = jit->GetBlockCache()->GetBlockNumberFromStartAddress(em_address); int block_num = jit->GetBlockCache()->GetBlockNumberFromStartAddress(em_address);
if (block_num < 0) if (block_num < 0)
{ {
for (int i = 0; i < 500; i++) { for (int i = 0; i < 500; i++)
{
block_num = jit->GetBlockCache()->GetBlockNumberFromStartAddress(em_address - 4 * i); block_num = jit->GetBlockCache()->GetBlockNumberFromStartAddress(em_address - 4 * i);
if (block_num >= 0) if (block_num >= 0)
break; break;
} }
if (block_num >= 0) {
if (block_num >= 0)
{
JitBlock *block = jit->GetBlockCache()->GetBlock(block_num); JitBlock *block = jit->GetBlockCache()->GetBlock(block_num);
if (!(block->originalAddress <= em_address && if (!(block->originalAddress <= em_address &&
block->originalSize + block->originalAddress >= em_address)) block->originalSize + block->originalAddress >= em_address))
block_num = -1; block_num = -1;
} }
// Do not merge this "if" with the above - block_num changes inside it. // Do not merge this "if" with the above - block_num changes inside it.
if (block_num < 0) { if (block_num < 0)
{
ppc_box->SetValue(StrToWxStr(StringFromFormat("(non-code address: %08x)", ppc_box->SetValue(StrToWxStr(StringFromFormat("(non-code address: %08x)",
em_address))); em_address)));
x86_box->SetValue(StrToWxStr(StringFromFormat("(no translation)"))); x86_box->SetValue(StrToWxStr(StringFromFormat("(no translation)")));
@ -191,7 +196,9 @@ void CJitWindow::Compare(u32 em_address)
size * 4, block->codeSize, 100 * (block->codeSize / (4 * size) - 1)); size * 4, block->codeSize, 100 * (block->codeSize / (4 * size) - 1));
ppc_box->SetValue(StrToWxStr((char*)xDis)); ppc_box->SetValue(StrToWxStr((char*)xDis));
} else { }
else
{
ppc_box->SetValue(StrToWxStr(StringFromFormat( ppc_box->SetValue(StrToWxStr(StringFromFormat(
"(non-code address: %08x)", em_address))); "(non-code address: %08x)", em_address)));
x86_box->SetValue("---"); x86_box->SetValue("---");

View File

@ -359,7 +359,9 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
curAddress += 32; curAddress += 32;
} }
else else
{
sprintf(dis, "INVALID VIEWAS TYPE"); sprintf(dis, "INVALID VIEWAS TYPE");
}
char desc[256] = ""; char desc[256] = "";
if (viewAsType != VIEWAS_HEX) if (viewAsType != VIEWAS_HEX)

View File

@ -368,7 +368,9 @@ void CMemoryWindow::onSearch(wxCommandEvent& event)
i += 1; i += 1;
} }
delete[] tmpstr; delete[] tmpstr;
} else { }
else
{
//Looking for an ascii string //Looking for an ascii string
size = rawData.size(); size = rawData.size();
Dest.resize(size+1); Dest.resize(size+1);

View File

@ -31,8 +31,10 @@ static const char *special_reg_names[] = {
"PC", "LR", "CTR", "CR", "FPSCR", "MSR", "SRR0", "SRR1", "Exceptions", "Int Mask", "Int Cause", "PC", "LR", "CTR", "CR", "FPSCR", "MSR", "SRR0", "SRR1", "Exceptions", "Int Mask", "Int Cause",
}; };
static u32 GetSpecialRegValue(int reg) { static u32 GetSpecialRegValue(int reg)
switch (reg) { {
switch (reg)
{
case 0: return PowerPC::ppcState.pc; case 0: return PowerPC::ppcState.pc;
case 1: return PowerPC::ppcState.spr[SPR_LR]; case 1: return PowerPC::ppcState.spr[SPR_LR];
case 2: return PowerPC::ppcState.spr[SPR_CTR]; case 2: return PowerPC::ppcState.spr[SPR_CTR];
@ -50,8 +52,10 @@ static u32 GetSpecialRegValue(int reg) {
wxString CRegTable::GetValue(int row, int col) wxString CRegTable::GetValue(int row, int col)
{ {
if (row < 32) { if (row < 32)
switch (col) { {
switch (col)
{
case 0: return StrToWxStr(GetGPRName(row)); case 0: return StrToWxStr(GetGPRName(row));
case 1: return wxString::Format(wxT("%08x"), GPR(row)); case 1: return wxString::Format(wxT("%08x"), GPR(row));
case 2: return StrToWxStr(GetFPRName(row)); case 2: return StrToWxStr(GetFPRName(row));
@ -59,9 +63,13 @@ wxString CRegTable::GetValue(int row, int col)
case 4: return wxString::Format(wxT("%016llx"), riPS1(row)); case 4: return wxString::Format(wxT("%016llx"), riPS1(row));
default: return wxEmptyString; default: return wxEmptyString;
} }
} else { }
if (row - 32 < NUM_SPECIALS) { else
switch (col) { {
if (row - 32 < NUM_SPECIALS)
{
switch (col)
{
case 0: return StrToWxStr(special_reg_names[row - 32]); case 0: return StrToWxStr(special_reg_names[row - 32]);
case 1: return wxString::Format(wxT("%08x"), GetSpecialRegValue(row - 32)); case 1: return wxString::Format(wxT("%08x"), GetSpecialRegValue(row - 32));
default: return wxEmptyString; default: return wxEmptyString;
@ -71,8 +79,10 @@ wxString CRegTable::GetValue(int row, int col)
return wxEmptyString; return wxEmptyString;
} }
static void SetSpecialRegValue(int reg, u32 value) { static void SetSpecialRegValue(int reg, u32 value)
switch (reg) { {
switch (reg)
{
case 0: PowerPC::ppcState.pc = value; break; case 0: PowerPC::ppcState.pc = value; break;
case 1: PowerPC::ppcState.spr[SPR_LR] = value; break; case 1: PowerPC::ppcState.spr[SPR_LR] = value; break;
case 2: PowerPC::ppcState.spr[SPR_CTR] = value; break; case 2: PowerPC::ppcState.spr[SPR_CTR] = value; break;
@ -94,15 +104,19 @@ void CRegTable::SetValue(int row, int col, const wxString& strNewVal)
u32 newVal = 0; u32 newVal = 0;
if (TryParse(WxStrToStr(strNewVal), &newVal)) if (TryParse(WxStrToStr(strNewVal), &newVal))
{ {
if (row < 32) { if (row < 32)
{
if (col == 1) if (col == 1)
GPR(row) = newVal; GPR(row) = newVal;
else if (col == 3) else if (col == 3)
riPS0(row) = newVal; riPS0(row) = newVal;
else if (col == 4) else if (col == 4)
riPS1(row) = newVal; riPS1(row) = newVal;
} else { }
if ((row - 32 < NUM_SPECIALS) && (col == 1)) { else
{
if ((row - 32 < NUM_SPECIALS) && (col == 1))
{
SetSpecialRegValue(row - 32, newVal); SetSpecialRegValue(row - 32, newVal);
} }
} }
@ -135,7 +149,8 @@ wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
attr->SetBackgroundColour(wxColour(wxT("#FFFFFF"))); //wxWHITE attr->SetBackgroundColour(wxColour(wxT("#FFFFFF"))); //wxWHITE
attr->SetFont(DebuggerFont); attr->SetFont(DebuggerFont);
switch (col) { switch (col)
{
case 1: case 1:
attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER); attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
break; break;
@ -149,11 +164,13 @@ wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
} }
bool red = false; bool red = false;
switch (col) { switch (col)
{
case 1: red = row < 32 ? m_CachedRegHasChanged[row] : m_CachedSpecialRegHasChanged[row-32]; break; case 1: red = row < 32 ? m_CachedRegHasChanged[row] : m_CachedSpecialRegHasChanged[row-32]; break;
case 3: case 3:
case 4: red = row < 32 ? m_CachedFRegHasChanged[row][col-3] : false; break; case 4: red = row < 32 ? m_CachedFRegHasChanged[row][col-3] : false; break;
} }
attr->SetTextColour(red ? wxColor(wxT("#FF0000")) : wxColor(wxT("#000000"))); attr->SetTextColour(red ? wxColor(wxT("#FF0000")) : wxColor(wxT("#000000")));
attr->IncRef(); attr->IncRef();
return attr; return attr;

View File

@ -387,18 +387,23 @@ void FifoPlayerDlg::OnCheckEarlyMemoryUpdates(wxCommandEvent& event)
void FifoPlayerDlg::OnSaveFile(wxCommandEvent& WXUNUSED(event)) void FifoPlayerDlg::OnSaveFile(wxCommandEvent& WXUNUSED(event))
{ {
// Pointer to the file data that was created as a result of recording.
FifoDataFile *file = FifoRecorder::GetInstance().GetRecordedFile(); FifoDataFile *file = FifoRecorder::GetInstance().GetRecordedFile();
if (file) if (file)
{ {
// Bring up a save file dialog. The location the user chooses will be assigned to this variable.
wxString path = wxSaveFileSelector(_("Dolphin FIFO"), wxT("dff"), wxEmptyString, this); wxString path = wxSaveFileSelector(_("Dolphin FIFO"), wxT("dff"), wxEmptyString, this);
// Has a valid file path
if (!path.empty()) if (!path.empty())
{ {
// Attempt to save the file to the path the user chose
wxBeginBusyCursor(); wxBeginBusyCursor();
bool result = file->Save(WxStrToStr(path).c_str()); bool result = file->Save(WxStrToStr(path).c_str());
wxEndBusyCursor(); wxEndBusyCursor();
// Wasn't able to save the file, shit's whack, yo.
if (!result) if (!result)
PanicAlert("Error saving file"); PanicAlert("Error saving file");
} }
@ -409,14 +414,21 @@ void FifoPlayerDlg::OnRecordStop(wxCommandEvent& WXUNUSED(event))
{ {
FifoRecorder& recorder = FifoRecorder::GetInstance(); FifoRecorder& recorder = FifoRecorder::GetInstance();
// Recorder is still recording
if (recorder.IsRecording()) if (recorder.IsRecording())
{ {
// Then stop recording
recorder.StopRecording(); recorder.StopRecording();
// and disable the button to stop recording
m_RecordStop->Disable(); m_RecordStop->Disable();
} }
else else // Recorder is actually about to start recording
{ {
// So start recording
recorder.StartRecording(m_FramesToRecord, RecordingFinished); recorder.StartRecording(m_FramesToRecord, RecordingFinished);
// and change the button label accordingly.
m_RecordStop->SetLabel(_("Stop")); m_RecordStop->SetLabel(_("Stop"));
} }
} }
@ -839,10 +851,12 @@ void FifoPlayerDlg::UpdateAnalyzerGui()
if ((int)m_framesList->GetCount() != num_frames) if ((int)m_framesList->GetCount() != num_frames)
{ {
m_framesList->Clear(); m_framesList->Clear();
for (int i = 0; i < num_frames; ++i) for (int i = 0; i < num_frames; ++i)
{ {
m_framesList->Append(wxString::Format(wxT("Frame %i"), i)); m_framesList->Append(wxString::Format(wxT("Frame %i"), i));
} }
wxCommandEvent ev = wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); wxCommandEvent ev = wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
ev.SetInt(-1); ev.SetInt(-1);
OnFrameListSelectionChanged(ev); OnFrameListSelectionChanged(ev);

View File

@ -468,10 +468,13 @@ void CFrame::OnClose(wxCloseEvent& event)
event.Skip(); event.Skip();
// Save GUI settings // Save GUI settings
if (g_pCodeWindow) SaveIniPerspectives(); if (g_pCodeWindow)
// Close the log window now so that its settings are saved {
SaveIniPerspectives();
}
else else
{ {
// Close the log window now so that its settings are saved
m_LogWindow->Close(); m_LogWindow->Close();
m_LogWindow = NULL; m_LogWindow = NULL;
} }
@ -494,8 +497,10 @@ void CFrame::PostEvent(wxCommandEvent& event)
g_pCodeWindow->GetEventHandler()->AddPendingEvent(event); g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
} }
else else
{
event.Skip(); event.Skip();
} }
}
void CFrame::OnMove(wxMoveEvent& event) void CFrame::OnMove(wxMoveEvent& event)
{ {
@ -706,11 +711,15 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
m_GameListCtrl->Update(); m_GameListCtrl->Update();
} }
else if (!m_GameListCtrl->GetISO(0)) else if (!m_GameListCtrl->GetISO(0))
{
m_GameListCtrl->BrowseForDirectory(); m_GameListCtrl->BrowseForDirectory();
}
else else
{
// Game started by double click // Game started by double click
BootGame(std::string("")); BootGame(std::string(""));
} }
}
bool IsHotkey(wxKeyEvent &event, int Id) bool IsHotkey(wxKeyEvent &event, int Id)
{ {
@ -964,8 +973,10 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
} }
} }
else else
{
event.Skip(); event.Skip();
} }
}
void CFrame::OnKeyUp(wxKeyEvent& event) void CFrame::OnKeyUp(wxKeyEvent& event)
{ {
@ -1019,8 +1030,10 @@ void CFrame::DoFullscreen(bool bF)
} }
} }
else else
{
m_RenderFrame->Raise(); m_RenderFrame->Raise();
} }
}
const CGameListCtrl *CFrame::GetGameListCtrl() const const CGameListCtrl *CFrame::GetGameListCtrl() const
{ {

View File

@ -67,11 +67,15 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event)
else else
{ {
if (GetNotebookCount() == 1) if (GetNotebookCount() == 1)
{
wxMessageBox(_("At least one pane must remain open."), wxMessageBox(_("At least one pane must remain open."),
_("Notice"), wxOK, this); _("Notice"), wxOK, this);
}
else if (nb->GetPageCount() != 0 && !nb->GetPageText(0).IsSameAs(wxT("<>"))) else if (nb->GetPageCount() != 0 && !nb->GetPageText(0).IsSameAs(wxT("<>")))
{
wxMessageBox(_("You can't close panes that have pages in them."), wxMessageBox(_("You can't close panes that have pages in them."),
_("Notice"), wxOK, this); _("Notice"), wxOK, this);
}
else else
{ {
// Detach and delete the empty notebook // Detach and delete the empty notebook
@ -92,14 +96,21 @@ void CFrame::ToggleLogWindow(bool bShow)
if (bShow) if (bShow)
{ {
if (!m_LogWindow) m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW); // Create a new log window if it doesn't exist.
if (!m_LogWindow)
{
m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW);
}
m_LogWindow->Enable(); m_LogWindow->Enable();
DoAddPage(m_LogWindow, DoAddPage(m_LogWindow,
g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[0] : 0, g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[0] : 0,
g_pCodeWindow ? bFloatWindow[0] : false); g_pCodeWindow ? bFloatWindow[0] : false);
} }
else else
{ {
// Hiding the log window, so disable it and remove it.
m_LogWindow->Disable(); m_LogWindow->Disable();
DoRemovePage(m_LogWindow, true); DoRemovePage(m_LogWindow, true);
} }
@ -117,6 +128,7 @@ void CFrame::ToggleLogConfigWindow(bool bShow)
{ {
if (!m_LogConfigWindow) if (!m_LogConfigWindow)
m_LogConfigWindow = new LogConfigWindow(this, m_LogWindow, IDM_LOGCONFIGWINDOW); m_LogConfigWindow = new LogConfigWindow(this, m_LogWindow, IDM_LOGCONFIGWINDOW);
const int nbIndex = IDM_LOGCONFIGWINDOW - IDM_LOGWINDOW; const int nbIndex = IDM_LOGCONFIGWINDOW - IDM_LOGWINDOW;
DoAddPage(m_LogConfigWindow, DoAddPage(m_LogConfigWindow,
g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[nbIndex] : 0, g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[nbIndex] : 0,
@ -147,7 +159,9 @@ void CFrame::ToggleConsole(bool bShow)
Console->Open(); Console->Open();
} }
else else
{
ShowWindow(GetConsoleWindow(), SW_SHOW); ShowWindow(GetConsoleWindow(), SW_SHOW);
}
// Create the parent window if it doesn't exist // Create the parent window if it doesn't exist
wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW); wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW);
@ -248,7 +262,9 @@ void CFrame::ClosePages()
void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event) void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event)
{ {
event.Skip(); event.Skip();
if (!g_pCodeWindow) return;
if (!g_pCodeWindow)
return;
// Remove the blank page if any // Remove the blank page if any
AddRemoveBlankPage(); AddRemoveBlankPage();
@ -364,6 +380,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
MenuPopup->Append(Item); MenuPopup->Append(Item);
Item->Enable(false); Item->Enable(false);
MenuPopup->Append(new wxMenuItem(MenuPopup)); MenuPopup->Append(new wxMenuItem(MenuPopup));
for (int i = IDM_LOGWINDOW; i <= IDM_CODEWINDOW; i++) for (int i = IDM_LOGWINDOW; i <= IDM_CODEWINDOW; i++)
{ {
wxWindow *Win = FindWindowById(i); wxWindow *Win = FindWindowById(i);
@ -379,6 +396,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
// Line up our menu with the cursor // Line up our menu with the cursor
wxPoint Pt = ::wxGetMousePosition(); wxPoint Pt = ::wxGetMousePosition();
Pt = ScreenToClient(Pt); Pt = ScreenToClient(Pt);
// Show // Show
PopupMenu(MenuPopup, Pt); PopupMenu(MenuPopup, Pt);
} }
@ -425,6 +443,7 @@ void CFrame::TogglePane()
if (m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
} }
if (NB) if (NB)
{ {
if (NB->GetPageCount() == 0) if (NB->GetPageCount() == 0)
@ -433,9 +452,11 @@ void CFrame::TogglePane()
m_Mgr->Update(); m_Mgr->Update();
} }
else else
{
ShowResizePane(); ShowResizePane();
} }
} }
}
void CFrame::DoRemovePage(wxWindow *Win, bool bHide) void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
{ {
@ -452,7 +473,10 @@ void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
Win->Reparent(this); Win->Reparent(this);
} }
else else
{
Win->Destroy(); Win->Destroy();
}
Parent->Destroy(); Parent->Destroy();
} }
else else
@ -469,10 +493,13 @@ void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
Win->Reparent(this); Win->Reparent(this);
} }
else else
{
Win->Destroy(); Win->Destroy();
} }
} }
} }
}
if (g_pCodeWindow) if (g_pCodeWindow)
AddRemoveBlankPage(); AddRemoveBlankPage();
} }
@ -480,8 +507,15 @@ void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
void CFrame::DoAddPage(wxWindow *Win, int i, bool Float) void CFrame::DoAddPage(wxWindow *Win, int i, bool Float)
{ {
if (!Win) return; if (!Win) return;
if (i < 0 || i > GetNotebookCount()-1) i = 0;
if (Win && GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return; // Ensure accessor remains within valid bounds.
if (i < 0 || i > GetNotebookCount()-1)
i = 0;
// The page was already previously added, no need to add it again.
if (Win && GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND)
return;
if (!Float) if (!Float)
GetNotebookFromId(i)->AddPage(Win, Win->GetName(), true); GetNotebookFromId(i)->AddPage(Win, Win->GetName(), true);
else else
@ -520,10 +554,15 @@ void CFrame::OnDropDownSettingsToolbar(wxAuiToolBarEvent& event)
wxRect rect = Tb->GetToolRect(event.GetId()); wxRect rect = Tb->GetToolRect(event.GetId());
wxPoint Pt = Tb->ClientToScreen(rect.GetBottomLeft()); wxPoint Pt = Tb->ClientToScreen(rect.GetBottomLeft());
Pt = ScreenToClient(Pt); Pt = ScreenToClient(Pt);
// Show // Show
PopupMenu(menuPopup, Pt); PopupMenu(menuPopup, Pt);
// Make the button un-stuck again // Make the button un-stuck again
if (!m_bEdit) Tb->SetToolSticky(event.GetId(), false); if (!m_bEdit)
{
Tb->SetToolSticky(event.GetId(), false);
}
} }
} }
@ -551,8 +590,13 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i, wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i,
StrToWxStr(Perspectives[i].Name), StrToWxStr(Perspectives[i].Name),
wxT(""), wxITEM_CHECK); wxT(""), wxITEM_CHECK);
menuPopup->Append(mItem); menuPopup->Append(mItem);
if (i == ActivePerspective) mItem->Check(true);
if (i == ActivePerspective)
{
mItem->Check(true);
}
} }
} }
@ -560,8 +604,10 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
wxRect rect = tb->GetToolRect(event.GetId()); wxRect rect = tb->GetToolRect(event.GetId());
wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft()); wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft());
pt = ScreenToClient(pt); pt = ScreenToClient(pt);
// show // show
PopupMenu(menuPopup, pt); PopupMenu(menuPopup, pt);
// make sure the button is "un-stuck" // make sure the button is "un-stuck"
tb->SetToolSticky(event.GetId(), false); tb->SetToolSticky(event.GetId(), false);
} }
@ -609,12 +655,17 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
wxString DefaultValue = wxString::Format(_("Perspective %d"), wxString DefaultValue = wxString::Format(_("Perspective %d"),
Perspectives.size() + 1); Perspectives.size() + 1);
dlg.SetValue(DefaultValue); dlg.SetValue(DefaultValue);
bool DlgOk = false; int Return = 0;
int Return = 0;
bool DlgOk = false;
while (!DlgOk) while (!DlgOk)
{ {
Return = dlg.ShowModal(); Return = dlg.ShowModal();
if (Return == wxID_CANCEL) if (Return == wxID_CANCEL)
{
return; return;
}
else if (dlg.GetValue().Find(wxT(",")) != -1) else if (dlg.GetValue().Find(wxT(",")) != -1)
{ {
wxMessageBox(_("The name can not contain the character ','"), wxMessageBox(_("The name can not contain the character ','"),
@ -630,8 +681,10 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
dlg.SetValue(DefaultValue); dlg.SetValue(DefaultValue);
} }
else else
{
DlgOk = true; DlgOk = true;
} }
}
SPerspectives Tmp; SPerspectives Tmp;
Tmp.Name = WxStrToStr(dlg.GetValue()); Tmp.Name = WxStrToStr(dlg.GetValue());
@ -663,11 +716,14 @@ void CFrame::ResetToolbarStyle()
if (Pane.window->IsKindOf(CLASSINFO(wxAuiToolBar))) if (Pane.window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{ {
Pane.Show(); Pane.Show();
// Show all of it // Show all of it
if (Pane.rect.GetLeft() > GetClientSize().GetX() - 50) if (Pane.rect.GetLeft() > GetClientSize().GetX() - 50)
{
Pane.Position(GetClientSize().GetX() - Pane.window->GetClientSize().GetX()); Pane.Position(GetClientSize().GetX() - Pane.window->GetClientSize().GetX());
} }
} }
}
m_Mgr->Update(); m_Mgr->Update();
} }
@ -765,22 +821,31 @@ static int Limit(int i, int Low, int High)
void CFrame::SetPaneSize() void CFrame::SetPaneSize()
{ {
if (Perspectives.size() <= ActivePerspective) return; if (Perspectives.size() <= ActivePerspective)
int iClientX = GetSize().GetX(), iClientY = GetSize().GetY(); return;
int iClientX = GetSize().GetX();
int iClientY = GetSize().GetY();
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar))) if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{ {
if (!m_Mgr->GetAllPanes()[i].IsOk()) return; if (!m_Mgr->GetAllPanes()[i].IsOk())
return;
if (Perspectives[ActivePerspective].Width.size() <= j || if (Perspectives[ActivePerspective].Width.size() <= j ||
Perspectives[ActivePerspective].Height.size() <= j) Perspectives[ActivePerspective].Height.size() <= j)
continue; continue;
// Width and height of the active perspective
u32 W = Perspectives[ActivePerspective].Width[j], u32 W = Perspectives[ActivePerspective].Width[j],
H = Perspectives[ActivePerspective].Height[j]; H = Perspectives[ActivePerspective].Height[j];
// Check limits // Check limits
W = Limit(W, 5, 95); W = Limit(W, 5, 95);
H = Limit(H, 5, 95); H = Limit(H, 5, 95);
// Convert percentages to pixel lengths // Convert percentages to pixel lengths
W = (W * iClientX) / 100; W = (W * iClientX) / 100;
H = (H * iClientY) / 100; H = (H * iClientY) / 100;
@ -859,8 +924,10 @@ void CFrame::LoadIniPerspectives()
std::string _Section, _Perspective, _Width, _Height; std::string _Section, _Perspective, _Width, _Height;
std::vector<std::string> _SWidth, _SHeight; std::vector<std::string> _SWidth, _SHeight;
Tmp.Name = VPerspectives[i]; Tmp.Name = VPerspectives[i];
// Don't save a blank perspective // Don't save a blank perspective
if (Tmp.Name.empty()) continue; if (Tmp.Name.empty())
continue;
_Section = StringFromFormat("P - %s", Tmp.Name.c_str()); _Section = StringFromFormat("P - %s", Tmp.Name.c_str());
ini.Get(_Section.c_str(), "Perspective", &_Perspective, ini.Get(_Section.c_str(), "Perspective", &_Perspective,
@ -984,10 +1051,12 @@ wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
for(u32 j = 0; j < NB->GetPageCount(); j++) for(u32 j = 0; j < NB->GetPageCount(); j++)
{ {
if (NB->GetPage(j)->GetId() == Id) return NB->GetPage(j); if (NB->GetPage(j)->GetId() == Id)
return NB->GetPage(j);
} }
} }
return NULL; return NULL;
@ -1036,12 +1105,14 @@ void CFrame::AddRemoveBlankPage()
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
for(u32 j = 0; j < NB->GetPageCount(); j++) for(u32 j = 0; j < NB->GetPageCount(); j++)
{ {
if (NB->GetPageText(j).IsSameAs(wxT("<>")) && NB->GetPageCount() > 1) if (NB->GetPageText(j).IsSameAs(wxT("<>")) && NB->GetPageCount() > 1)
NB->DeletePage(j); NB->DeletePage(j);
} }
if (NB->GetPageCount() == 0) if (NB->GetPageCount() == 0)
NB->AddPage(new wxPanel(this, wxID_ANY), wxT("<>"), true); NB->AddPage(new wxPanel(this, wxID_ANY), wxT("<>"), true);
} }
@ -1053,6 +1124,7 @@ int CFrame::GetNotebookAffiliation(wxWindowID Id)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
for(u32 k = 0; k < NB->GetPageCount(); k++) for(u32 k = 0; k < NB->GetPageCount(); k++)
{ {

View File

@ -177,10 +177,12 @@ void CFrame::CreateMenu()
loadMenu->Append(IDM_UNDOLOADSTATE, _("Undo Load State") + wxString(wxT("\tShift+F12"))); loadMenu->Append(IDM_UNDOLOADSTATE, _("Undo Load State") + wxString(wxT("\tShift+F12")));
loadMenu->AppendSeparator(); loadMenu->AppendSeparator();
for (int i = 1; i <= 8; i++) { for (int i = 1; i <= 8; i++)
{
loadMenu->Append(IDM_LOADSLOT1 + i - 1, GetMenuLabel(HK_LOAD_STATE_SLOT_1 + i - 1)); loadMenu->Append(IDM_LOADSLOT1 + i - 1, GetMenuLabel(HK_LOAD_STATE_SLOT_1 + i - 1));
saveMenu->Append(IDM_SAVESLOT1 + i - 1, GetMenuLabel(HK_SAVE_STATE_SLOT_1 + i - 1)); saveMenu->Append(IDM_SAVESLOT1 + i - 1, GetMenuLabel(HK_SAVE_STATE_SLOT_1 + i - 1));
} }
m_MenuBar->Append(emulationMenu, _("&Emulation")); m_MenuBar->Append(emulationMenu, _("&Emulation"));
// Options menu // Options menu
@ -297,7 +299,10 @@ void CFrame::CreateMenu()
viewMenu->Append(IDM_PURGECACHE, _("Purge Cache")); viewMenu->Append(IDM_PURGECACHE, _("Purge Cache"));
m_MenuBar->Append(viewMenu, _("&View")); m_MenuBar->Append(viewMenu, _("&View"));
if (g_pCodeWindow) g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, m_MenuBar); if (g_pCodeWindow)
{
g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, m_MenuBar);
}
// Help menu // Help menu
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
@ -558,12 +563,16 @@ void CFrame::BootGame(const std::string& filename)
} }
else if (!StartUp.m_strDefaultGCM.empty() else if (!StartUp.m_strDefaultGCM.empty()
&& wxFileExists(wxSafeConvertMB2WX(StartUp.m_strDefaultGCM.c_str()))) && wxFileExists(wxSafeConvertMB2WX(StartUp.m_strDefaultGCM.c_str())))
{
bootfile = StartUp.m_strDefaultGCM; bootfile = StartUp.m_strDefaultGCM;
}
else else
{ {
if (!SConfig::GetInstance().m_LastFilename.empty() if (!SConfig::GetInstance().m_LastFilename.empty()
&& wxFileExists(wxSafeConvertMB2WX(SConfig::GetInstance().m_LastFilename.c_str()))) && wxFileExists(wxSafeConvertMB2WX(SConfig::GetInstance().m_LastFilename.c_str())))
{
bootfile = SConfig::GetInstance().m_LastFilename; bootfile = SConfig::GetInstance().m_LastFilename;
}
else else
{ {
m_GameListCtrl->BrowseForDirectory(); m_GameListCtrl->BrowseForDirectory();
@ -608,7 +617,9 @@ void CFrame::DoOpen(bool Boot)
// Should we boot a new game or just change the disc? // Should we boot a new game or just change the disc?
if (Boot && !path.IsEmpty()) if (Boot && !path.IsEmpty())
{
BootGame(WxStrToStr(path)); BootGame(WxStrToStr(path));
}
else else
{ {
DVDInterface::ChangeDisc(WxStrToStr(path).c_str()); DVDInterface::ChangeDisc(WxStrToStr(path).c_str());
@ -666,7 +677,8 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event))
GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(false); GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(false);
} }
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++)
{
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER || SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA) if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER || SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
controllers |= (1 << i); controllers |= (1 << i);
@ -726,12 +738,16 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
UpdateGUI(); UpdateGUI();
} }
else else
{
DoPause(); DoPause();
} }
}
else else
{
// Core is uninitialized, start the game // Core is uninitialized, start the game
BootGame(std::string("")); BootGame(std::string(""));
} }
}
void CFrame::OnRenderParentClose(wxCloseEvent& event) void CFrame::OnRenderParentClose(wxCloseEvent& event)
{ {
@ -920,13 +936,19 @@ void CFrame::OnBootDrive(wxCommandEvent& event)
// Refresh the file list and browse for a favorites directory // Refresh the file list and browse for a favorites directory
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event)) void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
{ {
if (m_GameListCtrl) m_GameListCtrl->Update(); if (m_GameListCtrl)
{
m_GameListCtrl->Update();
}
} }
void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event)) void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
{ {
if (m_GameListCtrl) m_GameListCtrl->BrowseForDirectory(); if (m_GameListCtrl)
{
m_GameListCtrl->BrowseForDirectory();
}
} }
// Create screenshot // Create screenshot
@ -1127,7 +1149,9 @@ void CFrame::OnConfigPAD(wxCommandEvent& WXUNUSED (event))
InputPlugin *const pad_plugin = Pad::GetPlugin(); InputPlugin *const pad_plugin = Pad::GetPlugin();
bool was_init = false; bool was_init = false;
if (g_controller_interface.IsInit()) // check if game is running if (g_controller_interface.IsInit()) // check if game is running
{
was_init = true; was_init = true;
}
else else
{ {
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_X11) && HAVE_X11
@ -1153,7 +1177,9 @@ void CFrame::OnConfigWiimote(wxCommandEvent& WXUNUSED (event))
InputPlugin *const wiimote_plugin = Wiimote::GetPlugin(); InputPlugin *const wiimote_plugin = Wiimote::GetPlugin();
bool was_init = false; bool was_init = false;
if (g_controller_interface.IsInit()) // check if game is running if (g_controller_interface.IsInit()) // check if game is running
{
was_init = true; was_init = true;
}
else else
{ {
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_X11) && HAVE_X11
@ -1204,7 +1230,10 @@ void CFrame::OnHelp(wxCommandEvent& event)
void CFrame::ClearStatusBar() void CFrame::ClearStatusBar()
{ {
if (this->GetStatusBar()->IsEnabled()) this->GetStatusBar()->SetStatusText(wxT(""),0); if (this->GetStatusBar()->IsEnabled())
{
this->GetStatusBar()->SetStatusText(wxT(""),0);
}
} }
void CFrame::StatusBarMessage(const char * Text, ...) void CFrame::StatusBarMessage(const char * Text, ...)
@ -1216,7 +1245,10 @@ void CFrame::StatusBarMessage(const char * Text, ...)
vsnprintf(Str, MAX_BYTES, Text, ArgPtr); vsnprintf(Str, MAX_BYTES, Text, ArgPtr);
va_end(ArgPtr); va_end(ArgPtr);
if (this->GetStatusBar()->IsEnabled()) this->GetStatusBar()->SetStatusText(StrToWxStr(Str),0); if (this->GetStatusBar()->IsEnabled())
{
this->GetStatusBar()->SetStatusText(StrToWxStr(Str),0);
}
} }
@ -1233,8 +1265,10 @@ void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED (event))
g_NetPlaySetupDiag = new NetPlaySetupDiag(this, m_GameListCtrl); g_NetPlaySetupDiag = new NetPlaySetupDiag(this, m_GameListCtrl);
} }
else else
{
g_NetPlaySetupDiag->Raise(); g_NetPlaySetupDiag->Raise();
} }
}
void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event)) void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event))
{ {
@ -1618,7 +1652,11 @@ void CFrame::UpdateGUI()
m_bGameLoading = false; m_bGameLoading = false;
} }
if (m_ToolBar) m_ToolBar->Refresh(); // Refresh toolbar
if (m_ToolBar)
{
m_ToolBar->Refresh();
}
// Commit changes to manager // Commit changes to manager
m_Mgr->Update(); m_Mgr->Update();
@ -1685,7 +1723,11 @@ void CFrame::GameListChanged(wxCommandEvent& event)
break; break;
} }
if (m_GameListCtrl) m_GameListCtrl->Update(); // Update gamelist
if (m_GameListCtrl)
{
m_GameListCtrl->Update();
}
} }
// Enable and disable the toolbar // Enable and disable the toolbar

View File

@ -149,7 +149,8 @@ void GCMicDialog::OnButtonClick(wxCommandEvent& event)
{ {
event.Skip(); event.Skip();
if (m_ButtonMappingTimer->IsRunning()) return; if (m_ButtonMappingTimer->IsRunning())
return;
wxTheApp->Bind(wxEVT_KEY_DOWN, &GCMicDialog::OnKeyDown, this); wxTheApp->Bind(wxEVT_KEY_DOWN, &GCMicDialog::OnKeyDown, this);

View File

@ -732,7 +732,9 @@ void CGameListCtrl::OnKeyPress(wxListEvent& event)
continue; continue;
} }
else if (lastKey != event.GetKeyCode()) else if (lastKey != event.GetKeyCode())
{
sLoop = 0; sLoop = 0;
}
lastKey = event.GetKeyCode(); lastKey = event.GetKeyCode();
sLoop++; sLoop++;
@ -801,7 +803,9 @@ void CGameListCtrl::OnMouseMotion(wxMouseEvent& event)
toolTip = new wxEmuStateTip(this, StrToWxStr(temp), &toolTip); toolTip = new wxEmuStateTip(this, StrToWxStr(temp), &toolTip);
} }
else else
{
toolTip = new wxEmuStateTip(this, _("Not Set"), &toolTip); toolTip = new wxEmuStateTip(this, _("Not Set"), &toolTip);
}
// Get item Coords // Get item Coords
GetItemRect(item, Rect); GetItemRect(item, Rect);
@ -891,8 +895,11 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
else if (selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".ciso" else if (selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".ciso"
&& selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".wbfs") && selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".wbfs")
popupMenu->Append(IDM_COMPRESSGCM, _("Compress ISO...")); popupMenu->Append(IDM_COMPRESSGCM, _("Compress ISO..."));
} else }
else
{
popupMenu->Append(IDM_LIST_INSTALLWAD, _("Install to Wii Menu")); popupMenu->Append(IDM_LIST_INSTALLWAD, _("Install to Wii Menu"));
}
PopupMenu(popupMenu); PopupMenu(popupMenu);
} }
@ -911,14 +918,20 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
const GameListItem * CGameListCtrl::GetSelectedISO() const GameListItem * CGameListCtrl::GetSelectedISO()
{ {
if (m_ISOFiles.size() == 0) if (m_ISOFiles.size() == 0)
{
return NULL; return NULL;
}
else if (GetSelectedItemCount() == 0) else if (GetSelectedItemCount() == 0)
{
return NULL; return NULL;
}
else else
{ {
long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (item == wxNOT_FOUND) if (item == wxNOT_FOUND)
{
return NULL; return NULL;
}
else else
{ {
// Here is a little workaround for multiselections: // Here is a little workaround for multiselections:
@ -1030,6 +1043,7 @@ void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED (event))
const GameListItem *iso = GetSelectedISO(); const GameListItem *iso = GetSelectedISO();
if (!iso) if (!iso)
return; return;
CISOProperties ISOProperties(iso->GetFileName(), this); CISOProperties ISOProperties(iso->GetFileName(), this);
if(ISOProperties.ShowModal() == wxID_OK) if(ISOProperties.ShowModal() == wxID_OK)
Update(); Update();
@ -1249,7 +1263,9 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
void CGameListCtrl::OnSize(wxSizeEvent& event) void CGameListCtrl::OnSize(wxSizeEvent& event)
{ {
if (lastpos == event.GetSize()) return; if (lastpos == event.GetSize())
return;
lastpos = event.GetSize(); lastpos = event.GetSize();
AutomaticColumnWidth(); AutomaticColumnWidth();
@ -1261,7 +1277,9 @@ void CGameListCtrl::AutomaticColumnWidth()
wxRect rc(GetClientRect()); wxRect rc(GetClientRect());
if (GetColumnCount() == 1) if (GetColumnCount() == 1)
{
SetColumnWidth(0, rc.GetWidth()); SetColumnWidth(0, rc.GetWidth());
}
else if (GetColumnCount() > 4) else if (GetColumnCount() > 4)
{ {
int resizable = rc.GetWidth() - ( int resizable = rc.GetWidth() - (
@ -1291,7 +1309,6 @@ void CGameListCtrl::UnselectAll()
{ {
SetItemState(i, 0, wxLIST_STATE_SELECTED); SetItemState(i, 0, wxLIST_STATE_SELECTED);
} }
} }

View File

@ -301,11 +301,15 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
UpdateCodeList(); UpdateCodeList();
} }
else else
{
PanicAlertT("File contained no codes."); PanicAlertT("File contained no codes.");
} }
}
else else
{
PanicAlertT("Failed to download codes."); PanicAlertT("Failed to download codes.");
} }
}
} }

View File

@ -1,3 +1,4 @@
// Copyright (C) 2003 Dolphin Project. // Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -149,7 +150,8 @@ void HotkeyConfigDialog::OnButtonClick(wxCommandEvent& event)
{ {
event.Skip(); event.Skip();
if (m_ButtonMappingTimer->IsRunning()) return; if (m_ButtonMappingTimer->IsRunning())
return;
wxTheApp->Bind(wxEVT_KEY_DOWN, &HotkeyConfigDialog::OnKeyDown, this); wxTheApp->Bind(wxEVT_KEY_DOWN, &HotkeyConfigDialog::OnKeyDown, this);

View File

@ -98,9 +98,11 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
} }
} }
else else
{
break; break;
} }
} }
}
else else
{ {
// TODO : Should we add a way to browse the wad file ? // TODO : Should we add a way to browse the wad file ?
@ -131,9 +133,13 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
_iniFilename = tmp; _iniFilename = tmp;
} }
} }
GameIniFile = File::GetUserPath(D_GAMECONFIG_IDX) + _iniFilename + ".ini"; GameIniFile = File::GetUserPath(D_GAMECONFIG_IDX) + _iniFilename + ".ini";
if (GameIni.Load(GameIniFile.c_str())) if (GameIni.Load(GameIniFile.c_str()))
{
LoadGameConfig(); LoadGameConfig();
}
else else
{ {
// Will fail out if GameConfig folder doesn't exist // Will fail out if GameConfig folder doesn't exist
@ -148,6 +154,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
<< "[ActionReplay] Add action replay cheats here.\n"; << "[ActionReplay] Add action replay cheats here.\n";
f.close(); f.close();
} }
if (GameIni.Load(GameIniFile.c_str())) if (GameIni.Load(GameIniFile.c_str()))
LoadGameConfig(); LoadGameConfig();
else else
@ -226,7 +233,9 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
} }
} }
else if (!GCFiles.empty()) else if (!GCFiles.empty())
{
CreateDirectoryTree(RootId, GCFiles, 1, GCFiles.at(0)->m_FileSize); CreateDirectoryTree(RootId, GCFiles, 1, GCFiles.at(0)->m_FileSize);
}
m_Treectrl->Expand(RootId); m_Treectrl->Expand(RootId);
} }
@ -255,7 +264,11 @@ size_t CISOProperties::CreateDirectoryTree(wxTreeItemId& parent,
const DiscIO::SFileInfo *rFileInfo = fileInfos[CurrentIndex]; const DiscIO::SFileInfo *rFileInfo = fileInfos[CurrentIndex];
char *name = (char*)rFileInfo->m_FullPath; char *name = (char*)rFileInfo->m_FullPath;
if (rFileInfo->IsDirectory()) name[strlen(name) - 1] = '\0'; if (rFileInfo->IsDirectory())
{
name[strlen(name) - 1] = '\0';
}
char *itemName = strrchr(name, DIR_SEP_CHR); char *itemName = strrchr(name, DIR_SEP_CHR);
if(!itemName) if(!itemName)
@ -664,8 +677,10 @@ void CISOProperties::OnExtractFile(wxCommandEvent& WXUNUSED (event))
WiiDisc.at(partitionNum).FileSystem->ExportFile(WxStrToStr(File).c_str(), WxStrToStr(Path).c_str()); WiiDisc.at(partitionNum).FileSystem->ExportFile(WxStrToStr(File).c_str(), WxStrToStr(Path).c_str());
} }
else else
{
pFileSystem->ExportFile(WxStrToStr(File).c_str(), WxStrToStr(Path).c_str()); pFileSystem->ExportFile(WxStrToStr(File).c_str(), WxStrToStr(Path).c_str());
} }
}
void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolder, const int partitionNum) void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolder, const int partitionNum)
{ {
@ -679,7 +694,9 @@ void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolde
FS = WiiDisc.at(partitionNum).FileSystem; FS = WiiDisc.at(partitionNum).FileSystem;
} }
else else
{
FS = pFileSystem; FS = pFileSystem;
}
FS->GetFileList(fst); FS->GetFileList(fst);
@ -799,8 +816,10 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event)
ExportDir(WxStrToStr(Directory).c_str(), WxStrToStr(Path).c_str(), partitionNum); ExportDir(WxStrToStr(Directory).c_str(), WxStrToStr(Path).c_str(), partitionNum);
} }
else else
{
ExportDir(WxStrToStr(Directory).c_str(), WxStrToStr(Path).c_str()); ExportDir(WxStrToStr(Directory).c_str(), WxStrToStr(Path).c_str());
} }
}
void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event) void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
{ {

View File

@ -600,8 +600,10 @@ void GamepadPage::SaveProfile(wxCommandEvent&)
m_config_dialog->UpdateProfileComboBox(); m_config_dialog->UpdateProfileComboBox();
} }
else else
{
PanicAlertT("You must enter a valid profile name."); PanicAlertT("You must enter a valid profile name.");
} }
}
void GamepadPage::DeleteProfile(wxCommandEvent&) void GamepadPage::DeleteProfile(wxCommandEvent&)
{ {
@ -872,7 +874,9 @@ ControlGroupsSizer::ControlGroupsSizer(ControllerEmu* const controller, wxWindow
col_size = grp_size; col_size = grp_size;
} }
else else
{
stacked_groups->Add(control_group, 0, wxEXPAND); stacked_groups->Add(control_group, 0, wxEXPAND);
}
if (groups) if (groups)
groups->push_back(control_group_box); groups->push_back(control_group_box);

View File

@ -111,7 +111,9 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
dc.DrawCircle( 32, 32, 32); dc.DrawCircle( 32, 32, 32);
} }
else else
{
dc.DrawRectangle( 16, 16, 32, 32 ); dc.DrawRectangle( 16, 16, 32, 32 );
}
if ( GROUP_TYPE_CURSOR != (*g)->control_group->type ) if ( GROUP_TYPE_CURSOR != (*g)->control_group->type )
{ {
@ -217,7 +219,9 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
for (unsigned int n = 0; n<button_count; ++n) for (unsigned int n = 0; n<button_count; ++n)
{ {
if ( buttons & bitmasks[n] ) if ( buttons & bitmasks[n] )
{
dc.SetBrush( *wxRED_BRUSH ); dc.SetBrush( *wxRED_BRUSH );
}
else else
{ {
unsigned char amt = 255 - (*g)->control_group->controls[n]->control_ref->State() * 128; unsigned char amt = 255 - (*g)->control_group->controls[n]->control_ref->State() * 128;

View File

@ -111,12 +111,20 @@ void LogConfigWindow::LoadSettings()
IniFile ini; IniFile ini;
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX)); ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
// Retrieve the verbosity value from the config ini file.
int verbosity; int verbosity;
ini.Get("Options", "Verbosity", &verbosity, 0); ini.Get("Options", "Verbosity", &verbosity, 0);
if (verbosity < 1) verbosity = 1;
if (verbosity > MAX_LOGLEVEL) verbosity = MAX_LOGLEVEL; // Ensure the verbosity level is valid.
if (verbosity < 1)
verbosity = 1;
if (verbosity > MAX_LOGLEVEL)
verbosity = MAX_LOGLEVEL;
// Actually set the logging verbosity.
m_verbosity->SetSelection(verbosity - 1); m_verbosity->SetSelection(verbosity - 1);
// Get the logger output settings from the config ini file.
ini.Get("Options", "WriteToFile", &m_writeFile, false); ini.Get("Options", "WriteToFile", &m_writeFile, false);
m_writeFileCB->SetValue(m_writeFile); m_writeFileCB->SetValue(m_writeFile);
ini.Get("Options", "WriteToConsole", &m_writeConsole, true); ini.Get("Options", "WriteToConsole", &m_writeConsole, true);
@ -134,11 +142,17 @@ void LogConfigWindow::LoadSettings()
{ {
m_writeDebugger = false; m_writeDebugger = false;
} }
// Run through all of the log types and check each checkbox for each logging type
// depending on its set value within the config ini.
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{ {
bool log_enabled; bool log_enabled;
ini.Get("Logs", m_LogManager->GetShortName((LogTypes::LOG_TYPE)i), &log_enabled, true); ini.Get("Logs", m_LogManager->GetShortName((LogTypes::LOG_TYPE)i), &log_enabled, true);
if (log_enabled) enableAll = false;
if (log_enabled)
enableAll = false;
m_checks->Check(i, log_enabled); m_checks->Check(i, log_enabled);
} }
} }
@ -148,7 +162,10 @@ void LogConfigWindow::SaveSettings()
IniFile ini; IniFile ini;
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX)); ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
// Save the verbosity level.
ini.Set("Options", "Verbosity", m_verbosity->GetSelection() + 1); ini.Set("Options", "Verbosity", m_verbosity->GetSelection() + 1);
// Save the enabled/disabled states of the logger outputs to the config ini.
ini.Set("Options", "WriteToFile", m_writeFile); ini.Set("Options", "WriteToFile", m_writeFile);
ini.Set("Options", "WriteToConsole", m_writeConsole); ini.Set("Options", "WriteToConsole", m_writeConsole);
ini.Set("Options", "WriteToWindow", m_writeWindow); ini.Set("Options", "WriteToWindow", m_writeWindow);
@ -156,16 +173,28 @@ void LogConfigWindow::SaveSettings()
if (IsDebuggerPresent()) if (IsDebuggerPresent())
ini.Set("Options", "WriteToDebugger", m_writeDebugger); ini.Set("Options", "WriteToDebugger", m_writeDebugger);
#endif #endif
// Save all enabled/disabled states of the log types to the config ini.
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
ini.Set("Logs", m_LogManager->GetShortName((LogTypes::LOG_TYPE)i), m_checks->IsChecked(i)); ini.Set("Logs", m_LogManager->GetShortName((LogTypes::LOG_TYPE)i), m_checks->IsChecked(i));
}
ini.Save(File::GetUserPath(F_LOGGERCONFIG_IDX)); ini.Save(File::GetUserPath(F_LOGGERCONFIG_IDX));
} }
// If the verbosity changes while logging
void LogConfigWindow::OnVerbosityChange(wxCommandEvent& event) void LogConfigWindow::OnVerbosityChange(wxCommandEvent& event)
{ {
// Get the new verbosity
int v = m_verbosity->GetSelection() + 1; int v = m_verbosity->GetSelection() + 1;
// Set all log types to that verbosity level
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
m_LogManager->SetLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)v); m_LogManager->SetLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)v);
}
event.Skip(); event.Skip();
} }

View File

@ -64,9 +64,14 @@ void CLogWindow::CreateGUIControls()
// Set up log listeners // Set up log listeners
int verbosity; int verbosity;
ini.Get("Options", "Verbosity", &verbosity, 0); ini.Get("Options", "Verbosity", &verbosity, 0);
if (verbosity < 1) verbosity = 1;
if (verbosity > MAX_LOGLEVEL) verbosity = MAX_LOGLEVEL;
// Ensure the verbosity level is valid
if (verbosity < 1)
verbosity = 1;
if (verbosity > MAX_LOGLEVEL)
verbosity = MAX_LOGLEVEL;
// Get the logger output settings from the config ini file.
ini.Get("Options", "WriteToFile", &m_writeFile, false); ini.Get("Options", "WriteToFile", &m_writeFile, false);
ini.Get("Options", "WriteToConsole", &m_writeConsole, true); ini.Get("Options", "WriteToConsole", &m_writeConsole, true);
ini.Get("Options", "WriteToWindow", &m_writeWindow, true); ini.Get("Options", "WriteToWindow", &m_writeWindow, true);
@ -80,6 +85,7 @@ void CLogWindow::CreateGUIControls()
{ {
m_writeDebugger = false; m_writeDebugger = false;
} }
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{ {
bool enable; bool enable;

View File

@ -376,9 +376,11 @@ void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
main_frame->BootGame(WxStrToStr(FileToLoad)); main_frame->BootGame(WxStrToStr(FileToLoad));
} }
else else
{
main_frame->BootGame(std::string("")); main_frame->BootGame(std::string(""));
} }
} }
}
// First check if we have an exec command line. // First check if we have an exec command line.
else if (LoadFile && FileToLoad != wxEmptyString) else if (LoadFile && FileToLoad != wxEmptyString)

View File

@ -466,7 +466,7 @@ bool CMemcardManager::CopyDeleteSwitch(u32 error, int slot)
break; break;
case DELETE_FAIL: case DELETE_FAIL:
PanicAlertT("Order of files in the File Directory do not match the block order\n" PanicAlertT("Order of files in the File Directory do not match the block order\n"
"Right click and export all of the saves,\nand import the the saves to a new memcard\n"); "Right click and export all of the saves,\nand import the saves to a new memcard\n");
break; break;
default: default:
PanicAlert(E_UNK); PanicAlert(E_UNK);
@ -508,7 +508,10 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
{ {
SuccessAlertT("The checksum was successfully fixed"); SuccessAlertT("The checksum was successfully fixed");
} }
else PanicAlert(E_SAVEFAILED); else
{
PanicAlert(E_SAVEFAILED);
}
break; break;
case ID_CONVERTTOGCI: case ID_CONVERTTOGCI:
fileName2 = "convert"; fileName2 = "convert";
@ -533,7 +536,10 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
wxEmptyString, wxEmptyString, wxT(".gci"), wxEmptyString, wxEmptyString, wxT(".gci"),
_("GCI File(*.gci)") + wxString(_T("|*.gci")), _("GCI File(*.gci)") + wxString(_T("|*.gci")),
wxFD_OVERWRITE_PROMPT|wxFD_SAVE, this); wxFD_OVERWRITE_PROMPT|wxFD_SAVE, this);
if (temp2.empty()) break;
if (temp2.empty())
break;
fileName2 = WxStrToStr(temp2); fileName2 = WxStrToStr(temp2);
} }
if (fileName.length() > 0) if (fileName.length() > 0)
@ -610,7 +616,8 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
// TODO: add error checking and animate icons // TODO: add error checking and animate icons
memoryCard[card] = new GCMemcard(fileName); memoryCard[card] = new GCMemcard(fileName);
if (!memoryCard[card]->IsValid()) return false; if (!memoryCard[card]->IsValid())
return false;
int j; int j;
@ -671,7 +678,10 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
{ {
memset(pxdata,0,96*32*4); memset(pxdata,0,96*32*4);
int frames=3; int frames=3;
if (numFrames<frames) frames=numFrames;
if (numFrames<frames)
frames=numFrames;
for (int f=0;f<frames;f++) for (int f=0;f<frames;f++)
{ {
for (int y=0;y<32;y++) for (int y=0;y<32;y++)
@ -714,7 +724,10 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
m_MemcardList[card]->SetItem(index, COLUMN_COMMENT, wxComment); m_MemcardList[card]->SetItem(index, COLUMN_COMMENT, wxComment);
blocks = memoryCard[card]->DEntry_BlockCount(fileIndex); blocks = memoryCard[card]->DEntry_BlockCount(fileIndex);
if (blocks == 0xFFFF) blocks = 0;
if (blocks == 0xFFFF)
blocks = 0;
wxBlock.Printf(wxT("%10d"), blocks); wxBlock.Printf(wxT("%10d"), blocks);
m_MemcardList[card]->SetItem(index,COLUMN_BLOCKS, wxBlock); m_MemcardList[card]->SetItem(index,COLUMN_BLOCKS, wxBlock);
firstblock = memoryCard[card]->DEntry_FirstBlock(fileIndex); firstblock = memoryCard[card]->DEntry_FirstBlock(fileIndex);

View File

@ -56,7 +56,10 @@ CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID)
SuccessAlertT("Successfully imported save files"); SuccessAlertT("Successfully imported save files");
b_tryAgain = false; b_tryAgain = false;
} }
else b_tryAgain = AskYesNoT("Import failed, try again?"); else
{
b_tryAgain = AskYesNoT("Import failed, try again?");
}
} while(b_tryAgain); } while(b_tryAgain);
} }
else else
@ -77,7 +80,10 @@ CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID)
SuccessAlertT("Successfully exported file to %s", pathData_bin); SuccessAlertT("Successfully exported file to %s", pathData_bin);
b_tryAgain = false; b_tryAgain = false;
} }
else b_tryAgain = AskYesNoT("Export failed, try again?"); else
{
b_tryAgain = AskYesNoT("Export failed, try again?");
}
} while(b_tryAgain); } while(b_tryAgain);
} }
} }
@ -333,7 +339,6 @@ void CWiiSaveCrypted::ExportWiiSaveFiles()
for (Common::replace_v::const_iterator iter = replacements.begin(); iter != replacements.end(); ++iter) for (Common::replace_v::const_iterator iter = replacements.begin(); iter != replacements.end(); ++iter)
{ {
for (size_t j = 0; (j = __name.find(iter->second, j)) != __name.npos; ++j) for (size_t j = 0; (j = __name.find(iter->second, j)) != __name.npos; ++j)
{ {
__name.replace(j, iter->second.length(), 1, iter->first); __name.replace(j, iter->second.length(), 1, iter->first);
@ -488,6 +493,7 @@ bool CWiiSaveCrypted::getPaths(bool forExport)
WiiTitlePath = Common::GetTitleDataPath(m_TitleID); WiiTitlePath = Common::GetTitleDataPath(m_TitleID);
BannerFilePath = WiiTitlePath + "banner.bin"; BannerFilePath = WiiTitlePath + "banner.bin";
} }
if (forExport) if (forExport)
{ {
char GameID[5]; char GameID[5];
@ -530,7 +536,10 @@ void CWiiSaveCrypted::ScanForFiles(std::string savDir, std::vector<std::string>&
Directories.push_back(savDir); Directories.push_back(savDir);
for (u32 i = 0; i < Directories.size(); i++) for (u32 i = 0; i < Directories.size(); i++)
{ {
if (i) FileList.push_back(Directories[i]);//add dir to fst if (i != 0)
{
FileList.push_back(Directories[i]);//add dir to fst
}
File::FSTEntry FST_Temp; File::FSTEntry FST_Temp;
File::ScanDirectoryTree(Directories[i], FST_Temp); File::ScanDirectoryTree(Directories[i], FST_Temp);

View File

@ -26,7 +26,6 @@
// --- this is used for encrypted Wii save files // --- this is used for encrypted Wii save files
class CWiiSaveCrypted class CWiiSaveCrypted
{ {
public: public:
@ -40,8 +39,7 @@ public:
void ImportWiiSaveFiles(); void ImportWiiSaveFiles();
void ExportWiiSaveFiles(); // To data.bin void ExportWiiSaveFiles(); // To data.bin
void do_sig(); void do_sig();
void make_ec_cert(u8 *cert, u8 *sig, char *signer, char *name, u8 *priv, void make_ec_cert(u8 *cert, u8 *sig, char *signer, char *name, u8 *priv, u32 key_id);
u32 key_id);
bool getPaths(bool forExport = false); bool getPaths(bool forExport = false);
void ScanForFiles(std::string savDir, std::vector<std::string>&FilesList, u32 *_numFiles, u32 *_sizeFiles); void ScanForFiles(std::string savDir, std::vector<std::string>&FilesList, u32 *_numFiles, u32 *_sizeFiles);
@ -91,7 +89,6 @@ private:
AP_CERT_SZ = 0x180, AP_CERT_SZ = 0x180,
FULL_CERT_SZ = 0x3C0, // SIG_SZ + NG_CERT_SZ + AP_CERT_SZ + 0x80? FULL_CERT_SZ = 0x3C0, // SIG_SZ + NG_CERT_SZ + AP_CERT_SZ + 0x80?
BK_HDR_MAGIC = 0x426B0001, BK_HDR_MAGIC = 0x426B0001,
FILE_HDR_MAGIC = 0x03adf17e FILE_HDR_MAGIC = 0x03adf17e
}; };

View File

@ -218,7 +218,9 @@ bool CPatchAddEdit::UpdateTempEntryData(std::vector<PatchEngine::PatchEntry>::it
parsed_ok = false; parsed_ok = false;
} }
else else
{
parsed_ok = false; parsed_ok = false;
}
if (!parsed_ok) if (!parsed_ok)
{ {

View File

@ -825,6 +825,7 @@ void TASInputDlg::SetTurboFalse(wxMouseEvent& event)
case ID_A: case ID_A:
A_turbo = false; A_turbo = false;
break; break;
case ID_B: case ID_B:
B_turbo = false; B_turbo = false;
break; break;
@ -868,6 +869,7 @@ void TASInputDlg::SetTurboFalse(wxMouseEvent& event)
case ID_RIGHT: case ID_RIGHT:
DR_turbo = false; DR_turbo = false;
break; break;
default: default:
return; return;
} }
@ -989,7 +991,6 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_a_button->GetValue()) if(wx_a_button->GetValue())
wx_a_button->SetValue(false); wx_a_button->SetValue(false);
else else
wx_a_button->SetValue(true); wx_a_button->SetValue(true);
} }
@ -998,7 +999,6 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_b_button->GetValue()) if(wx_b_button->GetValue())
wx_b_button->SetValue(false); wx_b_button->SetValue(false);
else else
wx_b_button->SetValue(true); wx_b_button->SetValue(true);
} }
@ -1007,7 +1007,6 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_x_button->GetValue()) if(wx_x_button->GetValue())
wx_x_button->SetValue(false); wx_x_button->SetValue(false);
else else
wx_x_button->SetValue(true); wx_x_button->SetValue(true);
} }
@ -1016,7 +1015,6 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_y_button->GetValue()) if(wx_y_button->GetValue())
wx_y_button->SetValue(false); wx_y_button->SetValue(false);
else else
wx_y_button->SetValue(true); wx_y_button->SetValue(true);
} }
@ -1025,15 +1023,14 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_z_button->GetValue()) if(wx_z_button->GetValue())
wx_z_button->SetValue(false); wx_z_button->SetValue(false);
else else
wx_z_button->SetValue(true); wx_z_button->SetValue(true);
} }
if(L_turbo) if(L_turbo)
{ {
if(wx_l_button->GetValue()) if(wx_l_button->GetValue())
wx_l_button->SetValue(false); wx_l_button->SetValue(false);
else else
wx_l_button->SetValue(true); wx_l_button->SetValue(true);
} }
@ -1042,7 +1039,6 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_r_button->GetValue()) if(wx_r_button->GetValue())
wx_r_button->SetValue(false); wx_r_button->SetValue(false);
else else
wx_r_button->SetValue(true); wx_r_button->SetValue(true);
} }
@ -1051,7 +1047,6 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_start_button->GetValue()) if(wx_start_button->GetValue())
wx_start_button->SetValue(false); wx_start_button->SetValue(false);
else else
wx_start_button->SetValue(true); wx_start_button->SetValue(true);
} }
@ -1060,7 +1055,6 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_up_button->GetValue()) if(wx_up_button->GetValue())
wx_up_button->SetValue(false); wx_up_button->SetValue(false);
else else
wx_up_button->SetValue(true); wx_up_button->SetValue(true);
} }
@ -1069,7 +1063,6 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_down_button->GetValue()) if(wx_down_button->GetValue())
wx_down_button->SetValue(false); wx_down_button->SetValue(false);
else else
wx_down_button->SetValue(true); wx_down_button->SetValue(true);
} }
@ -1078,7 +1071,6 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_left_button->GetValue()) if(wx_left_button->GetValue())
wx_left_button->SetValue(false); wx_left_button->SetValue(false);
else else
wx_left_button->SetValue(true); wx_left_button->SetValue(true);
} }
@ -1087,7 +1079,6 @@ void TASInputDlg::ButtonTurbo()
{ {
if(wx_right_button->GetValue()) if(wx_right_button->GetValue())
wx_right_button->SetValue(false); wx_right_button->SetValue(false);
else else
wx_right_button->SetValue(true); wx_right_button->SetValue(true);
} }