about summary refs log tree commit diff stats
path: root/src/wrapped32/wrappedlibxcbres.c
blob: fda4dae80040ffb99534795c92c0b609b3106a4a (plain) (blame)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _GNU_SOURCE         /* See feature_test_macros(7) */
#include <dlfcn.h>

#include "wrappedlibs.h"

#include "debug.h"
#include "wrapper32.h"
#include "bridge.h"
#include "librarian/library_private.h"
#include "x64emu.h"
#include "callback.h"
#include "librarian.h"
#include "box32context.h"
#include "emu/x64emu_private.h"
#include "myalign32.h"
#include "converter32.h"

#ifdef ANDROID
	static const char* libxcbresName = "libxcb-res.so";
#else
	static const char* libxcbresName = "libxcb-res.so.0";
#endif

#define LIBNAME libxcbres

typedef struct my_xcb_XXX_iterator_s {
    void*             data;
    int               rem;
    int               index;
} my_xcb_XXX_iterator_t;

typedef struct my_xcb_XXX_iterator_32_s {
    ptr_t             data;
    int               rem;
    int               index;
} my_xcb_XXX_iterator_32_t;

typedef struct my_xcb_cookie_s {
    uint32_t        data;
} my_xcb_cookie_t;

typedef my_xcb_cookie_t (*zFpup)(void*, uint32_t, void*);
typedef my_xcb_XXX_iterator_t (*ZFp_t)(void*);

#define ADDED_FUNCTIONS()       				\
GO(xcb_res_query_client_ids, zFpup)           	\
GO(xcb_res_query_client_ids_ids_iterator, ZFp_t)\

#include "generated/wrappedlibxcbrestypes32.h"

#include "wrappercallback32.h"

#define SUPER(F, P, ...)           \
    EXPORT void* my32_##F P        \
    {                              \
        (void)emu;                 \
        *ret = my->F(__VA_ARGS__); \
        return ret;                \
    }

SUPER(xcb_res_query_client_ids, (x64emu_t* emu, my_xcb_cookie_t* ret, void* c, uint32_t count, void* specs), c, count, specs)

#undef SUPER

#define SUPER(F)           		   												\
    EXPORT void* my32_##F(x64emu_t* emu, my_xcb_XXX_iterator_32_t* ret, void* R)\
    {                              												\
        (void)emu;       														\
		my_xcb_XXX_iterator_t ret_l = my->F(R);									\
        ret->data = to_ptrv(ret_l.data); 										\
        ret->rem = ret_l.rem; 													\
        ret->index = ret_l.index; 												\
        return ret;      														\
    }

SUPER(xcb_res_query_client_ids_ids_iterator)

#undef SUPER

#include "wrappedlib_init32.h"