Merge pull request #1595 from LennyMcLennington/drm-flag
Add CMake option to enable stricter DRM
This commit is contained in:
commit
b995074440
@ -138,6 +138,8 @@ set(Launcher_MSA_CLIENT_ID "6b329578-bfec-42a3-b503-303ab3f2ac96" CACHE STRING "
|
||||
set(Launcher_CURSEFORGE_API_KEY "" CACHE STRING "API key for the CurseForge platform")
|
||||
set(Launcher_CURSEFORGE_API_KEY_API_URL "https://cf.polymc.org/api" CACHE STRING "URL to fetch the Curseforge API key from.")
|
||||
|
||||
# Enable artificial DRM beyond what is forced by Mojang
|
||||
set(Launcher_STRICT_DRM OFF CACHE BOOL "Enables artificial DRM, beyond what is done by Mojang, that prevents you from using offline mode or custom yggdrasil without having a valid Minecraft account added first. This shouldn't need to be enabled unless you're distributing the software on some repo that would require you to enable it.")
|
||||
|
||||
#### Check the current Git commit and branch
|
||||
include(GetGitRevisionDescription)
|
||||
@ -151,6 +153,13 @@ message(STATUS "Git refspec: ${Launcher_GIT_REFSPEC}")
|
||||
string(TIMESTAMP TODAY "%Y-%m-%d")
|
||||
set(Launcher_BUILD_TIMESTAMP "${TODAY}")
|
||||
|
||||
############################ Macro Definitions #############################
|
||||
|
||||
if (Launcher_STRICT_DRM)
|
||||
message("Strict DRM is enabled.")
|
||||
set(Launcher_APP_BINARY_DEFS ${Launcher_APP_BINARY_DEFS} LAUNCHER_STRICT_DRM)
|
||||
endif()
|
||||
|
||||
################################ 3rd Party Libs ################################
|
||||
|
||||
# Find the required Qt parts
|
||||
|
@ -109,6 +109,14 @@ public:
|
||||
MinecraftAccountPtr defaultAccount() const;
|
||||
void setDefaultAccount(MinecraftAccountPtr profileId);
|
||||
bool anyAccountIsValid();
|
||||
bool drmCheck()
|
||||
{
|
||||
#ifdef LAUNCHER_STRICT_DRM
|
||||
return anyAccountIsValid();
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isActive() const;
|
||||
|
||||
|
@ -1700,8 +1700,7 @@ void MainWindow::finalizeInstance(InstancePtr inst)
|
||||
{
|
||||
view->updateGeometries();
|
||||
setSelectedInstanceById(inst->id());
|
||||
if (APPLICATION->accounts()->anyAccountIsValid())
|
||||
{
|
||||
if (APPLICATION->accounts()->drmCheck()) {
|
||||
ProgressDialog loadDialog(this);
|
||||
auto update = inst->createUpdateTask(Net::Mode::Online);
|
||||
connect(update.get(), &Task::failed, [this](QString reason)
|
||||
@ -1714,9 +1713,7 @@ void MainWindow::finalizeInstance(InstancePtr inst)
|
||||
loadDialog.setSkipButton(true, tr("Abort"));
|
||||
loadDialog.execWithTask(update.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
CustomMessageBox::selectable(
|
||||
this,
|
||||
tr("Error"),
|
||||
|
@ -188,7 +188,7 @@ void AccountListPage::on_actionAddMicrosoft_triggered()
|
||||
|
||||
void AccountListPage::on_actionAddOffline_triggered()
|
||||
{
|
||||
if (!m_accounts->anyAccountIsValid()) {
|
||||
if (!m_accounts->drmCheck()) {
|
||||
QMessageBox::warning(
|
||||
this,
|
||||
tr("Error"),
|
||||
|
@ -422,8 +422,7 @@ void VersionPage::on_actionChange_version_triggered()
|
||||
|
||||
void VersionPage::on_actionDownload_All_triggered()
|
||||
{
|
||||
if (!APPLICATION->accounts()->anyAccountIsValid())
|
||||
{
|
||||
if (!APPLICATION->accounts()->drmCheck()) {
|
||||
CustomMessageBox::selectable(
|
||||
this, tr("Error"),
|
||||
tr("Cannot download Minecraft or update instances unless you have at least "
|
||||
|
Loading…
Reference in New Issue
Block a user