summaryrefslogtreecommitdiff
path: root/emu/README.md
blob: 4d0e01324d9ff08e468bea736fd84ee87d100e2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# FBGL Framebuffer Emulator

Professional LD_PRELOAD-based framebuffer emulator with clean architecture.

## Structure

- `fbgl_preload.h` - Public header with configuration and types
- `fbgl_preload.c` - Implementation with hook functions
- `sdl_viewer.c` - SDL-based viewer application

## Features

- Clean struct-based state management
- Proper header/source separation
- Statistics tracking
- Error handling
- FPS counter in viewer

## Building

```bash
make
```

Or manually:
```bash
gcc -shared -fPIC -o libfbgl_preload.so fbgl_preload.c -ldl
gcc -o sdl_viewer sdl_viewer.c $(pkg-config --cflags --libs sdl2)
```

## Usage


Terminal 2:
```bash
LD_PRELOAD=./libfbgl_preload.so ./your_fbgl_program
```

Terminal 1:
```bash
./fbgl_viewer
```


## Architecture

1. Hook library intercepts framebuffer syscalls
2. Redirects to shared memory segment
3. SDL viewer displays shared memory contents
4. Program thinks it's using real /dev/fb0

## Configuration

Edit `fbgl_preload.h` to change:
- Screen resolution (FBGL_WIDTH, FBGL_HEIGHT)
- Color depth (FBGL_BPP)
- Shared memory key (FBGL_SHM_KEY)