Adding a global goto but it still doesn't work with rectangle shadows

This commit is contained in:
Anonymus Raccoon
2020-02-25 02:35:07 +01:00
parent 4437df4666
commit 298f02890e
11 changed files with 91 additions and 14 deletions
+10
View File
@@ -22,4 +22,14 @@ namespace ComSquare::Memory
{
return this->_start;
}
bool IMemory::isMirror()
{
return false;
}
std::shared_ptr<IMemory> IMemory::getMirrored()
{
return nullptr;
}
}
+7
View File
@@ -8,6 +8,7 @@
#include <cstdint>
#include <vector>
#include <memory>
#include "../Models/Int24.hpp"
namespace ComSquare::Memory
@@ -42,6 +43,12 @@ namespace ComSquare::Memory
//! @brief Get the first address mapped to this component.
//! @return the _start value.
virtual uint24_t getStart();
//! @brief Check if this memory is a mirror or not.
//! @return True if this memory is a mirror. False otherwise.
virtual bool isMirror();
//! @brief Return the memory accessor this accessor mirror if any
//! @return nullptr if isMirror is false, the source otherwise.
virtual std::shared_ptr<IMemory> getMirrored();
};
};
+5 -5
View File
@@ -22,11 +22,6 @@ namespace ComSquare
//! @brief The list of components registered inside the bus. Every components that can read/write to a public address should be in this vector.
std::vector<std::shared_ptr<IMemory>> _memoryAccessors;
//! @brief Helper function to get the components that is responsible of read/write at an address.
//! @param addr The address you want to look for.
//! @return The components responsible for the address param or nullptr if none was found.
std::shared_ptr<IMemory> getAccessor(uint24_t addr);
//! @brief The last value read via the memory bus.
uint8_t _openBus = 0;
@@ -54,6 +49,11 @@ namespace ComSquare
//! @brief Map components to the address space using the currently loaded cartridge to set the right mapping mode.
//! @param console All the components.
void mapComponents(SNES &console);
//! @brief Helper function to get the components that is responsible of read/write at an address.
//! @param addr The address you want to look for.
//! @return The components responsible for the address param or nullptr if none was found.
std::shared_ptr<IMemory> getAccessor(uint24_t addr);
};
}
}
+10
View File
@@ -23,4 +23,14 @@ namespace ComSquare::Memory
{
return this->_initial->write(addr, data);
}
bool MemoryShadow::isMirror()
{
return true;
}
std::shared_ptr<IMemory> MemoryShadow::getMirrored()
{
return this->_initial;
}
}
+6
View File
@@ -31,6 +31,12 @@ namespace ComSquare::Memory
//! @param data The data to write.
//! @throw InvalidAddress will be thrown if the address is more than the size of the initial IMemory.
void write(uint24_t addr, uint8_t data) override;
//! @brief Check if this memory is a mirror or not.
//! @return True if this memory is a mirror. False otherwise.
bool isMirror() override;
//! @brief Return the memory accessor this accessor mirror if any
//! @return nullptr if isMirror is false, the source otherwise.
std::shared_ptr<IMemory> getMirrored() override;
};
}
+10
View File
@@ -32,4 +32,14 @@ namespace ComSquare::Memory
this->_bankOffset = bankOffset;
return this;
}
bool RectangleShadow::isMirror()
{
return true;
}
std::shared_ptr<IMemory> RectangleShadow::getMirrored()
{
return this->_initial;
}
}
+6 -1
View File
@@ -34,7 +34,12 @@ namespace ComSquare::Memory
//! @param data The new data to write.
//! @throw This function should thrown an InvalidAddress for address that are not mapped to the component.
void write_internal(uint24_t addr, uint8_t data) override;
//! @brief Check if this memory is a mirror or not.
//! @return True if this memory is a mirror. False otherwise.
bool isMirror() override;
//! @brief Return the memory accessor this accessor mirror if any
//! @return nullptr if isMirror is false, the source otherwise.
std::shared_ptr<IMemory> getMirrored() override;
RectangleShadow *setBankOffset(uint8_t bankOffset);
};