summaryrefslogtreecommitdiff
path: root/memview.h
blob: 47aab273ae7dc8c4cd24b51d5c39b0ed52311788 (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
#ifndef CORE_MEMVIEW_H
#define CORE_MEMVIEW_H

#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <SDL.h>

#include "procfs.h"

#ifndef PAGE_WIDTH
#define PAGE_WIDTH (256)
#endif

#define PAGE_HEIGHT ((PAGE_SIZE * CHAR_BIT) / PAGE_WIDTH)

uintptr_t to_addr(int x, int y);
void to_pos(uintptr_t addr, int *x, int *y);

struct viewer;
struct viewer *create_viewer(int fd, SDL_Renderer *renderer);
void destroy_viewer(struct viewer *v);

bool render_pages(struct viewer *v,
		int x, int y, int width, int height, double scale, bool refresh);
void pencil(struct viewer *v,
		double x1, double y1, double x2, double y2, bool bit);

#endif