Add settings / diagnostics about disks.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
953571a433
commit
25dc50d83c
3 changed files with 101 additions and 23 deletions
|
@ -250,7 +250,7 @@ namespace sa2
|
||||||
CardManager & manager = GetCardMgr();
|
CardManager & manager = GetCardMgr();
|
||||||
for (size_t slot = 1; slot < 8; ++slot)
|
for (size_t slot = 1; slot < 8; ++slot)
|
||||||
{
|
{
|
||||||
const SS_CARDTYPE current = manager.QuerySlot(slot);;
|
const SS_CARDTYPE current = manager.QuerySlot(slot);
|
||||||
if (ImGui::BeginCombo(std::to_string(slot).c_str(), getCardName(current).c_str()))
|
if (ImGui::BeginCombo(std::to_string(slot).c_str(), getCardName(current).c_str()))
|
||||||
{
|
{
|
||||||
const std::vector<SS_CARDTYPE> & cards = getCardsForSlot(slot);
|
const std::vector<SS_CARDTYPE> & cards = getCardsForSlot(slot);
|
||||||
|
@ -299,8 +299,12 @@ namespace sa2
|
||||||
|
|
||||||
if (ImGui::BeginTabItem("Disks"))
|
if (ImGui::BeginTabItem("Disks"))
|
||||||
{
|
{
|
||||||
|
size_t dragAndDropSlot;
|
||||||
|
size_t dragAndDropDrive;
|
||||||
|
frame->getDragDropSlotAndDrive(dragAndDropSlot, dragAndDropDrive);
|
||||||
|
|
||||||
CardManager & cardManager = GetCardMgr();
|
CardManager & cardManager = GetCardMgr();
|
||||||
if (ImGui::BeginTable("Disk2", 11, ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit))
|
if (ImGui::BeginTable("Disk2", 12, ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit))
|
||||||
{
|
{
|
||||||
ImGui::TableSetupColumn("Slot", ImGuiTableColumnFlags_WidthFixed);
|
ImGui::TableSetupColumn("Slot", ImGuiTableColumnFlags_WidthFixed);
|
||||||
ImGui::TableSetupColumn("Drive", ImGuiTableColumnFlags_WidthFixed);
|
ImGui::TableSetupColumn("Drive", ImGuiTableColumnFlags_WidthFixed);
|
||||||
|
@ -311,6 +315,7 @@ namespace sa2
|
||||||
ImGui::TableSetupColumn("Status", ImGuiTableColumnFlags_WidthFixed);
|
ImGui::TableSetupColumn("Status", ImGuiTableColumnFlags_WidthFixed);
|
||||||
ImGui::TableSetupColumn("Eject", ImGuiTableColumnFlags_WidthFixed);
|
ImGui::TableSetupColumn("Eject", ImGuiTableColumnFlags_WidthFixed);
|
||||||
ImGui::TableSetupColumn("Swap", ImGuiTableColumnFlags_WidthFixed);
|
ImGui::TableSetupColumn("Swap", ImGuiTableColumnFlags_WidthFixed);
|
||||||
|
ImGui::TableSetupColumn("D&D", ImGuiTableColumnFlags_WidthFixed);
|
||||||
ImGui::TableSetupColumn("Filename", ImGuiTableColumnFlags_WidthStretch);
|
ImGui::TableSetupColumn("Filename", ImGuiTableColumnFlags_WidthStretch);
|
||||||
ImGui::TableHeadersRow();
|
ImGui::TableHeadersRow();
|
||||||
|
|
||||||
|
@ -326,7 +331,7 @@ namespace sa2
|
||||||
card2->GetLightStatus(statuses + 0, statuses + 1);
|
card2->GetLightStatus(statuses + 0, statuses + 1);
|
||||||
const UINT firmware = card2->GetCurrentFirmware();
|
const UINT firmware = card2->GetCurrentFirmware();
|
||||||
|
|
||||||
for (size_t drive = 0; drive < NUM_DRIVES; ++drive)
|
for (size_t drive = DRIVE_1; drive < NUM_DRIVES; ++drive)
|
||||||
{
|
{
|
||||||
ImGui::PushID(drive);
|
ImGui::PushID(drive);
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
|
@ -363,6 +368,12 @@ namespace sa2
|
||||||
card2->DriveSwap();
|
card2->DriveSwap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if (ImGui::RadioButton("", (dragAndDropSlot == slot) && (dragAndDropDrive == drive)))
|
||||||
|
{
|
||||||
|
frame->setDragDropSlotAndDrive(slot, drive);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::TextUnformatted(card2->GetFullDiskFilename(drive).c_str());
|
ImGui::TextUnformatted(card2->GetFullDiskFilename(drive).c_str());
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
@ -370,22 +381,52 @@ namespace sa2
|
||||||
}
|
}
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HD_CardIsEnabled())
|
||||||
|
{
|
||||||
|
ImGui::PushID(7);
|
||||||
|
Disk_Status_e disk1Status_;
|
||||||
|
HD_GetLightStatus(&disk1Status_);
|
||||||
|
for (size_t drive = HARDDISK_1; drive < NUM_HARDDISKS; ++drive)
|
||||||
|
{
|
||||||
|
ImGui::PushID(drive);
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::Text("%d", SLOT7);
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::Text("%d", drive + 1);
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TextUnformatted("HD");
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
|
||||||
|
ImGui::Text("%d", disk1Status_);
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if (ImGui::SmallButton("Eject"))
|
||||||
|
{
|
||||||
|
HD_Unplug(drive);
|
||||||
|
}
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if (ImGui::SmallButton("Swap"))
|
||||||
|
{
|
||||||
|
HD_ImageSwap();
|
||||||
|
}
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if (ImGui::RadioButton("", (dragAndDropSlot == SLOT7) && (dragAndDropDrive == drive)))
|
||||||
|
{
|
||||||
|
frame->setDragDropSlotAndDrive(SLOT7, drive);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TextUnformatted(HD_GetFullName(drive).c_str());
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hdEnabled = HD_CardIsEnabled();
|
|
||||||
if (ImGui::Checkbox("HD card", &hdEnabled))
|
|
||||||
{
|
|
||||||
HD_SetEnabled(hdEnabled);
|
|
||||||
}
|
|
||||||
ImGui::Button("Hard disk 1");
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextUnformatted(HD_GetFullName(HARDDISK_1).c_str());
|
|
||||||
|
|
||||||
ImGui::Button("Hard disk 2");
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextUnformatted(HD_GetFullName(HARDDISK_2).c_str());
|
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,8 @@ namespace sa2
|
||||||
, myMultiplier(1)
|
, myMultiplier(1)
|
||||||
, myFullscreen(false)
|
, myFullscreen(false)
|
||||||
, mySpeed(options.fixedSpeed)
|
, mySpeed(options.fixedSpeed)
|
||||||
|
, myDragAndDropSlot(SLOT6)
|
||||||
|
, myDragAndDropDrive(DRIVE_1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,14 +266,31 @@ namespace sa2
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CardManager & cardManager = GetCardMgr();
|
CardManager & cardManager = GetCardMgr();
|
||||||
if (cardManager.QuerySlot(SLOT6) == CT_Disk2)
|
SS_CARDTYPE cardInSlot = cardManager.QuerySlot(myDragAndDropSlot);
|
||||||
|
switch (cardInSlot)
|
||||||
{
|
{
|
||||||
// for now we insert in DRIVE_1
|
case CT_Disk2:
|
||||||
Disk2InterfaceCard * card2 = dynamic_cast<Disk2InterfaceCard*>(cardManager.GetObj(SLOT6));
|
|
||||||
const ImageError_e error = card2->InsertDisk(DRIVE_1, drop.file, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
|
||||||
if (error != eIMAGE_ERROR_NONE)
|
|
||||||
{
|
{
|
||||||
card2->NotifyInvalidImage(DRIVE_1, drop.file, error);
|
// for now we insert in DRIVE_1
|
||||||
|
Disk2InterfaceCard * card2 = dynamic_cast<Disk2InterfaceCard*>(cardManager.GetObj(myDragAndDropSlot));
|
||||||
|
const ImageError_e error = card2->InsertDisk(myDragAndDropDrive, drop.file, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
||||||
|
if (error != eIMAGE_ERROR_NONE)
|
||||||
|
{
|
||||||
|
card2->NotifyInvalidImage(myDragAndDropDrive, drop.file, error);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CT_GenericHDD:
|
||||||
|
{
|
||||||
|
if (!HD_Insert(myDragAndDropDrive, drop.file))
|
||||||
|
{
|
||||||
|
FrameMessageBox("Invalid HD image", "ERROR", MB_OK);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FrameMessageBox("Invalid D&D target", "ERROR", MB_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -476,4 +495,16 @@ namespace sa2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SDLFrame::getDragDropSlotAndDrive(size_t & slot, size_t & drive) const
|
||||||
|
{
|
||||||
|
slot = myDragAndDropSlot;
|
||||||
|
drive = myDragAndDropDrive;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDLFrame::setDragDropSlotAndDrive(const size_t slot, const size_t drive)
|
||||||
|
{
|
||||||
|
myDragAndDropSlot = slot;
|
||||||
|
myDragAndDropDrive = drive;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,9 @@ namespace sa2
|
||||||
|
|
||||||
const std::shared_ptr<SDL_Window> & GetWindow() const;
|
const std::shared_ptr<SDL_Window> & GetWindow() const;
|
||||||
|
|
||||||
|
void getDragDropSlotAndDrive(size_t & slot, size_t & drive) const;
|
||||||
|
void setDragDropSlotAndDrive(const size_t slot, const size_t drive);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetApplicationIcon();
|
void SetApplicationIcon();
|
||||||
|
|
||||||
|
@ -52,6 +55,9 @@ namespace sa2
|
||||||
int myMultiplier;
|
int myMultiplier;
|
||||||
bool myFullscreen;
|
bool myFullscreen;
|
||||||
|
|
||||||
|
size_t myDragAndDropSlot;
|
||||||
|
size_t myDragAndDropDrive;
|
||||||
|
|
||||||
common2::Speed mySpeed;
|
common2::Speed mySpeed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue