Google Stadia - Force 4K VP9

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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
        });
    });
})();