mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-01 16:53:01 +05:00
Streamlined std::variant usage
This commit is contained in:
parent
dc435f9ad2
commit
f13b248376
1 changed files with 10 additions and 10 deletions
|
@ -246,10 +246,10 @@ namespace Memory
|
||||||
switch ( bVer )
|
switch ( bVer )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
if ( std::holds_alternative<PatternAndOffset>(address11) ) return HandlePattern( std::get<PatternAndOffset>(address11) );
|
if ( auto pao = std::get_if<PatternAndOffset>(&address11) ) return HandlePattern( *pao );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const uintptr_t addr = std::get<uintptr_t>(address11);
|
const uintptr_t addr = *std::get_if<uintptr_t>(&address11);
|
||||||
#ifdef assert
|
#ifdef assert
|
||||||
assert(addr);
|
assert(addr);
|
||||||
#endif
|
#endif
|
||||||
|
@ -262,10 +262,10 @@ namespace Memory
|
||||||
return AdjustAddress_11(addr);
|
return AdjustAddress_11(addr);
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
if ( std::holds_alternative<PatternAndOffset>(addressSteam) ) return HandlePattern( std::get<PatternAndOffset>(addressSteam) );
|
if ( auto pao = std::get_if<PatternAndOffset>(&addressSteam) ) return HandlePattern( *pao );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const uintptr_t addr = std::get<uintptr_t>(addressSteam);
|
const uintptr_t addr = *std::get_if<uintptr_t>(&addressSteam);
|
||||||
#ifdef assert
|
#ifdef assert
|
||||||
assert(addr);
|
assert(addr);
|
||||||
#endif
|
#endif
|
||||||
|
@ -278,10 +278,10 @@ namespace Memory
|
||||||
case 3:
|
case 3:
|
||||||
return GetDummy();
|
return GetDummy();
|
||||||
case 4:
|
case 4:
|
||||||
if ( std::holds_alternative<PatternAndOffset>(addressNewsteamR2) ) return HandlePattern( std::get<PatternAndOffset>(addressNewsteamR2) );
|
if ( auto pao = std::get_if<PatternAndOffset>(&addressNewsteamR2) ) return HandlePattern( *pao );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const uintptr_t addr = std::get<uintptr_t>(addressNewsteamR2);
|
const uintptr_t addr = *std::get_if<uintptr_t>(&addressNewsteamR2);
|
||||||
#ifdef assert
|
#ifdef assert
|
||||||
assert(addr);
|
assert(addr);
|
||||||
#endif
|
#endif
|
||||||
|
@ -291,10 +291,10 @@ namespace Memory
|
||||||
return DynBaseAddress(addr);
|
return DynBaseAddress(addr);
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
if ( std::holds_alternative<PatternAndOffset>(addressNewsteamR2_LV) ) return HandlePattern( std::get<PatternAndOffset>(addressNewsteamR2_LV) );
|
if ( auto pao = std::get_if<PatternAndOffset>(&addressNewsteamR2) ) return HandlePattern( *pao );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const uintptr_t addr = std::get<uintptr_t>(addressNewsteamR2_LV);
|
const uintptr_t addr = *std::get_if<uintptr_t>(&addressNewsteamR2_LV);
|
||||||
#ifdef assert
|
#ifdef assert
|
||||||
assert(addr);
|
assert(addr);
|
||||||
#endif
|
#endif
|
||||||
|
@ -304,10 +304,10 @@ namespace Memory
|
||||||
return DynBaseAddress(addr);
|
return DynBaseAddress(addr);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if ( std::holds_alternative<PatternAndOffset>(address10) ) return HandlePattern( std::get<PatternAndOffset>(address10) );
|
if ( auto pao = std::get_if<PatternAndOffset>(&address10) ) return HandlePattern( *pao );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const uintptr_t addr = std::get<uintptr_t>(address10);
|
const uintptr_t addr = *std::get_if<uintptr_t>(&address10);
|
||||||
#ifdef assert
|
#ifdef assert
|
||||||
assert(addr);
|
assert(addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue