| e8555c89 Andy McCall |
1 |
#include "MSXCliComm.hh" |
| 2 |
|
| 3 |
#include "GlobalCliComm.hh" |
| 4 |
|
| 5 |
#include "MSXCommandController.hh" |
| 6 |
#include "MSXMotherBoard.hh" |
| 7 |
|
| 8 |
namespace openmsx { |
| 9 |
|
| 10 |
MSXCliComm::MSXCliComm(MSXMotherBoard& motherBoard_, GlobalCliComm& cliComm_) |
| 11 |
: motherBoard(motherBoard_) |
| 12 |
, cliComm(cliComm_) |
| 13 |
{ |
| 14 |
} |
| 15 |
|
| 16 |
void MSXCliComm::log(LogLevel level, std::string_view message, float fraction) |
| 17 |
{ |
| 18 |
if (!suppressMessages) { |
| 19 |
cliComm.log(level, message, fraction); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
void MSXCliComm::update(UpdateType type, std::string_view name, std::string_view value) |
| 24 |
{ |
| 25 |
cliComm.updateHelper(type, motherBoard.getMachineID(), name, value); |
| 26 |
} |
| 27 |
|
| 28 |
void MSXCliComm::updateFiltered(UpdateType type, std::string_view name, std::string_view value) |
| 29 |
{ |
| 30 |
if (auto [it, inserted] = prevValues[type].try_emplace(name, value); |
| 31 |
!inserted) { |
| 32 |
if (it->second == value) { |
| 33 |
return; |
| 34 |
} else { |
| 35 |
it->second = value; |
| 36 |
} |
| 37 |
} |
| 38 |
cliComm.updateHelper(type, motherBoard.getMachineID(), name, value); |
| 39 |
} |
| 40 |
|
| 41 |
void MSXCliComm::setSuppressMessages(bool enable) |
| 42 |
{ |
| 43 |
suppressMessages = enable; |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
} |