# hidegonsan/xymenu architecture

> Architecture diagram of the GitHub repository hidegonsan/xymenu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hidegonsan/xymenu
- Repository: https://github.com/hidegonsan/xymenu

## Overview

##### Main Components
- Main Entry Point: Located in Sources/main.cpp, this sets up the menu, registers entries (including cheat functionality), and runs the menu loop.
- Menu & UI Component: Represented by the XYMenu classes (found in both Includes/XYMenu and Sources/XYMenu.cpp). This is the core of the menu system.
- Helper Modules: Organised in Helpers (both in Includes/Helpers and Sources/Helpers), these provide utility functionalities such as AutoRegion, HoldKey, KeySequence, OSDManager, QuickMenu, Strings, and Wrappers. They handle lower-level logic (input, on-screen display, text manipulation) that supports the UI.
- Cheats and Additional Features: There’s a cheats.cpp and associated header (cheats.hpp), which likely add cheat functionality and special actions to the menu.
- Build and Configuration: Files like Makefile, .gitignore, and 3gx.ld indicate the project build process and linking configuration. The XYMenu.plgInfo file suggests metadata for the plugin.

##### Visualizing Relationships and Interactions
- There should be a block for the “Menu System” (XYMenu), detailing its role in handling menu entries and running the interaction loop.
- A separate “Cheat Engine” block (or module) connected with both the Main component and the Menu System – since the cheats are registered as entries in the menu.
- Optionally, denote the “Build/Configuration” aspects on the side as supporting elements (not runtime components but necessary for compilation and plugin metadata).

##### Architectural Patterns and Design Principles
- The design shows a modular approach where helpers encapsulate reusable logic, and the UI (XYMenu) acts as a dedicated component. This separation encourages a clear separation of concerns.
- The plugin nature implies that the system might run within a host application/environment; the main loop (in main.cpp) repeatedly calls menu->Run(), suggesting a real-time or event-driven design.

##### Relevant Technologies, Frameworks, or Libraries
- The project is written in C++.
- The Makefile indicates a standard build process for C/C++ projects.
- While no external frameworks are immediately visible, it’s built with a structure that supports integration – as evidenced by its metadata file (XYMenu.plgInfo).
- The project’s use of hardware-specific terminology (3gx.ld, CTRPF) hints at specialized linking and compilation rules related to the target platform.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Main Entry Point"] 
    subgraph "Menu System"
        B["XYMenu Header"]
        C["XYMenu Implementation"]
    end
    subgraph "Helper Modules"
        D["Helpers Header"]
        E["AutoRegion"]
        F["HoldKey"]
        G["KeySequence"]
        H["OSDManager"]
        I["QuickMenu"]
        J["Strings"]
        K["Wrappers"]
        L["MenuEntryHelpers"]
    end
    subgraph "Cheat Module"
        M["Cheat Header"]
        N["Cheat Implementation"]
    end
    subgraph "Build/Configuration"
        O["Makefile"]
        P[".gitignore"]
        Q["Linker Script"]
        R["Plugin Metadata"]
    end

    A -->|"initializes"| B
    B -->|"setsUpAndCalls"| C
    C -->|"uses"| D
    C -->|"calls"| E
    C -->|"calls"| F
    C -->|"calls"| G
    C -->|"calls"| H
    C -->|"calls"| I
    C -->|"calls"| J
    C -->|"calls"| K
    C -->|"calls"| L
    C -->|"registers"| M
    M -->|"implements"| N
    A ---|"builtWith"| O
    A ---|"builtWith"| P
    A ---|"builtWith"| Q
    A ---|"builtWith"| R

    click A "https://github.com/hidegonsan/xymenu/blob/main/Sources/main.cpp"
    click B "https://github.com/hidegonsan/xymenu/blob/main/Includes/XYMenu/XYMenu.hpp"
    click C "https://github.com/hidegonsan/xymenu/blob/main/Sources/XYMenu.cpp"
    click D "https://github.com/hidegonsan/xymenu/blob/main/Includes/Helpers.hpp"
    click E "https://github.com/hidegonsan/xymenu/blob/main/Includes/Helpers/AutoRegion.hpp"
    click F "https://github.com/hidegonsan/xymenu/blob/main/Includes/Helpers/HoldKey.hpp"
    click G "https://github.com/hidegonsan/xymenu/blob/main/Includes/Helpers/KeySequence.hpp"
    click H "https://github.com/hidegonsan/xymenu/blob/main/Includes/Helpers/OSDManager.hpp"
    click I "https://github.com/hidegonsan/xymenu/blob/main/Includes/Helpers/QuickMenu.hpp"
    click J "https://github.com/hidegonsan/xymenu/blob/main/Includes/Helpers/Strings.hpp"
    click K "https://github.com/hidegonsan/xymenu/blob/main/Includes/Helpers/Wrappers.hpp"
    click L "https://github.com/hidegonsan/xymenu/blob/main/Includes/Helpers/MenuEntryHelpers.hpp"
    click M "https://github.com/hidegonsan/xymenu/blob/main/Includes/cheats.hpp"
    click N "https://github.com/hidegonsan/xymenu/blob/main/Sources/cheats.cpp"
    click O "https://github.com/hidegonsan/xymenu/tree/main/Makefile"
    click P "https://github.com/hidegonsan/xymenu/blob/main/.gitignore"
    click Q "https://github.com/hidegonsan/xymenu/blob/main/3gx.ld"
    click R "https://github.com/hidegonsan/xymenu/blob/main/XYMenu.plgInfo"

    classDef runtime fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef helper fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef cheat fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef config fill:#fff3cd,stroke:#856404,stroke-width:2px;

    class A,B,C runtime;
    class D,E,F,G,H,I,J,K,L helper;
    class M,N cheat;
    class O,P,Q,R config;
```
