Skip to content

Commit

Permalink
fix: fix #1606
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Jan 1, 2025
1 parent 8d6643e commit 66196ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/ll/api/memory/win/Signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ void* SignatureView::resolve(std::span<std::byte> range, bool disableErrorOutput
getLogger().fatal("Couldn't find: {}", toString());
getLogger().fatal("In module: {}", sys_utils::getCallerModuleFileName());
}
return (void*)result.get();
return result.has_result() ? (void*)result.get() : nullptr;
}
} // namespace ll::memory
30 changes: 8 additions & 22 deletions src/mc/deps/core/utility/typeid_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,20 @@ std::atomic_ushort& Bedrock::typeid_t<CommandRegistry>::_getCounter() {
return *(std::atomic_ushort*)"?storage@?1??_getCounter@?$typeid_t@VCommandRegistry@@@Bedrock@@CAAEAU?$atomic@G@std@"
"@XZ@4U45@A"_symp;
}
#define LL_TYPEID_STORAGE_SYMBOL(TYPE, SYMBOL) \
#define LL_TYPEID_STORAGE_ID(TYPE, ID) \
template <> \
Bedrock::typeid_t<CommandRegistry> Bedrock::type_id<CommandRegistry, TYPE>() { \
static auto* id = \
(Bedrock::typeid_t<CommandRegistry>*)"?id@?1???$type_id@VCommandRegistry@@" SYMBOL \
"@Bedrock@@YA?AV?$typeid_t@VCommandRegistry@@@1@XZ@4V21@A"_sig \
\
\
.resolve(true); \
if (!id) { \
static auto* fn = (Bedrock::typeid_t<CommandRegistry>(*)() \
) "??$type_id@VCommandRegistry@@" SYMBOL "@Bedrock@@YA?AV?$typeid_t@VCommandRegistry@@@0@XZ"_sig \
\
\
.resolve(); \
if (fn) { \
return fn(); \
} \
return 0; \
} \
(Bedrock::typeid_t<CommandRegistry>*)"?id@?1???$type_id@VCommandRegistry@@" ID \
"@Bedrock@@YA?AV?$typeid_t@VCommandRegistry@@@1@XZ@4V21@A"_symp; \
return *id; \
}

LL_TYPEID_STORAGE_SYMBOL(CommandItem, "VCommandItem@@");
LL_TYPEID_STORAGE_SYMBOL(MobEffect const*, "PEBVMobEffect@@");
LL_TYPEID_STORAGE_SYMBOL(DimensionType, "V?$AutomaticID@VDimension@@");
LL_TYPEID_STORAGE_SYMBOL(CommandIntegerRange, "VCommandIntegerRange@@");
LL_TYPEID_STORAGE_SYMBOL(ActorDefinitionIdentifier const*, "PEBUActorDefinitionIdentifier@@");
LL_TYPEID_STORAGE_ID(CommandItem, "VCommandItem@@");
LL_TYPEID_STORAGE_ID(MobEffect const*, "PEBVMobEffect@@");
LL_TYPEID_STORAGE_ID(DimensionType, "V?$AutomaticID@VDimension@@H@@");
LL_TYPEID_STORAGE_ID(CommandIntegerRange, "VCommandIntegerRange@@");
LL_TYPEID_STORAGE_ID(ActorDefinitionIdentifier const*, "PEBUActorDefinitionIdentifier@@");

ushort Bedrock::crtypidImpl(size_t type) {
static ll::ConcurrentDenseMap<size_t, ushort> map;
Expand Down

0 comments on commit 66196ff

Please sign in to comment.