mirror of https://github.com/stella-emu/stella.git
fix cart detection for 512K ROMs
add new event & hotkey for selecting previous multicart ROM
This commit is contained in:
parent
f284b91f28
commit
70ab70ab46
|
@ -1749,9 +1749,15 @@
|
||||||
<td>Control + 1</td>
|
<td>Control + 1</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Load <i>previous</i> game in ROM (multicart ROM, TIA mode)</td>
|
||||||
|
<td>Shift-Control + r</td>
|
||||||
|
<td>Shift-Control + r</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Reload current ROM (singlecart ROM, TIA mode)<br>
|
<td>Reload current ROM (singlecart ROM, TIA mode)<br>
|
||||||
Load next game in ROM (multicart ROM, TIA mode)</td>
|
Load <i>next</i> game in ROM (multicart ROM, TIA mode)</td>
|
||||||
<td>Control + r</td>
|
<td>Control + r</td>
|
||||||
<td>Control + r</td>
|
<td>Control + r</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -459,6 +459,7 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultCommo
|
||||||
{Event::Quit, KBDK_Q, KBDM_CTRL},
|
{Event::Quit, KBDK_Q, KBDM_CTRL},
|
||||||
#endif
|
#endif
|
||||||
{Event::ReloadConsole, KBDK_R, KBDM_CTRL},
|
{Event::ReloadConsole, KBDK_R, KBDM_CTRL},
|
||||||
|
{Event::PreviousMultiCartRom, KBDK_R, KBDM_SHIFT | KBDM_CTRL},
|
||||||
|
|
||||||
{Event::VidmodeDecrease, KBDK_MINUS, MOD3},
|
{Event::VidmodeDecrease, KBDK_MINUS, MOD3},
|
||||||
{Event::VidmodeIncrease, KBDK_EQUALS, MOD3},
|
{Event::VidmodeIncrease, KBDK_EQUALS, MOD3},
|
||||||
|
|
|
@ -218,6 +218,14 @@ CartDetector::createFromMultiCart(const ByteBuffer& image, size_t& size,
|
||||||
{
|
{
|
||||||
// Get a piece of the larger image
|
// Get a piece of the larger image
|
||||||
uInt32 i = settings.getInt("romloadcount");
|
uInt32 i = settings.getInt("romloadcount");
|
||||||
|
|
||||||
|
// Move to the next game
|
||||||
|
if(!settings.getBool("romloadprev"))
|
||||||
|
i = (i + 1) % numroms;
|
||||||
|
else
|
||||||
|
i = (i - 1) % numroms;
|
||||||
|
settings.setValue("romloadcount", i);
|
||||||
|
|
||||||
size /= numroms;
|
size /= numroms;
|
||||||
ByteBuffer slice = make_unique<uInt8[]>(size);
|
ByteBuffer slice = make_unique<uInt8[]>(size);
|
||||||
std::copy_n(image.get()+i*size, size, slice.get());
|
std::copy_n(image.get()+i*size, size, slice.get());
|
||||||
|
@ -228,9 +236,6 @@ CartDetector::createFromMultiCart(const ByteBuffer& image, size_t& size,
|
||||||
buf << " [G" << (i+1) << "]";
|
buf << " [G" << (i+1) << "]";
|
||||||
id = buf.str();
|
id = buf.str();
|
||||||
|
|
||||||
// Move to the next game the next time this ROM is loaded
|
|
||||||
settings.setValue("romloadcount", (i+1)%numroms);
|
|
||||||
|
|
||||||
if(size <= 2_KB) type = Bankswitch::Type::_2K;
|
if(size <= 2_KB) type = Bankswitch::Type::_2K;
|
||||||
else if(size == 4_KB) type = Bankswitch::Type::_4K;
|
else if(size == 4_KB) type = Bankswitch::Type::_4K;
|
||||||
else if(size == 8_KB) type = Bankswitch::Type::_F8;
|
else if(size == 8_KB) type = Bankswitch::Type::_F8;
|
||||||
|
@ -529,7 +534,13 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, size_t si
|
||||||
}
|
}
|
||||||
else if(size == 512_KB)
|
else if(size == 512_KB)
|
||||||
{
|
{
|
||||||
if(isProbablyTVBoy(image, size))
|
if(isProbably3EX(image, size))
|
||||||
|
type = Bankswitch::Type::_3EX;
|
||||||
|
else if(isProbably3E(image, size))
|
||||||
|
type = Bankswitch::Type::_3E;
|
||||||
|
else if(isProbably3F(image, size))
|
||||||
|
type = Bankswitch::Type::_3F;
|
||||||
|
else if(isProbablyTVBoy(image, size))
|
||||||
type = Bankswitch::Type::_TVBOY;
|
type = Bankswitch::Type::_TVBOY;
|
||||||
}
|
}
|
||||||
else // what else can we do?
|
else // what else can we do?
|
||||||
|
|
|
@ -123,7 +123,7 @@ class Event
|
||||||
ToggleFrameStats, ToggleSAPortOrder, ExitGame,
|
ToggleFrameStats, ToggleSAPortOrder, ExitGame,
|
||||||
// add new events from here to avoid that user remapped events get overwritten
|
// add new events from here to avoid that user remapped events get overwritten
|
||||||
SettingDecrease, SettingIncrease, PreviousSetting, NextSetting,
|
SettingDecrease, SettingIncrease, PreviousSetting, NextSetting,
|
||||||
ToggleAdaptRefresh,
|
ToggleAdaptRefresh, PreviousMultiCartRom,
|
||||||
|
|
||||||
LastType
|
LastType
|
||||||
};
|
};
|
||||||
|
|
|
@ -544,7 +544,11 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Event::ReloadConsole:
|
case Event::ReloadConsole:
|
||||||
if(pressed && !repeated) myOSystem.reloadConsole();
|
if(pressed && !repeated) myOSystem.reloadConsole(true);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Event::PreviousMultiCartRom:
|
||||||
|
if(pressed && !repeated) myOSystem.reloadConsole(false);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Event::VolumeDecrease:
|
case Event::VolumeDecrease:
|
||||||
|
@ -2172,6 +2176,7 @@ void EventHandler::exitEmulation(bool checkLauncher)
|
||||||
EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
|
EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
|
||||||
{ Event::Quit, "Quit", "" },
|
{ Event::Quit, "Quit", "" },
|
||||||
{ Event::ReloadConsole, "Reload current ROM/load next game", "" },
|
{ Event::ReloadConsole, "Reload current ROM/load next game", "" },
|
||||||
|
{ Event::PreviousMultiCartRom, "Load previous multicart game", "" },
|
||||||
{ Event::ExitMode, "Exit current Stella menu/mode", "" },
|
{ Event::ExitMode, "Exit current Stella menu/mode", "" },
|
||||||
{ Event::OptionsMenuMode, "Enter Options menu UI", "" },
|
{ Event::OptionsMenuMode, "Enter Options menu UI", "" },
|
||||||
{ Event::CmdMenuMode, "Toggle Commands menu UI", "" },
|
{ Event::CmdMenuMode, "Toggle Commands menu UI", "" },
|
||||||
|
@ -2409,7 +2414,7 @@ const Event::EventSet EventHandler::MiscEvents = {
|
||||||
// Event::MouseAxisXMove, Event::MouseAxisYMove,
|
// Event::MouseAxisXMove, Event::MouseAxisYMove,
|
||||||
// Event::MouseButtonLeftValue, Event::MouseButtonRightValue,
|
// Event::MouseButtonLeftValue, Event::MouseButtonRightValue,
|
||||||
Event::HandleMouseControl, Event::ToggleGrabMouse,
|
Event::HandleMouseControl, Event::ToggleGrabMouse,
|
||||||
Event::ToggleSAPortOrder,
|
Event::ToggleSAPortOrder, Event::PreviousMultiCartRom
|
||||||
};
|
};
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -525,7 +525,7 @@ class EventHandler
|
||||||
#else
|
#else
|
||||||
REFRESH_SIZE = 0,
|
REFRESH_SIZE = 0,
|
||||||
#endif
|
#endif
|
||||||
EMUL_ACTIONLIST_SIZE = 156 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
|
EMUL_ACTIONLIST_SIZE = 157 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
|
||||||
MENU_ACTIONLIST_SIZE = 18
|
MENU_ACTIONLIST_SIZE = 18
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -399,7 +399,7 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
|
||||||
// Each time a new console is loaded, we simulate a cart removal
|
// Each time a new console is loaded, we simulate a cart removal
|
||||||
// Some carts need knowledge of this, as they behave differently
|
// Some carts need knowledge of this, as they behave differently
|
||||||
// based on how many power-cycles they've been through since plugged in
|
// based on how many power-cycles they've been through since plugged in
|
||||||
mySettings->setValue("romloadcount", 0);
|
mySettings->setValue("romloadcount", -1); // we move to the next game initially
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create an instance of the 2600 game console
|
// Create an instance of the 2600 game console
|
||||||
|
@ -474,8 +474,10 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool OSystem::reloadConsole()
|
bool OSystem::reloadConsole(bool nextrom)
|
||||||
{
|
{
|
||||||
|
mySettings->setValue("romloadprev", !nextrom);
|
||||||
|
|
||||||
return createConsole(myRomFile, myRomMD5, false) == EmptyString;
|
return createConsole(myRomFile, myRomMD5, false) == EmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,9 +345,11 @@ class OSystem
|
||||||
Reloads the current console (essentially deletes and re-creates it).
|
Reloads the current console (essentially deletes and re-creates it).
|
||||||
This can be thought of as a real console off/on toggle.
|
This can be thought of as a real console off/on toggle.
|
||||||
|
|
||||||
|
@param nextrom If true select next multicart ROM, else previous one
|
||||||
|
|
||||||
@return True on successful creation, otherwise false
|
@return True on successful creation, otherwise false
|
||||||
*/
|
*/
|
||||||
bool reloadConsole();
|
bool reloadConsole(bool nextrom = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a new ROM launcher, to select a new ROM to emulate.
|
Creates a new ROM launcher, to select a new ROM to emulate.
|
||||||
|
|
Loading…
Reference in New Issue