diff --git a/Changes.txt b/Changes.txt index eb541ed7d..f318f4a5b 100644 --- a/Changes.txt +++ b/Changes.txt @@ -46,6 +46,10 @@ sometimes the image was 'double-blended', resulting in a snapshot that was too dark. + * Fixed crash when selecting 'CompuMate' as a controller type for a non- + CompuMate ROM; this controller type can no longer be manually + selected, and will be used automatically used for CompuMate ROMs. + * Added debugger pseudo-register '_fcycles', which gives the number of CPU cycles that have occurred since the frame started. diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index dc1a50b69..d9424c6d4 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -461,8 +461,6 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& return new AtariVoxWidget(boss, font, x, y, controller); case Controller::BoosterGrip: return new BoosterWidget(boss, font, x, y, controller); - case Controller::CompuMate: // TODO - implement this - return new NullControlWidget(boss, font, x, y, controller); case Controller::Driving: return new DrivingWidget(boss, font, x, y, controller); case Controller::Genesis: @@ -471,10 +469,8 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& return new JoystickWidget(boss, font, x, y, controller); case Controller::Keyboard: return new KeyboardWidget(boss, font, x, y, controller); - case Controller::KidVid: // TODO - implement this - return new NullControlWidget(boss, font, x, y, controller); - case Controller::MindLink: // TODO - implement this - return new NullControlWidget(boss, font, x, y, controller); +// case Controller::KidVid: // TODO - implement this +// case Controller::MindLink: // TODO - implement this case Controller::Paddles: return new PaddleWidget(boss, font, x, y, controller); case Controller::SaveKey: @@ -482,7 +478,7 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& case Controller::TrakBall: return new TrakBallWidget(boss, font, x, y, controller); default: - return nullptr; // make compiler happy + return new NullControlWidget(boss, font, x, y, controller); } } diff --git a/src/emucore/DefProps.hxx b/src/emucore/DefProps.hxx index 6b3524fd6..95ac7e822 100644 --- a/src/emucore/DefProps.hxx +++ b/src/emucore/DefProps.hxx @@ -2376,7 +2376,7 @@ static const char* const DefProps[DEF_PROPS_SIZE][21] = { { "b9336ed6d94a5cc81a16483b0a946a73", "Atari, Jerome Domurat, Michael Sierchio", "CX2667, CX2667P", "RealSports Soccer (1983) (Atari) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" }, { "b958d5fd9574c5cf9ece4b9421c28ecd", "Piero Cavina", "", "Multi-Sprite Game V1.0 (Piero Cavina) (PD)", "", "New Release", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "b95a6274ca0e0c773bfdc06b4c3daa42", "Paul Slocum", "", "3-D Corridor (29-03-2003) (Paul Slocum)", "", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, - { "b98cc2c6f7a0f05176f74f0f62c45488", "Spectravideo", "SV-010", "CompuMate (1983) (Spectravideo)", "", "", "", "CM", "", "", "", "", "COMPUMATE", "COMPUMATE", "", "", "", "", "", "YES", "80" }, + { "b98cc2c6f7a0f05176f74f0f62c45488", "Spectravideo", "SV-010", "CompuMate (1983) (Spectravideo)", "", "", "", "CM", "", "", "", "", "", "", "", "", "", "", "", "YES", "80" }, { "b9b4612358a0b2c1b4d66bb146767306", "Commavid, Ben Burch", "CM-010", "Rush Hour (1983) (Commavid) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "23", "245", "", "" }, { "b9d1e3be30b131324482345959aed5e5", "Activision, Rex Bradford", "", "Kabobber (07-25-1983) (Activision) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "b9f6fa399b8cd386c235983ec45e4355", "Parker Brothers, John Emerson", "931511", "Action Force (1983) (Parker Bros) (PAL)", "AKA G.I. Joe - Cobra Strike", "", "", "", "", "", "", "", "PADDLES", "", "", "01 55", "", "", "", "", "" }, @@ -2994,7 +2994,7 @@ static const char* const DefProps[DEF_PROPS_SIZE][21] = { { "e7864caaf9ec49ed67b1904ce8602690", "", "", "Donkey Kong 2K3 Pic (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "e7a758bb0b43d0f7004e92b9abf4bc83", "", "", "Troll's Adventure (Hack)", "Hack of Adventure", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "e7dd8c2e6c100044002c1086d02b366e", "Activision, Steve Cartwright - Ariola", "EAX-013, PAX-013, 711 013-720", "Barnstorming (1982) (Activision) (PAL)", "AKA Die tollkeuhnen Flieger", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, - { "e7f005ddb6902c648de098511f6ae2e5", "Spectravideo - Universum", "SV-010", "CompuMate (1983) (Spectravideo) (PAL)", "", "", "", "CM", "", "", "", "", "COMPUMATE", "COMPUMATE", "", "", "", "", "", "YES", "80" }, + { "e7f005ddb6902c648de098511f6ae2e5", "Spectravideo - Universum", "SV-010", "CompuMate (1983) (Spectravideo) (PAL)", "", "", "", "CM", "", "", "", "", "", "", "", "", "", "", "", "YES", "80" }, { "e800e4aec7c6c54c9cf3db0d1d030058", "", "", "Qb (2.06) (Retroactive) (Stella)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" }, { "e80a4026d29777c3c7993fbfaee8920f", "", "", "Frisco (Unknown)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "e823b13751e4388f1f2a375d3560a8d7", "Arcadia Corporation, Stephen Harland Landrum", "AR-4105", "Official Frogger (Preview) (1983) (Arcadia) [a]", "", "", "", "", "", "", "", "", "", "", "", "", "", "32", "", "", "" }, diff --git a/src/emucore/stella.pro b/src/emucore/stella.pro index b80bea13f..9c4230f17 100644 --- a/src/emucore/stella.pro +++ b/src/emucore/stella.pro @@ -14379,8 +14379,6 @@ "Cartridge.ModelNo" "SV-010" "Cartridge.Name" "CompuMate (1983) (Spectravideo)" "Cartridge.Type" "CM" -"Controller.Left" "COMPUMATE" -"Controller.Right" "COMPUMATE" "Display.Phosphor" "YES" "Display.PPBlend" "80" "" @@ -18178,8 +18176,6 @@ "Cartridge.ModelNo" "SV-010" "Cartridge.Name" "CompuMate (1983) (Spectravideo) (PAL)" "Cartridge.Type" "CM" -"Controller.Left" "COMPUMATE" -"Controller.Right" "COMPUMATE" "Display.Phosphor" "YES" "Display.PPBlend" "80" "" diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index e875b79f9..80f62b5be 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -185,7 +185,8 @@ GameInfoDialog::GameInfoDialog( ypos = vBorder; pwidth = font.getStringWidth("Paddles_IAxis"); - t = new StaticTextWidget(myTab, font, hSpace, ypos+1, "P0 Controller ", kTextAlignLeft); + myP0Label = new StaticTextWidget(myTab, font, hSpace, ypos+1, + "P0 Controller ", kTextAlignLeft); ctrls.clear(); VarList::push_back(ctrls, "Joystick", "JOYSTICK" ); VarList::push_back(ctrls, "Paddles", "PADDLES" ); @@ -201,18 +202,18 @@ GameInfoDialog::GameInfoDialog( VarList::push_back(ctrls, "AtariVox", "ATARIVOX" ); VarList::push_back(ctrls, "SaveKey", "SAVEKEY" ); VarList::push_back(ctrls, "Sega Genesis", "GENESIS" ); - VarList::push_back(ctrls, "CompuMate", "COMPUMATE" ); // VarList::push_back(ctrls, "KidVid", "KIDVID" ); VarList::push_back(ctrls, "MindLink", "MINDLINK" ); - myP0Controller = new PopUpWidget(myTab, font, t->getRight(), t->getTop()-1, + myP0Controller = new PopUpWidget(myTab, font, myP0Label->getRight(), myP0Label->getTop()-1, pwidth, lineHeight, ctrls, "", 0, kLeftCChanged); wid.push_back(myP0Controller); ypos += lineHeight + vGap; pwidth = font.getStringWidth("Paddles_IAxis"); - t = new StaticTextWidget(myTab, font, hSpace, ypos+1, "P1 Controller ", kTextAlignLeft); - myP1Controller = new PopUpWidget(myTab, font, t->getRight(), t->getTop()-1, + myP1Label = new StaticTextWidget(myTab, font, hSpace, ypos+1, + "P1 Controller ", kTextAlignLeft); + myP1Controller = new PopUpWidget(myTab, font, myP1Label->getRight(), myP1Label->getTop()-1, pwidth, lineHeight, ctrls, "", 0, kRightCChanged); wid.push_back(myP1Controller); @@ -226,7 +227,7 @@ GameInfoDialog::GameInfoDialog( wid.push_back(mySwapPaddles); // EEPROM erase button for P0 - ypos += lineHeight + vGap + 4 ; + ypos += lineHeight + vGap + 4; myEraseEEPROMLabel = new StaticTextWidget(myTab, font, hSpace, ypos, "AtariVox/SaveKey "); myEraseEEPROMButton = new ButtonWidget(myTab, font, myEraseEEPROMLabel->getRight(), ypos - 4, "Erase EEPROM", kEEButtonPressed); @@ -546,38 +547,25 @@ void GameInfoDialog::setDefaults() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void GameInfoDialog::updateControllerStates(int cmd) +void GameInfoDialog::updateControllerStates() { - string contrP0 = myP0Controller->getSelectedTag().toString(); - string contrP1 = myP1Controller->getSelectedTag().toString(); + const string& contrP0 = myP0Controller->getSelectedTag().toString(); + const string& contrP1 = myP1Controller->getSelectedTag().toString(); bool enableEEEraseButton = false; bool enableSwapPaddles = false; bool enableSwapPorts = false; - // make sure the CompuMate is always selected for both controllers - if(cmd == kLeftCChanged) - { - if(contrP0 == "COMPUMATE") - myP1Controller->setSelected("COMPUMATE"); - else if(contrP1 == "COMPUMATE") - myP1Controller->setSelected(contrP0); - } - if(cmd == kRightCChanged) - { - if(contrP1 == "COMPUMATE") - myP0Controller->setSelected("COMPUMATE"); - else if(contrP0 == "COMPUMATE") - myP0Controller->setSelected(contrP1); - } + // Compumate bankswitching scheme doesn't allow to select controllers + bool enableSelectControl = myType->getSelectedTag() != "CM"; - enableSwapPorts = myP0Controller->getSelectedTag().toString() != "COMPUMATE"; - enableSwapPaddles = string::npos != contrP0.find("PADDLES") - || string::npos != contrP1.find("PADDLES"); + enableSwapPorts = enableSelectControl; + enableSwapPaddles = BSPF::startsWithIgnoreCase(contrP0, "PADDLES") || + BSPF::startsWithIgnoreCase(contrP1, "PADDLES"); if(instance().hasConsole()) { - Controller& lport = instance().console().leftController(); - Controller& rport = instance().console().rightController(); + const Controller& lport = instance().console().leftController(); + const Controller& rport = instance().console().rightController(); // we only enable the button if we have a valid previous and new controller. enableEEEraseButton = ((lport.type() == Controller::SaveKey && contrP0 == "SAVEKEY") @@ -586,12 +574,13 @@ void GameInfoDialog::updateControllerStates(int cmd) || (rport.type() == Controller::AtariVox && contrP1 == "ATARIVOX")); } + myP0Label->setEnabled(enableSelectControl); + myP1Label->setEnabled(enableSelectControl); + myP0Controller->setEnabled(enableSelectControl); + myP1Controller->setEnabled(enableSelectControl); + mySwapPorts->setEnabled(enableSwapPorts); - //if(!enableSwapPaddles) - // mySwapPorts->setState(false); mySwapPaddles->setEnabled(enableSwapPaddles); - //if(!enableSwapPaddles) - // mySwapPaddles->setState(false); myEraseEEPROMLabel->setEnabled(enableEEEraseButton); myEraseEEPROMButton->setEnabled(enableEEEraseButton); @@ -632,9 +621,17 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd, setDefaults(); break; + case kTabChangedCmd: + if(data == 2) // 'Controller' tab selected + updateControllerStates(); + + // The underlying dialog still needs access to this command + Dialog::handleCommand(sender, cmd, data, 0); + break; + case kLeftCChanged: case kRightCChanged: - updateControllerStates(cmd); + updateControllerStates(); break; case kEEButtonPressed: @@ -676,7 +673,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd, case kMCtrlChanged: { - bool state = myMouseControl->getSelectedTag().toString() != "AUTO"; + bool state = myMouseControl->getSelectedTag() != "AUTO"; myMouseX->setEnabled(state); myMouseY->setEnabled(state); break; diff --git a/src/gui/GameInfoDialog.hxx b/src/gui/GameInfoDialog.hxx index 77b9d2fd0..4d7705da0 100644 --- a/src/gui/GameInfoDialog.hxx +++ b/src/gui/GameInfoDialog.hxx @@ -45,7 +45,7 @@ class GameInfoDialog : public Dialog, public CommandSender void setDefaults() override; void loadView(); - void updateControllerStates(int cmd = 0); + void updateControllerStates(); void eraseEEPROM(); private: @@ -67,6 +67,8 @@ class GameInfoDialog : public Dialog, public CommandSender PopUpWidget* myTVType; // Controller properties + StaticTextWidget* myP0Label; + StaticTextWidget* myP1Label; PopUpWidget* myP0Controller; PopUpWidget* myP1Controller; CheckboxWidget* mySwapPorts; @@ -74,8 +76,6 @@ class GameInfoDialog : public Dialog, public CommandSender StaticTextWidget* myEraseEEPROMLabel; ButtonWidget* myEraseEEPROMButton; StaticTextWidget* myEraseEEPROMInfo; - PopUpWidget* myLeftPort; - PopUpWidget* myRightPort; PopUpWidget* myMouseControl; PopUpWidget* myMouseX; PopUpWidget* myMouseY;