# fragglet/vanilla-utilities architecture

> Architecture diagram of the GitHub repository fragglet/vanilla-utilities, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fragglet/vanilla-utilities
- Repository: https://github.com/fragglet/vanilla-utilities

## Overview

##### Main Components

a) Core Utility Groups:
- Network Drivers Layer
- Control Interface Layer
- Statistics Interface Layer
- Game Adapters Layer

b) Supporting Components:
- Library Components
- Configuration Systems
- Test Framework

**[Doom] [Duke Nukem 3D] [Rise of the Triad]**

**[vcommit (3D Realms COMMIT)] [vrottcom (ROTT)]**

**Network Drivers:          Control:        Statistics:**
- udpsetup                - analogjs       - statdump
- ipxsetup                - replay
- sersetup
- parsetup
- sirsetup
- metanet
- solo-net

**[Library Components]**
- DOS Interface (dos.c)
- Logging System (log.c)
- Interrupt Handlers (ints.c)
- Flag Processing (flag.c)

##### Connection Types

**[UDP/IP Stack]**
- Winsock1
- Winsock2
- DOS MSClient

**[Hardware Layer]**
- Serial Port
- Parallel Port
- IrDA
- Network Card

##### Important Details

- Metanet component's ability to chain other drivers
- Modular nature of the network drivers
- Composability between components
- Configuration file relationships (especially for modem configurations)

##### Specific Implementation Notes

- Adapters (in /adapters) separately to show their bridging role
- Common interfaces in /lib that support all components
- How the test framework (/test) interfaces with the components
- Relationship between network drivers and their setup utilities

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef game fill:#f9f,stroke:#333,stroke-width:2px
    classDef adapter fill:#ffa07a,stroke:#333,stroke-width:2px
    classDef network fill:#87ceeb,stroke:#333,stroke-width:2px
    classDef control fill:#90ee90,stroke:#333,stroke-width:2px
    classDef stats fill:#ffff00,stroke:#333,stroke-width:2px
    classDef library fill:#dcdcdc,stroke:#333,stroke-width:2px
    classDef hardware fill:#ff6b6b,stroke:#333,stroke-width:2px

    %% Games Layer
    subgraph Games
        Doom["Doom"]:::game
        Duke["Duke Nukem 3D"]:::game
        ROTT["Rise of the Triad"]:::game
    end

    %% Adapters Layer
    subgraph Adapters
        VCOMMIT["vcommit (3D Realms)"]:::adapter
        VROTT["vrottcom (ROTT)"]:::adapter
    end
    click VCOMMIT "https://github.com/fragglet/vanilla-utilities/blob/master/adapters/vcommit.c"
    click VROTT "https://github.com/fragglet/vanilla-utilities/blob/master/adapters/vrottcom.c"

    %% Core Utilities Layer
    subgraph CoreUtils
        subgraph NetworkDrivers
            IPX["ipxsetup"]:::network
            UDP["udpsetup"]:::network
            SER["sersetup"]:::network
            PAR["parsetup"]:::network
            SIR["sirsetup"]:::network
            META["metanet"]:::network
            SOLO["solo-net"]:::network
            DNET["doomnet"]:::network
        end
        click IPX "https://github.com/fragglet/vanilla-utilities/blob/master/net/ipxsetup.c"
        click SER "https://github.com/fragglet/vanilla-utilities/blob/master/net/sersetup.c"
        click PAR "https://github.com/fragglet/vanilla-utilities/blob/master/net/parsetup.c"
        click SIR "https://github.com/fragglet/vanilla-utilities/blob/master/net/sirsetup.c"
        click META "https://github.com/fragglet/vanilla-utilities/blob/master/net/metanet.c"
        click SOLO "https://github.com/fragglet/vanilla-utilities/blob/master/net/solo-net.c"
        click DNET "https://github.com/fragglet/vanilla-utilities/blob/master/net/doomnet.c"

        subgraph ControlInterface
            ANALOG["analogjs"]:::control
            REPLAY["replay"]:::control
            CTRL["control"]:::control
            JOY["joystick"]:::control
        end
        click ANALOG "https://github.com/fragglet/vanilla-utilities/blob/master/ctrl/analogjs.c"
        click REPLAY "https://github.com/fragglet/vanilla-utilities/blob/master/ctrl/replay.c"
        click CTRL "https://github.com/fragglet/vanilla-utilities/blob/master/ctrl/control.c"
        click JOY "https://github.com/fragglet/vanilla-utilities/blob/master/ctrl/joystick.asm"

        subgraph StatsInterface
            STATDUMP["statdump"]:::stats
            STATS["stats core"]:::stats
            STATPRNT["stats printer"]:::stats
        end
        click STATDUMP "https://github.com/fragglet/vanilla-utilities/blob/master/stat/statdump.c"
        click STATS "https://github.com/fragglet/vanilla-utilities/blob/master/stat/stats.c"
        click STATPRNT "https://github.com/fragglet/vanilla-utilities/blob/master/stat/statprnt.c"
    end

    %% Support Layer
    subgraph Support
        subgraph LibraryComponents
            DOS["DOS Interface"]:::library
            LOG["Logging System"]:::library
            INTS["Interrupt Handlers"]:::library
            FLAG["Flag Processing"]:::library
        end
        click DOS "https://github.com/fragglet/vanilla-utilities/blob/master/lib/dos.c"
        click LOG "https://github.com/fragglet/vanilla-utilities/blob/master/lib/log.c"
        click INTS "https://github.com/fragglet/vanilla-utilities/blob/master/lib/ints.c"
        click FLAG "https://github.com/fragglet/vanilla-utilities/blob/master/lib/flag.c"

        subgraph Hardware
            SERIAL["Serial Port"]:::hardware
            PARALLEL["Parallel Port"]:::hardware
            IRDA["IrDA"]:::hardware
            NIC["Network Card"]:::hardware
        end
    end

    %% Connections
    Doom --> VCOMMIT
    Duke --> VCOMMIT
    ROTT --> VROTT

    VCOMMIT --> NetworkDrivers
    VROTT --> NetworkDrivers

    NetworkDrivers --> LibraryComponents
    ControlInterface --> LibraryComponents
    StatsInterface --> LibraryComponents

    NetworkDrivers --> Hardware

    %% Legend
    subgraph Legend
        L1["Games"]:::game
        L2["Adapters"]:::adapter
        L3["Network Components"]:::network
        L4["Control Components"]:::control
        L5["Statistics Components"]:::stats
        L6["Library Components"]:::library
        L7["Hardware Interfaces"]:::hardware
    end
```
