123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- /*
- * BuildVariants.cpp
- * -----------------
- * Purpose: Handling of various OpenMPT build variants.
- * Notes : (currently none)
- * Authors: OpenMPT Devs
- * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
- */
- #include "stdafx.h"
- #include "BuildVariants.h"
- #include "../common/version.h"
- #include "../misc/mptOS.h"
- #include "../misc/mptCPU.h"
- #include "Mptrack.h"
- OPENMPT_NAMESPACE_BEGIN
- bool BuildVariants::IsKnownSystem()
- {
- return false
- || mpt::OS::Windows::IsOriginal()
- || (mpt::OS::Windows::IsWine() && theApp.GetWineVersion()->Version().IsValid())
- ;
- }
- BuildVariants::Variants BuildVariants::GetBuildVariant()
- {
- #if defined(MPT_BUILD_RETRO)
- return Retro;
- #else
- #if defined(_WIN32_WINNT)
- #if (_WIN32_WINNT >= 0x0A00) // Windows 10
- return Standard;
- #else
- return Legacy;
- #endif
- #else
- return Unknown;
- #endif
- #endif
- }
- mpt::ustring BuildVariants::GetBuildVariantName(BuildVariants::Variants variant)
- {
- mpt::ustring result;
- switch(variant)
- {
- case Standard:
- result = U_("Standard");
- break;
- case Legacy:
- result = U_("Legacy");
- break;
- case Retro:
- result = U_("Retro");
- break;
- case Unknown:
- result = U_("Unknown");
- break;
- }
- return result;
- }
- mpt::ustring BuildVariants::GetBuildVariantDescription(BuildVariants::Variants variant)
- {
- mpt::ustring result;
- switch(variant)
- {
- case Standard:
- result = U_("");
- break;
- case Legacy:
- result = U_("");
- break;
- case Retro:
- result = U_(" RETRO");
- break;
- case Unknown:
- result = U_("");
- break;
- }
- return result;
- }
- mpt::ustring BuildVariants::GuessCurrentBuildName()
- {
- if(GetBuildVariant() == Unknown)
- {
- return mpt::ustring();
- }
- if(mpt::arch_bits == 64)
- {
- if(GetBuildVariant() == Standard)
- {
- return U_("win64");
- } else
- {
- return U_("win64old");
- }
- } else if(mpt::arch_bits == 32)
- {
- if(GetBuildVariant() == Standard)
- {
- return U_("win32");
- } else
- {
- return U_("win32old");
- }
- } else
- {
- return mpt::ustring();
- }
- }
- bool BuildVariants::ProcessorCanRunCurrentBuild()
- {
- #ifdef MPT_ENABLE_ARCH_INTRINSICS
- if((CPU::Info::Get().AvailableFeatures & CPU::GetMinimumFeatures()) != CPU::GetMinimumFeatures())
- {
- return false;
- }
- #endif // MPT_ENABLE_ARCH_INTRINSICS
- return true;
- }
- bool BuildVariants::SystemCanRunCurrentBuild()
- {
- if(mpt::OS::Windows::HostCanRun(mpt::OS::Windows::GetHostArchitecture(), mpt::OS::Windows::GetProcessArchitecture()) == mpt::OS::Windows::EmulationLevel::NA)
- {
- return false;
- }
- #ifdef MPT_ENABLE_ARCH_INTRINSICS
- if((CPU::Info::Get().AvailableFeatures & CPU::GetMinimumFeatures()) != CPU::GetMinimumFeatures())
- {
- return false;
- }
- #endif // MPT_ENABLE_ARCH_INTRINSICS
- if(IsKnownSystem())
- {
- if(mpt::OS::Windows::IsOriginal())
- {
- if(mpt::OS::Windows::Version::Current().IsBefore(mpt::OS::Windows::Version::GetMinimumKernelLevel()))
- {
- return false;
- }
- if(mpt::OS::Windows::Version::Current().IsBefore(mpt::OS::Windows::Version::GetMinimumAPILevel()))
- {
- return false;
- }
- } else if(mpt::OS::Windows::IsWine())
- {
- if(theApp.GetWineVersion()->Version().IsBefore(mpt::OS::Wine::GetMinimumWineVersion()))
- {
- return false;
- }
- }
- }
- return true;
- }
- OPENMPT_NAMESPACE_END
|