Google Stadia - Force 4K VP9

Forces 4K resolution and the VP9 codec on Google Stadia; especially useful for clarity on ultra widescreen monitors

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Google Stadia - Force 4K VP9
// @namespace    https://chipwolf.uk
// @version      0.1
// @description  Forces 4K resolution and the VP9 codec on Google Stadia; especially useful for clarity on ultra widescreen monitors
// @author       Chip Wolf
// @match        *://stadia.google.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // source: https://gist.github.com/therocco/cfc98672d058496038755137611ea5c8

    // set local codec to VP9
    localStorage.setItem('video_codec_implementation_by_codec_key', '{"vp9":"ExternalDecoder"}');

    // set 4k dimensions and screen values
    let x = 3840;
    let y = 2160;
    let screen = [
        ['availHeight', y],
        ['availWidth', x],
        ['height', y],
        ['width', x]
    ];

    // force new screen resolution
    screen.forEach(([prop, value]) => {
        Object.defineProperty(window.screen, prop, {
            value,
            configurable: true
        });
    });
})();