Пример #1
0
void ReportWindow::docInfoEditor() {
qDebug("docInfoEditor()");
    ReportProperties * diag = new ReportProperties(this);
    if(diag) {
        // Info
        diag->setReportTitle(reportTitle());
        diag->setReportName(reportName());
        diag->setReportDescription(reportDescription());
        // Background
        diag->setBgEnabled(bgEnabled());
        diag->setBgStatic(bgStatic());
        diag->setBgImageData(bgImage());
        diag->setBgQuery(qsList, bgQuery());
        diag->setBgColumn(bgColumn());
        diag->setBgResizeMode(bgResizeMode());
        diag->setBgAlign(bgAlign());
        diag->setBgBoundsX(bgBoundsX());
        diag->setBgBoundsY(bgBoundsY());
        diag->setBgBoundsWidth(bgBoundsWidth());
        diag->setBgBoundsHeight(bgBoundsHeight());
        diag->setBgOpacity(bgOpacity());
        // Watermark
        diag->setWatermarkOpacity(watermarkOpacity());
        diag->setWmFont(watermarkFont());
        diag->SetUseBestWMFont(watermarkUseDefaultFont());
        diag->setWmTextStatic(watermarkUseStaticText());
        diag->setWmText(watermarkText());
        diag->setWmColumn(watermarkColumn());
        diag->setWmQuery(qsList, watermarkQuery());
        if(diag->exec() == QDialog::Accepted) {
            // Info
            setReportTitle(diag->getReportTitle());
            setReportName(diag->getReportName());
            setReportDescription(diag->getReportDescription());
            // Background
            setBgEnabled(diag->isBgEnabled());
            setBgStatic(diag->isBgStatic());
            setBgImage(diag->getBgImageData());
            setBgQuery(diag->getBgQuery());
            setBgColumn(diag->getBgColumn());
            setBgResizeMode(diag->getBgResizeMode());
            setBgAlign(diag->getBgAlign());
            setBgBoundsX(diag->getBgBoundsX());
            setBgBoundsY(diag->getBgBoundsY());
            setBgBoundsWidth(diag->getBgBoundsWidth());
            setBgBoundsHeight(diag->getBgBoundsHeight());
            setBgOpacity(diag->getBgOpacity());
            // Watermark
            setWatermarkOpacity(diag->getWatermarkOpacity());
            setWatermarkFont(diag->getWmFont());
            setWatermarkUseDefaultFont(diag->getUseBestWmFont());
            setWatermarkUseStaticText(diag->isWmTextStatic());
            setWatermarkText(diag->getWmText());
            setWatermarkColumn(diag->getWmColumn());
            setWatermarkQuery(diag->getWmQuery());
        }
        delete diag;
    }
}
Пример #2
0
void ElDorito::Initialize()
{
	::CreateDirectoryA(GetDirectory().c_str(), NULL);

	// init our command modules
	Modules::ElModules::Instance();

	// load variables/commands from cfg file
	Modules::CommandMap::Instance().ExecuteCommand("Execute dewrito_prefs.cfg");
	Modules::CommandMap::Instance().ExecuteCommand("Execute autoexec.cfg"); // also execute autoexec, which is a user-made cfg guaranteed not to be overwritten by ElDew

	//This should be removed when we can save binds
	Modules::CommandMap::Instance().ExecuteCommand("Bind CAPITAL +VoIP.Talk");

	// Parse command-line commands
	int numArgs = 0;
	LPWSTR* szArgList = CommandLineToArgvW(GetCommandLineW(), &numArgs);
	bool usingLauncher = Modules::ModuleGame::Instance().VarSkipLauncher->ValueInt == 1;
	bool skipKill = false;
	bool dedicated = false;

	if( szArgList && numArgs > 1 )
	{
		std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;

		for( int i = 1; i < numArgs; i++ )
		{
			std::wstring arg = std::wstring(szArgList[i]);
			if( arg.compare(0, 1, L"-") != 0 ) // if it doesn't start with -
				continue;

#ifndef _DEBUG
			if (arg.compare(L"-launcher") == 0)
				usingLauncher = true;
#endif

#ifdef _DEBUG
			if (arg.compare(L"-dedicated") == 0)
			{
				dedicated = true;
			}
#endif

			if (arg.compare(L"-multiInstance") == 0)
			{
				skipKill = true;
			}

			size_t pos = arg.find(L"=");
			if( pos == std::wstring::npos || arg.length() <= pos + 1 ) // if it doesn't contain an =, or there's nothing after the =
				continue;

			std::string argname = converter.to_bytes(arg.substr(1, pos - 1));
			std::string argvalue = converter.to_bytes(arg.substr(pos + 1));

			Modules::CommandMap::Instance().ExecuteCommand(argname + " \"" + argvalue + "\"", true);
		}
	}

	if (dedicated)
	{
		// Commenting this out for now because it makes testing difficult
		/*DetourRestoreAfterWith();
		DetourTransactionBegin();
		DetourUpdateThread(GetCurrentThread());
		DetourAttach((PVOID*)&Video_InitD3D, &hooked_Video_InitD3D);

		if (DetourTransactionCommit() != NO_ERROR) {
		return;
		}*/
		Patches::Network::ForceDedicated();
	}

	// Language patch
	Patch(0x2333FD, { (uint8_t)Modules::ModuleGame::Instance().VarLanguageID->ValueInt }).Apply();

	setWatermarkText("ElDewrito | Version: " + Utils::Version::GetVersionString() + " | Build Date: " __DATE__);

#ifndef _DEBUG
	if (!usingLauncher) // force release builds to use launcher, simple check so its easy to get around if needed
	{
		MessageBox(GetConsoleWindow(), "Please run Halo Online using the ElDewrito launcher.\nIt should be named DewritoUpdater.exe.", "ElDewrito", MB_OK | MB_ICONINFORMATION);
		TerminateProcess(GetCurrentProcess(), 0);
	}
#endif

	if (!skipKill)
	{
		int ourPid = GetCurrentProcessId();
		killProcessByName("eldorado.exe", ourPid);
		killProcessByName("custom_menu.exe", ourPid);
		killProcessByName("DewritoUpdater.exe", ourPid);
	}

	// Initialize server modules
	Server::Chat::Initialize();
	CreateThread(0, 0, StartRconWebSocketServer, 0, 0, 0);
}
Пример #3
0
void ElDorito::Initialize()
{
	::CreateDirectoryA(GetDirectory().c_str(), NULL);

	// Parse command-line commands
	int numArgs = 0;
	LPWSTR* szArgList = CommandLineToArgvW(GetCommandLineW(), &numArgs);

	//Check for the instance switch before initializing anything
	if (szArgList && numArgs > 1)
	{
		for (int i = 1; i < numArgs; i++)
		{
			std::wstring arg = std::wstring(szArgList[i]);
			if (arg.compare(L"-instance") == 0 && i < numArgs - 1)
			{
				instanceName = Utils::String::ThinString(szArgList[i + 1]);

				std::wstringstream wss;
				wss << "preferences_" << szArgList[i + 1] << ".dat";
				std::wstring preferencesName = wss.str();
				wchar_t* str = new wchar_t[preferencesName.size()];
				wcscpy(str, preferencesName.c_str());
				Pointer(0x189D3F0).Write<wchar_t*>(str);
			}
		}
	}

	// init our command modules
	Console::Init();
	Modules::ElModules::Instance();

	// load variables/commands from cfg file
	// If instancing is enabled then load the instanced dewrito_prefs.cfg
	if (instanceName != "")
	{
		std::stringstream ss;
		ss << "Execute dewrito_prefs_" << instanceName << ".cfg";
		Modules::CommandMap::Instance().ExecuteCommand(ss.str());
	}
	else
	{
		Modules::CommandMap::Instance().ExecuteCommand("Execute dewrito_prefs.cfg");
	}
	Modules::CommandMap::Instance().ExecuteCommand("Execute autoexec.cfg"); // also execute autoexec, which is a user-made cfg guaranteed not to be overwritten by ElDew

	//This should be removed when we can save binds
	Modules::CommandMap::Instance().ExecuteCommand("Bind CAPITAL +VoIP.Talk");

	bool usingLauncher = Modules::ModuleGame::Instance().VarSkipLauncher->ValueInt == 1;
	mapsFolder = "maps\\";

	skipTitleSplash = Modules::ModuleGame::Instance().VarSkipTitleSplash->ValueInt == 1;

	if( szArgList && numArgs > 1 )
	{
		std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;

		for( int i = 1; i < numArgs; i++ )
		{
			std::wstring arg = std::wstring(szArgList[i]);
			if( arg.compare(0, 1, L"-") != 0 ) // if it doesn't start with -
				continue;

			if (arg.compare(L"-launcher") == 0)
				usingLauncher = true;

			if (arg.compare(L"-headless") == 0)
			{
				isDedicated = true;
				isHeadless = true;
			}

			if (arg.compare(L"-dedicated") == 0)
			{
				isDedicated = true;
				usingLauncher = true;
			}

			if (arg.compare(L"-maps") == 0 && i < numArgs - 1)
			{
				mapsFolder = Utils::String::ThinString(szArgList[i + 1]);
				if (mapsFolder.length() > 0 && mapsFolder.back() != '\\' && mapsFolder.back() != '/')
					mapsFolder += "\\";
			}

			if (arg.compare(L"-webdebug") == 0)
				webDebugging = true;

			if (arg.compare(L"-connect") == 0 && i < numArgs - 1)
			{
				serverAddress = Utils::String::ThinString(szArgList[i + 1]);
				connectToServer = true;
			}

			if (arg.compare(L"-password") == 0 && i < numArgs - 1)
				serverPassword = Utils::String::ThinString(szArgList[i + 1]);

			size_t pos = arg.find(L"=");
			if( pos == std::wstring::npos || arg.length() <= pos + 1 ) // if it doesn't contain an =, or there's nothing after the =
				continue;

			std::string argname = converter.to_bytes(arg.substr(1, pos - 1));
			std::string argvalue = converter.to_bytes(arg.substr(pos + 1));

			Modules::CommandMap::Instance().ExecuteCommand(argname + " \"" + argvalue + "\"", true);
		}
	}

#if _DEBUG
	// Always enable web debugging in debug builds
	webDebugging = true;
#endif

	Patches::Core::SetMapsFolder(mapsFolder);

	if (isDedicated)
	{
		Patches::Network::ForceDedicated();

		if (isHeadless)
		{
			Patches::Network::ForceHeadless();
			//// Commenting this out for now because it makes testing difficult
			DetourRestoreAfterWith();
			DetourTransactionBegin();
			DetourUpdateThread(GetCurrentThread());
			DetourAttach((PVOID*)&Video_InitD3D, &hooked_Video_InitD3D);

			if (DetourTransactionCommit() != NO_ERROR) {
				return;
			}
		}
		

	}
	else
	{
		Web::Ui::ScreenLayer::Init();
		Web::Ui::MpEventDispatcher::Init();
		Web::Ui::WebChat::Init();
		Web::Ui::WebConsole::Init();
		Web::Ui::WebLoadingScreen::Init();
		Web::Ui::WebScoreboard::Init();
		Web::Ui::Voting::Init();

		if (connectToServer)
		{
			//Skip the title splash screen if we're trying to connect to a server.
			skipTitleSplash = true;

			std::stringstream connectString;
			connectString << "connect " << serverAddress << " " << serverPassword;
			Modules::CommandMap::Instance().ExecuteCommand(connectString.str());
		}
	}

	// Language patch
	Patch(0x2333FD, { (uint8_t)Modules::ModuleGame::Instance().VarLanguageID->ValueInt }).Apply();

	setWatermarkText("ElDewrito | Version: " + Utils::Version::GetVersionString() + " | Build Date: " __DATE__);

#ifndef _DEBUG
	if (!usingLauncher) // force release builds to use launcher, simple check so its easy to get around if needed
	{
		MessageBox(GetConsoleWindow(), "Please run Halo Online using the ElDewrito launcher.\nIt should be named DewritoUpdater.exe.", "ElDewrito", MB_OK | MB_ICONINFORMATION);
		TerminateProcess(GetCurrentProcess(), 0);
	}
#endif

	// Ensure a ban list file exists
	Server::SaveDefaultBanList(Server::LoadDefaultBanList());

	// Initialize server modules
	Server::Chat::Initialize();
	Server::Voting::Init();
	Server::VariableSynchronization::Initialize();
	CreateThread(0, 0, StartRconWebSocketServer, 0, 0, 0);

	if (!Blam::Cache::StringIDCache::Instance.Load("maps\\string_ids.dat"))
	{
		MessageBox(NULL, "Failed to load 'maps\\string_ids.dat'!", "", MB_OK);
	}
}