1#ifndef CARTRIDGESLOTMANAGER_HH
2#define CARTRIDGESLOTMANAGER_HH
42 [[nodiscard]]
bool isExternalSlot(
int ps,
int ss,
bool convert)
const;
45 [[nodiscard]]
unsigned getSlot(
int ps,
int ss)
const;
53 std::string_view commandName);
54 void execute(std::span<const TclObject> tokens,
TclObject& result,
55 EmuTime::param time)
override;
56 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
57 void tabCompletion(std::vector<std::string>& tokens)
const override;
58 [[nodiscard]]
bool needRecord(std::span<const TclObject> tokens)
const override;
60 const HardwareConfig* getExtensionConfig(std::string_view cartName);
65 struct CartridgeSlotInfo final :
InfoTopic {
66 explicit CartridgeSlotInfo(
InfoCommand& machineInfoCommand);
67 void execute(std::span<const TclObject> tokens,
69 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
76 void getMediaInfo(
TclObject& result)
override;
78 [[nodiscard]]
bool exists()
const;
79 [[nodiscard]]
bool used(
const HardwareConfig* allowed =
nullptr)
const;
81 std::optional<CartCmd> cartCommand;
82 std::optional<ExtCmd> extCommand;
84 unsigned useCount = 0;
89 static constexpr unsigned MAX_SLOTS = 16 + 4;
90 std::array<Slot, MAX_SLOTS> slots;
CartridgeSlotManager(MSXMotherBoard &motherBoard)
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
void getSpecificSlot(unsigned slot, int &ps, int &ss) const
bool isExternalSlot(int ps, int ss, bool convert) const
void removeExternalSlot(int ps)
void freeSlot(int ps, int ss, const HardwareConfig &hwConfig)
int allocateAnyPrimarySlot(const HardwareConfig &hwConfig)
int allocateSpecificPrimarySlot(unsigned slot, const HardwareConfig &hwConfig)
void allocateSlot(int ps, int ss, const HardwareConfig &hwConfig)
void freePrimarySlot(int ps, const HardwareConfig &hwConfig)
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: