gba: add under-the-hood support for direct MMIO reading, to be used for something at some point, maybe

This commit is contained in:
goyuken 2012-11-27 16:44:50 +00:00
parent 178e1a4518
commit 175caf3a53
4 changed files with 35 additions and 2 deletions

View File

@ -116,13 +116,38 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
/// </summary>
public enum MemoryArea : int
{
/// <summary>
/// BIOS, may be invalid if bios not loaded. valid size: 16K. system bus: @00000000h
/// </summary>
bios = 0,
/// <summary>
/// external workram. valid size: 256K. system bus: @02000000h
/// </summary>
ewram = 1,
/// <summary>
/// internal workram. valid size: 32K. system bus: @03000000h
/// </summary>
iwram = 2,
/// <summary>
/// palettes. valid size: 1K. system bus: @05000000h
/// </summary>
palram = 3,
/// <summary>
/// video ram. valid size: 96K. system bus: @06000000h
/// </summary>
vram = 4,
/// <summary>
/// sprite attribute ram. valid size: 1K. system bus: @07000000h
/// </summary>
oam = 5,
rom = 6
/// <summary>
/// rom. always valid to full size, even if no rom or small rom loaded. valid size: 32M. system bus: @08000000h, others
/// </summary>
rom = 6,
/// <summary>
/// direct access to cached io port values. this should NEVER be modified! valid size: 4K. system bus: @04000000h (sort of)
/// </summary>
io = 7
}
/// <summary>

View File

@ -144,7 +144,12 @@ EXPORT void libmeteor_loadbios(const void *data, unsigned size)
EXPORT uint8_t *libmeteor_getmemoryarea(int which)
{
return AMeteor::_memory.GetMemoryArea(which);
if (which < 7)
return AMeteor::_memory.GetMemoryArea(which);
else if (which == 7)
return AMeteor::_io.GetIoPointer();
else
return NULL;
}
EXPORT int libmeteor_loadsaveram(const void *data, unsigned size)

View File

@ -208,6 +208,9 @@ namespace AMeteor
bool SaveState (std::ostream& stream);
bool LoadState (std::istream& stream);
// this should be considered very dangerous to use
uint8_t* GetIoPointer() {return m_iomem;}
private :
uint8_t* m_iomem;
};