Exemplo n.º 1
0
void UpdateInfoForm::onButtonPressed(wxCommandEvent& event)
{
	Close();

	UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo( m_uiInternId );

	if (!item)
		return;

	if (m_bLaunch)
	{
		if (item)
		{
			if (m_cbReminder->IsChecked())
				item->addOFlag(UserCore::Item::ItemInfoI::OPTION_NOTREMINDUPDATE);
			else
				item->delOFlag(UserCore::Item::ItemInfoI::OPTION_NOTREMINDUPDATE);
		}
	}

	if (event.GetId() == m_butUpdate->GetId())
	{
		g_pMainApp->handleInternalLink(m_uiInternId, ACTION_UPDATE, FormatArgs("show=true"));
	}
	else if (event.GetId() == m_butLaunch->GetId())
	{
		g_pMainApp->handleInternalLink(m_uiInternId, ACTION_LAUNCH, FormatArgs("noupdate"));
	}
}
Exemplo n.º 2
0
void InternalLink::launchItem(DesuraId id, Args args)
{
	bool cdKeyArg = args.containsArg("cdkey");
	bool noUpdateArg = args.containsArg("noupdate");
	bool exeNumArg = args.containsArg("exe");
	std::string exe = args.getArgValue("exe");

	if (exe == "")
		exeNumArg = false;

	g_pMainApp->showPlay();

	if (checkForPreorder(id))
		return;

	UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo(id);
	bool delFlag=false;

	if (!item || !item->isLaunchable())
	{
		installItem(id, Args());
		return;
	}

	if (!item->hasAcceptedEula())
	{
		showPrompt(id, FormatArgs("prompt=eula"));
		return;
	}

	if (!exeNumArg && item->getExeCount(true) > 1)
	{
		showExeSelect(id, cdKeyArg);
		return;
	}
	else if (exe.size() > 0)
	{
		item->setActiveExe(exe.c_str());
	}

	bool hasCDKey = item->getCurrentBranch() && item->getCurrentBranch()->hasCDKey();
	bool hasDLCDKey = item->getCurrentBranch() && item->getCurrentBranch()->isCDKeyValid();

	if (!cdKeyArg && ((item->isFirstLaunch() && hasCDKey) || (hasCDKey && !hasDLCDKey)))
	{
		showCDKey(id, FormatArgs("launch=true", std::string("exe=") + exe));
		return;
	}

	bool shouldShowGameDisk = false;

	if (args.containsArg("gamedisk") == false && HasAnyFlags(item->getOptions(), UserCore::Item::ItemInfoI::OPTION_DONTPROMPTGAMEDISK) == false)
	{
		size_t x=0; 
		while (g_GameDiskList[x].isOk())
		{
			if (item->getId() == g_GameDiskList[x] || item->getParentId() == g_GameDiskList[x])
			{
				shouldShowGameDisk = true;
				break;
			}

			x++;
		}
	}

	if (shouldShowGameDisk)
	{
		showGameDisk(id, exe.c_str(), cdKeyArg);
		return;
	}

	if (noUpdateArg && !HasAnyFlags(item->getOptions(), UserCore::Item::ItemInfoI::OPTION_NOTREMINDUPDATE))
	{
		item->addOFlag(UserCore::Item::ItemInfoI::OPTION_NOTREMINDUPDATE);
		delFlag = true;
	}

	UI::Forms::ItemForm* form = showItemForm(id, UI::Forms::INSTALL_ACTION::IA_LAUNCH);

	if (!form)
		Warning(gcString("Cant find item (or item not ready) for launch [{0}].\n", id.toInt64()));

	if (item && delFlag)
		item->delOFlag(UserCore::Item::ItemInfoI::OPTION_NOTREMINDUPDATE);
}