From bf377ae32307787296b153e30a9fc6f303ad2e72 Mon Sep 17 00:00:00 2001 From: Salad Dais Date: Fri, 28 May 2021 21:53:44 +0000 Subject: [PATCH] Make using VOCache optional, off by default --- hippolyzer/apps/proxy_gui.py | 7 +++++++ hippolyzer/apps/proxy_mainwindow.ui | 12 ++++++++++++ hippolyzer/lib/proxy/lludp_proxy.py | 9 +++++---- hippolyzer/lib/proxy/sessions.py | 1 + 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/hippolyzer/apps/proxy_gui.py b/hippolyzer/apps/proxy_gui.py index 7b58b8f..04f7cdf 100644 --- a/hippolyzer/apps/proxy_gui.py +++ b/hippolyzer/apps/proxy_gui.py @@ -189,6 +189,7 @@ class ProxyGUI(QtWidgets.QMainWindow): self.actionProxyRemotelyAccessible.setChecked( self.settings.value("RemotelyAccessible", False, type=bool)) self.actionProxyRemotelyAccessible.triggered.connect(self._setProxyRemotelyAccessible) + self.actionUseViewerObjectCache.triggered.connect(self._setUseViewerObjectCache) self._filterMenu = QtWidgets.QMenu() self._populateFilterMenu() @@ -373,6 +374,10 @@ class ProxyGUI(QtWidgets.QMainWindow): msg.setText("Remote accessibility setting changes will take effect on next run") msg.exec() + def _setUseViewerObjectCache(self, checked: bool): + self.settings.setValue("UseViewerObjectCache", checked) + self.sessionManager.use_viewer_object_cache = checked + def _manageAddons(self): dialog = AddonDialog(self) dialog.exec_() @@ -809,6 +814,8 @@ def gui_main(): signal.signal(signal.SIGINT, lambda *args: QtWidgets.QApplication.quit()) window.show() remote_access = window.settings.value("RemotelyAccessible", False, type=bool) + use_vocache = window.settings.value("UseViewerObjectCache", False, type=bool) + window.sessionManager.use_viewer_object_cache = use_vocache http_host = None if remote_access: http_host = "0.0.0.0" diff --git a/hippolyzer/apps/proxy_mainwindow.ui b/hippolyzer/apps/proxy_mainwindow.ui index 4c7ceae..53b548a 100644 --- a/hippolyzer/apps/proxy_mainwindow.ui +++ b/hippolyzer/apps/proxy_mainwindow.ui @@ -262,6 +262,7 @@ + @@ -299,6 +300,17 @@ Make the proxy accessible from other devices on the network + + + true + + + Use Viewer Object Cache + + + Can help make the proxy aware of certain objects, but can cause slowdowns + + diff --git a/hippolyzer/lib/proxy/lludp_proxy.py b/hippolyzer/lib/proxy/lludp_proxy.py index 6c98f8e..0789946 100644 --- a/hippolyzer/lib/proxy/lludp_proxy.py +++ b/hippolyzer/lib/proxy/lludp_proxy.py @@ -124,10 +124,11 @@ class InterceptingLLUDPProxyProtocol(BaseLLUDPProxyProtocol): AddonManager.handle_region_changed(self.session, region) if message.name == "RegionHandshake": region.cache_id = message["RegionInfo"]["CacheID"] - try: - region.objects.load_cache() - except: - LOG.exception("Failed to load region cache, skipping") + if self.session_manager.use_viewer_object_cache: + try: + region.objects.load_cache() + except: + LOG.exception("Failed to load region cache, skipping") try: region.message_handler.handle(message) diff --git a/hippolyzer/lib/proxy/sessions.py b/hippolyzer/lib/proxy/sessions.py index f46c137..94c0b0c 100644 --- a/hippolyzer/lib/proxy/sessions.py +++ b/hippolyzer/lib/proxy/sessions.py @@ -154,6 +154,7 @@ class SessionManager: self.message_logger: Optional[BaseMessageLogger] = None self.addon_ctx: Dict[str, Any] = {} self.name_cache = NameCache() + self.use_viewer_object_cache: bool = False def create_session(self, login_data) -> Session: session = Session.from_login_data(login_data, self)