/* * rarch_verify_api_version: * * Compare libretro core API version against API version * used by RetroArch. * * TODO - when libretro v2 gets added, allow for switching * between libretro version backend dynamically. **/ void rarch_verify_api_version(void) { RARCH_LOG("Version of libretro API: %u\n", pretro_api_version()); RARCH_LOG("Compiled against API: %u\n", RETRO_API_VERSION); if (pretro_api_version() != RETRO_API_VERSION) RARCH_WARN(RETRO_LOG_LIBRETRO_ABI_BREAK); }
// Not really a hash, but should be enough to differentiate implementations from each other. // Subtle differences in the implementation will not be possible to spot. // The alternative would have been checking serialization sizes, but it was troublesome for cross platform compat. static uint32_t implementation_magic_value(void) { size_t i; uint32_t res = 0; unsigned api = pretro_api_version(); res |= api; const char *lib = g_extern.system.info.library_name; size_t len = strlen(lib); for (i = 0; i < len; i++) res ^= lib[i] << (i & 0xf); lib = g_extern.system.info.library_version; len = strlen(lib); for (i = 0; i < len; i++) res ^= lib[i] << (i & 0xf); const char *ver = PACKAGE_VERSION; len = strlen(ver); for (i = 0; i < len; i++) res ^= ver[i] << ((i & 0xf) + 16); return res; }