# seconb/aimmy-arduino-edition architecture

> Architecture diagram of the GitHub repository seconb/aimmy-arduino-edition, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/seconb/aimmy-arduino-edition
- Repository: https://github.com/seconb/aimmy-arduino-edition

## Overview

##### Project Type & Purpose
- The project is a desktop application (written with C# using WPF/XAML) designed to automate aiming in games. It integrates Arduino support for mouse input, and the README warns about detection in specific games.
- It’s an “edition” of Aimmy that features additional Arduino/USB Host Shield integration, UI enhancements, and optimizations from an upstream fork (including DirectX screen capture, bezier curve manipulation, third-person support, etc).

##### File Structure
- The core solution “Aimmy2.sln” encompasses most of the application code under the “Aimmy2” folder.
– AILogic: Contains AIManager.cs for automated aiming decision logic.
– InputLogic: Handles mouse input through InputBindingManager.cs and MouseManager.cs.
– Class: Contains helper classes like Animator, UI, Theming, and others that perform core functionality.
– MouseMovementLibraries/ArduinoSupport: Contains ArduinoMouseInput.cs, clearly responsible for interfacing with the Arduino hardware.
– UILibrary and Visuality: These folders include multiple XAML views and their code-behind, forming the presentation layer.
– WinformsReplacement: Contains helper code for interacting with native Windows API calls.
- Outside the main application folder are deployment and hardware integration assets:
– “Arduino Setup” folder includes scripts (batch files) and firmware files (hex, config files, etc) used to flash the Arduino and set it up.
– “Universalv3_web_model” holds .bin files and a JSON model, possibly used for configuration or an external model resource.
– “configs” holds a configuration file, indicating external tuning parameters.

##### Key Components of the System (to include
a. Presentation Layer:
– UI Components (MainWindow, Welcome, various XAML files in UILibrary & Visuality).
– Display and configuration windows (e.g., ConfigSaver, DetectedPlayerWindow).
b. Business/Domain Logic:
– AILogic: Processes aiming decisions with AIManager.
– InputLogic: Manages mouse events/input for translating user actions into in-game movements.
– Other utility classes (Animator, PropertyChanger, SaveDictionary, etc.) that support the dynamic behaviors.
c. Hardware & Peripheral Integration:
– Arduino Support: Code in MouseMovementLibraries/ArduinoSupport and the separate Arduino Setup scripts that handle physical device interfacing.
– USB Host Shield support is indicated by both the Arduino-related code and the setup instructions.
d. Auxiliary/Utility Components:
– File management, configuration, updating, and external data handling (found in “Other” folder classes like UpdateManager, GithubManager, RequirementsManager, etc).
– WinformsReplacement: Provides native API calls and scaling support, bridging between legacy code and current UI paradigms.
– External Model Data: Files in Universalv3_web_model (might relate to AI or configuration models).

##### Relationships & Interactions
- The front end (UI) receives user input (config controls, status displays) and communicates with the business logic. For instance, changes in UI settings (e.g., bezier curve strengths) update the logic in AILogic or InputLogic.
- InputLogic processes mouse events and transfers commands to the AI and, when the Arduino mode is active, to the Arduino support module. This module then handles the communication with the actual Arduino hardware (flashed/set up via Arduino Setup).
- The Helper and utility classes (“Class” and “Other”) function as services that support these operations (e.g., configuration management, file handling, update checking).
- WinformsReplacement and the graphics folders (with fonts, etc.) support UI rendering and ensuring proper user experience.

##### Important Architectural Patterns and Technologies
- Modular Separation: Notice a clear separation between UI (presentation layer: UILibrary/Visuality), business logic (AILogic, InputLogic), and hardware integration (MouseMovementLibraries/ArduinoSupport plus the Arduino Setup components).
- MVVM-like Pattern: The use of XAML with code-behind hints at a Model-View-ViewModel (or at least a separation between UI and business logic).
- External Configuration and Updatability: The presence of configuration files and update managers indicates an architecture that favors external customization and dynamic updates.
- Hardware Interfacing: The project uses Arduino/USB Host Shield integration, denoting a layer dedicated to hardware communication.

## Diagram (Mermaid)

```mermaid
flowchart TD

  %% Presentation Layer
  subgraph "Presentation Layer"
    UI_UILibrary["UILibrary (UI Components)"]
    UI_Visuality["Visuality (ConfigSaver, DetectedPlayerWindow)"]
    UI_MainWindow["MainWindow (View)"]
    UI_Welcome["Welcome (View)"]
  end

  %% Business/Domain Logic
  subgraph "Business/Domain Logic"
    BL_AI["AI Management (AIManager)"]
    BL_Input["Input & Mouse Handling (InputLogic)"]
    BL_Utils["Utility Classes (Animators, PropertyChanger, etc.)"]
  end

  %% Hardware Integration
  subgraph "Hardware Integration"
    HW_Arduino["Arduino Support (ArduinoMouseInput)"]
    HW_Setup["Arduino Setup Scripts/Firmware"]
  end

  %% Auxiliary/Utility Components
  subgraph "Auxiliary Components"
    AUX_Utils["Additional Utilities (UpdateManager, GithubManager, etc.)"]
    AUX_Winforms["Winforms Replacement (Native API Calls)"]
  end

  %% External Resources & Configuration
  subgraph "External Resources"
    ER_Model["External Model Files"]
    ER_Configs["Configuration Files"]
  end

  %% Connections between layers

  %% Presentation to Business logic
  UI_MainWindow -->|"triggersCommand"| BL_AI
  UI_UILibrary -->|"sendsInput"| BL_Input
  UI_Visuality -->|"updatesSettings"| BL_AI
  UI_Welcome -->|"initiatesSession"| BL_AI

  %% Business logic internal connection
  BL_AI -->|"passesParams"| BL_Input

  %% Business to Hardware integration
  BL_Input -->|"sendsHardwareCmd"| HW_Arduino
  HW_Setup -->|"initializesHardware"| HW_Arduino

  %% Auxiliary feedback to Business and Presentation
  AUX_Utils -->|"providesUpdate"| BL_AI
  AUX_Utils -->|"assistsLogic"| BL_Input
  AUX_Winforms -->|"nativeAPICall"| UI_UILibrary
  AUX_Utils -->|"updatesUI"| UI_MainWindow

  %% External configuration resources linking to system layers
  ER_Configs -->|"configures"| BL_Input
  ER_Configs -->|"configuresUI"| UI_MainWindow
  ER_Model -->|"loadsModel"| AUX_Utils

  %% Class definitions for colors
  class UI_UILibrary,UI_Visuality,UI_MainWindow,UI_Welcome ui
  class BL_AI,BL_Input,BL_Utils logic
  class HW_Arduino,HW_Setup hardware
  class AUX_Utils,AUX_Winforms utility
  class ER_Model,ER_Configs external

  %% Style definitions
  classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px;
  classDef logic fill:#90EE90,stroke:#000,stroke-width:1px;
  classDef hardware fill:#FFA500,stroke:#000,stroke-width:1px;
  classDef utility fill:#D3D3D3,stroke:#000,stroke-width:1px;
  classDef external fill:#F0E68C,stroke:#000,stroke-width:1px;

  %% Click Events
  click UI_UILibrary "https://github.com/seconb/aimmy-arduino-edition/tree/master/Aimmy2/UILibrary"
  click UI_Visuality "https://github.com/seconb/aimmy-arduino-edition/tree/master/Aimmy2/Visuality"
  click UI_MainWindow "https://github.com/seconb/aimmy-arduino-edition/blob/master/Aimmy2/MainWindow.xaml"
  click UI_Welcome "https://github.com/seconb/aimmy-arduino-edition/blob/master/Aimmy2/Welcome.xaml"
  click BL_AI "https://github.com/seconb/aimmy-arduino-edition/blob/master/Aimmy2/AILogic/AIManager.cs"
  click BL_Input "https://github.com/seconb/aimmy-arduino-edition/tree/master/Aimmy2/InputLogic"
  click BL_Utils "https://github.com/seconb/aimmy-arduino-edition/tree/master/Aimmy2/Class"
  click HW_Arduino "https://github.com/seconb/aimmy-arduino-edition/blob/master/Aimmy2/MouseMovementLibraries/ArduinoSupport/ArduinoMouseInput.cs"
  click HW_Setup "https://github.com/seconb/aimmy-arduino-edition/tree/master/Arduino Setup"
  click AUX_Utils "https://github.com/seconb/aimmy-arduino-edition/tree/master/Aimmy2/Other"
  click AUX_Winforms "https://github.com/seconb/aimmy-arduino-edition/tree/master/Aimmy2/WinformsReplacement"
  click ER_Model "https://github.com/seconb/aimmy-arduino-edition/tree/master/Universalv3_web_model"
  click ER_Configs "https://github.com/seconb/aimmy-arduino-edition/tree/master/configs"
```
