mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-27 00:07:10 +00:00
Fixing a bug with the write in 0x0
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
namespace ComSquare
|
||||
{
|
||||
//! @brief Exception thrown when someone tries to load an invalid rom.
|
||||
class InvalidAction : std::exception {
|
||||
class InvalidAction : public std::exception {
|
||||
private:
|
||||
std::string _msg;
|
||||
public:
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace ComSquare
|
||||
{
|
||||
//! @brief Exception thrown when trying to read/write to an invalid address.
|
||||
class InvalidAddress : std::exception {
|
||||
class InvalidAddress : public std::exception {
|
||||
private:
|
||||
std::string _msg;
|
||||
public:
|
||||
@@ -25,6 +25,24 @@ namespace ComSquare
|
||||
}
|
||||
const char *what() const noexcept override { return this->_msg.c_str(); }
|
||||
};
|
||||
|
||||
//! @brief Exception thrown when trying to read/write to an invalid address in a rectangle memory region.
|
||||
class InvalidRectangleAddress : public std::exception {
|
||||
private:
|
||||
std::string _msg;
|
||||
public:
|
||||
InvalidRectangleAddress(std::string where, int32_t addr, int16_t subaddr, int16_t start, int16_t end)
|
||||
{
|
||||
std::stringstream stream;
|
||||
stream << "Could not read/write data at address: 0x" << std::hex << addr << " from " << where;
|
||||
if (subaddr < start)
|
||||
stream << " (" << std::hex << subaddr << " < " << start << ")";
|
||||
else
|
||||
stream << " (" << std::hex << subaddr << " > " << end << ")";
|
||||
this->_msg = stream.str();
|
||||
}
|
||||
const char *what() const noexcept override { return this->_msg.c_str(); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif //COMSQUARE_INVALIDADDRESS_HPP
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace ComSquare
|
||||
{
|
||||
//! @brief Exception thrown when someone tries to load an invalid rom.
|
||||
class InvalidRomException : std::exception {
|
||||
class InvalidRomException : public std::exception {
|
||||
private:
|
||||
std::string _msg;
|
||||
public:
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace ComSquare
|
||||
{
|
||||
//! @brief When this is thrown, it means that we should work more.
|
||||
class NotImplementedException : std::exception {
|
||||
class NotImplementedException : public std::exception {
|
||||
public:
|
||||
explicit NotImplementedException() = default;
|
||||
const char *what() const noexcept override { return "Not implemented yet."; }
|
||||
|
||||
Reference in New Issue
Block a user