Unverified Commit 65332599 authored by Ignacio Sanchez Gines's avatar Ignacio Sanchez Gines
Browse files

Disable save states when running bios

parent 142373d9
Pipeline #40448 failed with stages
in 1 minute and 36 seconds
......@@ -397,7 +397,7 @@ static void main_menu(void)
emu_enable_bootrom_sms(config_emulator.sms_bootrom);
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("When the BIOS is enabled it will execute as in original hardware,\ncausing invalid roms to lock or preventing some other to boot.\n\nSet 'Media Slot' to 'None'in order to boot the games included in BIOS.");
ImGui::SetTooltip("When the BIOS is enabled it will execute as in original hardware,\ncausing invalid roms to lock or preventing some other to boot.\n\nSet 'Media Slot' to 'None' in order to boot the games included in BIOS.");
if (ImGui::MenuItem("Load BIOS..."))
{
open_sms_bootrom = true;
......@@ -419,7 +419,7 @@ static void main_menu(void)
emu_enable_bootrom_gg(config_emulator.gg_bootrom);
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("When the BIOS is enabled it will execute as in original hardware,\ncausing invalid roms to lock or preventing some other to boot.\n\nSet 'Media Slot' to 'None'in order to boot the games included in BIOS.");
ImGui::SetTooltip("When the BIOS is enabled it will execute as in original hardware,\ncausing invalid roms to lock or preventing some other to boot.\n\nSet 'Media Slot' to 'None' in order to boot the games included in BIOS.");
if (ImGui::MenuItem("Load BIOS..."))
{
open_gg_bootrom = true;
......
......@@ -493,6 +493,12 @@ void GearsystemCore::LoadRam(const char* szPath, bool fullPath)
void GearsystemCore::SaveState(int index)
{
if (m_pMemory->GetCurrentSlot() == Memory::MediaSlots::BiosSlot)
{
Log("Save states disabled when running BIOS");
return;
}
Log("Creating save state %d...", index);
SaveState(NULL, index);
......@@ -502,6 +508,12 @@ void GearsystemCore::SaveState(int index)
void GearsystemCore::SaveState(const char* szPath, int index)
{
if (m_pMemory->GetCurrentSlot() == Memory::MediaSlots::BiosSlot)
{
Log("Save states disabled when running BIOS");
return;
}
Log("Creating save state...");
using namespace std;
......@@ -551,6 +563,12 @@ void GearsystemCore::SaveState(const char* szPath, int index)
bool GearsystemCore::SaveState(u8* buffer, size_t& size)
{
if (m_pMemory->GetCurrentSlot() == Memory::MediaSlots::BiosSlot)
{
Log("Save states disabled when running BIOS");
return false;
}
bool ret = false;
if (m_pCartridge->IsReady() && IsValidPointer(m_pMemory->GetCurrentRule()))
......@@ -579,6 +597,12 @@ bool GearsystemCore::SaveState(u8* buffer, size_t& size)
bool GearsystemCore::SaveState(std::ostream& stream, size_t& size)
{
if (m_pMemory->GetCurrentSlot() == Memory::MediaSlots::BiosSlot)
{
Log("Save states disabled when running BIOS");
return false;
}
if (m_pCartridge->IsReady() && IsValidPointer(m_pMemory->GetCurrentRule()))
{
Log("Gathering save state data...");
......@@ -614,6 +638,12 @@ bool GearsystemCore::SaveState(std::ostream& stream, size_t& size)
void GearsystemCore::LoadState(int index)
{
if (m_pMemory->GetCurrentSlot() == Memory::MediaSlots::BiosSlot)
{
Log("Save states disabled when running BIOS");
return;
}
Log("Loading save state %d...", index);
LoadState(NULL, index);
......@@ -623,6 +653,12 @@ void GearsystemCore::LoadState(int index)
void GearsystemCore::LoadState(const char* szPath, int index)
{
if (m_pMemory->GetCurrentSlot() == Memory::MediaSlots::BiosSlot)
{
Log("Save states disabled when running BIOS");
return;
}
Log("Loading save state...");
using namespace std;
......@@ -678,6 +714,12 @@ void GearsystemCore::LoadState(const char* szPath, int index)
bool GearsystemCore::LoadState(const u8* buffer, size_t size)
{
if (m_pMemory->GetCurrentSlot() == Memory::MediaSlots::BiosSlot)
{
Log("Save states disabled when running BIOS");
return false;
}
if (m_pCartridge->IsReady() && IsValidPointer(m_pMemory->GetCurrentRule()) && (size > 0) && IsValidPointer(buffer))
{
Log("Gathering load state data [%d bytes]...", size);
......@@ -698,6 +740,12 @@ bool GearsystemCore::LoadState(const u8* buffer, size_t size)
bool GearsystemCore::LoadState(std::istream& stream)
{
if (m_pMemory->GetCurrentSlot() == Memory::MediaSlots::BiosSlot)
{
Log("Save states disabled when running BIOS");
return false;
}
if (m_pCartridge->IsReady() && IsValidPointer(m_pMemory->GetCurrentRule()))
{
using namespace std;
......
......@@ -345,4 +345,9 @@ int Memory::GetBootromBankCount()
void Memory::SetMediaSlot(MediaSlots slot)
{
m_StoredMediaSlot = slot;
}
Memory::MediaSlots Memory::GetCurrentSlot()
{
return m_MediaSlot;
}
\ No newline at end of file
......@@ -78,6 +78,7 @@ public:
u8* GetBootrom();
int GetBootromBankCount();
void SetMediaSlot(MediaSlots slot);
MediaSlots GetCurrentSlot();
private:
void LoadBootroom(const char* szFilePath, bool gg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment