Created
November 7, 2022 17:18
-
-
Save thoughtpolice/218f8dbb4c7c18f40e9d58a66f10226d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! this program exists only to launch RPCS3, pointed to the Tekken Tag | |
//! Tournament 2 ROM on my hard drive, with Steam Remote Play. there are a very | |
//! weird set of circumstances leading to this: | |
//! | |
//! as a prerequisite: modern Steam supports a full userspace gamepad input | |
//! device stack, called "Steam Input". games launched by steam have the Steam | |
//! Overlay injected into them, which also handles Steam Input. in effect, Steam | |
//! Input allows arbitrary gamepads, such as PS4 DualShocks or Nintendo Joycons, | |
//! or even exotic devices like Hitbox/PS4 Hori Fightpads, to be registered and | |
//! control mapped on the system, entirely through Steam and without any other | |
//! operating system support. Steam then effectively translates the USB/BT input | |
//! protocols of these devices into "ordinary" XInput gamepad input devices, | |
//! which are the standard gamepad input devices recognized by Windows and all | |
//! Windows games (cf. Linux with its evdev subsystem.) therefore, if your game | |
//! is from Steam, you can just plug in a PS4 or JoyCon and immediately play any | |
//! game such as God of War or Halo as if it was an Xbox controller. | |
//! | |
//! an even more recent innovation from Steam Input is the ability to virtualize | |
//! inputs over the network. using Steam Remote Play, gamepad devices from | |
//! arbitrary computers are instead routed over the internet using a custom | |
//! streaming UDP protocol, and virtually "plugged into" the host device. this | |
//! allows online multiplayer to be supported e.g. on classic fighting games | |
//! that have no online component, by purely virtualizing the input layer, with | |
//! no extra support. | |
//! | |
//! now taking a step back: the goal is to launch Tekken Tag Tournament 2, using | |
//! RPCS3 as a PS3 emulator, and launch it under Steam, with Steam Input and | |
//! Steam Remote Play support, so I can play 4-player Pair Play online with | |
//! friends. there are a number of issues however, including... | |
//! | |
//! most notably, when Steam launches a game, it only passes off Steam Input | |
//! virtual gamepad devices _to the first window that spawns_. therefore it's | |
//! critical to make sure the only window that appears due to this application | |
//! is a fully-spawned, running RPCS3 Emulation Window; therefore no | |
//! conhost.exe, no RPCS3 UI, and nothing else can appear. this requires | |
//! --no-gui on RPCS3, at minimum... | |
//! | |
//! normally, at this point, it would be enough to just add a non-Steam game to | |
//! the game list in your UI, and launch the game. this will work and the Steam | |
//! Input virtual gamepads will be assigned, BUT: arbitrary non-Steam games | |
//! cannot be played with Steam Remote Play, by default, and are therefore | |
//! limited only to local coop, without online. fixing this requires another | |
//! hack... | |
//! | |
//! second, this application MUST BE RUN FROM STEAM using another "donor game" | |
//! for Steam Remote Play; this works by replacing the donor game .exe in | |
//! Steam's download folder with this dependency-free .exe instead after you | |
//! compile it, which will launch the emulator directly with the right | |
//! arguments. the donor game has Steam Remote Play listed as "supported", | |
//! meaning that when Steam sees foo.exe launch from its game directory, it | |
//! enables support for Remote Play | |
//! | |
//! these two things trick Steam into passing its virtual gamepad devices onto | |
//! RPCS3 directly with no intervention, which allows Tekken Tag Tournament 2 to | |
//! work online with Remote Play. | |
//! | |
//! XXX FIXMEs: | |
//! - harcoded paths? | |
//! - steam deck support? this trick also is needed on Linux... | |
//! - if RemotePlayWhatever[1] is ever fixed, this will be obsoleted (until | |
//! RPW breaks again...) | |
//! | |
//! [1] https://github.com/m4dEngi/RemotePlayWhatever | |
// NOTE: you MUST use the windows subsystem for this app, so it does have a | |
// conhost.exe process spawned for it. (similarly we have to launch RPCS3.exe | |
// without a visible conhost.exe as well, see below) | |
#![cfg(target_os = "windows")] | |
#![windows_subsystem = "windows"] | |
use std::process::Command; | |
fn main() { | |
if cfg!(target_os = "windows") { | |
use std::os::windows::process::CommandExt; | |
const CREATE_NO_WINDOW: u32 = 0x08000000; | |
Command::new("cmd") | |
.args([ | |
"/C", | |
"C:\\MiscApps\\rpcs3\\rpcs3.exe", | |
"--no-gui", | |
"E:\\roms\\rpcs3\\BLES01702-[TEKKEN TAG TOURNAMENT 2]\\PS3_GAME\\USRDIR\\EBOOT.BIN", | |
]) | |
.current_dir("C:\\MiscApps\\rpcs3") | |
.creation_flags(CREATE_NO_WINDOW) // IMPORTANT: no conhost.exe | |
.status() | |
.expect("failed to execute process"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment