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
2 changes: 1 addition & 1 deletion rcheevos
5 changes: 3 additions & 2 deletions src/RA_Integration.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
Expand Down Expand Up @@ -86,7 +89,6 @@
<ClCompile Include="RA_ImageFactory.cpp" />
<ClCompile Include="RA_Json.cpp" />
<ClCompile Include="RA_md5factory.cpp" />
<ClCompile Include="services\AchievementLogicSerializer.cpp" />
<ClCompile Include="services\AchievementRuntime.cpp" />
<ClCompile Include="services\AchievementRuntimeExports.cpp" />
<ClCompile Include="services\FrameEventQueue.cpp" />
Expand Down Expand Up @@ -215,7 +217,6 @@
<ClInclude Include="RA_Log.h" />
<ClInclude Include="RA_md5factory.h" />
<ClInclude Include="RA_Resource.h" />
<ClInclude Include="services\AchievementLogicSerializer.hh" />
<ClInclude Include="services\AchievementRuntime.hh" />
<ClInclude Include="services\AchievementRuntimeExports.hh" />
<ClInclude Include="services\FrameEventQueue.hh" />
Expand Down
6 changes: 0 additions & 6 deletions src/RA_Integration.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,6 @@
<ClCompile Include="ui\win32\PointerInspectorDialog.cpp">
<Filter>UI\Win32</Filter>
</ClCompile>
<ClCompile Include="services\AchievementLogicSerializer.cpp">
<Filter>Services</Filter>
</ClCompile>
<ClCompile Include="services\search\SearchImpl.cpp">
<Filter>Services\Search</Filter>
</ClCompile>
Expand Down Expand Up @@ -827,9 +824,6 @@
<ClInclude Include="ui\win32\bindings\GridMemoryWatchValueColumnBinding.hh">
<Filter>UI\Win32\Bindings</Filter>
</ClInclude>
<ClInclude Include="services\AchievementLogicSerializer.hh">
<Filter>Services</Filter>
</ClInclude>
<ClInclude Include="services\search\SearchImpl.hh">
<Filter>Services\Search</Filter>
</ClInclude>
Expand Down
7 changes: 4 additions & 3 deletions src/base.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<LinkIncremental>false</LinkIncremental>
<UseDebugLibraries>true</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
Expand All @@ -55,6 +54,9 @@
<ProgramDatabaseFile>$(OutDir)\$(TargetName).pdb</ProgramDatabaseFile>
<IgnoreSpecificDefaultLibraries>libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries>
</Link>
<Manifest>
<EnableSegmentHeap>true</EnableSegmentHeap>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
Expand All @@ -80,7 +82,6 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
Expand Down
4 changes: 4 additions & 0 deletions src/devkit/RADevKit.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
<ClCompile Include="data\models\MemoryNotesModel.cpp" />
<ClCompile Include="data\models\MemoryRegionsModel.cpp" />
<ClCompile Include="data\models\RichPresenceModel.cpp" />
<ClCompile Include="data\Requirement.cpp" />
<ClCompile Include="data\util\AchievementLogicSerializer.cpp" />
<ClCompile Include="data\util\IndirectNoteResolver.cpp" />
<ClCompile Include="data\util\TriggerValidation.cpp" />
<ClCompile Include="data\Value.cpp" />
Expand Down Expand Up @@ -118,6 +120,8 @@
<ClInclude Include="data\models\MemoryRegionsModel.hh" />
<ClInclude Include="data\models\RichPresenceModel.hh" />
<ClInclude Include="data\NotifyTargetSet.hh" />
<ClInclude Include="data\Requirement.hh" />
<ClInclude Include="data\util\AchievementLogicSerializer.hh" />
<ClInclude Include="data\util\IndirectNoteResolver.hh" />
<ClInclude Include="data\util\TriggerValidation.hh" />
<ClInclude Include="data\Value.hh" />
Expand Down
12 changes: 12 additions & 0 deletions src/devkit/RADevKit.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@
<ClInclude Include="services\IConfiguration.hh">
<Filter>services</Filter>
</ClInclude>
<ClInclude Include="data\util\AchievementLogicSerializer.hh">
<Filter>data\util</Filter>
</ClInclude>
<ClInclude Include="data\Requirement.hh">
<Filter>data</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="util\GSL.cpp">
Expand Down Expand Up @@ -317,5 +323,11 @@
<ClCompile Include="data\models\AchievementSetModel.cpp">
<Filter>data\models</Filter>
</ClCompile>
<ClCompile Include="data\util\AchievementLogicSerializer.cpp">
<Filter>data\util</Filter>
</ClCompile>
<ClCompile Include="data\Requirement.cpp">
<Filter>data</Filter>
</ClCompile>
</ItemGroup>
</Project>
67 changes: 67 additions & 0 deletions src/devkit/data/Requirement.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include "Requirement.hh"

#include "context/IEmulatorMemoryContext.hh"

#include "services/ServiceLocator.hh"
#include "services/IConfiguration.hh"

#include "util/Strings.hh"

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

namespace ra {
namespace data {

std::wstring Requirement::FormatOperandValue(unsigned nValue, Requirement::OperandType nType)
{
rc_typed_value_t pValue{};
pValue.type = RC_VALUE_TYPE_UNSIGNED;
pValue.value.u32 = nValue;
return FormatOperandValue(pValue, nType);
}

std::wstring Requirement::FormatOperandValue(float fValue, Requirement::OperandType nType)
{
rc_typed_value_t pValue{};
pValue.type = RC_VALUE_TYPE_FLOAT;
pValue.value.f32 = fValue;
return FormatOperandValue(pValue, nType);
}

std::wstring Requirement::FormatOperandValue(rc_typed_value_t& pValue, Requirement::OperandType nType)
{
switch (nType)
{
case ra::data::Requirement::OperandType::Value:
{
rc_typed_value_convert(&pValue, RC_VALUE_TYPE_UNSIGNED);
const auto& pConfiguration = ra::services::ServiceLocator::Get<ra::services::IConfiguration>();
if (pConfiguration.IsFeatureEnabled(ra::services::Feature::PreferDecimal))
return std::to_wstring(pValue.value.u32);

return ra::util::String::Printf(L"0x%02x", pValue.value.u32);
}

case ra::data::Requirement::OperandType::Float:
{
rc_typed_value_convert(&pValue, RC_VALUE_TYPE_FLOAT);
auto sFloat = std::to_wstring(pValue.value.f32);
if (sFloat.find('.') != std::string::npos)
{
while (sFloat.back() == '0')
sFloat.pop_back();
if (sFloat.back() == '.')
sFloat.push_back('0');
}
return sFloat;
}

default:
rc_typed_value_convert(&pValue, RC_VALUE_TYPE_UNSIGNED);
const auto& pMemoryContext = ra::services::ServiceLocator::Get<ra::context::IEmulatorMemoryContext>();
return pMemoryContext.FormatAddress(pValue.value.u32);
}
}

} // namespace data
} // namespace ra
Loading
Loading