-
-
Save a9udn9u/85e0c8e863db85c5b62320766bd7b2e9 to your computer and use it in GitHub Desktop.
import json | |
import re | |
from mitmproxy import http | |
url_pattern = re.compile(r"^.*\.nvidiagrid.net/v2/session") | |
user_agent_pattern = re.compile(r"(Mozilla\/[\d\.]+) \(.+?\)") | |
def request(flow: http.HTTPFlow) -> None: | |
# Check if the request matches the regex pattern | |
if url_pattern.match(flow.request.pretty_url): | |
flow.request.headers['nv-device-os'] = 'WINDOWS' | |
flow.request.headers['sec-ch-ua-platform'] = '"WINDOWS"' | |
flow.request.headers['sec-ch-ua-platform-version'] = '14.0.0' | |
if "user-agent" in flow.request.headers: | |
flow.request.headers["user-agent"] = user_agent_pattern.sub( | |
r'\1 (Windows NT 10.0; Win64; x64)', | |
flow.request.headers["user-agent"]) | |
if flow.request.headers.get("content-type") == "application/json": | |
try: | |
body = json.loads(flow.request.content) | |
if body.get("sessionRequestData", {}).get("clientRequestMonitorSettings", None) is not None: | |
body["sessionRequestData"]["clientRequestMonitorSettings"] = [ | |
{ | |
"heightInPixels": 1440, | |
"framesPerSecond": 120, | |
"widthInPixels": 2560 | |
} | |
] | |
flow.request.content = json.dumps(body).encode("utf-8") | |
except json.JSONDecodeError: | |
pass | |
function FindProxyForURL(url, host) { | |
var proxy = "PROXY <your proxy server IP>:<your proxy server port>"; | |
if (/^https:\/\/.+\.nvidiagrid.net/.test(url)) { | |
// Should only proxy /v2/session, but the URL path is removed by Chrome | |
return proxy; | |
} | |
return "DIRECT"; | |
} |
@lordgreg the reason why nvidia disabled in on linux is because support for video hardware decoding support is very patchy. You must absolutely have it enabled in chrome, or else you'll have terrible lag and resolution will drop.
Go to chrome://gpu/
in Chrome and look if the Video Acceleration Information
section is populated.
This script does not seem to work anymore.
Can anyone confirm if this works?
Yes, I use this almost every day to get 2560x1440 in destiny 2.
This script does not seem to work anymore. Can anyone confirm if this works?
Confirmed to work.
how do you use it in the chrome then in fullscreen mode? how do you prevent when escape is being pressed that you dont get thrown out of full screen?
btw, this looks okay:
Additionally,
I've tested two browsers, Chrome and Brave from Flatpak, both having GPU Acceleration enabled, the installed RPM version of google chrome. All 3 of them yielded exactly the same result, lowering the resolution to unbearable 720 as soon as I started moving.
Unsure what is causing this, maybe my graphics card, maybe some entry missing under gpuinfo.
I'll probably give up eventually and reboot to windows when I'll want to play, or just move to boosteroid.
Thank you all for the suggestions and support :)
Is there any way to force 10 bit color support? Btw, the script for me works fine, 2k and 120 fps.
btw, this looks okay:
No it does not. "Video Decode" here, means that the feature is enabled. As I wrote, you need to have codecs listed in Video Acceleration Information
hi @kubrickfr and thank you for your feedback. Can you please post a screenshot on how this looks on your side?
Thank you in advance! 👍
I'm having the same issue. I tried it with a Mint 22.1 Live ISO with persistence on a USB3.0 connected HDD. The games start fine with 1440p (H.264, 8-bits too), but then they drop to 1080p and even lower. Mitmproxy shows that the proxy is filtering nvidiagrid.net as expected. I've tried Google Chrome and Microsoft Edge stable, and I've had the same issue with both. I also tried lowering the frequency to 60 Hz instead of 120 Hz (my screen supports 165 Hz) and disabling V-Sync in different games (C2077, Outlaws, BG3, etc.), which seemed to last a few seconds more, but didn't help either at the end.
I'm wondering if it could be a performance bottleneck with mimproxy on my PC, which isn't the newest, and also the fact that it's not a full Linux install? Of course, GFN runs fine with the same PC at 1440p under W10 with a 1Gbps internet connection.