Skip to content

Alfex4936/SC1-Multi-Launcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Rust Programming Language: A language empowering everyone to build reliable and efficient software

SC1-Multi-Launcher

image

스타크래프트 1 게임을 여러 개 실행시킬 수 있는 앱

StarCraft I, Multi-Loader

This project is a Rust implementation using windows-rs.

I created this as a practice project to gain familiarity with windows-rs by porting the existing C++ version.

The original C++ version can be found at sc_multiloader by @somerby10ml

Play

Download CLI or GUI version from here

CLI

If you want to run N games, use -n.

./sclauncher-cli.exe -n 3

Want to run in 64bits? pass -b

./sclauncher-cli.exe -n 3 -b

GUI

Key Features

Process Management

  • Launching Games: Games are launched as separate processes, with their process identifiers (PIDs) and handles stored for management.
  • Killing Games: Individual or all games can be terminated based on their PIDs and associated handles.

Handle Management

  • Safe Handle Wrapping: Utilizes HandleWrapper to ensure that process handles are managed safely, automatically closing handles when they are no longer needed.
  • Process Querying: Leverages advanced Windows API calls to query running processes, obtain handles, and modify process properties.

Implementation Details

GameManager Structure

  • Manages a list of game processes using a vector of tuples, each containing a PID and a handle.
  • Provides methods to launch games, kill a specific game, or kill all managed games.

Process and Handle Functions

  • launch_game: Launches a game using specified path and stores its handle.
  • kill_a_game: Terminates a game using its PID and closes its handle.
  • kill_all_games: Terminates all tracked games and clears the list of handles.

Handle Management with HandleWrapper

  • Encapsulates process handles ensuring that they are closed properly using Rust's ownership and RAII principles.
  • Provides methods to safely create and manage snapshots of system processes.

Using windows-rs

This application heavily relies on windows-rs for:

  • Creating processes with specific arguments and tracking their PIDs and handles.
  • Querying and interacting with system processes to manage game instances effectively.
  • Safely terminating processes and closing handles to avoid resource leaks.
  • Prompts for administrative rights when needed, ensuring unrestricted access to critical system operations.
  • Elevate the application to run with admin privileges, allowing for deeper system integrations and modifications.

Safety and Concurrency

Uses Rust's async capabilities and safe concurrency models to manage multiple game processes simultaneously without risking data races or unsafe memory access.

TODO

  • leptos GUI
  • clap CLI
  • Process get
  • Process handle information
  • Kill process's handle