1#ifndef CARTRIDGESLOTMANAGER_HH
2#define CARTRIDGESLOTMANAGER_HH
51 [[nodiscard]]
bool isExternalSlot(
int ps,
int ss,
bool convert)
const;
56 return slots[slot].exists();
63 return slots[slot].config;
65 [[nodiscard]] std::pair<int, int>
getPsSs(
unsigned slot)
const {
67 return {slots[slot].ps, slots[slot].ss};
71 std::string result =
strCat(ps);
77 if (slots[slot].config == &config)
return slot;
83 [[nodiscard]]
unsigned getSlot(
int ps,
int ss)
const;
91 std::string_view commandName);
92 void execute(std::span<const TclObject> tokens,
TclObject& result,
93 EmuTime::param time)
override;
94 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
95 void tabCompletion(std::vector<std::string>& tokens)
const override;
96 [[nodiscard]]
bool needRecord(std::span<const TclObject> tokens)
const override;
98 [[nodiscard]]
const HardwareConfig* getExtensionConfig(std::string_view cartName)
const;
103 struct CartridgeSlotInfo final : InfoTopic {
104 explicit CartridgeSlotInfo(InfoCommand& machineInfoCommand);
105 void execute(std::span<const TclObject> tokens,
106 TclObject& result)
const override;
107 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
110 struct Slot :
public MediaInfoProvider {
114 void getMediaInfo(TclObject& result)
override;
116 [[nodiscard]]
bool exists()
const;
117 [[nodiscard]]
bool used(
const HardwareConfig* allowed =
nullptr)
const;
119 std::optional<CartCmd> cartCommand;
120 std::optional<ExtCmd> extCommand;
122 unsigned useCount = 0;
127 std::array<Slot, MAX_SLOTS> slots;
void getAnyFreeSlot(int &ps, int &ss) const
static int getSlotNum(std::string_view slot)
void createExternalSlot(int ps)
void testRemoveExternalSlot(int ps, const HardwareConfig &allowed) const
static constexpr unsigned MAX_SLOTS
void getSpecificSlot(unsigned slot, int &ps, int &ss) const
int getNumberOfSlots() const
bool isExternalSlot(int ps, int ss, bool convert) const
void removeExternalSlot(int ps)
void freeSlot(int ps, int ss, const HardwareConfig &hwConfig)
std::pair< int, int > getPsSs(unsigned slot) const
std::optional< unsigned > findSlotWith(const HardwareConfig &config) const
int allocateAnyPrimarySlot(const HardwareConfig &hwConfig)
int allocateSpecificPrimarySlot(unsigned slot, const HardwareConfig &hwConfig)
std::string getPsSsString(unsigned slot) const
void allocateSlot(int ps, int ss, const HardwareConfig &hwConfig)
const HardwareConfig * getConfigForSlot(unsigned slot) const
void freePrimarySlot(int ps, const HardwareConfig &hwConfig)
bool slotExists(unsigned slot) const
Commands that directly influence the MSX state should send and events so that they can be recorded by...
bool exists(zstring_view filename)
Does this file (directory) exists?
This file implemented 3 utility functions:
auto count_if(InputRange &&range, UnaryPredicate pred)
void strAppend(std::string &result, Ts &&...ts)
constexpr auto xrange(T e)