fix: logos config not initialized (resolves #691)

bot: make sure rescue zone icon blinking to consider bot reached rescue zone when escorting hostages (ref #688)
bot: remove hardcoded radio communication randoms, so they're now depends on bots personality
refactor: some refactoring of code
This commit is contained in:
jeefo 2025-05-07 13:07:40 +03:00
commit 6dfb09f110
No known key found for this signature in database
GPG key ID: D696786B81B667C8
26 changed files with 180 additions and 141 deletions

View file

@ -109,19 +109,22 @@ public:
};
// used for transit calls between game dll and engine without all needed functions on bot side
class DynamicLinkerHook : public Singleton <DynamicLinkerHook> {
class EntityLinkHook : public Singleton <EntityLinkHook> {
private:
#if defined(CR_WINDOWS)
# define DLSYM_FUNCTION GetProcAddress
# define DLCLOSE_FUNCTION FreeLibrary
#elif defined(CR_PSVITA) // just a shim
# define DLSYM_FUNCTION vrtld_dlsym
# define DLCLOSE_FUNCTION vrtld_dlclose
#else
# define DLSYM_FUNCTION dlsym
# define DLCLOSE_FUNCTION dlclose
#endif
private:
using DlsymProto = SharedLibrary::Func CR_STDCALL (SharedLibrary::Handle, const char *);
using DlcloseProto = int CR_STDCALL (SharedLibrary::Handle);
using DlsymProto = decltype (DLSYM_FUNCTION);
using DlcloseProto = decltype (DLCLOSE_FUNCTION);
private:
bool m_paused { false };
@ -133,16 +136,16 @@ private:
SharedLibrary m_self {};
public:
DynamicLinkerHook () = default;
~DynamicLinkerHook () = default;
EntityLinkHook () = default;
~EntityLinkHook () = default;
public:
void initialize ();
bool needsBypass () const;
SharedLibrary::Func lookup (SharedLibrary::Handle module, const char *function);
SharedLibrary::Func lookupSymbol (SharedLibrary::Handle module, const char *function);
decltype (auto) close (SharedLibrary::Handle module) {
decltype (auto) freeLibrary (SharedLibrary::Handle module) {
if (m_self.handle () == module) {
disable ();
return m_dlclose (module);
@ -177,15 +180,15 @@ public:
}
public:
CR_FORCE_STACK_ALIGN static SharedLibrary::Func CR_STDCALL lookupHandler (SharedLibrary::Handle module, const char *function) {
return instance ().lookup (module, function);
CR_FORCE_STACK_ALIGN static SharedLibrary::Func CR_STDCALL lookupHandler (SharedLibrary::Handle handle, const char *function) {
return instance ().lookupSymbol (handle, function);
}
CR_FORCE_STACK_ALIGN static int CR_STDCALL closeHandler (SharedLibrary::Handle module) {
return instance ().close (module);
CR_FORCE_STACK_ALIGN static int CR_STDCALL closeHandler (SharedLibrary::Handle handle) {
return instance ().freeLibrary (handle);
}
};
// expose global
CR_EXPOSE_GLOBAL_SINGLETON (DynamicLinkerHook, entlink);
CR_EXPOSE_GLOBAL_SINGLETON (EntityLinkHook, entlink);
CR_EXPOSE_GLOBAL_SINGLETON (ServerQueryHook, fakequeries);