# luciouskami/xigncode3bypass architecture

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

- Interactive diagram: https://gitdiagram.com/luciouskami/xigncode3bypass
- Repository: https://github.com/luciouskami/xigncode3bypass

## Overview

##### Project type and purpose
- From the README (“XignCode3Bypass”) and file tree, this is neither a classic web app nor an open-source library in the usual sense. It’s a C++-based reverse-engineering / bypass tool for the XignCode3 protection used by the game “冒险岛2.”
- It consists of three Visual Studio projects:
- XignCode Library – shared definitions, readers/writers for the XignCode protocol
- XignCode Client – in-game hook/injection component that intercepts calls to the real XignCode driver
- XignCode Host  – simulated “server” side of XignCode3, processes messages from the client

##### File structure
- Top level: one solution file (`XignCode3 Bypass.sln`) and three subfolders (Client, Host, Library).
- XignCode Library contains `XignDefs.hpp`, `XignReader/Writer` classes – this is built as a static/dynamic library.
- XignCode Client has `main.cpp`, `client.cpp/hpp`, `XignCode.cpp/hpp`, `export.def` – this hooks the game process, uses the library to parse or build XignCode packets, and communicates to the Host.
- XignCode Host has `main.cpp`, `server.cpp/hpp`, `session.cpp/hpp` and resource files – this simulates the protected server side, responds to client packets, manages session state.

##### README
- The author’s TODO: “剥离驱动并模拟通讯” – strip out the original kernel driver and simulate its communications entirely in user-mode.
- The tool is used by renaming target process to the CN region game name.

##### Core components and their relationships
a. Components:
- Game Process (target): original game executable into which the Client DLL or EXE is injected.
- XignCode Client: hook layer that intercepts or replaces calls to the genuine XignCode3 driver.
- XignCode Library: shared code for packet definitions, serialization/deserialization.
- XignCode Host: user-mode server simulator that accepts client packets, runs server logic, and sends back valid responses.
b. Data flow & interactions:
1. Game Process issues an XignCode API call → intercepted by XignCode Client hook.
2. Client uses XignCode Library to parse or build the request packet.
3. Client sends request over an IPC channel (named pipe or localhost socket) to XignCode Host.
4. Host receives request, uses XignCode Library to parse it, runs session logic (`session.cpp`), constructs a response.
5. Host sends the response back via the same IPC channel.
6. Client receives the response, forwards it back into the game process as if from the original driver.
c. Architectural patterns & principles:
- Proxy/hook pattern: client stands in for the original driver.
- Shared serialization library: DRY principle for packet definitions.
- Separation of concerns: Client only handles hooking and IPC, Host handles session state and packet logic.
d. Key technologies & frameworks:
- C++17 (presumably) under Visual Studio (VCXPROJ files)
- IPC mechanism (named pipes or sockets) – see `client.cpp` / `server.cpp`

## Diagram (Mermaid)

```mermaid
flowchart TB
    Game["Game Process"]:::game
    Client["XignCode Client\n(Hook + IPC)"]:::client
    IPC["IPC Channel\n(Named Pipe/Socket)"]:::ipc
    Host["XignCode Host\n(Session Manager + Response Generator)"]:::host
    Lib["XignCode Library"]:::library

    Game -->|"Hooked API Call"| Client
    Client -->|"serialize/deserialize"| Lib
    Client -->|"XignPacket_Request"| IPC
    IPC -->|"Request"| Host
    Host -->|"parse/build"| Lib
    Host -->|"XignPacket_Response"| IPC
    IPC -->|"Response"| Client
    Client -->|"Forward to Game"| Game

    click Lib "https://github.com/luciouskami/xigncode3bypass/tree/master/XignCode Library/"
    click Client "https://github.com/luciouskami/xigncode3bypass/tree/master/XignCode Client/"
    click Host "https://github.com/luciouskami/xigncode3bypass/tree/master/XignCode Host/"

    classDef game fill:#b7e4c7,stroke:#2d6a4f,color:#000;
    classDef client fill:#d8f3dc,stroke:#40916c,color:#000;
    classDef ipc fill:#caf0f8,stroke:#0077b6,color:#000;
    classDef host fill:#ffe5d9,stroke:#e85d04,color:#000;
    classDef library fill:#e0e0e0,stroke:#6c757d,color:#000;
```
