Skip to content

armgit / WacOS

Public Imported from GitHub
0

A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.

Rust
6.4 KB
Raw Blame
//! comum\jogos.h: quem é jogo (launcher, anti-cheat, motor) e quem é Chromium/Electron. Na dúvida, é jogo.
#![allow(dead_code)]

use std::path::Path;

fn existe(f: &str) -> bool {
    Path::new(f).exists()
}
/// launchers, anti-cheat, overlays de jogo e jogos conhecidos (nome do .exe, minúsculo)
pub fn exe_proibido(exe: &str) -> bool {
    const L: &[&str] = &[
        "steam.exe", "steamwebhelper.exe", "steamservice.exe", "gameoverlayui.exe", "gameoverlayui64.exe", "battle.net.exe", "agent.exe", "blizzard error.exe", "eadesktop.exe", "eabackgroundservice.exe", "ealauncher.exe",
        "origin.exe", "originwebhelperservice.exe", "epicgameslauncher.exe", "epicwebhelper.exe", "epiconlineservices.exe", "riotclientservices.exe", "riotclientux.exe", "riotclientuxrender.exe", "riot client.exe",
        "leagueclient.exe", "leagueclientux.exe", "leagueclientuxrender.exe", "league of legends.exe", "valorant.exe", "valorant-win64-shipping.exe", "vgc.exe", "vgtray.exe", "faceit.exe", "faceitclient.exe",
        "faceitservice.exe", "esportal.exe", "gamersclub.exe", "gcclient.exe", "easyanticheat.exe", "easyanticheat_eos.exe", "easyanticheat_setup.exe", "beservice.exe", "beservice_x64.exe", "belauncher.exe",
        "xigncode.exe", "nprotect.exe", "gameguard.exe", "ucldr_battlegrounds_gl.exe", "tslgame.exe", "ubisoftconnect.exe", "upc.exe", "uplaywebcore.exe", "galaxyclient.exe", "gogclient.exe", "xboxpcapp.exe",
        "gamebar.exe", "gamebarftserver.exe", "xboxappservices.exe", "robloxplayerbeta.exe", "robloxplayerlauncher.exe", "robloxstudiobeta.exe", "minecraftlauncher.exe", "minecraft.windows.exe", "javaw.exe",
        "rockstarlauncher.exe", "launcher.exe", "socialclubhelper.exe", "playgtav.exe", "gta5.exe", "overwolf.exe", "overwolfbrowser.exe", "medal.exe", "hoyoplay.exe", "launcherhoyoplay.exe", "genshinimpact.exe",
        "yuanshen.exe", "starrail.exe", "zenlesszonezero.exe", "wargaminggamecenter.exe", "wgc.exe", "amazongames.exe", "amazon games ui.exe", "itch.exe", "playnite.desktopapp.exe", "playnite.fullscreenapp.exe",
        "bsglauncher.exe", "escapefromtarkov.exe", "fortniteclient-win64-shipping.exe", "fortnitelauncher.exe", "cs2.exe", "csgo.exe", "dota2.exe", "r5apex.exe", "r5apex_dx12.exe", "overwatch.exe", "rainbowsix.exe",
        "rainbowsix_be.exe", "cod.exe", "modernwarfare.exe", "blackops6.exe", "destiny2.exe", "rustclient.exe", "pubg.exe", "eldenring.exe", "start_protected_game.exe", "osu!.exe", "lutris.exe",
    ];
    L.contains(&exe)
}
/// pastas de jogos (caminho completo em minúsculas)
pub fn caminho_de_jogo(c: &str) -> bool {
    const P: &[&str] = &[
        "\\steamapps\\", "\\steam\\", "\\riot games\\", "\\epic games\\", "\\ea games\\", "\\ea app\\", "\\electronic arts\\", "\\origin games\\", "\\battle.net\\", "\\blizzard", "\\ubisoft", "\\gog galaxy\\",
        "\\gog games\\", "\\xboxgames\\", "\\rockstar games\\", "\\easyanticheat", "\\battleye", "\\games\\", "\\jogos\\", "\\hoyoplay\\", "\\mihoyo\\", "\\genshin impact", "\\wargaming", "\\amazon games\\",
        "\\itch\\apps\\", "\\riot vanguard\\", "\\faceit", "\\battlestate games\\", "\\call of duty\\", "\\overwatch\\", "\\roblox\\", "\\.minecraft\\", "\\minecraft", "\\microsoft.gaming",
        "\\windowsapps\\microsoft.xbox", "\\playnite\\", "\\heroic\\",
    ];
    P.iter().any(|p| c.contains(p))
}
/// motores de jogo (classe da janela principal)
pub fn classe_de_jogo(cls: &str) -> bool {
    const C: &[&str] = &["UnrealWindow", "UnityWndClass", "SDL_app", "GLFW30", "Valve001", "CryENGINE", "RiotWindowClass", "LWJGL", "SFML_Window", "OgreD3D11Wnd", "TankWindowClass", "Godot_Engine", "GodotWindow", "raylib", "GameMaker", "YYGameMakerYY", "OsuWindow", "Respawn001", "Tarkov"];
    C.contains(&cls)
}
fn marcas_de_jogo(pasta: &str) -> bool {
    const F: &[&str] = &[
        "UnityPlayer.dll", "GameAssembly.dll", "steam_api64.dll", "steam_api.dll", "steamclient64.dll", "EOSSDK-Win64-Shipping.dll", "EOSSDK-Win32-Shipping.dll", "galaxy64.dll", "Galaxy.dll", "BEClient_x64.dll",
        "BEClient.dll", "EasyAntiCheat", "BattlEye", "EasyAntiCheat_EOS_Setup.exe", "start_protected_game.exe", "discord_game_sdk.dll", "bink2w64.dll", "PhysX3_x64.dll", "PhysX_64.dll", "fmodstudio.dll", "fmod.dll",
        "amd_ags_x64.dll", "nvngx_dlss.dll", "sl.interposer.dll", "xess.dll", "libxess.dll",
        "SDL2.dll", "SDL3.dll", // jogos, portes e emuladores feitos com o SDL (issue #378)
    ];
    F.iter().any(|f| existe(&format!("{pasta}\\{f}")))
}
fn anti_cheat_ao_lado(pasta: &str) -> bool {
    ["BEClient_x64.dll", "BEClient.dll", "EasyAntiCheat", "BattlEye", "EasyAntiCheat_EOS_Setup.exe", "start_protected_game.exe"].iter().any(|f| existe(&format!("{pasta}\\{f}")))
}
/// o OBS Studio tem cara de jogo mas não é (com anti-cheat ao lado continua fora)
pub fn programa_nao_jogo(orig: &str) -> bool {
    let c = orig.to_lowercase();
    let Some(barra) = c.rfind('\\') else { return false };
    let exe = &c[barra + 1..];
    let obs = matches!(exe, "obs64.exe" | "obs32.exe" | "obs.exe") && (c.contains("\\bin\\64bit\\") || c.contains("\\bin\\32bit\\")) && existe(&format!("{}\\obs.dll", &orig[..barra]));
    obs && !anti_cheat_ao_lado(&orig[..barra])
}
/// o .exe é de jogo / launcher / anti-cheat? (caminho completo; não abre o processo)
pub fn programa_de_jogo(orig: &str) -> bool {
    if programa_nao_jogo(orig) {
        return false;
    }
    let c = orig.to_lowercase();
    let Some(barra) = c.rfind('\\') else { return false };
    let exe = &c[barra + 1..];
    if exe_proibido(exe) || caminho_de_jogo(&c) {
        return true;
    }
    if c.contains("\\binaries\\win64\\") || c.contains("\\binaries\\win32\\") || c.contains("-shipping.exe") || c.contains("_be.exe") || c.contains("_eac.exe") {
        return true;
    }
    marcas_de_jogo(&orig[..barra])
}
/// app Chromium/Electron: navegadores conhecidos pelo nome; Electron/CEF pelos pacotes ao lado do .exe
pub fn programa_chromium(orig: &str) -> bool {
    let c = orig.to_lowercase();
    let Some(barra) = c.rfind('\\') else { return false };
    let exe = &c[barra + 1..];
    if ["chrome.exe", "msedge.exe", "brave.exe", "vivaldi.exe", "opera.exe", "opera_gx.exe", "chromium.exe", "thorium.exe", "arc.exe", "yandex.exe", "browser.exe"].contains(&exe) {
        return true;
    }
    let pasta = &orig[..barra];
    ["resources.pak", "chrome_100_percent.pak", "icudtl.dat", "v8_context_snapshot.bin", "snapshot_blob.bin"].iter().filter(|f| existe(&format!("{pasta}\\{f}"))).count() >= 2
}