Esempio n. 1
0
//====================================================================
// La página web ha terminado de cargar
//====================================================================
void CBaseHTML::OnDocumentReady( Awesomium::WebView* caller, const Awesomium::WebURL& url )
{
	try
	{
		m_pSteamID = NULL;

		// Creamos el objeto JavaScript "Game"
		JSValue pGame		= caller->CreateGlobalJavascriptObject( WSLit("Game") );
		JSValue pSteam		= caller->CreateGlobalJavascriptObject( WSLit("Steam") );
		JSValue pPlayer		= caller->CreateGlobalJavascriptObject( WSLit("Player") );

		m_pGameObject	= pGame.ToObject();
		m_pSteamObject	= pSteam.ToObject();
		m_pPlayerObject	= pPlayer.ToObject();

		// Métodos	
		m_pGameObject.SetCustomMethod( WSLit("emitSound"), false);
		m_pGameObject.SetCustomMethod( WSLit("runCommand"), false);
		m_pGameObject.SetCustomMethod( WSLit("reload"), false);
		m_pGameObject.SetCustomMethod( WSLit("log"), false);
		m_pGameObject.SetCustomMethod( WSLit("getCommand"), true );

		// Variables
		m_pPlayerObject.SetProperty( WSLit("health"), JSValue(0) );
		m_pPlayerObject.SetProperty( WSLit("clip1Ammo"), JSValue(0) );
		m_pPlayerObject.SetProperty( WSLit("clip1TotalAmmo"), JSValue(0) );
		m_pPlayerObject.SetProperty( WSLit("info"), JSValue(0) );

		m_pSteamObject.SetProperty( WSLit("playerID"), JSValue(0) );
		m_pSteamObject.SetProperty( WSLit("serverTime"), JSValue(0) );
		m_pSteamObject.SetProperty( WSLit("country"), JSValue(WSLit("NULL")) );
		m_pSteamObject.SetProperty( WSLit("batteryPower"), JSValue(255) );
		m_pSteamObject.SetProperty( WSLit("computerActive"), JSValue(0) );

		m_pGameObject.SetProperty( WSLit("Steam"), JSValue(m_pSteamObject) );
		m_pGameObject.SetProperty( WSLit("Player"), JSValue(m_pPlayerObject) );

		m_pGameObject.SetProperty( WSLit("gameMode"), JSValue(GAME_MODE_NONE) );
		m_pGameObject.SetProperty( WSLit("isInGame"), JSValue(false) );
		m_pGameObject.SetProperty( WSLit("isPaused"), JSValue(false) );
		m_pGameObject.SetProperty( WSLit("maxClients"), JSValue(32) );
		m_pGameObject.SetProperty( WSLit("isLoaded"), JSValue(false) );
	}
	catch( ... )
	{
		Warning("[CBaseHTML::OnDocumentReady] ERROR! \n");
	}

	BaseClass::OnDocumentReady( caller, url );
}
void C_AwesomiumBrowserManager::DispatchJavaScriptMethods(C_AwesomiumBrowserInstance* pBrowserInstance)
{
	//WebView* pWebView = m_webViews[pWebTab];

	std::string previousObjectName = "-1";

	JSValue response;
	JSObject responseObject;
	std::vector<JavaScriptMethodCall_t*>& methodCalls = pBrowserInstance->GetJavaScriptMethodCalls();
	for (auto pJavaScriptMethodCall : methodCalls)
	{
		if (previousObjectName != pJavaScriptMethodCall->objectName)
		{
			previousObjectName = pJavaScriptMethodCall->objectName;
			response = pBrowserInstance->GetWebView()->ExecuteJavascriptWithResult(WSLit(pJavaScriptMethodCall->objectName.c_str()), WSLit(""));
			if (!response.IsObject())
				continue;

			responseObject = response.ToObject();
		}

		JSArray arguments;
		for (auto argument : pJavaScriptMethodCall->methodArguments)
			arguments.Push(WSLit(argument.c_str()));

		responseObject.InvokeAsync(WSLit(pJavaScriptMethodCall->methodName.c_str()), arguments);
	}

	//m_pWebBrowser->DispatchJavaScriptMethods(pWebTab);
}
Esempio n. 3
0
	void BindMethods(WebView* web_view) {
		// Create a global js object named 'app'
		JSValue result = web_view->CreateGlobalJavascriptObject(WSLit("app"));
		if (result.IsObject()) {
			// Bind our custom method to it.
			JSObject& app_object = result.ToObject();
			method_dispatcher_.Bind(app_object,
				WSLit("backgroundGrey"),
				JSDelegate(this, &TutorialApp::BackgroundGrey));

			method_dispatcher_.Bind(app_object,
				WSLit("backgroundWhite"),
				JSDelegate(this, &TutorialApp::BackgroundWhite));

			method_dispatcher_.Bind(app_object,
				WSLit("backgroundBluish"),
				JSDelegate(this, &TutorialApp::BackgroundBluish));
		}

		// Bind our method dispatcher to the WebView
		web_view->set_js_method_handler(&method_dispatcher_);
	}
void C_AwesomiumBrowserManager::DispatchJavaScriptMethod(C_AwesomiumBrowserInstance* pBrowserInstance, std::string objectName, std::string objectMethod, std::vector<std::string> methodArguments)
{
	//WebView* pWebView = m_webViews[pWebTab];

	JSValue response = pBrowserInstance->GetWebView()->ExecuteJavascriptWithResult(WSLit(objectName.c_str()), WSLit(""));
	if (response.IsObject())
	{
		JSObject object = response.ToObject();
		JSArray arguments;

		for (auto argument : methodArguments)
			arguments.Push(WSLit(argument.c_str()));

		object.InvokeAsync(WSLit(objectMethod.c_str()), arguments);
	}

	//m_pWebBrowser->DispatchJavaScriptMethod(pWebTab, objectName, objectMethod, methodArguments);
	/*
	for (auto arg : args)
	{
	DevMsg("Argument: %s\n", arg->text.c_str());
	}
	*/
}
void MenuListener::OnShowPopupMenu(WebView *caller, const WebPopupMenuInfo &menu_info)
{
//	DevMsg("DISABLED FOR TESTING!\n");
//	return;

	//C_WebTab* pWebTab = g_pAnarchyManager->GetWebManager()->GetWebBrowser()->FindWebTab(caller);
	//C_WebTab* pHudWebTab = g_pAnarchyManager->GetWebManager()->GetHudWebTab();
	//WebView* pHudWebView = g_pAnarchyManager->GetWebManager()->GetWebBrowser()->FindWebView(pHudWebTab);

	C_AwesomiumBrowserInstance* pAwesomiumBrowserInstance = g_pAnarchyManager->GetAwesomiumBrowserManager()->FindAwesomiumBrowserInstance(caller);	// FIXME: This should be a general EmbeddedInstance of any type.
	C_AwesomiumBrowserInstance* pHudBrowserInstance = g_pAnarchyManager->GetAwesomiumBrowserManager()->FindAwesomiumBrowserInstance("hud");
	WebView* pHudWebView = pHudBrowserInstance->GetWebView();

	DevMsg("Pop menu detected!\n");

	std::vector<std::string> methodArguments;
	methodArguments.push_back(pAwesomiumBrowserInstance->GetId());
	methodArguments.push_back(VarArgs("%i", menu_info.bounds.x));
	methodArguments.push_back(VarArgs("%i", menu_info.bounds.y));
	methodArguments.push_back(VarArgs("%i", menu_info.bounds.width));
	methodArguments.push_back(VarArgs("%i", menu_info.bounds.height));
	methodArguments.push_back(VarArgs("%i", menu_info.item_height));
	methodArguments.push_back(VarArgs("%f", menu_info.item_font_size));
	methodArguments.push_back(VarArgs("%i", menu_info.selected_item));
	methodArguments.push_back(VarArgs("%i", menu_info.right_aligned));

	for (int i = 0; i < menu_info.items.size(); i++)
	{
		if (menu_info.items[i].type == kWebMenuItemType_Option)
			methodArguments.push_back("Option");
		else if (menu_info.items[i].type == kWebMenuItemType_CheckableOption)
			methodArguments.push_back("CheckableOption");
		else if (menu_info.items[i].type == kWebMenuItemType_Group)
			methodArguments.push_back("Group");
		else if (menu_info.items[i].type == kWebMenuItemType_Separator)
			methodArguments.push_back("Separator");

		methodArguments.push_back(WebStringToCharString(menu_info.items[i].label));
		methodArguments.push_back(WebStringToCharString(menu_info.items[i].tooltip));
		methodArguments.push_back(VarArgs("%i", menu_info.items[i].action));
		methodArguments.push_back(VarArgs("%i", menu_info.items[i].right_to_left));
		methodArguments.push_back(VarArgs("%i", menu_info.items[i].has_directional_override));
		methodArguments.push_back(VarArgs("%i", menu_info.items[i].enabled));
		methodArguments.push_back(VarArgs("%i", menu_info.items[i].checked));
	}
	
	std::string objectName = "window.arcadeHud";
	std::string objectMethod = "showPopupMenu";

	JSValue response = pHudWebView->ExecuteJavascriptWithResult(WSLit(objectName.c_str()), WSLit(""));
	if (response.IsObject())
	{
		JSObject object = response.ToObject();
		JSArray arguments;

		for (auto argument : methodArguments)
			arguments.Push(WSLit(argument.c_str()));

		object.InvokeAsync(WSLit(objectMethod.c_str()), arguments);
	}
}
void C_AwesomiumBrowserManager::CreateAaApi(WebView* pWebView)
{
	DevMsg("Adding AAAPI...\n");

	JSValue result = pWebView->CreateGlobalJavascriptObject(WSLit("aaapi"));
	if (!result.IsObject())
	{
		DevMsg("Failed to create AAAPI.\n");
		g_pAnarchyManager->ThrowEarlyError("Anarchy Arcade cannot detect its UI process.\nPlease adjust your anti-virus software to allow\nAArcade to communicate with its UI and try again.");
		return;
	}

	JSObject& aaapiObject = result.ToObject();

	// SYSTEM
	result = pWebView->CreateGlobalJavascriptObject(WSLit("aaapi.system"));
	if (!result.IsObject())
		return;

	JSObject& systemObject = result.ToObject();
	systemObject.SetCustomMethod(WSLit("quit"), false);
	systemObject.SetCustomMethod(WSLit("launchItem"), false);
	systemObject.SetCustomMethod(WSLit("spawnItem"), false);	// OBSOLETE!!
	systemObject.SetCustomMethod(WSLit("spawnEntry"), false);
	systemObject.SetCustomMethod(WSLit("setLibraryBrowserContext"), false);
	systemObject.SetCustomMethod(WSLit("getLibraryBrowserContext"), true);
	systemObject.SetCustomMethod(WSLit("didSelectPopupMenuItem"), true);
	systemObject.SetCustomMethod(WSLit("didCancelPopupMenu"), true);
	systemObject.SetCustomMethod(WSLit("loadFirstLocalApp"), false);
	systemObject.SetCustomMethod(WSLit("loadNextLocalApp"), false);
	systemObject.SetCustomMethod(WSLit("loadLocalAppClose"), false);
	systemObject.SetCustomMethod(WSLit("detectAllMaps"), false);
	systemObject.SetCustomMethod(WSLit("detectAllModels"), false);
	systemObject.SetCustomMethod(WSLit("detectAllMapScreenshots"), true);
	systemObject.SetCustomMethod(WSLit("getAllMapScreenshots"), true);
	systemObject.SetCustomMethod(WSLit("getScreenshot"), true);
	systemObject.SetCustomMethod(WSLit("getAllMaps"), true);
	systemObject.SetCustomMethod(WSLit("getMap"), true);
	systemObject.SetCustomMethod(WSLit("loadMap"), false);
	systemObject.SetCustomMethod(WSLit("loadMapNow"), false);
	systemObject.SetCustomMethod(WSLit("deactivateInputMode"), false);
	systemObject.SetCustomMethod(WSLit("forceInputMode"), false);
	systemObject.SetCustomMethod(WSLit("hudMouseDown"), false);
	systemObject.SetCustomMethod(WSLit("hudMouseUp"), false);
	systemObject.SetCustomMethod(WSLit("getSelectedWebTab"), true);
	systemObject.SetCustomMethod(WSLit("requestActivateInputMode"), false);
	systemObject.SetCustomMethod(WSLit("simpleImageReady"), false);
	systemObject.SetCustomMethod(WSLit("importSteamGames"), true);
	systemObject.SetCustomMethod(WSLit("saveLibretroKeybind"), false);
	systemObject.SetCustomMethod(WSLit("getLibretroKeybinds"), true);
	//systemObject.SetCustomMethod(WSLit("getLibretroOptions"), true);
	systemObject.SetCustomMethod(WSLit("generateUniqueId"), true);
	systemObject.SetCustomMethod(WSLit("removeAppFilepath"), false);
	systemObject.SetCustomMethod(WSLit("getMapInstances"), true);
	systemObject.SetCustomMethod(WSLit("getInstance"), true);
	systemObject.SetCustomMethod(WSLit("getDefaultLibretroInputDevices"), true);
	systemObject.SetCustomMethod(WSLit("saveLibretroOption"), false);
	systemObject.SetCustomMethod(WSLit("getLibretroOptions"), true);
	systemObject.SetCustomMethod(WSLit("spawnNearestObject"), false);
	systemObject.SetCustomMethod(WSLit("setNearestObjectDist"), true);
	systemObject.SetCustomMethod(WSLit("isInGame"), true);
	systemObject.SetCustomMethod(WSLit("fileBrowse"), false);
	systemObject.SetCustomMethod(WSLit("metaSearch"), false);
	systemObject.SetCustomMethod(WSLit("getDOM"), false);
	systemObject.SetCustomMethod(WSLit("clearAwesomiumCache"), false);
	systemObject.SetCustomMethod(WSLit("disconnect"), false);
	systemObject.SetCustomMethod(WSLit("viewStream"), false);
	systemObject.SetCustomMethod(WSLit("autoInspect"), false);
	systemObject.SetCustomMethod(WSLit("viewPreview"), false);
	systemObject.SetCustomMethod(WSLit("runLibretro"), false);
	systemObject.SetCustomMethod(WSLit("popout"), false);
	systemObject.SetCustomMethod(WSLit("cabinetSelected"), false);
	systemObject.SetCustomMethod(WSLit("modelSelected"), false);
	systemObject.SetCustomMethod(WSLit("objectHover"), false);
	systemObject.SetCustomMethod(WSLit("objectSelected"), false);
	systemObject.SetCustomMethod(WSLit("moveObject"), false);
	systemObject.SetCustomMethod(WSLit("deleteObject"), false);
	systemObject.SetCustomMethod(WSLit("beginImportSteamGames"), false);	// this loads the profile page
	systemObject.SetCustomMethod(WSLit("startImportSteamGames"), false);	// this actually starts adding stuff to the library
	systemObject.SetCustomMethod(WSLit("showEngineOptionsMenu"), false);
	systemObject.SetCustomMethod(WSLit("setSlaveScreen"), false);
	systemObject.SetCustomMethod(WSLit("navigateToURI"), false);
	systemObject.SetCustomMethod(WSLit("getWorldInfo"), true);
	systemObject.SetCustomMethod(WSLit("getDbSize"), true);
	systemObject.SetCustomMethod(WSLit("createDbBackup"), true);
	systemObject.SetCustomMethod(WSLit("viewObjectInfo"), false);
	systemObject.SetCustomMethod(WSLit("getEntityInfo"), true);
	systemObject.SetCustomMethod(WSLit("getObjectInfo"), true);
	systemObject.SetCustomMethod(WSLit("getObject"), true);
	systemObject.SetCustomMethod(WSLit("getAllObjectInfos"), true);
	systemObject.SetCustomMethod(WSLit("getTransformInfo"), true);
	systemObject.SetCustomMethod(WSLit("adjustObjectOffset"), false);
	systemObject.SetCustomMethod(WSLit("adjustObjectRot"), false);
	systemObject.SetCustomMethod(WSLit("adjustObjectScale"), false);
	systemObject.SetCustomMethod(WSLit("goBack"), false);
	systemObject.SetCustomMethod(WSLit("doCopy"), false);
	systemObject.SetCustomMethod(WSLit("goForward"), false);
	systemObject.SetCustomMethod(WSLit("reload"), false);
	systemObject.SetCustomMethod(WSLit("goHome"), false);
	systemObject.SetCustomMethod(WSLit("playSound"), false);
	systemObject.SetCustomMethod(WSLit("libretroPause"), false);
	systemObject.SetCustomMethod(WSLit("libretroReset"), false);
	systemObject.SetCustomMethod(WSLit("libretroSetOverlay"), false);
	systemObject.SetCustomMethod(WSLit("acquire"), false);
	systemObject.SetCustomMethod(WSLit("libretroClearOverlay"), false);
	systemObject.SetCustomMethod(WSLit("libretroSaveOverlay"), false);
	systemObject.SetCustomMethod(WSLit("libretroUpdateDLL"), true);
	systemObject.SetCustomMethod(WSLit("setStartWithWindows"), false);
	systemObject.SetCustomMethod(WSLit("checkStartWithWindows"), true);
	systemObject.SetCustomMethod(WSLit("libretroGetAllDLLs"), true);
	systemObject.SetCustomMethod(WSLit("getLibretroActiveOverlay"), true);
	systemObject.SetCustomMethod(WSLit("getLibretroOverlays"), true);
	systemObject.SetCustomMethod(WSLit("getLibretroGUIGamepadEnabled"), true);
	systemObject.SetCustomMethod(WSLit("setLibretroGUIGamepadEnabled"), false);
	systemObject.SetCustomMethod(WSLit("setLibretroGUIGamepadButtonState"), false);
	systemObject.SetCustomMethod(WSLit("clearLibretroGUIGamepadButtonStates"), false);
	systemObject.SetCustomMethod(WSLit("taskClear"), false);
	systemObject.SetCustomMethod(WSLit("closeTask"), false);
	systemObject.SetCustomMethod(WSLit("hideTask"), false);
	systemObject.SetCustomMethod(WSLit("unhideTask"), false);
	systemObject.SetCustomMethod(WSLit("switchToTask"), false);
	systemObject.SetCustomMethod(WSLit("setTabMenuFile"), false);
	systemObject.SetCustomMethod(WSLit("displayTask"), false);
	systemObject.SetCustomMethod(WSLit("takeScreenshot"), false);
	systemObject.SetCustomMethod(WSLit("deleteScreenshot"), false);
	systemObject.SetCustomMethod(WSLit("teleportScreenshot"), false);
	systemObject.SetCustomMethod(WSLit("saveNewNode"), false);
	systemObject.SetCustomMethod(WSLit("addToastMessage"), false);
	systemObject.SetCustomMethod(WSLit("clearNodeSpace"), false);
	systemObject.SetCustomMethod(WSLit("feedback"), false);
	systemObject.SetCustomMethod(WSLit("doPause"), false);
	systemObject.SetCustomMethod(WSLit("consoleCommand"), false);
	systemObject.SetCustomMethod(WSLit("specialReady"), false);
	systemObject.SetCustomMethod(WSLit("selectTaskObject"), false);
	systemObject.SetCustomMethod(WSLit("alphabetSafe"), true);
	systemObject.SetCustomMethod(WSLit("getConVarValue"), true);
	systemObject.SetCustomMethod(WSLit("getAllMounts"), true);
	systemObject.SetCustomMethod(WSLit("getMount"), true);
	systemObject.SetCustomMethod(WSLit("getAllTasks"), true);
	systemObject.SetCustomMethod(WSLit("getAllWorkshopSubscriptions"), true);
	systemObject.SetCustomMethod(WSLit("getRelativeAssetPath"), true);
	systemObject.SetCustomMethod(WSLit("getAllBackpacks"), true);
	systemObject.SetCustomMethod(WSLit("getBackpack"), true);
	systemObject.SetCustomMethod(WSLit("getNearestObjectToPlayerLook"), true);
	systemObject.SetCustomMethod(WSLit("getNextNearestObjectToPlayerLook"), true);
	systemObject.SetCustomMethod(WSLit("getNodeSetupInfo"), true);


	// LIBRARY
	result = pWebView->CreateGlobalJavascriptObject(WSLit("aaapi.library"));
	if (!result.IsObject())
		return;

	JSObject& libraryObject = result.ToObject();

	// SUPER DUPER LIBRARY QUERY IN GENERALIZED ORDINARY GUY FORM
	libraryObject.SetCustomMethod(WSLit("hasLibraryEntry"), true);
	libraryObject.SetCustomMethod(WSLit("getFirstLibraryEntry"), true);
	libraryObject.SetCustomMethod(WSLit("getNextLibraryEntry"), true);
	libraryObject.SetCustomMethod(WSLit("findFirstLibraryEntry"), true);
	libraryObject.SetCustomMethod(WSLit("findNextLibraryEntry"), true);
	// EACH QUERY HANDLE IS CLEARED WHEN IT IS USED TO EXHAUSTION
	// *ALL* QUERY HANDLES ARE CLEARED ON MAP TRANSITION FOR GARBAGE COLLECTION OF UNCLOSED HANDLES

	libraryObject.SetCustomMethod(WSLit("getAllLibraryTypes"), true);
	libraryObject.SetCustomMethod(WSLit("getLibraryType"), true);
	libraryObject.SetCustomMethod(WSLit("getAllLibraryApps"), true);
	libraryObject.SetCustomMethod(WSLit("getLibraryApp"), true);
	libraryObject.SetCustomMethod(WSLit("getFirstLibraryItem"), true);	// OBSOLETE!
	libraryObject.SetCustomMethod(WSLit("getNextLibraryItem"), true);	// OBSOLETE!
	libraryObject.SetCustomMethod(WSLit("getLibraryItem"), true);
	libraryObject.SetCustomMethod(WSLit("getLibraryModel"), true);
	libraryObject.SetCustomMethod(WSLit("getSelectedLibraryItem"), true);
	libraryObject.SetCustomMethod(WSLit("findFirstLibraryItem"), true);	// OBSOLETE!
	libraryObject.SetCustomMethod(WSLit("findNextLibraryItem"), true);	// OBSOLETE!
	libraryObject.SetCustomMethod(WSLit("findLibraryItem"), true);
	libraryObject.SetCustomMethod(WSLit("findLibraryModel"), true);
	libraryObject.SetCustomMethod(WSLit("findLibraryApp"), true);
	libraryObject.SetCustomMethod(WSLit("findLibraryType"), true);
	libraryObject.SetCustomMethod(WSLit("updateItem"), true);
	libraryObject.SetCustomMethod(WSLit("updateApp"), true);
	libraryObject.SetCustomMethod(WSLit("updateInstance"), true);
	libraryObject.SetCustomMethod(WSLit("deleteInstance"), true);
	libraryObject.SetCustomMethod(WSLit("updateModel"), true);
	libraryObject.SetCustomMethod(WSLit("updateType"), true);
	libraryObject.SetCustomMethod(WSLit("createItem"), true);
	libraryObject.SetCustomMethod(WSLit("createApp"), true);
	libraryObject.SetCustomMethod(WSLit("createType"), true);
	libraryObject.SetCustomMethod(WSLit("createModel"), true);
	libraryObject.SetCustomMethod(WSLit("saveItem"), true);
	libraryObject.SetCustomMethod(WSLit("deleteApp"), false);

	libraryObject.SetCustomMethod(WSLit("getFirstLibraryModel"), true);	// OBSOLETE!
	libraryObject.SetCustomMethod(WSLit("getNextLibraryModel"), true);	// OBSOLETE!
	libraryObject.SetCustomMethod(WSLit("findFirstLibraryModel"), true);	// OBSOLETE!
	libraryObject.SetCustomMethod(WSLit("findNextLibraryModel"), true);	// OBSOLETE!

	// CALLBACKS
	result = pWebView->CreateGlobalJavascriptObject(WSLit("aaapi.callbacks"));
	if (!result.IsObject())
		return;

	JSObject& callbacksObject = result.ToObject();
	//callbacksObject.SetCustomMethod(WSLit("loadNextLocalAppCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("startupCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("defaultLibraryReadyCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("mountNextWorkshopCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("loadNextLocalItemLegacyCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("detectNextMapCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("spawnNextObjectCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("addNextDefaultLibraryCallback"), false);
	//callbacksObject.SetCustomMethod(WSLit("defaultLibraryReadyCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("updateLibraryVersionCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("readyToLoadUserLibraryCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("rebuildSoundCacheCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("processAllModelsCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("processNextModelCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("addNextModelCallback"), false);
	callbacksObject.SetCustomMethod(WSLit("importNextSteamGameCallback"), false);

	// NETWORK
	result = pWebView->CreateGlobalJavascriptObject(WSLit("aaapi.network"));
	if (!result.IsObject())
		return;

	JSObject& networkObject = result.ToObject();
	networkObject.SetCustomMethod(WSLit("getConnectedSession"), true);
	networkObject.SetCustomMethod(WSLit("getAllUserChat"), true);
	networkObject.SetCustomMethod(WSLit("getAllUsers"), true);
	networkObject.SetCustomMethod(WSLit("getNumUsers"), true);
	networkObject.SetCustomMethod(WSLit("getSyncOverview"), true);
	networkObject.SetCustomMethod(WSLit("hostSession"), false);
	networkObject.SetCustomMethod(WSLit("objectUpdateReceived"), false);
	networkObject.SetCustomMethod(WSLit("restartNetwork"), false);
	networkObject.SetCustomMethod(WSLit("disconnected"), false);
	networkObject.SetCustomMethod(WSLit("networkEvent"), false);
	networkObject.SetCustomMethod(WSLit("followPlayer"), false);
	networkObject.SetCustomMethod(WSLit("joinLobby"), false);
	networkObject.SetCustomMethod(WSLit("banPlayer"), false);
	networkObject.SetCustomMethod(WSLit("syncPano"), false);
	networkObject.SetCustomMethod(WSLit("unbanPlayer"), false);
	networkObject.SetCustomMethod(WSLit("sendEntryUpdate"), false);
	networkObject.SetCustomMethod(WSLit("sendLocalChatMsg"), false);
	//networkObject.SetCustomMethod(WSLit("extractOverviewTGA"), false);

	/*
	result = pWebView->CreateGlobalJavascriptObject(WSLit("aaapi.metaverse"));
	if (!result.IsObject())
	return;

	JSObject& metaverseObject = result.ToObject();
	metaverseObject.SetCustomMethod(WSLit("OnSelectItem"), false);
	*/
}