mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2026-10-11 17:58:06 +08:00
Custom Sky Color and unify some stuff (#1779)
This commit is contained in:
1 parent
248fd36542
commit
3e5cad97e9
169 files changed
+612
-649
No files matched your search
+25
-25
@@ -4,32 +4,32 @@
|
||||
|
||||
namespace memory
|
||||
{
|
||||
std::optional<std::uint8_t> to_hex(char const c)
|
||||
std::optional<uint8_t> to_hex(char const c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '0': return static_cast<std::uint8_t>(0x0);
|
||||
case '1': return static_cast<std::uint8_t>(0x1);
|
||||
case '2': return static_cast<std::uint8_t>(0x2);
|
||||
case '3': return static_cast<std::uint8_t>(0x3);
|
||||
case '4': return static_cast<std::uint8_t>(0x4);
|
||||
case '5': return static_cast<std::uint8_t>(0x5);
|
||||
case '6': return static_cast<std::uint8_t>(0x6);
|
||||
case '7': return static_cast<std::uint8_t>(0x7);
|
||||
case '8': return static_cast<std::uint8_t>(0x8);
|
||||
case '9': return static_cast<std::uint8_t>(0x9);
|
||||
case 'a': return static_cast<std::uint8_t>(0xa);
|
||||
case 'b': return static_cast<std::uint8_t>(0xb);
|
||||
case 'c': return static_cast<std::uint8_t>(0xc);
|
||||
case 'd': return static_cast<std::uint8_t>(0xd);
|
||||
case 'e': return static_cast<std::uint8_t>(0xe);
|
||||
case 'f': return static_cast<std::uint8_t>(0xf);
|
||||
case 'A': return static_cast<std::uint8_t>(0xA);
|
||||
case 'B': return static_cast<std::uint8_t>(0xB);
|
||||
case 'C': return static_cast<std::uint8_t>(0xC);
|
||||
case 'D': return static_cast<std::uint8_t>(0xD);
|
||||
case 'E': return static_cast<std::uint8_t>(0xE);
|
||||
case 'F': return static_cast<std::uint8_t>(0xF);
|
||||
case '0': return static_cast<uint8_t>(0x0);
|
||||
case '1': return static_cast<uint8_t>(0x1);
|
||||
case '2': return static_cast<uint8_t>(0x2);
|
||||
case '3': return static_cast<uint8_t>(0x3);
|
||||
case '4': return static_cast<uint8_t>(0x4);
|
||||
case '5': return static_cast<uint8_t>(0x5);
|
||||
case '6': return static_cast<uint8_t>(0x6);
|
||||
case '7': return static_cast<uint8_t>(0x7);
|
||||
case '8': return static_cast<uint8_t>(0x8);
|
||||
case '9': return static_cast<uint8_t>(0x9);
|
||||
case 'a': return static_cast<uint8_t>(0xa);
|
||||
case 'b': return static_cast<uint8_t>(0xb);
|
||||
case 'c': return static_cast<uint8_t>(0xc);
|
||||
case 'd': return static_cast<uint8_t>(0xd);
|
||||
case 'e': return static_cast<uint8_t>(0xe);
|
||||
case 'f': return static_cast<uint8_t>(0xf);
|
||||
case 'A': return static_cast<uint8_t>(0xA);
|
||||
case 'B': return static_cast<uint8_t>(0xB);
|
||||
case 'C': return static_cast<uint8_t>(0xC);
|
||||
case 'D': return static_cast<uint8_t>(0xD);
|
||||
case 'E': return static_cast<uint8_t>(0xE);
|
||||
case 'F': return static_cast<uint8_t>(0xF);
|
||||
default: return std::nullopt;
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ namespace memory
|
||||
auto c2 = to_hex(ida_sig[i + 1]);
|
||||
if (c1 && c2)
|
||||
{
|
||||
m_bytes.emplace_back(static_cast<std::uint8_t>((*c1 * 0x10) + *c2));
|
||||
m_bytes.emplace_back(static_cast<uint8_t>((*c1 * 0x10) + *c2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace memory
|
||||
for (std::size_t i{}; i != size; ++i)
|
||||
{
|
||||
if (mask[i] != '?')
|
||||
m_bytes.emplace_back(static_cast<const std::uint8_t*>(bytes)[i]);
|
||||
m_bytes.emplace_back(static_cast<const uint8_t*>(bytes)[i]);
|
||||
else
|
||||
m_bytes.push_back(std::nullopt);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ namespace memory
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<std::optional<std::uint8_t>> m_bytes;
|
||||
std::vector<std::optional<uint8_t>> m_bytes;
|
||||
};
|
||||
}
|
||||
@@ -33,7 +33,7 @@ namespace memory
|
||||
|
||||
// https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithm
|
||||
// https://www.youtube.com/watch?v=AuZUeshhy-s
|
||||
std::optional<handle> scan_pattern(const std::optional<std::uint8_t>* sig, std::size_t length, handle begin, std::size_t module_size)
|
||||
std::optional<handle> scan_pattern(const std::optional<uint8_t>* sig, std::size_t length, handle begin, std::size_t module_size)
|
||||
{
|
||||
std::size_t maxShift = length;
|
||||
std::size_t max_idx = length - 1;
|
||||
@@ -96,7 +96,7 @@ namespace memory
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool pattern_matches(std::uint8_t* target, const std::optional<std::uint8_t>* sig, std::size_t length)
|
||||
bool pattern_matches(uint8_t* target, const std::optional<uint8_t>* sig, std::size_t length)
|
||||
{
|
||||
for (std::size_t i{}; i != length; ++i)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ namespace memory
|
||||
const auto scan_end = m_size - length;
|
||||
for (std::uintptr_t i{}; i != scan_end; ++i)
|
||||
{
|
||||
if (pattern_matches(m_base.add(i).as<std::uint8_t*>(), data, length))
|
||||
if (pattern_matches(m_base.add(i).as<uint8_t*>(), data, length))
|
||||
{
|
||||
result.push_back(m_base.add(i));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user