MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / GetDeviceID

Method GetDeviceID

Sources/Jazz2/PreferencesCache.cpp:728–907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

726 }
727
728 String PreferencesCache::GetDeviceID()
729 {
730#if defined(DEATH_TARGET_X86)
731 std::int32_t arch = 1;
732 Cpu::Features cpuFeatures = Cpu::runtimeFeatures();
733 if (cpuFeatures & Cpu::Avx) {
734 arch |= 0x400;
735 }
736 if (cpuFeatures & Cpu::Avx2) {
737 arch |= 0x800;
738 }
739 if (cpuFeatures & Cpu::Avx512f) {
740 arch |= 0x1000;
741 }
742#elif defined(DEATH_TARGET_ARM)
743 std::int32_t arch = 2;
744 Cpu::Features cpuFeatures = Cpu::runtimeFeatures();
745 if (cpuFeatures & Cpu::Neon) {
746 arch |= 0x2000;
747 }
748#elif defined(DEATH_TARGET_POWERPC)
749 std::int32_t arch = 3;
750#elif defined(DEATH_TARGET_RISCV)
751 std::int32_t arch = 5;
752#elif defined(DEATH_TARGET_WASM)
753 std::int32_t arch = 4;
754 Cpu::Features cpuFeatures = Cpu::runtimeFeatures();
755 if (cpuFeatures & Cpu::Simd128) {
756 arch |= 0x4000;
757 }
758#else
759 std::int32_t arch = 0;
760#endif
761#if defined(DEATH_TARGET_32BIT)
762 arch |= 0x100;
763#endif
764#if defined(DEATH_TARGET_BIG_ENDIAN)
765 arch |= 0x200;
766#endif
767#if defined(DEATH_TARGET_CYGWIN)
768 arch |= 0x200000;
769#endif
770#if defined(DEATH_TARGET_MINGW)
771 arch |= 0x400000;
772#endif
773
774#if defined(DEATH_TARGET_ANDROID)
775 auto sanitizeName = [](char* dst, std::size_t dstMaxLength, std::size_t& dstLength, StringView name, bool isBrand) {
776 bool wasSpace = true;
777 std::size_t lowercaseLength = 0;
778
779 if (isBrand) {
780 for (char c : name) {
781 if (c == '\0' || c == ' ') {
782 break;
783 }
784 lowercaseLength++;
785 }

Callers

nothing calls this directly

Calls 12

formatIntoFunction · 0.85
GetAppleVersionFunction · 0.85
GetSwitchVersionFunction · 0.85
HasSwitchAtmosphereFunction · 0.85
GetUnixFlavorFunction · 0.85
IsWineFunction · 0.85
toBase64UrlFunction · 0.85
runtimeFeaturesFunction · 0.50
arraySizeFunction · 0.50
FromUtf16Function · 0.50
emptyMethod · 0.45
hasPrefixMethod · 0.45

Tested by

no test coverage detected