Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alfex4936/sc1-multi-launcher

StarCraft I multi launcher in Rust. using windows-rs
https://github.com/alfex4936/sc1-multi-launcher

rust starcraft starcraft1 windows-api windows-rs

Last synced: about 1 month ago
JSON representation

StarCraft I multi launcher in Rust. using windows-rs

Awesome Lists containing this project

README

        





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

# SC1-Multi-Launcher

![image](https://github.com/Alfex4936/chulbong-kr/assets/2356749/a1a61911-f325-414c-99f2-2eeae3c2c24c)

스타크래프트 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](https://github.com/somersby10ml/sc_multiloader/tree/main) by @somerby10ml

## Play

Download CLI or GUI version from [here](https://github.com/Alfex4936/SC1-Multi-Launcher/releases)

### CLI

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

```powershell
./sclauncher-cli.exe -n 3
```

Want to run in 64bits? pass `-b`

```powershell
./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
- [x] clap CLI
- [x] Process get
- [x] Process handle information
- [x] Kill process's handle