# GMoD-TeachGMAD

<p align="center">
  <img src="banner.png" alt="GMoD Teach GMAD Banner" width="560">
</p>

<p align="center">
  <strong>The fast, lightweight batch autoinstaller and extractor for Garry's Mod addons.</strong>
</p>

<p align="center">
  <a href="https://discord.gg/AzC9u9EB68"><img src="https://img.shields.io/badge/Discord-Join%20Community-5865F2?style=flat-square&logo=discord&logoColor=white" alt="Discord"></a>
  <a href="https://ko-fi.com/sromandev"><img src="https://img.shields.io/badge/Ko--fi-Support-FF5E5B?style=flat-square&logo=kofi&logoColor=white" alt="Ko-fi"></a>
  <img src="https://img.shields.io/badge/Language-C%2B%2B20-00599C?style=flat-square&logo=c%2B%2B" alt="C++20">
  <img src="https://img.shields.io/badge/GUI-SDL2-1772b4?style=flat-square" alt="SDL2">
  <img src="https://img.shields.io/badge/Platform-Windows%20x64%20%7C%20x86-blue?style=flat-square&logo=windows" alt="Platform">
  <img src="https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey?style=flat-square" alt="License">
</p>

---

## About The Project

Installing manual Garry's Mod addons shouldn't feel like a chore. 

Whether you are dealing with raw `.gma` files or compressed Steam Workshop `.bin` downloads, **GMoD-TeachGMAD** handles the heavy lifting for you in a single click. It extracts, converts, and neatly places maps and addon folders directly into your Garry's Mod directory.

Made with love for the GMod community by **Sebastian G. Romanelli**.

---

## Features

- **Automated Batch Processing**: Drops all `.gma` and `.bin` archives in your download directory and installs them in one go.
- **Smart Map & Addon Routing**: Detects map files inside packages, routes `.bsp` contents directly to `garrysmod/maps/`, and sends the rest of the assets to `garrysmod/addons/`.
- **Fluid, Non-Blocking UI**: Built on hardware-accelerated SDL2 with a background worker thread. Your UI stays responsive at 60 FPS while decompressing gigabytes of addons.
- **Real-Time Progress Feedback**: Tracks item-by-item completion and displays the active file being extracted.
- **Native Windows Dialogs**: Convenient folder pickers (`IFileOpenDialog`) on first run to configure your paths effortlessly.
- **Hard Software / Zero Bloat**: Pure native C++20, minimal footprint, and zero heavy web runtime wrappers.

---

## How to Use

### 1. First Run Setup
When you open **GMoD-TeachGMAD** for the first time, you will be prompted to select two directories:
1. **Garry's Mod Directory**: The root `garrysmod/` game folder (e.g. `C:\Steam\steamapps\common\GarrysMod\garrysmod`).
2. **GMAD-LS Directory**: The folder containing your downloaded `.bin` or `.gma` files.

*(These settings are saved locally to `config.ini` and can be edited or reset at any time).*

### 2. Available Actions
- **Install All**: Extracts all `.bin` and `.gma` files into your Garry's Mod game folder.
- **Install + Clean**: Installs everything and cleans the source folder upon completion.
- **Reset Config**: Resets folder paths and restarts the setup wizard.
- **Open Web**: Visits the official project repository and documentation.

---

## Building from Source

### Prerequisites
- Windows 10/11
- [CMake 3.20+](https://cmake.org/download/)
- Visual Studio 2019/2022 with C++ Desktop Development (MSVC supporting C++20)

### Quick Build with `build.bat`
The repository includes a ready-to-use batch script:

```cmd
# Build Release (Default x64)
build.bat

# Build and launch immediately
build.bat run

# Build Debug configuration
build.bat debug

# Clean build artifacts
build.bat clean
```

The compiled binary and dependencies will be placed in `build/Release/GMoD-TeachGMAD.exe`.

---

## Technical Documentation & Architecture

For in-depth details on the modular codebase, namespaces, Win32 subsystems, and extraction pipeline, check out [`src/Readme.md`](src/Readme.md).

---

## Contributing & Community

Got ideas, feedback, or want to contribute? You are very welcome!

- Join the discussion on [Discord](https://discord.gg/AzC9u9EB68)
- Support the project on [Ko-fi](https://ko-fi.com/sromandev)
- Submit an Issue or Pull Request on GitHub

---

## License

This project is Open-Source under the **Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)** License.  
Free for the community. Commercial sale or paid redistribution is prohibited.
