Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions src/Exports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "context\IConsoleContext.hh"
#include "context\IRcClient.hh"
#include "context\impl\ConsoleContext.hh"
#include "context\impl\EmulatorMemoryContext.hh"

#include "data\context\EmulatorContext.hh"
#include "data\context\GameContext.hh"
Expand Down Expand Up @@ -428,20 +429,30 @@ API void CCONV _RA_SetUserAgentDetail(const char* sDetail)

API void CCONV _RA_InstallMemoryBank(int nBankID, void* pReader, void* pWriter, int nBankSize)
{
ra::services::ServiceLocator::GetMutable<ra::data::context::EmulatorContext>().AddMemoryBlock(nBankID, nBankSize,
static_cast<ra::data::context::EmulatorContext::MemoryReadFunction*>(pReader),
static_cast<ra::data::context::EmulatorContext::MemoryWriteFunction*>(pWriter));
auto* pEmulatorMemoryContext = dynamic_cast<ra::context::impl::EmulatorMemoryContext*>(&ra::services::ServiceLocator::GetMutable<ra::context::IEmulatorMemoryContext>());
if (pEmulatorMemoryContext)
{
pEmulatorMemoryContext->AddMemoryBlock(nBankID, nBankSize,
static_cast<ra::context::impl::EmulatorMemoryContext::MemoryReadFunction*>(pReader),
static_cast<ra::context::impl::EmulatorMemoryContext::MemoryWriteFunction*>(pWriter));
}
}

API void CCONV _RA_InstallMemoryBankBlockReader(int nBankID, void* pReader)
{
ra::services::ServiceLocator::GetMutable<ra::data::context::EmulatorContext>().AddMemoryBlockReader(
nBankID, static_cast<ra::data::context::EmulatorContext::MemoryReadBlockFunction*>(pReader));
auto* pEmulatorMemoryContext = dynamic_cast<ra::context::impl::EmulatorMemoryContext*>(&ra::services::ServiceLocator::GetMutable<ra::context::IEmulatorMemoryContext>());
if (pEmulatorMemoryContext)
{
pEmulatorMemoryContext->AddMemoryBlockReader(
nBankID, static_cast<ra::context::impl::EmulatorMemoryContext::MemoryReadBlockFunction*>(pReader));
}
}

API void CCONV _RA_ClearMemoryBanks()
{
ra::services::ServiceLocator::GetMutable<ra::data::context::EmulatorContext>().ClearMemoryBlocks();
auto* pEmulatorMemoryContext = dynamic_cast<ra::context::impl::EmulatorMemoryContext*>(&ra::services::ServiceLocator::GetMutable<ra::context::IEmulatorMemoryContext>());
if (pEmulatorMemoryContext)
pEmulatorMemoryContext->ClearMemoryBlocks();;
}

API unsigned int CCONV _RA_IdentifyRom(const BYTE* pROM, unsigned int nROMSize)
Expand Down
11 changes: 6 additions & 5 deletions src/RA_Defs.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "RA_Defs.h"

#include "util\Strings.hh"
#include "services\ServiceLocator.hh"
#include "context/IEmulatorMemoryContext.hh"

#include "data\context\EmulatorContext.hh"
#include "services/ServiceLocator.hh"

#include "util/Strings.hh"

#include <rcheevos/src/rcheevos/rc_internal.h>

Expand All @@ -13,8 +14,8 @@ _Use_decl_annotations_
std::string ByteAddressToString(ra::data::ByteAddress nAddr)
{
#ifndef RA_UTEST
const auto& pEmulatorContext = ra::services::ServiceLocator::Get<ra::data::context::EmulatorContext>();
return pEmulatorContext.FormatAddress(nAddr);
const auto& pEmulatorMemoryContext = ra::services::ServiceLocator::Get<ra::context::IEmulatorMemoryContext>();
return pEmulatorMemoryContext.FormatAddress(nAddr);
#else
return ra::StringPrintf("0x%04x", nAddr);
#endif
Expand Down
6 changes: 2 additions & 4 deletions src/RA_Integration.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
<ClCompile Include="data\models\MemoryRegionsModel.cpp" />
<ClCompile Include="data\models\RichPresenceModel.cpp" />
<ClCompile Include="data\models\TriggerValidation.cpp" />
<ClCompile Include="data\search\MemBlock.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
Expand All @@ -111,6 +110,7 @@
<ClCompile Include="services\impl\JsonFileConfiguration.cpp" />
<ClCompile Include="services\impl\OfflineRcClient.cpp" />
<ClCompile Include="services\impl\ThreadPool.cpp" />
<ClCompile Include="services\impl\WindowsDebuggerDetector.cpp" />
<ClCompile Include="services\impl\WindowsFileSystem.cpp" />
<ClCompile Include="services\impl\WindowsHttpRequester.cpp" />
<ClCompile Include="services\Initialization.cpp" />
Expand Down Expand Up @@ -234,7 +234,6 @@
<ClInclude Include="data\models\MemoryRegionsModel.hh" />
<ClInclude Include="data\models\RichPresenceModel.hh" />
<ClInclude Include="data\models\TriggerValidation.hh" />
<ClInclude Include="data\search\MemBlock.hh" />
<ClInclude Include="data\Types.hh" />
<ClInclude Include="Exports.hh" />
<ClInclude Include="pch.h" />
Expand All @@ -255,7 +254,6 @@
<ClInclude Include="services\GameIdentifier.hh" />
<ClInclude Include="services\IAudioSystem.hh" />
<ClInclude Include="services\IClipboard.hh" />
<ClInclude Include="services\IClock.hh" />
<ClInclude Include="services\IConfiguration.hh" />
<ClInclude Include="services\ILocalStorage.hh" />
<ClInclude Include="services\ILogger.hh" />
Expand All @@ -264,9 +262,9 @@
<ClInclude Include="services\impl\JsonFileConfiguration.hh" />
<ClInclude Include="services\impl\OfflineRcClient.hh" />
<ClInclude Include="services\impl\ThreadPool.hh" />
<ClInclude Include="services\impl\Clock.hh" />
<ClInclude Include="services\impl\WindowsAudioSystem.hh" />
<ClInclude Include="services\impl\WindowsClipboard.hh" />
<ClInclude Include="services\impl\WindowsDebuggerDetector.hh" />
<ClInclude Include="services\impl\WindowsDebuggerFileLogger.hh" />
<ClInclude Include="services\impl\WindowsFileSystem.hh" />
<ClInclude Include="services\impl\WindowsHttpRequester.hh" />
Expand Down
21 changes: 6 additions & 15 deletions src/RA_Integration.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
<Filter Include="Services\Search">
<UniqueIdentifier>{e978c08c-fedb-4ead-af63-0420b26291bb}</UniqueIdentifier>
</Filter>
<Filter Include="Data\Search">
<UniqueIdentifier>{94064815-198f-4ee6-bdea-3a44f8b79d2d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="RA_md5factory.cpp">
Expand Down Expand Up @@ -399,9 +396,6 @@
<ClCompile Include="services\search\SearchImpl.cpp">
<Filter>Services\Search</Filter>
</ClCompile>
<ClCompile Include="data\search\MemBlock.cpp">
<Filter>Data\Search</Filter>
</ClCompile>
<ClCompile Include="ui\viewmodels\MemoryWatchViewModel.cpp">
<Filter>UI\ViewModels</Filter>
</ClCompile>
Expand All @@ -420,6 +414,9 @@
<ClCompile Include="services\impl\OfflineRcClient.cpp">
<Filter>Services\Impl</Filter>
</ClCompile>
<ClCompile Include="services\impl\WindowsDebuggerDetector.cpp">
<Filter>Services\Impl</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="RA_Resource.h">
Expand Down Expand Up @@ -476,12 +473,6 @@
<ClInclude Include="services\impl\FileLogger.hh">
<Filter>Services\Impl</Filter>
</ClInclude>
<ClInclude Include="services\IClock.hh">
<Filter>Services</Filter>
</ClInclude>
<ClInclude Include="services\impl\Clock.hh">
<Filter>Services\Impl</Filter>
</ClInclude>
<ClInclude Include="services\impl\WindowsDebuggerFileLogger.hh">
<Filter>Services\Impl</Filter>
</ClInclude>
Expand Down Expand Up @@ -1010,9 +1001,6 @@
<ClInclude Include="services\Search\SearchImpl_double32_be_aligned.hh">
<Filter>Services\Search</Filter>
</ClInclude>
<ClInclude Include="data\search\MemBlock.hh">
<Filter>Data\Search</Filter>
</ClInclude>
<ClInclude Include="ui\viewmodels\MemoryWatchViewModel.hh">
<Filter>UI\ViewModels</Filter>
</ClInclude>
Expand All @@ -1034,6 +1022,9 @@
<ClInclude Include="services\impl\OfflineRcClient.hh">
<Filter>Services\Impl</Filter>
</ClInclude>
<ClInclude Include="services\impl\WindowsDebuggerDetector.hh">
<Filter>Services\Impl</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="RA_Shared.rc">
Expand Down
Loading
Loading