|
11 | 11 | #include "context\IConsoleContext.hh" |
12 | 12 | #include "context\IRcClient.hh" |
13 | 13 | #include "context\impl\ConsoleContext.hh" |
| 14 | +#include "context\impl\EmulatorMemoryContext.hh" |
14 | 15 |
|
15 | 16 | #include "data\context\EmulatorContext.hh" |
16 | 17 | #include "data\context\GameContext.hh" |
@@ -428,20 +429,30 @@ API void CCONV _RA_SetUserAgentDetail(const char* sDetail) |
428 | 429 |
|
429 | 430 | API void CCONV _RA_InstallMemoryBank(int nBankID, void* pReader, void* pWriter, int nBankSize) |
430 | 431 | { |
431 | | - ra::services::ServiceLocator::GetMutable<ra::data::context::EmulatorContext>().AddMemoryBlock(nBankID, nBankSize, |
432 | | - static_cast<ra::data::context::EmulatorContext::MemoryReadFunction*>(pReader), |
433 | | - static_cast<ra::data::context::EmulatorContext::MemoryWriteFunction*>(pWriter)); |
| 432 | + auto* pEmulatorMemoryContext = dynamic_cast<ra::context::impl::EmulatorMemoryContext*>(&ra::services::ServiceLocator::GetMutable<ra::context::IEmulatorMemoryContext>()); |
| 433 | + if (pEmulatorMemoryContext) |
| 434 | + { |
| 435 | + pEmulatorMemoryContext->AddMemoryBlock(nBankID, nBankSize, |
| 436 | + static_cast<ra::context::impl::EmulatorMemoryContext::MemoryReadFunction*>(pReader), |
| 437 | + static_cast<ra::context::impl::EmulatorMemoryContext::MemoryWriteFunction*>(pWriter)); |
| 438 | + } |
434 | 439 | } |
435 | 440 |
|
436 | 441 | API void CCONV _RA_InstallMemoryBankBlockReader(int nBankID, void* pReader) |
437 | 442 | { |
438 | | - ra::services::ServiceLocator::GetMutable<ra::data::context::EmulatorContext>().AddMemoryBlockReader( |
439 | | - nBankID, static_cast<ra::data::context::EmulatorContext::MemoryReadBlockFunction*>(pReader)); |
| 443 | + auto* pEmulatorMemoryContext = dynamic_cast<ra::context::impl::EmulatorMemoryContext*>(&ra::services::ServiceLocator::GetMutable<ra::context::IEmulatorMemoryContext>()); |
| 444 | + if (pEmulatorMemoryContext) |
| 445 | + { |
| 446 | + pEmulatorMemoryContext->AddMemoryBlockReader( |
| 447 | + nBankID, static_cast<ra::context::impl::EmulatorMemoryContext::MemoryReadBlockFunction*>(pReader)); |
| 448 | + } |
440 | 449 | } |
441 | 450 |
|
442 | 451 | API void CCONV _RA_ClearMemoryBanks() |
443 | 452 | { |
444 | | - ra::services::ServiceLocator::GetMutable<ra::data::context::EmulatorContext>().ClearMemoryBlocks(); |
| 453 | + auto* pEmulatorMemoryContext = dynamic_cast<ra::context::impl::EmulatorMemoryContext*>(&ra::services::ServiceLocator::GetMutable<ra::context::IEmulatorMemoryContext>()); |
| 454 | + if (pEmulatorMemoryContext) |
| 455 | + pEmulatorMemoryContext->ClearMemoryBlocks();; |
445 | 456 | } |
446 | 457 |
|
447 | 458 | API unsigned int CCONV _RA_IdentifyRom(const BYTE* pROM, unsigned int nROMSize) |
|
0 commit comments