2021-02-07 19:23:28 +00:00
|
|
|
#include "StdAfx.h"
|
2021-03-28 20:05:30 +01:00
|
|
|
#include "CardManager.h"
|
|
|
|
#include "Registry.h"
|
|
|
|
#include "Harddisk.h"
|
|
|
|
#include "Core.h"
|
2021-11-14 16:05:28 +00:00
|
|
|
#include "Memory.h"
|
2021-12-04 12:47:09 +00:00
|
|
|
#include "Interface.h"
|
2021-05-16 18:48:18 +01:00
|
|
|
#include "Debugger/Debug.h"
|
2021-03-28 20:05:30 +01:00
|
|
|
|
2021-05-05 15:56:10 +01:00
|
|
|
#include "Tfe/tfe.h"
|
2021-02-07 19:23:28 +00:00
|
|
|
#include "frontends/sdl/imgui/settingshelper.h"
|
|
|
|
|
2021-10-19 09:57:20 +01:00
|
|
|
#include "frontends/sdl/imgui/glselector.h"
|
2021-05-16 18:48:18 +01:00
|
|
|
#include "imgui_internal.h"
|
|
|
|
|
2021-12-11 20:08:47 +00:00
|
|
|
void CreateLanguageCard(void);
|
2021-05-16 18:48:18 +01:00
|
|
|
|
2021-02-07 19:23:28 +00:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
const std::map<SS_CARDTYPE, std::string> cards =
|
|
|
|
{
|
2021-12-03 18:46:23 +00:00
|
|
|
{CT_Empty, "Empty"},
|
|
|
|
{CT_Disk2, "Disk2"},
|
|
|
|
{CT_SSC, "SSC"},
|
|
|
|
{CT_MockingboardC, "MockingboardC"},
|
|
|
|
{CT_GenericPrinter, "GenericPrinter"},
|
|
|
|
{CT_GenericHDD, "GenericHDD"},
|
|
|
|
{CT_GenericClock, "GenericClock"},
|
|
|
|
{CT_MouseInterface, "MouseInterface"},
|
|
|
|
{CT_Z80, "Z80"},
|
|
|
|
{CT_Phasor, "Phasor"},
|
|
|
|
{CT_Echo, "Echo"},
|
|
|
|
{CT_SAM, "SAM"},
|
|
|
|
{CT_80Col, "80Col"},
|
|
|
|
{CT_Extended80Col, "Extended80Col"},
|
|
|
|
{CT_RamWorksIII, "RamWorksIII"},
|
|
|
|
{CT_Uthernet, "Uthernet"},
|
|
|
|
{CT_LanguageCard, "LanguageCard"},
|
|
|
|
{CT_LanguageCardIIe, "LanguageCardIIe"},
|
|
|
|
{CT_Saturn128K, "Saturn128K"},
|
|
|
|
{CT_FourPlay, "FourPlay"},
|
|
|
|
{CT_SNESMAX, "SNESMAX"},
|
|
|
|
{CT_VidHD, "VidHD"},
|
|
|
|
{CT_Uthernet2, "Uthernet2"},
|
2021-02-07 19:23:28 +00:00
|
|
|
};
|
|
|
|
|
2021-03-28 20:05:30 +01:00
|
|
|
const std::map<eApple2Type, std::string> apple2Types =
|
2021-02-07 19:23:28 +00:00
|
|
|
{
|
2021-12-03 18:46:23 +00:00
|
|
|
{A2TYPE_APPLE2, "APPLE2"},
|
|
|
|
{A2TYPE_APPLE2PLUS, "APPLE2PLUS"},
|
|
|
|
{A2TYPE_APPLE2JPLUS, "APPLE2JPLUS"},
|
|
|
|
{A2TYPE_APPLE2E, "APPLE2E"},
|
|
|
|
{A2TYPE_APPLE2EENHANCED, "APPLE2EENHANCED"},
|
|
|
|
{A2TYPE_APPLE2C, "APPLE2C"},
|
|
|
|
{A2TYPE_PRAVETS8M, "PRAVETS8M"},
|
|
|
|
{A2TYPE_PRAVETS82, "PRAVETS82"},
|
|
|
|
{A2TYPE_BASE64A, "BASE64A"},
|
|
|
|
{A2TYPE_PRAVETS8A, "PRAVETS8A"},
|
|
|
|
{A2TYPE_TK30002E, "TK30002E"},
|
2021-02-07 19:23:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const std::map<eCpuType, std::string> cpuTypes =
|
|
|
|
{
|
2021-12-03 18:46:23 +00:00
|
|
|
{CPU_6502, "6502"},
|
|
|
|
{CPU_65C02, "65C02"},
|
|
|
|
{CPU_Z80, "Z80"},
|
2021-02-07 19:23:28 +00:00
|
|
|
};
|
2021-03-06 18:00:31 +00:00
|
|
|
|
2021-04-03 09:46:56 +01:00
|
|
|
const std::map<AppMode_e, std::string> appModes =
|
2021-03-06 18:00:31 +00:00
|
|
|
{
|
2021-12-03 18:46:23 +00:00
|
|
|
{MODE_LOGO, "LOGO"},
|
|
|
|
{MODE_PAUSED, "PAUSED"},
|
|
|
|
{MODE_RUNNING, "RUNNING"},
|
|
|
|
{MODE_DEBUG, "DEBUG"},
|
|
|
|
{MODE_STEPPING, "STEPPING"},
|
|
|
|
{MODE_BENCHMARK, "BENCHMARCK"},
|
2021-03-06 18:00:31 +00:00
|
|
|
};
|
2021-03-28 20:05:30 +01:00
|
|
|
|
2021-04-03 08:47:29 +01:00
|
|
|
const std::map<Disk_Status_e, std::string> statuses =
|
|
|
|
{
|
|
|
|
{DISK_STATUS_OFF, "OFF"},
|
|
|
|
{DISK_STATUS_READ, "READ"},
|
|
|
|
{DISK_STATUS_WRITE, "WRITE"},
|
|
|
|
{DISK_STATUS_PROT, "PROT"},
|
|
|
|
};
|
|
|
|
|
2021-04-03 09:46:56 +01:00
|
|
|
const std::map<VideoType_e, std::string> videoTypes =
|
|
|
|
{
|
|
|
|
{VT_MONO_CUSTOM, "Monochrome (Custom)"},
|
|
|
|
{VT_COLOR_IDEALIZED, "Color (Composite Idealized)"},
|
|
|
|
{VT_COLOR_VIDEOCARD_RGB, "Color (RGB Card/Monitor)"},
|
|
|
|
{VT_COLOR_MONITOR_NTSC, "Color (Composite Monitor)"},
|
|
|
|
{VT_COLOR_TV, "Color TV"},
|
|
|
|
{VT_MONO_TV, "B&W TV"},
|
|
|
|
{VT_MONO_AMBER, "Monochrome (Amber)"},
|
|
|
|
{VT_MONO_GREEN, "Monochrome (Green)"},
|
|
|
|
{VT_MONO_WHITE, "Monochrome (White)"},
|
|
|
|
};
|
|
|
|
|
2021-03-28 20:05:30 +01:00
|
|
|
const std::map<size_t, std::vector<SS_CARDTYPE>> cardsForSlots =
|
|
|
|
{
|
|
|
|
{0, {CT_Empty, CT_LanguageCard, CT_Saturn128K}},
|
2021-10-23 20:16:04 +01:00
|
|
|
{1, {CT_Empty, CT_GenericPrinter, CT_Uthernet2}},
|
|
|
|
{2, {CT_Empty, CT_SSC, CT_Uthernet2}},
|
2021-12-03 18:46:23 +00:00
|
|
|
{3, {CT_Empty, CT_Uthernet, CT_Uthernet2, CT_VidHD}},
|
2021-10-23 20:16:04 +01:00
|
|
|
{4, {CT_Empty, CT_MockingboardC, CT_MouseInterface, CT_Phasor, CT_Uthernet2}},
|
|
|
|
{5, {CT_Empty, CT_MockingboardC, CT_Z80, CT_SAM, CT_Disk2, CT_FourPlay, CT_SNESMAX, CT_Uthernet2}},
|
2021-11-14 16:05:28 +00:00
|
|
|
{6, {CT_Empty, CT_Disk2, CT_Uthernet2}},
|
|
|
|
{7, {CT_Empty, CT_GenericHDD, CT_Uthernet2}},
|
2021-03-28 20:05:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const std::vector<SS_CARDTYPE> expansionCards =
|
|
|
|
{CT_Empty, CT_LanguageCard, CT_Extended80Col, CT_Saturn128K, CT_RamWorksIII};
|
2021-06-05 18:04:46 +01:00
|
|
|
|
2021-02-07 19:23:28 +00:00
|
|
|
}
|
|
|
|
|
2021-02-25 16:31:24 +00:00
|
|
|
namespace sa2
|
2021-02-07 19:23:28 +00:00
|
|
|
{
|
|
|
|
|
2021-02-25 16:31:24 +00:00
|
|
|
const std::string & getCardName(SS_CARDTYPE card)
|
|
|
|
{
|
|
|
|
return cards.at(card);
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::string & getApple2Name(eApple2Type type)
|
|
|
|
{
|
2021-03-28 20:05:30 +01:00
|
|
|
return apple2Types.at(type);
|
2021-02-25 16:31:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const std::string & getCPUName(eCpuType cpu)
|
|
|
|
{
|
|
|
|
return cpuTypes.at(cpu);
|
|
|
|
}
|
2021-02-07 19:23:28 +00:00
|
|
|
|
2021-04-03 09:46:56 +01:00
|
|
|
const std::string & getAppModeName(AppMode_e mode)
|
|
|
|
{
|
|
|
|
return appModes.at(mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::string & getVideoTypeName(VideoType_e type)
|
2021-03-06 18:00:31 +00:00
|
|
|
{
|
2021-04-03 09:46:56 +01:00
|
|
|
return videoTypes.at(type);
|
2021-03-06 18:00:31 +00:00
|
|
|
}
|
|
|
|
|
2021-03-28 20:05:30 +01:00
|
|
|
const std::vector<SS_CARDTYPE> & getCardsForSlot(size_t slot)
|
|
|
|
{
|
|
|
|
return cardsForSlots.at(slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector<SS_CARDTYPE> & getExpansionCards()
|
|
|
|
{
|
|
|
|
return expansionCards;
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::map<eApple2Type, std::string> & getAapple2Types()
|
|
|
|
{
|
|
|
|
return apple2Types;
|
|
|
|
}
|
|
|
|
|
2021-04-03 08:47:29 +01:00
|
|
|
const std::string & getDiskStatusName(Disk_Status_e status)
|
|
|
|
{
|
|
|
|
return statuses.at(status);
|
|
|
|
}
|
|
|
|
|
2021-12-04 12:47:09 +00:00
|
|
|
void insertCard(size_t slot, SS_CARDTYPE card, FrameBase * frame)
|
2021-03-28 20:05:30 +01:00
|
|
|
{
|
2021-10-23 20:16:04 +01:00
|
|
|
CardManager & cardManager = GetCardMgr();
|
2021-12-04 12:47:09 +00:00
|
|
|
Video & video = GetVideo();
|
|
|
|
const bool oldHasVid = video.HasVidHD();
|
2021-03-28 20:05:30 +01:00
|
|
|
switch (slot)
|
|
|
|
{
|
2021-12-04 12:47:09 +00:00
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
if (cardManager.QuerySlot(slot) == CT_VidHD)
|
|
|
|
{
|
|
|
|
// the old card was a VidHD, which will be removed
|
|
|
|
// reset it
|
|
|
|
video.SetVidHD(false);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2021-06-05 18:04:46 +01:00
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
{
|
|
|
|
if (card == CT_MockingboardC)
|
|
|
|
{
|
2021-10-23 20:16:04 +01:00
|
|
|
cardManager.Insert(9 - slot, card); // the other
|
2021-06-05 18:04:46 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (cardManager.QuerySlot(slot) == CT_MockingboardC)
|
|
|
|
{
|
2021-10-23 20:16:04 +01:00
|
|
|
cardManager.Insert(9 - slot, CT_Empty); // the other
|
2021-06-05 18:04:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2021-03-28 20:05:30 +01:00
|
|
|
};
|
2021-04-18 19:01:05 +01:00
|
|
|
|
2021-10-23 20:16:04 +01:00
|
|
|
cardManager.Insert(slot, card);
|
2021-11-14 16:06:08 +00:00
|
|
|
|
|
|
|
// keep everything consistent
|
|
|
|
// a bit of a heavy call, but nothing simpler is available now
|
|
|
|
MemInitializeIO();
|
2021-12-04 12:47:09 +00:00
|
|
|
|
|
|
|
if (oldHasVid != video.HasVidHD())
|
|
|
|
{
|
|
|
|
frame->Destroy();
|
|
|
|
frame->Initialize(true);
|
|
|
|
}
|
2021-03-28 20:05:30 +01:00
|
|
|
}
|
|
|
|
|
2021-12-04 13:36:33 +00:00
|
|
|
void setExpansionCard(SS_CARDTYPE card)
|
|
|
|
{
|
|
|
|
SetExpansionMemType(card);
|
|
|
|
CreateLanguageCard();
|
|
|
|
MemInitializeIO();
|
|
|
|
}
|
|
|
|
|
2021-04-03 09:46:56 +01:00
|
|
|
void setVideoStyle(Video & video, const VideoStyle_e style, const bool enabled)
|
|
|
|
{
|
|
|
|
VideoStyle_e currentVideoStyle = video.GetVideoStyle();
|
|
|
|
if (enabled)
|
|
|
|
{
|
|
|
|
currentVideoStyle = VideoStyle_e(currentVideoStyle | style);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
currentVideoStyle = VideoStyle_e(currentVideoStyle & (~style));
|
|
|
|
}
|
|
|
|
video.SetVideoStyle(currentVideoStyle);
|
|
|
|
}
|
|
|
|
|
2021-05-05 15:56:10 +01:00
|
|
|
void saveTFEEnabled(const int enabled)
|
|
|
|
{
|
2021-06-05 16:57:12 +01:00
|
|
|
REGSAVE(TEXT(REGVALUE_UTHERNET_ACTIVE), enabled);
|
2021-05-05 15:56:10 +01:00
|
|
|
}
|
|
|
|
|
2021-05-16 18:48:18 +01:00
|
|
|
void changeBreakpoint(const DWORD nAddress, const bool enableAndSet)
|
|
|
|
{
|
|
|
|
// see _BWZ_RemoveOne
|
|
|
|
for (Breakpoint_t & bp : g_aBreakpoints)
|
|
|
|
{
|
|
|
|
if (bp.bSet && bp.nLength && (nAddress >= bp.nAddress) && (nAddress < bp.nAddress + bp.nLength))
|
|
|
|
{
|
|
|
|
bp.bSet = enableAndSet;
|
|
|
|
bp.bEnabled = enableAndSet;
|
|
|
|
if (!enableAndSet)
|
|
|
|
{
|
|
|
|
bp.nLength = 0;
|
|
|
|
--g_nBreakpoints;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace ImGui
|
|
|
|
{
|
|
|
|
|
|
|
|
bool CheckBoxTristate(const char* label, int* v_tristate)
|
|
|
|
{
|
|
|
|
bool ret;
|
|
|
|
if (*v_tristate == -1)
|
|
|
|
{
|
|
|
|
ImGui::PushItemFlag(ImGuiItemFlags_MixedValue, true);
|
|
|
|
bool b = false;
|
|
|
|
ret = ImGui::Checkbox(label, &b);
|
|
|
|
if (ret)
|
|
|
|
*v_tristate = 1;
|
|
|
|
ImGui::PopItemFlag();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bool b = (*v_tristate != 0);
|
|
|
|
ret = ImGui::Checkbox(label, &b);
|
|
|
|
if (ret)
|
|
|
|
*v_tristate = (int)b;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PushStyleCompact()
|
|
|
|
{
|
|
|
|
ImGuiStyle& style = ImGui::GetStyle();
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(style.FramePadding.x, (float)(int)(style.FramePadding.y * 0.60f)));
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x, (float)(int)(style.ItemSpacing.y * 0.60f)));
|
|
|
|
}
|
|
|
|
|
|
|
|
void PopStyleCompact()
|
|
|
|
{
|
|
|
|
ImGui::PopStyleVar(2);
|
|
|
|
}
|
|
|
|
|
2021-02-07 19:23:28 +00:00
|
|
|
}
|