diff --git a/src/common/ZipHandler.cxx b/src/common/ZipHandler.cxx index 1f7c97604..7e9c191fc 100644 --- a/src/common/ZipHandler.cxx +++ b/src/common/ZipHandler.cxx @@ -111,8 +111,7 @@ uInt32 ZipHandler::decompress(uInt8*& image) return length; else { - delete[] image; image = 0; - length = 0; + delete[] image; image = NULL; throw zip_error_s[err]; } diff --git a/src/common/tv_filters/atari_ntsc_impl.h b/src/common/tv_filters/atari_ntsc_impl.h index 79e040db0..320d8081a 100644 --- a/src/common/tv_filters/atari_ntsc_impl.h +++ b/src/common/tv_filters/atari_ntsc_impl.h @@ -263,7 +263,7 @@ static void init( init_t* impl, atari_ntsc_setup_t const* setup ) float* out = impl->to_rgb; int n; - n = burst_count; + //n = burst_count; FIXME: dead code detected by llvm scan-build do { float const* in = decoder; diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index 437452d42..acdb11ee1 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -307,10 +307,8 @@ void DiStella::disasm(uInt32 distart, int pass) if(referenced) // start a new line with a label { if(!line_empty) - { addEntry(CartDebug::ROW); - line_empty = true; - } + myDisasmBuf << Base::HEX4 << myPC+myOffset << "'L" << Base::HEX4 << myPC+myOffset << "'.byte " << "$" << Base::HEX2 << (int)Debugger::debugger().peek(myPC+myOffset); diff --git a/src/debugger/gui/CartDASHWidget.cxx b/src/debugger/gui/CartDASHWidget.cxx index 836f4e84f..541326b47 100644 --- a/src/debugger/gui/CartDASHWidget.cxx +++ b/src/debugger/gui/CartDASHWidget.cxx @@ -58,13 +58,11 @@ CartridgeDASHWidget::CartridgeDASHWidget( for(uInt32 i = 0; i < 4; ++i) { - int xpos_s = xpos, ypos_s = ypos; + int xpos_s, ypos_s = ypos; ostringstream label; label << "Set segment " << i << " as: "; - ypos_s = ypos; - new StaticTextWidget(boss, _font, xpos, ypos, _font.getStringWidth(label.str()), myFontHeight, label.str(), kTextAlignLeft); ypos += myLineHeight + 8; @@ -108,8 +106,8 @@ CartridgeDASHWidget::CartridgeDASHWidget( label.str(""); label << Common::Base::HEX4 << (addr2 + 1) << "-" << Common::Base::HEX4 << (addr2 + 1 + 0x1FF); - t = new StaticTextWidget(boss, _font, xpos_s, ypos_s+2, - _font.getStringWidth(label.str()), myFontHeight, label.str(), kTextAlignLeft); + new StaticTextWidget(boss, _font, xpos_s, ypos_s+2, + _font.getStringWidth(label.str()), myFontHeight, label.str(), kTextAlignLeft); myBankState[2*i+1] = new EditTextWidget(boss, _font, xoffset, ypos_s, w - xoffset - 10, myLineHeight, ""); diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index 89a778551..2a0e6d118 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -542,7 +542,7 @@ void DataGridWidget::drawWidget(bool hilite) { //cerr << "DataGridWidget::drawWidget\n"; FBSurface& s = _boss->dialog().surface(); - int row, col, deltax; + int row, col; // Draw the internal grid and labels int linewidth = _cols * _colWidth; @@ -569,15 +569,12 @@ void DataGridWidget::drawWidget(bool hilite) if (_selectedItem == pos && _editMode) { adjustOffset(); - deltax = -_editScrollOffset; s.drawString(_font, _editString, x, y, _colWidth, kTextColor, - kTextAlignLeft, deltax, false); + kTextAlignLeft, -_editScrollOffset, false); } else { - deltax = 0; - uInt32 color = kTextColor; if(_changedList[pos]) { diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 69669ba81..213749569 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -437,7 +437,6 @@ void RomListWidget::drawWidget(bool hilite) FBSurface& s = _boss->dialog().surface(); const CartDebug::DisassemblyList& dlist = myDisasm->list; int i, pos, xpos, ypos, len = dlist.size(); - int deltax; const GUI::Rect& r = getEditRect(); const GUI::Rect& l = getLineRect(); @@ -509,16 +508,13 @@ void RomListWidget::drawWidget(bool hilite) if (_selectedItem == pos && _editMode) { adjustOffset(); - deltax = -_editScrollOffset; - s.drawString(_font, _editString, _x + r.x(), ypos, r.width(), kTextColor, - kTextAlignLeft, deltax, false); + kTextAlignLeft, -_editScrollOffset, false); drawCaret(); } else { - deltax = 0; s.drawString(_font, dlist[pos].bytes, _x + r.x(), ypos, r.width(), kTextColor); } } diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index 964b18f5d..693df3aaf 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -49,10 +49,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, const char* regNames[] = { "COLUP0:", "COLUP1:", "COLUPF:", "COLUBK:" }; for(int row = 0; row < 4; ++row) { - t = new StaticTextWidget(boss, lfont, xpos, ypos + row*lineHeight + 2, - 7*fontWidth, fontHeight, - regNames[row], - kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos + row*lineHeight + 2, + 7*fontWidth, fontHeight, regNames[row], kTextAlignLeft); } xpos += 7*fontWidth + 5; myColorRegs = new DataGridWidget(boss, nfont, xpos, ypos, @@ -86,18 +84,17 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, "PF BL M1 M0 P1", kTextAlignLeft); // Add label for Strobes; buttons will be added later - t = new StaticTextWidget(boss, lfont, xpos + t->getWidth() + 9*fontWidth, ypos, - 8*fontWidth, fontHeight, - "Strobes:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos + t->getWidth() + 9*fontWidth, ypos, + 8*fontWidth, fontHeight, "Strobes:", kTextAlignLeft); // Add vertical labels xpos -= 2*fontWidth + 5; ypos += lineHeight; const char* collLabel[] = { "P0", "P1", "M0", "M1", "BL" }; for(int row = 0; row < 5; ++row) { - t = new StaticTextWidget(boss, lfont, xpos, ypos + row*(lineHeight+3), - 2*fontWidth, fontHeight, - collLabel[row], kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos + row*(lineHeight+3), + 2*fontWidth, fontHeight, + collLabel[row], kTextAlignLeft); } // Finally, add all 15 collision bits @@ -184,9 +181,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, //////////////////////////// // grP0 xpos = 10; ypos = buttonY + 2*lineHeight; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, - 7*fontWidth, fontHeight, - "P0: GR:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 7*fontWidth, fontHeight, + "P0: GR:", kTextAlignLeft); xpos += 7*fontWidth + 5; myGRP0 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1); myGRP0->setTarget(this); @@ -208,9 +204,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // hmP0 xpos += myPosP0->getWidth() + 8; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, - 3*fontWidth, fontHeight, - "HM:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, + "HM:", kTextAlignLeft); xpos += 3*fontWidth + 5; myHMP0 = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 1, 4, Common::Base::F_16_1); @@ -235,9 +230,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // NUSIZ0 (player portion) xpos = 10 + lwidth; ypos += myGRP0->getHeight() + 5; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, - 8*fontWidth, fontHeight, - "NusizP0:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 8*fontWidth, fontHeight, + "NusizP0:", kTextAlignLeft); xpos += 8*fontWidth + 5; myNusizP0 = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 1, 3, Common::Base::F_16_1); @@ -255,8 +249,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, //////////////////////////// // grP1 xpos = 10; ypos += 2*lineHeight; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 7*fontWidth, fontHeight, - "P1: GR:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 7*fontWidth, fontHeight, + "P1: GR:", kTextAlignLeft); xpos += 7*fontWidth + 5; myGRP1 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1); myGRP1->setTarget(this); @@ -277,8 +271,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // hmP1 xpos += myPosP1->getWidth() + 8; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, - "HM:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, + "HM:", kTextAlignLeft); xpos += 3*fontWidth + 5; myHMP1 = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 1, 4, Common::Base::F_16_1); @@ -303,8 +297,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // NUSIZ1 (player portion) xpos = 10 + lwidth; ypos += myGRP1->getHeight() + 5; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 8*fontWidth, fontHeight, - "NusizP1:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 8*fontWidth, fontHeight, + "NusizP1:", kTextAlignLeft); xpos += 8*fontWidth + 5; myNusizP1 = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 1, 3, Common::Base::F_16_1); @@ -322,8 +316,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, //////////////////////////// // enaM0 xpos = 10; ypos += 2*lineHeight; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, - "M0:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, + "M0:", kTextAlignLeft); xpos += 3*fontWidth + 8; myEnaM0 = new CheckboxWidget(boss, lfont, xpos, ypos+2, "Enable", kCheckActionCmd); @@ -345,8 +339,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // hmM0 xpos += myPosM0->getWidth() + 8; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, - "HM:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, + "HM:", kTextAlignLeft); xpos += 3*fontWidth + 5; myHMM0 = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 1, 4, Common::Base::F_16_1); @@ -356,8 +350,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // NUSIZ0 (missile portion) xpos += myHMM0->getWidth() + 8; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 5*fontWidth, fontHeight, - "Size:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 5*fontWidth, fontHeight, + "Size:", kTextAlignLeft); xpos += 5*fontWidth + 5; myNusizM0 = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 1, 2, Common::Base::F_16_1); @@ -378,8 +372,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, //////////////////////////// // enaM1 xpos = 10; ypos += lineHeight + 6; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, - "M1:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, + "M1:", kTextAlignLeft); xpos += 3*fontWidth + 8; myEnaM1 = new CheckboxWidget(boss, lfont, xpos, ypos+2, "Enable", kCheckActionCmd); @@ -401,8 +395,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // hmM0 xpos += myPosM1->getWidth() + 8; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, - "HM:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, + "HM:", kTextAlignLeft); xpos += 3*fontWidth + 5; myHMM1 = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 1, 4, Common::Base::F_16_1); @@ -412,8 +406,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // NUSIZ1 (missile portion) xpos += myHMM1->getWidth() + 8; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 5*fontWidth, fontHeight, - "Size:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 5*fontWidth, fontHeight, + "Size:", kTextAlignLeft); xpos += 5*fontWidth + 5; myNusizM1 = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 1, 2, Common::Base::F_16_1); @@ -434,8 +428,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, //////////////////////////// // enaBL xpos = 10; ypos += lineHeight + 6; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, - "BL:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, + "BL:", kTextAlignLeft); xpos += 3*fontWidth + 8; myEnaBL = new CheckboxWidget(boss, lfont, xpos, ypos+2, "Enable", kCheckActionCmd); @@ -457,8 +451,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // hmBL xpos += myPosBL->getWidth() + 8; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, - "HM:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 3*fontWidth, fontHeight, + "HM:", kTextAlignLeft); xpos += 3*fontWidth + 5; myHMBL = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 1, 4, Common::Base::F_16_1); @@ -468,8 +462,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // CTRLPF (size portion) xpos += myHMBL->getWidth() + 8; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 5*fontWidth, fontHeight, - "Size:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 5*fontWidth, fontHeight, + "Size:", kTextAlignLeft); xpos += 5*fontWidth + 5; mySizeBL = new DataGridWidget(boss, nfont, xpos, ypos, 1, 1, 1, 2, Common::Base::F_16_1); @@ -490,8 +484,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, //////////////////////////// // PF0 xpos = 10; ypos += lineHeight + 6; - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, 4*fontWidth, fontHeight, - "PF:", kTextAlignLeft); + new StaticTextWidget(boss, lfont, xpos, ypos+2, 4*fontWidth, fontHeight, + "PF:", kTextAlignLeft); xpos += 4*fontWidth; myPF[0] = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 4, 1); myPF[0]->setTarget(this); diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 8b53b6ebc..9d0f00db6 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -228,31 +228,31 @@ void EventHandler::mapStelladaptors(const string& saport) { if(BSPF_startsWithIgnoreCase(myJoysticks[i]->name, "Stelladaptor")) { - saCount++; - if(saOrder[saCount-1] == 1) + if(saOrder[saCount] == 1) { myJoysticks[i]->name += " (emulates left joystick port)"; myJoysticks[i]->type = StellaJoystick::JT_STELLADAPTOR_LEFT; } - else if(saOrder[saCount-1] == 2) + else if(saOrder[saCount] == 2) { myJoysticks[i]->name += " (emulates right joystick port)"; myJoysticks[i]->type = StellaJoystick::JT_STELLADAPTOR_RIGHT; } + saCount++; } else if(BSPF_startsWithIgnoreCase(myJoysticks[i]->name, "2600-daptor")) { - saCount++; - if(saOrder[saCount-1] == 1) + if(saOrder[saCount] == 1) { myJoysticks[i]->name += " (emulates left joystick port)"; myJoysticks[i]->type = StellaJoystick::JT_2600DAPTOR_LEFT; } - else if(saOrder[saCount-1] == 2) + else if(saOrder[saCount] == 2) { myJoysticks[i]->name += " (emulates right joystick port)"; myJoysticks[i]->type = StellaJoystick::JT_2600DAPTOR_RIGHT; } + saCount++; } } myOSystem.settings().setValue("saport", saport); diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx index e01f8f622..29730ad5a 100644 --- a/src/gui/CheckListWidget.cxx +++ b/src/gui/CheckListWidget.cxx @@ -88,7 +88,6 @@ void CheckListWidget::drawWidget(bool hilite) FBSurface& s = _boss->dialog().surface(); int i, pos, len = _list.size(); string buffer; - int deltax; // Draw a thin frame around the list and to separate columns s.hLine(_x, _y, _x + _w - 1, kColor); @@ -124,15 +123,13 @@ void CheckListWidget::drawWidget(bool hilite) { buffer = _editString; adjustOffset(); - deltax = -_editScrollOffset; s.drawString(_font, buffer, _x + r.left, y, r.width(), kTextColor, - kTextAlignLeft, deltax, false); + kTextAlignLeft, -_editScrollOffset, false); } else { buffer = _list[pos]; - deltax = 0; s.drawString(_font, buffer, _x + r.left, y, r.width(), kTextColor); } } diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 56c04a5ce..036541336 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -150,7 +150,6 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent, myQuitButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Quit", kQuitCmd); wid.push_back(myQuitButton); - xpos += bwidth + 8; #else myQuitButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Quit", kQuitCmd); @@ -167,7 +166,6 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent, myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Select", kLoadROMCmd); wid.push_back(myStartButton); - xpos += bwidth + 8; #endif mySelectedItem = 0; // Highlight 'Rom Listing' diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx index 7e138271a..b0688f751 100644 --- a/src/gui/StringListWidget.cxx +++ b/src/gui/StringListWidget.cxx @@ -50,7 +50,6 @@ void StringListWidget::drawWidget(bool hilite) FBSurface& s = _boss->dialog().surface(); int i, pos, len = _list.size(); string buffer; - int deltax; // Draw a thin frame around the list. s.hLine(_x, _y, _x + _w - 1, kColor); @@ -76,15 +75,13 @@ void StringListWidget::drawWidget(bool hilite) { buffer = _editString; adjustOffset(); - deltax = -_editScrollOffset; s.drawString(_font, buffer, _x + r.left, y, r.width(), kTextColor, - kTextAlignLeft, deltax, false); + kTextAlignLeft, -_editScrollOffset, false); } else { buffer = _list[pos]; - deltax = 0; s.drawString(_font, buffer, _x + r.left, y, r.width(), kTextColor); } } diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 4371cf8db..70c38202a 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -192,7 +192,6 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, // Center window (in windowed mode) myCenter = new CheckboxWidget(myTab, font, xpos, ypos, "Center window"); wid.push_back(myCenter); - ypos += lineHeight + 4; // Add items for tab 0 addToFocusList(wid, myTab, tabID);