From 217580661d34832d6bdad3a5862f79c62c1dbfaa Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 19 Oct 2009 18:06:00 +0000 Subject: [PATCH] respect passed-in hostUrl --- direct/src/plugin/p3dInstance.cxx | 13 ++++--------- direct/src/plugin/p3dInstanceManager.I | 20 +++++++++++++++++++- direct/src/plugin/p3dInstanceManager.cxx | 5 +++++ direct/src/plugin/p3dInstanceManager.h | 2 ++ 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/direct/src/plugin/p3dInstance.cxx b/direct/src/plugin/p3dInstance.cxx index 5f48a05348..1c5cd4eefe 100644 --- a/direct/src/plugin/p3dInstance.cxx +++ b/direct/src/plugin/p3dInstance.cxx @@ -96,8 +96,8 @@ P3DInstance(P3D_request_ready_func *func, _has_log_basename = false; _hidden = (_fparams.lookup_token_int("hidden") != 0); _allow_python_dev = false; - _keep_user_env = false; - _auto_start = false; + _keep_user_env = (_fparams.lookup_token_int("keep_user_env") != 0); + _auto_start = (_fparams.lookup_token_int("auto_start") != 0); _auth_button_approved = false; _failed = false; _session = NULL; @@ -174,7 +174,7 @@ P3DInstance(P3D_request_ready_func *func, // it eventually, and it's good to have it loaded early, so we can // put up a splash image (for instance, the above IT_download image) // while we download the real contents. - P3DHost *host = inst_mgr->get_host(PANDA_PACKAGE_HOST_URL); + P3DHost *host = inst_mgr->get_host(inst_mgr->get_host_url()); _image_package = host->get_package("images", ""); if (_image_package != NULL) { _image_package->add_instance(this); @@ -1261,7 +1261,7 @@ mark_p3d_untrusted() { if (_p3dcert_package == NULL) { // We have to go download this package. P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr(); - P3DHost *host = inst_mgr->get_host(PANDA_PACKAGE_HOST_URL); + P3DHost *host = inst_mgr->get_host(inst_mgr->get_host_url()); _p3dcert_package = host->get_package("p3dcert", ""); if (_p3dcert_package != NULL) { _p3dcert_package->add_instance(this); @@ -1395,11 +1395,6 @@ scan_app_desc_file(TiXmlDocument *doc) { } } - // auto_start is true if it is set in the application itself, or in - // the web tokens. - if (_fparams.lookup_token_int("auto_start") != 0) { - _auto_start = true; - } if (_auth_button_approved) { // But finally, if the user has already clicked through the red // "auth" button, no need to present him/her with another green diff --git a/direct/src/plugin/p3dInstanceManager.I b/direct/src/plugin/p3dInstanceManager.I index 826270f20c..9630b84c48 100644 --- a/direct/src/plugin/p3dInstanceManager.I +++ b/direct/src/plugin/p3dInstanceManager.I @@ -51,6 +51,22 @@ reset_verify_contents() { } +//////////////////////////////////////////////////////////////////// +// Function: P3DInstanceManager::get_host_url +// Access: Public +// Description: Returns the standard host_url which the instances +// should attempt to contact to download auxiliary +// packages associated with the core API, such as the +// p3dcert and images packages. This is normally the +// compiled-in PANDA_PACKAGE_HOST_URL, but it might be +// set to something different by the -u parameter on the +// panda3d executable. +//////////////////////////////////////////////////////////////////// +inline const string &P3DInstanceManager:: +get_host_url() const { + return _host_url; +} + //////////////////////////////////////////////////////////////////// // Function: P3DInstanceManager::get_root_dir // Access: Public @@ -212,7 +228,9 @@ get_plugin_distributor() const { // Function: P3DInstanceManager::get_coreapi_host_url // Access: Public // Description: Returns the host URL from which this Core API was -// downloaded (according to the plugin). +// downloaded (according to the plugin). This is for +// reporting purposes only; see get_host_url() for the +// URL to contact to actually download content. //////////////////////////////////////////////////////////////////// inline const string &P3DInstanceManager:: get_coreapi_host_url() const { diff --git a/direct/src/plugin/p3dInstanceManager.cxx b/direct/src/plugin/p3dInstanceManager.cxx index 51532dd581..dc98692c9d 100644 --- a/direct/src/plugin/p3dInstanceManager.cxx +++ b/direct/src/plugin/p3dInstanceManager.cxx @@ -189,6 +189,11 @@ initialize(const string &contents_filename, const string &host_url, _platform = DTOOL_PLATFORM; } + _host_url = host_url; + if (_host_url.empty()) { + _host_url = PANDA_PACKAGE_HOST_URL; + } + _root_dir = find_root_dir(); // Allow the caller (e.g. panda3d.exe) to specify a log directory. diff --git a/direct/src/plugin/p3dInstanceManager.h b/direct/src/plugin/p3dInstanceManager.h index d58346acf3..8b750a4122 100644 --- a/direct/src/plugin/p3dInstanceManager.h +++ b/direct/src/plugin/p3dInstanceManager.h @@ -62,6 +62,7 @@ public: inline bool get_verify_contents() const; inline void reset_verify_contents(); + inline const string &get_host_url() const; inline const string &get_root_dir() const; inline const string &get_platform() const; inline const string &get_temp_directory() const; @@ -139,6 +140,7 @@ private: private: bool _is_initialized; + string _host_url; string _root_dir; string _certs_dir; bool _verify_contents;