Example #1
0
size_t SourceModBase::Format(char *buffer, size_t maxlength, const char *fmt, ...)
{
	size_t len;
	va_list ap;

	va_start(ap, fmt);
	len = FormatArgs(buffer, maxlength, fmt, ap);
	va_end(ap);

	return len;
}
Example #2
0
void GameDiskForm::onButtonClick(wxCommandEvent& event)
{
	if (m_butLaunch->GetId() == event.GetId())
	{
		if (m_cbReminder->GetValue())
			m_pItem->addOFlag(UserCore::Item::ItemInfoI::OPTION_DONTPROMPTGAMEDISK);

		g_pMainApp->handleInternalLink(m_pItem->getId(), ACTION_LAUNCH, FormatArgs(m_szExe.size()?gcString("exe={0}", m_szExe):"", m_bHasSeenCDKey?"cdkey":"", "gamedisk"));
	}

	Close();
}
Example #3
0
// Format the string
void Format(char *buf, UINT size, char *fmt, ...)
{
	va_list args;
	// Validate arguments
	if (buf == NULL || fmt == NULL)
	{
		return;
	}

	va_start(args, fmt);
	FormatArgs(buf, size, fmt, args);
	va_end(args);
}
Example #4
0
void CDKProgress::onError(gcException& e)
{
	if (e.getErrId() == ERR_CDKEY && e.getSecErrId() == 117) //not required
	{
		if (m_bLaunch)
			g_pMainApp->handleInternalLink(getItemId(), ACTION_LAUNCH, FormatArgs("cdkey"));

		GetParent()->Close();
	}

	gcFrame* par = dynamic_cast<gcFrame*>(GetParent());
	if (par)
		par->setProgressState(gcFrame::P_ERROR);

	gcErrorBox(GetParent(), "#CDK_ERRTITLE", "#CDK_ERROR", e);
	GetParent()->Close();
}
Example #5
0
void ExeSelectForm::onButtonClick(wxCommandEvent& event)
{
	for (size_t x=0; x<m_vButtonList.size(); x++)
	{
		if (m_vButtonList[x]->GetId() == event.GetId())
		{
			UserCore::Item::ItemInfoI *item = m_pItemManager->findItemInfo(m_Id);

			std::vector<UserCore::Item::Misc::ExeInfoI*> vExeList;
			item->getExeList(vExeList);

			g_pMainApp->handleInternalLink(m_Id, ACTION_LAUNCH, FormatArgs(std::string("exe=") + vExeList[x]->getName(), m_bHasSeenCDKey?"cdkey":""));
			break;
		}
	}

	Close();
}
Example #6
0
// 文字列をフォーマットして結果を返す
char *CopyFormat(char *fmt, ...)
{
	char *buf;
	char *ret;
	UINT size;
	va_list args;
	// 引数チェック
	if (fmt == NULL)
	{
		return NULL;
	}

	size = MAX(StrSize(fmt) * 10, MAX_SIZE * 10);
	buf = Malloc(size);

	va_start(args, fmt);
	FormatArgs(buf, size, fmt, args);

	ret = CopyStr(buf);
	Free(buf);

	va_end(args);
	return ret;
}
Example #7
0
void OsSpecific::StartPing(QProcess & pr, const QString & adr)
{
    pr.start(GetCmd(), FormatArgs(adr));
}
Example #8
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);
}
Example #9
0
void InternalLink::handleInternalLink(const char* link)
{
	std::vector<gcString> list;
	bool badLink = false;

	g_pMainApp->showMainWindow(true);
	
	if (strncmp("desura://", link, 9) == 0)
	{
		char* str = nullptr;
		Safe::strcpy(&str, link+9, 255);

		char* context = nullptr;

		char* token = Safe::strtok(str, "/", &context);

		while (token)
		{
			list.push_back(gcString(token));
			token = Safe::strtok(nullptr, "/", &context);
		}

		safe_delete(str);
	}
	else
	{	
		badLink = true;
	}

	if (list.size() >= 1)
	{
		if (list[0] == "switchtab" || list[0] == "tab")
		{
			if (!switchTab(badLink, list, link))
				return;
		}
		else if (list[0] == "settings")
		{
			gcString url(GetGCThemeManager()->getWebPage("settings"));

			if (list.size() >=2 )
				url += "#" + list[1];
			else
				url += "#general";

			g_pMainApp->loadUrl(url.c_str(), SUPPORT);
		}
		else if (list[0] == "cip")
		{
			handleInternalLink(0, ACTION_SHOWSETTINGS, FormatArgs("tab=cip"));
		}
		else if (list.size() < 3)
		{
#ifdef WIN32
			if (list[0] == "installwizard")
			{
				handleInternalLink(0, ACTION_INSTALLEDW);
			}
			else 
#endif	
			if (list[0] == "refresh")
			{
				GetUserCore()->forceUpdatePoll();

				if ((list.size() >= 2 && list[1] == "background") == false)
					g_pMainApp->showPlay();
			}
			else
			{
				badLink = true;
			}
		}
		else
		{
			if (!processItemLink(badLink, list, link))
				return;
		}
	}

	if (badLink)
	{
		Warning(gcString("{0} [{1}]\n", Managers::GetString("#MF_BADLINK"), link));

		gcWString errMsg(L"{0}: {1}.", Managers::GetString("#MF_BADLINK"), link);
		gcMessageBox(g_pMainApp->getMainWindow(), errMsg, Managers::GetString(L"#MF_ERRTITLE"));
	}
}
Example #10
0
	void performAction(uint32 index) override
	{
		g_pMainApp->handleInternalLink(m_Pid, ACTION_LAUNCH, FormatArgs());
	}